In my application I've 3 stack like StackOne
export const StackOne = createStackNavigator({
OneScreen: { screen:one },
TwoScreen: { screen:two },
ThreeScreen: { screen:three },
}, { initialRouteName: 'OneScreen', }
);
StackTwo
export const StackTwo = createStackNavigator({
OneScreenTwo: { screen:oneTwo },
TwoScreenTwo: { screen:twoTwo },
ThreeScreenTwo: { screen:threeTwo },
}, { initialRouteName: 'OneScreenTwo', }
);
I use the drawer navigation like this. MainDrawer
const MainDrawer = createDrawerNavigator(
{
One: { screen: StackOne },
Two: { screen: StackTwo },
Other: { screen: OtherScreen},
},
{}
);
All working fine. manage drawer - to stack very well
only issue is when I'm in StackOne's ScreenTwo of swipe the left- right still open the drawer menu.
not only this screen in every screen open drawer menu.
I try several link but can't find the success. Hope some one help. I follow this link Navigation
Thanks
You need to specify navigationOptions on the StackNavigator instead of TwoScreen etc, as otherwise it'd be configuring the StackNavigator instead of the DrawerNavigator:
StackOne.navigationOptions = ({ navigation }) => ({
drawerLockMode: navigation.state.index === 0 ? 'unlocked' : 'locked-closed',
});
Working example: https://snack.expo.io/@riwu/stack-nav-lock-drawer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With