0

我遇到了反应本机路由器通量导航的问题。我想使用 react-native-vector-icons 为我的标签显示一个图标,但对于组件 {ScreenOverview} 它不显示该图标。

代码:

const Scenes = Actions.create(
<Router>
    <Scene key='root' hideNavBar>

        <Scene
            key='amount'
            component={ScreenAmountPlayer}
            title='AmountOfPlayer'
            initial
        />

        <Scene
            key='names'
            component={ScreenEnterPlayerNames}
            title='EnterNames'
            hideNavBar
        />

        <Scene
            key='playScreen'
            hideNavBar
            tabs={true}
        >

            <Scene
                key='Play!'
                component={PlayScreen}
                icon={TabIcon}
                iconName={'play-circle-o'}
                hideNavBar
            />

            <Scene
                key='Overview'
                iconName={'list-ul'}
                icon={TabIcon}
                component={ScreenOverview}
                hideNavBar
            />

        </Scene>

    </Scene>
</Router>
) 

使用此代码,它看起来像这样: 在此处输入图像描述

当我将第二个场景更改为:

<Scene
    key='Overview'
    iconName={'list-ul'}
    icon={TabIcon}
    component={PlayScreen}
    hideNavBar
/>

它看起来像这样: 在此处输入图像描述

4

1 回答 1

0

我只是将我的场景包裹在另一个场景中并且它起作用了

        <Scene
            key='playScreen'
            hideNavBar
            tabs={true}
        >
            <Scene key='PlayWrapper' icon={TabIcon} iconName={'play-circle-o'} hideNavBar tabBarLabel='Play!'>
                <Scene
                    key='Play!'
                    component={PlayScreen}
                    hideNavBar
                />
            </Scene>

            <Scene key='OverviewWrapper' iconName={'list-ul'} icon={TabIcon} hideNavBar tabBarLabel='Overview'>
                <Scene
                    key='Overview'
                    component={ScreenOverview}
                    hideNavBar
                />
            </Scene>
        </Scene>
于 2018-03-19T13:23:22.727 回答