Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hide/remove Icon or Icon view from bottom tab navigation

I want to remove the Icon space/View from the Bottom tab Navigator. I tried to remove the Icon by removing tabBarIcon but it didn't work. Here is the code I tried and the outcome I received. It is not looking that good, the label is not at the center. They looks like they have gone below the visible screen. Code used:

const TabNavigator = createMaterialBottomTabNavigator(
{
    Home: {
        screen: screen1,
        navigationOptions: {
            // tiitle: "hello"
            // tabBarIcon: () => {
            //     <View></View>
            // },
            tabBarLabel: <Text style={{ fontSize: 15, textDecorationLine: 'underline', }}>Screen1</Text>,
        }
    },
    People: {
        screen: screen2,
        navigationOptions: {
            tabBarLabel: <Text style={{ fontSize: 15, textDecorationLine: 'underline' }}>Screen2</Text>,
            activeColor: '#E8947F',
            inactiveColor: '#C4C9CB',
        }
    },
    Connects: {
        screen: screen3,
        navigationOptions: {
            tabBarLabel: <Text style={{ fontSize: 15, textDecorationLine: 'underline' }}>Screen3</Text>,
            activeColor: '#E8947F',
            inactiveColor: '#C4C9CB',

            // barStyle: { backgroundColor: '#2c6d6a' },
        }
    },
},
{
    initialRouteName: 'Home',
    activeColor: '#E8947F',
    inactiveColor: '#C4C9CB',
    barStyle: { backgroundColor: '#00000000' },
});

Outcome:

enter image description here

I am new to React-Native. Please help me.

like image 581
Vikas Bansal Avatar asked Oct 31 '25 18:10

Vikas Bansal


2 Answers

You just have to add screenOptions={{tabBarIconStyle: { display: "none" }}} like below example.

<Tab.Navigator
  screenOptions={{
    tabBarLabelPosition: "beside-icon",
    tabBarLabelStyle: {
      fontWeight: "700",
      fontSize: 15
    },
    tabBarIconStyle: { display: "none" },
  }}
>
  <Tab.Screen
    component={DemoComponent}
    name="Demo"
    options={{ tabBarLabel: "My Demo" }}
  />
</Tab.Navigator>
like image 120
Vivek S Avatar answered Nov 03 '25 14:11

Vivek S


Just you need to add this options in Tab.Screen which you want to hide in TabNavigator like below.

<Tab.Screen name="Home" component={HomeStack} options={{
    tabBarButton: () => null,
    tabBarVisible: false,
  }} />
like image 21
Jemish Rajpara Avatar answered Nov 03 '25 14:11

Jemish Rajpara