Lock drawer when stack is not on root screen (#825)
This commit is contained in:
parent
fb88d08f88
commit
03adaa3f81
30
app/index.js
30
app/index.js
|
@ -129,18 +129,48 @@ const ChatsStack = createStackNavigator({
|
|||
defaultNavigationOptions: defaultHeader
|
||||
});
|
||||
|
||||
ChatsStack.navigationOptions = ({ navigation }) => {
|
||||
let drawerLockMode = 'unlocked';
|
||||
if (navigation.state.index > 0) {
|
||||
drawerLockMode = 'locked-closed';
|
||||
}
|
||||
return {
|
||||
drawerLockMode
|
||||
};
|
||||
};
|
||||
|
||||
const ProfileStack = createStackNavigator({
|
||||
ProfileView
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader
|
||||
});
|
||||
|
||||
ProfileView.navigationOptions = ({ navigation }) => {
|
||||
let drawerLockMode = 'unlocked';
|
||||
if (navigation.state.index > 0) {
|
||||
drawerLockMode = 'locked-closed';
|
||||
}
|
||||
return {
|
||||
drawerLockMode
|
||||
};
|
||||
};
|
||||
|
||||
const SettingsStack = createStackNavigator({
|
||||
SettingsView
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader
|
||||
});
|
||||
|
||||
SettingsStack.navigationOptions = ({ navigation }) => {
|
||||
let drawerLockMode = 'unlocked';
|
||||
if (navigation.state.index > 0) {
|
||||
drawerLockMode = 'locked-closed';
|
||||
}
|
||||
return {
|
||||
drawerLockMode
|
||||
};
|
||||
};
|
||||
|
||||
const ChatsDrawer = createDrawerNavigator({
|
||||
ChatsStack,
|
||||
ProfileStack,
|
||||
|
|
Loading…
Reference in New Issue