3

I am trying to change height of my bottom tab navigator bar in React Native. I've tried some answers from this Stack Overflow question but nothing seems to work. Please help.

My code:

export default function AppTabs({ logged }) {
  const Tabs = createBottomTabNavigator();

  return (
    <NavigationContainer>
      <SafeAreaView style={{ flex: 1 }}>
        <Tabs.Navigator
          screenOptions={({ route }) => ({
            tabBarIcon: ({ focused, color, size }) => {
              const current_color = focused ? COLORS.white : COLORS.lightGrey;

              if (route.name === "Home") {
                return <Foundation name="home" size={28} color={current_color}/>
              } else if (route.name === "Search") {
                return <Ionicons name="search" size={28} color={current_color} />
              } else if (route.name === "Library") {
                return <MaterialCommunityIcons name="bookshelf" size={28} color={current_color} />
              }
            },
            header: () => null,
            tabBarActiveBackgroundColor: COLORS.darkGgrey,
            tabBarInactiveBackgroundColor: COLORS.darkGgrey,
            tabBarActiveTintColor: COLORS.white,
            tabBarInactiveTintColor: COLORS.lightGrey
          })}
        >
          <Tabs.Screen name="Home" component={Home}/>
          <Tabs.Screen name="Search" component={Search}/>
          <Tabs.Screen name="Library" component={Library}/>
        </Tabs.Navigator>
        <PlayerBar track_name="Heart Attack" artist="Dave"/>
      </SafeAreaView>
    </NavigationContainer>
  );
}
themm1
  • 137
  • 2
  • 10
  • See this discussion on stack to achive your goal [BottomTabNavigator Height](https://stackoverflow.com/questions/57201508/react-navigation-increase-height-of-the-bottom-tab-navigation) – 64Bit1990 Aug 31 '21 at 12:11
  • @64Bit1990 OP has always said this link didn't work for him in starting of question – Jitendra Singh Aug 31 '21 at 12:13

1 Answers1

5

Can try this

const Tab = createBottomTabNavigator();

export const TabNavigation = () => {
  return (
    <Tab.Navigator
      screenOptions={{
      tabBarStyle: {height: 60},
    }}>
    ...
    </Tab.Navigator>
  );
};
Muhammed Yasir MT
  • 1,894
  • 1
  • 6
  • 7