导航反应原生路由器通量

时间:2017-08-17 07:19:50

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

我的应用程序中有这种路由器配置 -

<Router navigationBarStyle={styles.navBar}
                titleStyle={styles.navBarTitle}
            >
                <Scene key="modal" component={Modal}>
                    <Scene key="drawer" component={Drawer} open={false} type="replace" initial={this.state.flag ? false : true}>

                        <Scene key="mywishlist" component={MyWishlist} title="WISHLIST" type="replace" />
                        <Scene key="faq" component={FAQ} title="FAQ" type="replace" />
                        <Scene key="profilepic" component={ProfilePic} />
                        <Scene key="changepassword" component={ChangePassword} panHandlers={null} />
                        <Scene key="addressmanage" component={AddressManage} />
                        <Scene key="dishsearch" component={DishSearch} />
                        <Scene key="feedback" component={Feedback} hideNavBar type="replace" />
                        <Scene key="logout" component={Logout} hideNavBar type="replace" />
                    </Scene>
                    <Scene key="auth" initial={this.state.flag ? true : false} >
                        <Scene key="login" panHandlers={null} component={Login} title="Login" hideNavBar={true} type="replace" />
                        <Scene key="otp" panHandlers={null} component={OTP} title="OTP" hideNavBar={true} />
                        <Scene key="signup" panHandlers={null} component={SignUp} title="SignUp" hideNavBar={true} type="replace" />

                        <Scene key="coachmark" component={Coachmark} hideNavBar />
                    </Scene>
                    <Scene key="popUpImagePicker" panHandlers={null} component={PopUpImagePicker} title="PopUpImagePicker" hideNavBar={true} />
                    <Scene key="appModal" component={AppModal} />
                </Scene>

            </Router >

一旦我退出登陆,我就会在我的Actions.auth()中拨打componentWillMount()来登录屏幕,但它无效。关于为什么不工作的任何建议以及如何从“抽屉”内的任何屏幕进行登录?

1 个答案:

答案 0 :(得分:0)

你不工作是什么意思?这是路由问题吗?在我的项目中,我设置了TouchableOpacity,如果它是onPress,它将触发注销服务,使用AsyncStorage来多用户和多次删除用户的所有信息。然后再返回登录页面,我使用Actions.login({ type: 'reset' });重置历史记录,就像在此link中进行讨论一样。