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
|
defaultNavigationOptions: defaultHeader
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ChatsStack.navigationOptions = ({ navigation }) => {
|
||||||
|
let drawerLockMode = 'unlocked';
|
||||||
|
if (navigation.state.index > 0) {
|
||||||
|
drawerLockMode = 'locked-closed';
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
drawerLockMode
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const ProfileStack = createStackNavigator({
|
const ProfileStack = createStackNavigator({
|
||||||
ProfileView
|
ProfileView
|
||||||
}, {
|
}, {
|
||||||
defaultNavigationOptions: defaultHeader
|
defaultNavigationOptions: defaultHeader
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ProfileView.navigationOptions = ({ navigation }) => {
|
||||||
|
let drawerLockMode = 'unlocked';
|
||||||
|
if (navigation.state.index > 0) {
|
||||||
|
drawerLockMode = 'locked-closed';
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
drawerLockMode
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const SettingsStack = createStackNavigator({
|
const SettingsStack = createStackNavigator({
|
||||||
SettingsView
|
SettingsView
|
||||||
}, {
|
}, {
|
||||||
defaultNavigationOptions: defaultHeader
|
defaultNavigationOptions: defaultHeader
|
||||||
});
|
});
|
||||||
|
|
||||||
|
SettingsStack.navigationOptions = ({ navigation }) => {
|
||||||
|
let drawerLockMode = 'unlocked';
|
||||||
|
if (navigation.state.index > 0) {
|
||||||
|
drawerLockMode = 'locked-closed';
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
drawerLockMode
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const ChatsDrawer = createDrawerNavigator({
|
const ChatsDrawer = createDrawerNavigator({
|
||||||
ChatsStack,
|
ChatsStack,
|
||||||
ProfileStack,
|
ProfileStack,
|
||||||
|
|
Loading…
Reference in New Issue