Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you make the react-native react-navigation tab bar transparent

Is there a way to make the tab bar transparent? I tried the following but it just showed a white background. Do I need to implement my own tabBarComponent? If so, is there any documentation on that class and what interface I need to implement?

const MainTabNavigator = TabNavigator(
  {
    MessageCenter: { screen: MessageCenterStack },
    Camera: { screen: CameraStack },
  },
  {
    tabBarPosition: 'bottom',
    swipeEnabled: true,
    animationEnabled: true,
    tabBarOptions: {
      style: {
        backgroundColor:  'transparent',
      },
    }
  }
);
like image 698
MonkeyBonkey Avatar asked Apr 23 '18 19:04

MonkeyBonkey


People also ask

How do you make the bottom navigation bar transparent react native?

const MainTabNavigator = TabNavigator( { MessageCenter: { screen: MessageCenterStack }, Camera: { screen: CameraStack }, }, { tabBarPosition: 'bottom', swipeEnabled: true, animationEnabled: true, tabBarOptions: { style: { backgroundColor: 'transparent', }, } } ); react-native.

How do I customize tab navigation in react native?

Add icons to the tab bar To add icons to each tab, first import the Icon component from react-native-vector-icons library inside the navigation/TabNavigator/index. js file. For this example, let's use AntDesign based icons. // after other import statements import Icon from 'react-native-vector-icons/AntDesign';


1 Answers

I have to set position absolute and give it a left right and bottom for it the backgroundColor transparent to take effect.

tabBarOptions: {
  showIcon: true,
  showLabel: false,
  lazyLoad: true,
  style: {
    backgroundColor: 'transparent',
    borderTopWidth: 0,
    position: 'absolute',
    left: 50,
    right: 50,
    bottom: 20,
    height: 100
  }
}
like image 118
MonkeyBonkey Avatar answered Sep 20 '22 18:09

MonkeyBonkey