react-native version: 0.51.0
react-native-navigation:1.1.468
1. Android端 disableOpenGesture 失效:
Navigation.startTabBasedApp({
appStyle: AppSetting.appStyle,
tabs,
tabsStyle: AppSetting.tabsStyle,
animationType: 'fade',
drawer: {
disableOpenGesture: true, //Android 端失效
right: {
screen: 'trade.DrawerTrade'
}
}
});
}
iOS 设置 disableOpenGesture: true
后,侧边栏无法通过手势滑出,只能通过调用function的方式弹出,但Android设置后依然可以通过手势操作滑出侧边栏。
经过查阅此为react-native-navigation的bug(github issue),issue中指出this.props.navigator.setDrawerEnabled
方法可在Android端生效。
尝试后发现新问题,在disableOpenGesture: true
并且通过setDrawerEnabled
设置的情况下,android端正常(不可通过手势弹出侧边栏,可以通过调用function弹出侧边栏)iOS异常(无法通过任何一种方式弹出侧边栏)。
解决方案:
if (Platform.OS !== 'ios') {
this.props.navigator.setDrawerEnabled({
side: 'right',
enabled: false
});
}