Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove shadow overlay on drawer navigation. #3720

Closed
vishu-daffodil opened this issue Mar 12, 2018 · 5 comments
Closed

Remove shadow overlay on drawer navigation. #3720

vishu-daffodil opened this issue Mar 12, 2018 · 5 comments

Comments

@vishu-daffodil
Copy link

vishu-daffodil commented Mar 12, 2018

Hi, I have created a side menu using drawer navigation. i am getting shadow overlay on the back view. I want to remove the shadow overlay.

screen shot 2018-03-12 at 3 05 11 pm

But i want some thing like this.

screen shot 2018-03-12 at 3 05 28 pm

// Drawer.js
import React, { Component } from 'react';
import { View } from 'react-native';
import { DrawerNavigator } from 'react-navigation';
import Home from './AppNavigation';
import { SideMenu } from "./../Common/UIComponents";
import { widthScale } from "./../Common/Utils/Scaling";

export default DrawerStack = DrawerNavigator({
    Home: { screen: Home },
    MyAccount: { screen: () => <View /> },
    MessageToBigFm: { screen: () => <View /> },
    MeetTheMJs: { screen: () => <View /> },
    Videos: { screen: () => <View /> },
    AboutUs: { screen: () => <View /> },
    ContactUs: { screen: () => <View /> },
    TermsAndConditions: { screen: () => <View /> }
}, {
        contentComponent: SideMenu,
        drawerWidth: widthScale(320),
        drawerBackgroundColor: "transparent",
        style: { backgroundColor: "transparent", opacity: 0, shadowOpacity: 0, shadowColor: "transparent" }
    });

// SideMenu.js
import React, { Component } from "react";
import { View, Text, ScrollView, Platform } from "react-native";
import { NavigationActions } from "react-navigation";
import style from "./style";
import SideMenuHeader from "./SideMenuHeader";
import { ListFlat } from "./../../UIComponents";
import SideMenuData from "./SideMenuData";
import SideMenuCell from "./SideMenuCell";
import NavigationUtil from "./../../Utils/NavigationUtil";

class SideMenu extends Component {

    constructor(props) {
        super(props);
        this.navigateToScreenWithIndex = this.navigateToScreenWithIndex.bind(this);
        this.renderItemSeperator = this.renderItemSeperator.bind(this)
    }

    navigateToScreenWithIndex(index) {
        const routeData = SideMenuData[index];
        if (!routeData) {
            return null;
        }
        const routeKey = routeData.navigationKey;
        if (routeKey === null) {
            return;
        }
        const navigateAction = NavigationActions.reset({
            index: 0,
            actions: [
                NavigationActions.navigate({ routeName: routeKey })
            ]
        });
        this.props.navigation.dispatch(navigateAction);
    }

    renderItemSeperator({ leadingItem }) {
        if (leadingItem.key === 4) {
            return <View style={style.seperator} />
        } else {
            return null;
        }
    }

    render() {
        return (
            <View style={style.container}>
                {Platform.OS === "ios" && <View style={style.statusBar} />}
                <View style={style.listContainer}>
                    <ListFlat
                        horizontal={false}
                        renderHeader={() => <SideMenuHeader />}
                        data={SideMenuData}
                        CellComponent={SideMenuCell}
                        otherProps={{ onCellPress: this.navigateToScreenWithIndex }}
                        renderSeparator={this.renderItemSeperator}
                    />
                </View>
            </View>
        );
    }
}

export default SideMenu;
@andreyelpaev
Copy link

+1, same problem

@brentvatne
Copy link
Member

hi there! if you'd like to see this feature in react navigation, please create a feature request for it. alternatively, a pull request would be welcome too. thanks!

@yanush
Copy link

yanush commented Oct 26, 2018

I was able to achieve this behaviour by editing DrawerLayout.js (inside react-native-drawer-layout/dist) and changing styles of:
overlay: {
-backgroundColor: '#000',
+backgroundColor: 'transparent',
}

@bacarybruno
Copy link

For this to work on android, you have to copy node_modules/react-native-drawer-layout-polyfill/dist/index.js into index.android.js in the same folder.

@brentvatne
Copy link
Member

you folks who want this could also just open a PR here: http://github.com/react-navigation/react-navigation-drawer

@react-navigation react-navigation locked and limited conversation to collaborators Oct 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants