如何在react-native-router-flux中组合标签和导航栏?

时间:2017-11-22 21:06:03

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

我想为我的应用设置屏幕标题创建下一个结构:

|<-  Settings     |
|-----------------|
| Tab 1  |  Tab 2 |
|-----------------|
|                 |
|   Active tab    |
|    content      |
|                 |
|                 |

我试着这样做:

<Provider store={store}>
    <RouterWithRedux>
        <Scene key="root">
            <Scene key="landing" component={Landing} title="Landing" initial={true} />
            <Scene tabs key="rootTabBar" back wrap={false} title="Settings">
                <Scene key="home" component={Home} title="Home" icon={TabIcon} initial />
                <Scene key="search" component={Search} title="Search" icon={TabIcon} />
            </Scene>
        </Scene>
    </RouterWithRedux>
</Provider>

但我得不到我的预期,on attached screen is wrong tabs names

2 个答案:

答案 0 :(得分:2)

这段代码对我有用

 <Scene key="root" hideNavBar headerStyle={{ marginTop:STATUSBAR_HEIGHT, elevation:0}} >

            <Scene key="main" hideNavBar >

                <Scene key="newsList"
                    tabs={true}
                    hideNavBar={false}
                    headerMode='none'
                    navBar={Header}
                    wrap={false}

                >
                    <Scene key="TehcList" component={TehcList} title="Teknoloji" />
                    <Scene key="GameList" component={GameList} title="Oyun" />
                </Scene>

            </Scene>
        </Scene>

答案 1 :(得分:1)

尝试一下。

import {Router, Scene} from 'react-native-router-flux';
import Home from './screens/Home';
import Post from './screens/Post';
import Forum from './screens/Forum';

const Routes = () => (
    <Router>
       <Scene key = "root">
          <Scene key = "main" 
                tabs={true} 
                hideNavBar={true} 
                tabBarStyle={styles.navigationTabBar} 
                hideBackImage={true}>  
                    <Scene key = "home" component = {Home} title = "Home" initial={true} hideNavBar = {true}/>
                    <Scene key = "post" component = {Post} title = "Post" hideNavBar = {true} />
                    <Scene key = "forum" component = {Forum} title = "Forum" hideNavBar = {true} />
          </Scene>
       </Scene>
    </Router>
 )

 export default Routes

http://pythonic.ninja/how-to-navigate-to-nested-tab-using-react-native-router-flux.html`

的线索