我正在尝试在个人资料页面上实施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
按钮处理程序是什么样的,如果我想回弹到splashScreen
或loginScreen
场景?
答案 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'
/>