【问题标题】:How to remove fullwidth tab in createMaterialTopTabNavigator如何在 createMaterialTopTabNavigator 中删除全角选项卡
【发布时间】:2021-07-26 12:16:05
【问题描述】:

我很难在 createMaterialTopTabNavigator 中删除全角标签。我正在使用这个库 https://reactnavigation.org/docs/material-top-tab-navigator/

电流输出:

预期输出:

感谢您在这方面的帮助!

【问题讨论】:

    标签: css react-native react-native-navigation react-navigation-v5 react-native-tabnavigator


    【解决方案1】:

    试试这样的

    <Tab.Navigator
        tabBarOptions={{
          style: { alignItems: 'flex-start' },
          tabStyle: { alignItems: 'center', width: 100 },
          indicatorStyle: { width: 100 },
        }}>
        <Tab.Screen name="Home" component={HomeScreen} />
        <Tab.Screen name="Settings" component={SettingsScreen} />
    </Tab.Navigator>
    

    here

    【讨论】:

    • 您好,谢谢您的回答。我通过添加 tabStyle: { width: 'auto', marginHorizo​​ntal: 20 } :) 解决了这个问题
    • 但我猜这会隐藏底部指示器。
    猜你喜欢
    • 1970-01-01
    • 2021-06-06
    • 1970-01-01
    • 1970-01-01
    • 2011-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多