React Navigation - How to switch Tab Navigation to handle Login Screen?

前端 未结 1 1190
鱼传尺愫
鱼传尺愫 2021-01-26 19:05

I want to know if it\'s possible to handle login screen after the button login pressed,

I have a router.js:

export const TabLoged= TabNaviga         


        
1条回答
  •  误落风尘
    2021-01-26 19:29

    To achieve desired behavior you can use SwitchNavigator. There is a really good example for it in the doc. You can check it here.

    SwitchNavigator reference

    SwitchNavigator(RouteConfigs, SwitchNavigatorConfig)

    Example from docs

    const AppStack = StackNavigator({ Home: HomeScreen, Other: OtherScreen });
    const AuthStack = StackNavigator({ SignIn: SignInScreen });
    
    export default SwitchNavigator(
      {
        AuthLoading: AuthLoadingScreen,
        App: AppStack,
        Auth: AuthStack,
      },
      {
        initialRouteName: 'AuthLoading',
      }
    );
    

    0 讨论(0)
提交回复
热议问题