I had a similar issue on react-navigation v2. According to [drawer docs][1] you can define navigation options right after routes initialization and prohibited it to display Drawer navigator in defined routes.
routes looked like :
const RoutesStack = StackNavigator({
Authentication: {
screen: Authentication,
},
Then I added Options under it :
RoutesStack.navigationOptions = ({ navigation }) => {
name = (navigation.state.index !== undefined ? navigation.state.routes[navigation.state.index] : navigation.state.routeName)
let drawerLockMode = 'locked-closed'
if (name.routeName != 'Authentication' && name.routeName != 'Signup') {
drawerLockMode = 'unlocked'
}
return {
drawerLockMode,
};
}
[1]: https://reactnavigation.org/docs/en/navigation-options-resolution.html#a-drawer-has-a-stack-inside-of-it-and-you-want-to-lock-the-drawer-on-certain-screens
I also have faced this on react-navigation v2. as written in [drawer docs][1]
the solution can be to define navigation options right after routes initialization and it forbids to display Drawer navigator in defined routes.
My routes looks like
const RoutesStack = StackNavigator({
Authentication: {
screen: Authentication,
},
And Options added, bellow routes.
RoutesStack.navigationOptions = ({ navigation }) => {
name = (navigation.state.index !== undefined ? navigation.state.routes[navigation.state.index] : navigation.state.routeName)
let drawerLockMode = 'locked-closed'
if (name.routeName != 'Authentication' && name.routeName != 'Signup') {
drawerLockMode = 'unlocked'
}
return {
drawerLockMode,
};
}
[1]: https://reactnavigation.org/docs/en/navigation-options-resolution.html#a-drawer-has-a-stack-inside-of-it-and-you-want-to-lock-the-drawer-on-certain-screens