React Native Tabbar 颜色更改不起作用

我想在本机反应中单击标签栏时更改标签栏的颜色。我尝试使用此代码,但它显示了我的 iPhone 上的标准颜色。我寻找解决方案,但没有人在工作。更改 tabBarLabel 有效,但颜色无效。你可以帮帮我吗?这是我的代码:


const Tab = createBottomTabNavigator();


<Tab.Screen name="Settings" component={Settings}

  tabBarBadgeStyle={{backgroundColor: '#0000ff', color:'green'}}

 

 tabBarOptions={{

   tabBarLabel: 'Test',

   style: { backgroundColor: 'orange'}

 }}/>


jeck猫
浏览 161回答 1
1回答

慕沐林林

您必须在导航器中添加 tabBarOption 而不是 screen ,&nbsp; &nbsp; <Tab.Navigator&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tabBarOptions: {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; activeTintColor: '#e91e63',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;labelStyle: {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fontSize: 12,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;},&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;style: {&nbsp; &nbsp; &nbsp; &nbsp;backgroundColor: 'blue',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;},&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <Tab.Screen&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name={variable.overViewScreen}&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; component={Overview}&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <Tab.Screen&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name={variable.homeScreen}&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; component={DashboardRoot}&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; />&nbsp; &nbsp; &nbsp; &nbsp; </Tab.Navigator>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript