[V2] property "enabled" for side menu is not respected in setRoot.
Issue Description
Enabled property in initial config (setRoot) is not respected on both iOS and Android.
Steps to Reproduce / Code Snippets / Screenshots
Init the navigation like shown below.
Navigation.setRoot({
root: {
sideMenu: {
right: {
component: {
id: 'sideManu',
name: 'myApp.sideManu',
enabled: false,
visible: false,
},
},
center: {...}
}
})
The drawer is still enabled on the app startup and I can toggle it with swipe. Expected behaviour it doesn't show up when swiping since should be disabled.
FYI, however if I do later in the code on iOS:
Navigation.mergeOptions('sideDrawer', {
sideMenu: {
right: {
visible: false,
enabled: false,
}
}
})
It does get disabled. So the problem only with initial settings on iOS. On Android it never works.
Environment
- React Native Navigation version: 2.0.2485
- React Native version: 0.56.0
- Platform(s) (iOS, Android, or both?): iOS, Android
- Device info (Simulator/Device? OS version? Debug/Release?): simulator, iPhone 7 iOS 11.4, debug emulator, Genymotion Google Pixel 2.0 Android 8.0, debug
The Android SideMenuOptions don’t seem to include an enabled flag: https://github.com/wix/react-native-navigation/blob/v2/lib/android/app/src/main/java/com/reactnativenavigation/parse/SideMenuOptions.java
After https://github.com/wix/react-native-navigation/pull/4037
Navigation.setRoot({
root: {
sideMenu: {
left: {
component: {
id: 'SideMenu',
name: 'Drawer',
}
},
center: {
stack: {
id: 'RootStack',
children: [{
component: {
name: 'LoginScreen',
}
}],
},
}
}
}
});
Navigation.mergeOptions('SideMenu', {
sideMenu: {
left: {
visible: false,
enabled: false,
}
}
});
is working :)
@rafirr , it works only when the drawer is closed. i can still swipe and close it if it is openned
how to disabled open/close gestures sideMenu of RNN V2?
@NweThazin, to disable gestures try:
static options() {
return {
sideMenu: {
left: {
enabled: false
}
}
};
}
or
Navigation.mergeOptions('SideMenu', {
sideMenu: {
left: {
enabled: false
}
}
});
and then to open / close drawer:
Navigation.mergeOptions('SideMenu', {
sideMenu: {
left: {
visible: true, //false
},
}
});
and my setRoot function:
Navigation.setRoot({
root: {
sideMenu: {
left: {
component: {
id: 'SideMenu',
name: 'Drawer',
}
},
center: {
stack: {
id: 'RootStack',
children: [{
component: {
name: componentName,
options: {
animated: true
}
}
}],
},
options: {
topBar: {
visible: false
}
}
}
}
}
});
It works for me :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.
The issue has been closed for inactivity.