我无法删除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下的文字丢失了,但我有它。我在这做错了什么?
您可以尝试将showLabel
道具添加到父母或特定的孩子Scene
到false
,(默认情况下,它的值是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>
希望这会有所帮助。