ang*_*lex 10 react-native-navigation wix-react-native-navigation react-native-navigation-v2
使用react-native-navigation v1,您可以设置这样的抽屉:
drawer: {
left: {
screen: 'ScreenName'
}
}
Run Code Online (Sandbox Code Playgroud)
但没有使用它的例子.我尝试的方式和v1相同,但是没有用.是否有人以某种方式实现了它?
小智 18
在RNN V2中,您只需使用sideMenu而不是旧抽屉选项Ex即可添加抽屉:
Navigation.events().registerAppLaunchedListener(() => {
Navigation.setRoot({
root: {
sideMenu: {
id: "sideMenu",
left: {
component: {
id: "Drawer",
name: "navigation.Drawer"
}
},
center: {
stack: {
id: "AppRoot",
children: [{
component: {
id: "App",
name: "navigation.AppScreen"
}
}]
}
}
}
}
});
}
Run Code Online (Sandbox Code Playgroud)
并且为了关闭抽屉,使用Navigation.mergeOptions并像这样传递可见的false
<Button onPress={this.hideSideMenu}/>
hideSideMenu() {
Navigation.mergeOptions(this.props.componentId, {
sideMenu: {
left: {
visible: false
}
}
});
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7075 次 |
| 最近记录: |