Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change bottom bar container color of react navigation tabs in react native

I am trying to add border radius to bottom bar but with this i want to change container color from default to purple.

how can i do that ?

What i have done so far

enter image description here

What i want

enter image description here

Code:

tabBarOptions: {
      activeTintColor: colors.primary,
      inactiveTintColor: colors.black,
      showLabel: false,
      style: {
        borderWidth: 0.5,
        borderBottomWidth: 1,
        backgroundColor: 'white',
        borderTopLeftRadius: 20,
        borderTopRightRadius: 20,
        borderColor: colors.lightGrayText,
      },
    },

Anyone can help ?

thanks

like image 748
Muhammad Ashfaq Avatar asked Dec 23 '22 17:12

Muhammad Ashfaq


1 Answers

You have to add a position absolute which will make the tabbar stay inside the border

tabBarOptions={{
          activeTintColor: 'red',
          inactiveTintColor: 'black',
          showLabel: false,
          style: {
            borderWidth: 0.5,
            borderBottomWidth: 1,
            backgroundColor: 'red',
            borderTopLeftRadius: 20,
            borderTopRightRadius: 20,
            borderColor: 'grey',
            position: 'absolute'
          },
        }}>

Reference https://github.com/react-navigation/react-navigation/issues/5928

like image 197
Guruparan Giritharan Avatar answered Dec 28 '22 06:12

Guruparan Giritharan