1
  • 反应原生 0.38.1
  • 反应本机路由器通量 3.37.0

    我想基于身份验证实现动态选项卡,当用户登录时,显示主页和个人资料选项卡,否则仅显示主页选项卡

    我使用Switch但不工作。

     <Scene key="tabbar"
       tabs
       type={ActionConst.RESET}
       initial
       hideNavBar
       tabBarStyle={ styles.tabBar }
       pressOpacity={1}
       default="main">
    
         <Scene key="main"
             title="Home"
             type="switch"
             icon={TabHomeIcon}
             hideNavBar
             component={Main}
             initial/>
    
        <Scene key="profile"
            title="Profile"
            type="switch"
            icon={TabMeIcon}
            hideNavBar
            component={Profile}/>
    </Scene>
    
4

1 回答 1

-1

这是文档中的示例:

<Scene
    key="root"
    component={connect(state=>({profile:state.profile}))(Switch)}
    tabs={true}
    unmountScenes
    selector={props=>props.profile.sessionID ? "main" : "signUp"}
    >
    <Scene key="signUp" component={SignUp}/>
    <Scene key="main" component={Main}>
</Scene>
于 2017-02-15T14:31:07.417 回答