我有一个带3个屏幕的Stacknavigator,其中一个是Main,是一个具有自定义抽屉内容的抽屉导航器,并且在带有退出按钮的抽屉项中。如何返回登录屏幕?道具我可以访问抽屉堆栈,但不能访问主堆栈,如LoginScreen
const AppNavigator = createStackNavigator(
{
LoginScreen: { screen: Login },
Main: { screen: Main },
Register: {screen: RegisterScreen}
},
{
headerMode: 'none',
},
{
initialRouteName: 'LoginScreen',
}
);
function DrawerScreen (props) {
return(
<Drawer.Navigator
drawerContent={(props)=> <DrawerContent {...props}/>}
initialRouteName="Home" >
<Drawer.Screen name="Home" component={CuentaScreen}/>
<Drawer.Screen name="Profile" component={NotificationsScreen} />
<Drawer.Screen name="Register" component={RegisterScreen} />
</Drawer.Navigator>
)
};