gpt4 book ai didi

reactjs - 在 TabNavigator 中隐藏标签 - ReactNavigation

转载 作者:行者123 更新时间:2023-12-03 13:56:20 30 4
gpt4 key购买 nike

如何隐藏 TabNavigator 中的标签并仅显示图标?如果我执行以下操作:

const Tabs = TabNavigator({
Home: {
screen:MainHome,
navigationOptions: ({ navigation }) => ({
title: "Home", //Tried to hide this for next tab Search.
tabBarIcon: ({ tintColor, focused }) => <View><MaterialIcons name="home"/></View>
})
},
Search: {
screen:TestComp1,
navigationOptions: ({ navigation }) => ({
//If no title it shows the name as Search.
tabBarIcon: ({ tintColor, focused }) => <View><MaterialIcons name="accessibility"/></View>
})

}
}, {

tabBarPosition: 'bottom',

tabBarOptions: {
showIcon: true,
activeTintColor: '#e91e63', //Not working for icons.
inactiveBackgroundColor: 'green', // Not working at all.
style: {backgroundColor: '#3498DB', height: 60, padding:0, margin:0}
}
});

如果我从 navigationOptions 中删除 title,它会显示选项卡的名称(HomeSearch) 。我只想显示图标并更改事件图标的颜色。 activeTintColor 不适用于图标。

最佳答案

TabNavigator 有您可以设置的 showLabel 属性。更多信息请引用docs for v1docs for v2 .

showIcon - whether to show icon for tab, default is false

showLabel - whether to show label for tab, default is true

关于reactjs - 在 TabNavigator 中隐藏标签 - ReactNavigation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46770273/

30 4 0