Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react native createbottomtabnavigator hide tab bar label

I need to know how to hide the bottom label.

I've tried the following:

tabBarShowLabels: 'hidden', tabbarlabelvisible: false.

I also removed the tabbarlabel: 'Home' and it still shows

Any help would be appreciated or if someone could point me to the right direction.

enter image description here

import {createBottomTabNavigator} from 'react-navigation'
import Icon from 'react-native-vector-icons/Ionicons'


const Tabs = createBottomTabNavigator ({
  Home:{
    screen: Home,
    navigationOptions:{
      tabBarIcon: ({ focused, tintcolor }) => (
        <Icon name="ios-home" size={24}  />
      )
    }
  },
  Inbox:{screen: Inbox,
    navigationOptions:{
      tabBarIcon: ({ tintcolor }) => (
        <Icon name="ios-mail" size={24} />
      )
    }
  },
  Search:{screen: Search,
    navigationOptions:{
      tabBarIcon: ({ tintcolor }) => (
        <Icon name="ios-search" size={24} />
      )
    }
  },
  Favorites:{screen: Favorites,
    navigationOptions:{ 
    tabBarIcon: ({ tintcolor }) => (
      <Icon name="ios-heart" size={24} />
    )
  }
  },
  Settings:{screen: Settings,
    navigationOptions:{ 
      tabBarIcon: ({ tintcolor }) => (
        <Icon name="ios-settings" size={24} />
      )
    }
  }

}
});



export default class App extends Component {
  render() {

    return <Tabs />
  }
}
like image 724
obumoon Avatar asked Sep 25 '18 22:09

obumoon


People also ask

How do I get rid of the tab bar in react native?

This property is commonly used to change the styles of the tab bar, for example, by applying the backgroundColor styles' property. To remove the border, add the tabBarOptions prop and inside it, add a style property called borderTopWidth with a value 0 .

How do you style the tab bar 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';

How do I hide the navigation bar in react native?

To hide the navigation navbar with React Native, we set the screenOptions. headerShown option to false .

How do I remove the header tab navigator in react native?

(React Nav ver6. x) add this code snipet "options={{headerShown: false}}" in "<Tab. Screen />". It will delete header of each tab you add into.


2 Answers

You have to define showLabel: false as the docs says, just as

const Tabs = createBottomTabNavigator ({
  Home:{
    screen: Home,
    navigationOptions:{
      tabBarIcon: ({ focused, tintcolor }) => (
        <Icon name="ios-home" size={24}  />
      )
    }
  },
  ...
  ,
  Settings:{screen: Settings,
    navigationOptions:{
      tabBarIcon: ({ tintcolor }) => (
        <Icon name="ios-settings" size={24} />
      )
    }
  }

}
}, {
  tabBarOptions: { showLabel: false }
});
like image 72
Jose Vf Avatar answered Sep 23 '22 08:09

Jose Vf


On the new versions of React Navigation, you just need to pass showLabel prop as false

<Tab.Navigator tabBarOptions={{ showLabel: false }}>
like image 28
Lincon Kusunoki Avatar answered Sep 26 '22 08:09

Lincon Kusunoki