如何在react-native-router-flux中删除TabIcon下的文本

问题描述 投票:0回答:1

我无法删除react-native-router-flux的TabBar中的TabIcon下的文本。它是我的TabBar的屏幕:enter image description here

它是我的路由器代码:

const TabBar = ({focused}) => (
    <View>
        <Icon name="search" type="MaterialIcons" style={{fontSize: 28, color: focused ? 'red': 'white'}} />
    </View>
)

export default () => (
    <Router>
        <Scene hideNavBar>

            <Scene key="tabbar" tabs tabBarStyle={{backgroundColor: '#000'}}>

                <Scene key="list" title="Ahlo" component={List} hideNavBar icon={TabBar} />

                <Scene key="search" component={search} hideNavBar icon={TabBar} />

                <Scene key="account" component={account} hideNavBar icon={TabBar} />
            </Scene>

            <Scene key="article" component={article} />

            <Scene key="comment" component={comment} />

            <Scene key="register" component={register} />

            <Scene key="auth" component={auth} />
        </Scene>
    </Router>
)

在每个教程中,我都看到TabIcon下的文字丢失了,但我有它。我在这做错了什么?

react-native react-native-android react-navigation react-native-ios
1个回答
0
投票

您可以尝试将showLabel道具添加到父母或特定的孩子Scenefalse,(默认情况下,它的值是true

所以你的tabbar场景代码将是这样的:

<Scene key="tabbar" showLabel={false} tabs tabBarStyle={{backgroundColor: "#000"}}>
       <Scene key="list" component={List} showLabel={false} hideNavBar icon={TabBar} />
       <Scene key="search" component={search} showLabel={false} hideNavBar icon={TabBar} />
       <Scene key="account" component={account} showLabel={false} hideNavBar icon={TabBar} />
</Scene>

希望这会有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.