react-native - 反应导航标签栏颜色不起作用
问题描述
我有一个带有标签栏的React Navigation导航系统。现在我的问题:
当我添加颜色时,我的图标下的文本会出现。如果我删除文本我不能有标签栏颜色。标签或颜色:/这是我的代码:
const HomeTabs = () => {
return (
<Tab.Navigator tabBarOptions={{style: {backgroundColor: "#191720"}}, {showLabel: false} }>
<Tab.Screen name="Home" component={HomeScreen} options={{tabBarIcon: ({focused}) => focused ? <ChatBubbleIconActive /> : <ChatBubbleIcon />}} />
<Tab.Screen name="Home" component={HomeScreen} options={{tabBarIcon: () => <ChatBubbleIcon />}} />
<Tab.Screen name="Search" component={SearchScreen} options={{tabBarIcon: ({focused}) => focused ? <ShuffleIconActive /> : <ShuffleIcon />}} />
<Tab.Screen name="Personal" component={PersonalScreen} options={{tabBarIcon: ({focused}) => focused ? <ChatBubbleIcon /> : <ChatBubbleIcon />}} />
</Tab.Navigator>
);
}
编辑
所以我希望我的标签栏有一个图标但没有文字。例如 Instagram 有一个这样的标签栏:
你怎么看:Instagram不是纯白色的——>它是浅灰色的。
解决方案
尝试使用 screenOptions 而不是 tabBarOptions!:)
推荐阅读
- python - 移动 Panda Dataframe Python
- python - C# RijndaelManaged vs Python Crypto.Cipher AES + CBC
- javascript - Angular 12, rendering dynamically routes in the page error
- objective-c - 修剪 UICollectionView 前导和尾随空格。它应该在所有 iPhone 设备上看起来都一样
- c++ - 函数的线程安全向量,每个函数都可以删除对该向量的访问
- java - 如何声明包含更多列表的可嵌入对象列表?
- laravel - Laravel GraphQL 在 args 函数中访问一个 Arg
- c# - 如何使用名为“1”和“2”的属性反序列化 JSON?这些不是 C# 中的有效属性名称
- swagger-ui - 显示所有请求正文参数作为单独的输入框
- cordova - Cordova - 如何知道设备使用的启动画面路径