Search code examples
react-nativetabnavigator

How to change colour styles for tab navigator in react native?


I am a newbie to react native. I am using a tab navigator for my home screen and couldn't understand how to change the active and inactive tab colour styling.

export const MyApp = TabNavigator({
  Asset: {
   screen: AssetScreen
  },
 Sensors: {
  screen: sensorsStack
 },
 Settings: {
  screen: settingStack
 },
},{
tabBarPosition: 'bottom',
animationEnabled: true,
swipeEnabled:false,
tabBarOptions: {
upperCaseLabel: false,
showIcon: true,
activeBackgroundColor:'#2394C7',
inactiveBackgroundColor:'grey',
tabStyle:{
    marginTop:10,
    height :53,
    borderRightWidth:1
},
labelStyle: {
    fontSize: 15,
    fontWeight:'bold',
     marginTop: 0,
     color :'#ffffff'
  },
 },
});

Any suggestion will be greatly appreciate.


Solution

  • You can use activeBackgroundColor and inactiveBackgroundColor property under tabBarOptions to set colour for active and inactive tabs.

    Please see the document for more info here.