将本机路由器磁通从子场景

时间:2016-12-16 13:34:42

标签: react-native react-native-router-flux

我正在尝试在个人资料页面上实施logout按钮。

我定义了以下路线。

<Router>
    <Scene initial  key='splashScreen' component={SplashScreen} title='Sayan' hideNavBar />
    <Scene key='loginScreen' component={LoginScreen} title='President Login' hideNavBar />
    <Scene key='drawer' component={NavigationDrawer} open={false}>
        <Scene key='drawerChildrenWrapper' hideNavBar>
            <Scene key='homeScreen' component={HomeScreen} title='Sayan' hideNavBar />
            <Scene key='createUserScreen' component={CreateUserScreen} title='Create a user' hideNavBar />   
            <Scene key='Profile' component={ProfileScreen} title='Profile' hideNavBar />
        </Scene>
    </Scene>
</Router>

logout按钮处理程序是什么样的,如果我想回弹到splashScreenloginScreen场景?

2 个答案:

答案 0 :(得分:2)

这应关闭当前屏幕并显示loginScreen:     Actions.popTo( 'loginScreen');

Actions.pop关闭当前场景。 Actions.popTo本质上是两个命令... Actions.pop()和Actions.loginScreen()

答案 1 :(得分:0)

你可以使用type =&#34; reset&#34;在下一个路线

  

就我而言:

<Scene key="Wellcome"
   component={Wellcome}
   title="Wellcome"
   initial 
/>
<Scene key="Home"
   component={Home}
   title="Home"
   type='reset'
/>