Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to change the font color and the under line color of the top tab navigator?

Tags:

react-native

I'm setting up a new component of top TabNavigator and I want to change the color of the font and the color of the underline that marks each tab

This is for a new component

const TabNavigator = createMaterialTopTabNavigator(
  {
    Products: Results,
    Brands: Results,
    Categories: Results,
    UPC: Results,
    Tags: Results,
  },
  {
    tabBarOptions: {
      style: {
        backgroundColor: 'grey',
      },
      labelStyle: {
        fontSize: 9,
        margin: 0,
        padding: 0,
        fontFamily: 'Poppins-bold',
      },
    },
  }
)

I expect to change the color of the font and the color of the underline that marks each tab.

like image 828
Bob Avatar asked Oct 29 '25 19:10

Bob


1 Answers

You can change the background color of font by adding activeTintColor and inactiveTintColor in style tabBarOptions.

for the indicator, use indicatorStyle as below.

tabBarOptions: {
  activeTintColor: "white", 
  inactiveTintColor: "blue", 

  indicatorStyle :{
        backgroundColor:'red'
  }

  style: {
    backgroundColor: 'grey', 
  },
  labelStyle: {
    fontSize: 9,
    margin: 0,
    padding: 0,
    fontFamily: 'Poppins-bold',
  },
}
like image 190
Ayesh Nipun Avatar answered Oct 31 '25 12:10

Ayesh Nipun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!