Ahmed Essaadi
Ahmed Essaadi

Reputation: 415

is there any way to navigate into two different App container react native

hi i"m new to react native i'm trying to build my first app i'm having some trouble with react navigation I've done two different app container the first contain the startup Screen ,login,Signup, and Main which is the second app container that contain my other screenStacks now I've tried to implement a logout functionality but i couldn't managed how i can go back to the first app container that contain the login Screen i'm using react navigation 3.0 i don't know if this is possible to manage ??? any help please ,thank you :)

-App
      |
       StarutUPScreen
       SignIn
      Signout
       Main
      ....

  -Main
        |
         mainScreen
         other Screens
          ....

export default createAppContainer(
  createSwitchNavigator(
    {
      StartUpScreen,
      IntroOneScreen,
      IntroTwoScreen,
      IntroThreeScreen,
      SignIn,
      SignUp,
      ForgotPassword,
      Main (the other container)
    },
    {
      initialRouteName: "StartUpScreen"
    }
  )
);

Upvotes: 2

Views: 1809

Answers (1)

Vinil Prabhu
Vinil Prabhu

Reputation: 1289

there should be only one app container

you can create multiple stack navigator and nest them together

const MainNavigator = createStackNavigator({...});
// this will have only screens from main stack

const RootNavigator = createStackNavigator({...,MainNavigator});
// root navigator will have auth part and then main stack

const AppContainer = createAppContainer(AppNavigator);

// Now AppContainer is the main component for React to render

export default AppContainer;

Upvotes: 2

Related Questions