简体   繁体   中英

Going back from screen in stacknaviagtion to screen in drawernavigation is not working react native

I have two navigator in my application.

Stack Navigation:

const MainStackNavigator = createStackNavigator({
    MainScreen: { screen: Home },
    ProductDetail: { screen: ProductDetail },
    Search: { screen: Search },
    Shop: { screen: Shop },
},{
    headerMode: 'none',
});


Drawer Navigation:

const MainDrawerNavigator = createDrawerNavigator({
    Home: {
        screen: MainStackNavigator,
    },
    Wishlist: {
        screen: Wishlist,
    },
    Login: {
        screen: Login,
    },
    Register: {
        screen: Register,
    },
    Logout: {
        screen: Logout,
    },
})

The problem is When I'm in my Wishlist Screen I've my product card onPress of that I'm navigating to the ProductDetail Screen but when I press back button I'm redirecting to the MainScreen of the app.

I want that if I have came from wishlist screen on going back it should be go to wishlist screen.

您必须将MainStackNavigator附加到Wishlist ,而不是Home

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM