react-navigation / react-navigation

Routing and navigation for your React Native apps
https://reactnavigation.org
23.3k stars 4.97k forks source link

Adjust the margin of the bottom menu bar #11907

Closed hrh94 closed 2 weeks ago

hrh94 commented 1 month ago

Current behavior

I want to adjust “@react-navigation/material-bottom-tabs” bar below because it is too wide for me, but I don't know which parameter can be adjusted. I tried using the "barStyle" property to adjust it, and tried “height” and “padding” and “margin”, but there was a problem

import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs';
const Tab = createMaterialBottomTabNavigator();

    <Tab.Navigator
      barStyle={{
        backgroundColor: '#F6F6F6',
      }}
      activeIndicatorStyle={{ backgroundColor: '#F6F6F6' }}
      activeColor={colors.theme}
      shifting
    >
      <Tab.Screen
        name="HomeStack"
        component={Home}
        options={{
          tabBarLabel: '首页',
          tabBarIcon: ({ focused, color, size }) => (<FontAwesomeIcon icon={faHouse} color={color} size={30} />),
          tabBarLabelStyle: {
            color: '#000',
          },
        }}
      />
      <Tab.Screen
        name="SecurityCamera"
        component={SecurityCameraScreen}
        options={{
          tabBarLabel: '监控',
          tabBarIcon: ({ focused, color, size }) => (<FontAwesomeIcon icon={faVideoCamera} color={color} size={30} />),
        }}
      />
      <Tab.Screen
        name="Markets"
        component={MarketsScreen}
        options={{
          tabBarLabel: '营销',
          tabBarIcon: ({ focused, color, size }) => (<FontAwesomeIcon icon={faMagicWandSparkles} color={color} size={30} />),
        }}
      />
      <Tab.Screen
        name="Profile"
        component={ProfileScreen}
        options={{
          tabBarLabel: '我的',
          tabBarIcon: ({ focused, color, size }) => (<FontAwesomeIcon icon={faUser} color={color} size={30} />),
        }}
      />
    </Tab.Navigator>

微信图片_20240322172628

Expected behavior

The inner margin of the bar becomes smaller

Reproduction

https://reactnavigation.org/docs/material-bottom-tab-navigator/

Platform

Packages

Environment

"@react-navigation/bottom-tabs": "^6.5.11",
"@react-navigation/material-bottom-tabs": "^6.2.19",
"@react-navigation/native": "^6.1.9",
"@react-navigation/native-stack": "^6.9.17",
"@react-navigation/stack": "^6.3.20",
github-actions[bot] commented 1 month ago

Hey @hrh94! Thanks for opening the issue. It seems that the issue doesn't contain a link to a repro.

The best way to get attention to your issue is to provide an easy way for a developer to reproduce the issue.

You can provide a repro using any of the following:

github-actions[bot] commented 1 month ago

The versions mentioned in the issue for the following packages differ from the latest versions on npm:

Can you verify that the issue still exists after upgrading to the latest versions of these packages?

hrh94 commented 1 month ago

Usage issues cannot be resolved by upgrading to the latest version

github-actions[bot] commented 3 weeks ago

Hello 👋, this issue has been open for more than a month without a repro or any activity. If the issue is still present in the latest version, please provide a repro or leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution or workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix it.