React Native之router-flex的使用

Posted 做一个清醒者

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了React Native之router-flex的使用相关的知识,希望对你有一定的参考价值。

1.Switch

必须要使用tabs={true},否则会找不到unloginCenter的错误

<Scene
                            key="switch"
                            component={connect(state=>({login:state.loginReducer.login}))(Switch)}
                            title={Consts.UserCenterPage}
                            tabs={true}
                            unmountScenes
                            // hideOnChildTabs
                            selector={props=>props.login?tabbar:unloginCenter}
                        >
    <Scene key="tabbar" />
    <Scene key="unloginCenter" />
</Scene>

使用unmountScenes

执行顺序:

tabbar

unloginCenter
unloginCenter
-----登录
tabbar

不使用unmountScenes
unloginCenter
unloginCenter
-----登录
tabbar
tabbar

以上是关于React Native之router-flex的使用的主要内容,如果未能解决你的问题,请参考以下文章