javascript - How to change height of Bottom Tab Navigator in React Native - Stack Overflow

I am trying to change height of my bottom tab navigator bar in React Native. I've tried some answe

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" ponent={Home}/>
          <Tabs.Screen name="Search" ponent={Search}/>
          <Tabs.Screen name="Library" ponent={Library}/>
        </Tabs.Navigator>
        <PlayerBar track_name="Heart Attack" artist="Dave"/>
      </SafeAreaView>
    </NavigationContainer>
  );
}

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" ponent={Home}/>
          <Tabs.Screen name="Search" ponent={Search}/>
          <Tabs.Screen name="Library" ponent={Library}/>
        </Tabs.Navigator>
        <PlayerBar track_name="Heart Attack" artist="Dave"/>
      </SafeAreaView>
    </NavigationContainer>
  );
}
Share Improve this question asked Aug 31, 2021 at 12:06 themm1themm1 1572 silver badges12 bronze badges 2
  • See this discussion on stack to achive your goal BottomTabNavigator Height – 64Bit1990 Commented Aug 31, 2021 at 12:11
  • @64Bit1990 OP has always said this link didn't work for him in starting of question – Jitendra Singh Commented Aug 31, 2021 at 12:13
Add a ment  | 

1 Answer 1

Reset to default 6

Can try this

const Tab = createBottomTabNavigator();

export const TabNavigation = () => {
  return (
    <Tab.Navigator
      screenOptions={{
      tabBarStyle: {height: 60},
    }}>
    ...
    </Tab.Navigator>
  );
};

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744264868a4565817.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信