React native 如何居中对齐CreateMaterialOptabNavigator

React native 如何居中对齐CreateMaterialOptabNavigator,react-native,react-navigation,react-native-navigation,React Native,React Navigation,React Native Navigation,目前我的项目都在左边,默认情况下应该是这样的。我似乎不能把它移到中心。作为参考,我附上了一张图片 我已经尝试过使用tabStyle和alignSelf:“中心”alignItems:“中心”flexDirection:“行”,justifyContent:“中心” 代码如下: export const FoodScreenNavigator = createMaterialTopTabNavigator( { "McD": { screen: McD

目前我的项目都在左边,默认情况下应该是这样的。我似乎不能把它移到中心。作为参考,我附上了一张图片

我已经尝试过使用tabStyle和alignSelf:“中心”alignItems:“中心”flexDirection:“行”,justifyContent:“中心”

代码如下:

export const FoodScreenNavigator = createMaterialTopTabNavigator(
  {
    "McD": {
      screen: McDGrid,
      navigationOptions: {
        tabBarLabel: "McD"
      }
    },
    "Subway": {
      screen: SubwayScreen,
      navigationOptions: {
        tabBarLabel: "Subway"
      }
    },
    "BurgerKings": {
      screen: BurgerKingSelection,
      navigationOptions: {
        tabBarLabel: "Burger Kings"
      }
    },
    "ItalianMCT": {
      screen: StyleSelection,
      navigationOptions: {
        tabBarLabel: "Italian MCT"
      }
    }
  },
  {
    tabBarOptions: {
      activeTintColor: colors.FontColors.light_grey,
      inactiveTintColor: colors.FontColors.light_grey,
      style: {
        backgroundColor: colors.FontColors.dark_grey,
        justifyContent: "center"
      },
      labelStyle: {
        textAlign: "center",
        fontSize: fonts.h5,
        fontFamily: fonts.OpenSansSemiBold,
        justifyContent: "center"
      },
      tabStyle:{
        width: "auto"
      },
      indicatorStyle: {
        borderBottomColor: colors.UiBgColors.light_red,
        borderBottomWidth: 4,
        justifyContent: "center"
      },
      upperCaseLabel: false
    },
    backBehavior: "none"
  }
);
package.json

"react-navigation": "^4.0.8",
    "react-navigation-drawer": "^2.2.2",
    "react-navigation-stack": "^1.9.0",
    "react-navigation-tabs": "^2.5.6",

尝试在选项卡样式中添加marginLeft,如

tabStyle:{
        width:"auto",
        marginLeft:3,
},