下面是我的DrawerNavigator
:
export const Drawer = DrawerNavigator({
Home: { screen: AppStack, navigationOptions: {drawerLabel:() => null} },
Permissions: { screen: AppStack, navigationOptions: {drawerLabel:() => null} },
Explore: { screen: AppStack, navigationOptions: {drawerLabel:() => 'Explore'} },
ContactScreen: { screen: AppStack, navigationOptions: {drawerLabel:() => 'Contact & Support'} },
TOU: { screen: AppStack, navigationOptions: {drawerLabel:() => 'Terms of Use'} },
Privacy: { screen: AppStack, navigationOptions: {drawerLabel:() => 'Privacy Policy'} },
Disclaimer: { screen: AppStack },
Settings: { screen: AppStack, navigationOptions: {drawerLabel:() => null} },
},{
initialRouteName:'Privacy'
});
当从App.js调用<Drawer />
时,它会路由到Home
而不是Privacy
,因为我的initialRouteName
应该这样做。有谁知道为什么?
您已将AppStack
列为每条路线的屏幕名称。我想你的AppStack是用StackNavigator({...})创建的,而initialRouteName是Home
。