我有一个这样的 StackNavigation:
const AppNavigator = createStackNavigator({
Login: {
screen: Login,
navigationOptions: () => ({
title: 'Login',
headerTintColor: 'white',
headerStyle:{
backgroundColor: '#000',
elevation: 0,
showdowOpacity: 0
},
})
},
Home: {
screen: AppDrawerNavigator,
navigationOptions: () => ({
header: null
})
},
});
使用嵌套在里面的 DrawerNavigator:
const AppDrawerNavigator = createDrawerNavigator({
Home: {
screen: Home,
navigationOptions: {
drawerLabel: 'Home',
gesturesEnabled: false,
}
},
Favorites: {
screen: Favorites,
navigationOptions: {
drawerLabel: 'Favorites',
}
}
},
{
drawerPosition: 'left',
contentComponent: props => <Drawer {...props} />
});
堆栈导航器的初始路由工作正常
登录 -> 主页
但是当我尝试从主页导航到收藏夹时,它会在呈现收藏夹屏幕后立即导航回主页。
我正在使用 react-navigation@2.11.2 和 react-native@0.56.0