【问题标题】:createMaterialTopTabNavigator can't modify tabStyle paddingVerticalcreateMaterialTopTabNavigator 无法修改 tabStyle paddingVertical
【发布时间】:2020-10-20 06:59:55
【问题描述】:

Two lines up and down are createMaterialTopTabNavigator,I wont to customize the next line, but I can't remove paddingVertical part like the picture

tabBarOptions={{
          scrollEnabled: true,
          style: {
            backgroundColor: 'transparent',
          },
          tabStyle: {
            width: 'auto',
            margin: theme.sizes.radius,
            padding: 0, //only horizontal works,how to modify vertical padding ?
            backgroundColor: 'yellow',
          },
          labelStyle: {
            margin: 0,
            backgroundColor: 'red',
          },
          activeTintColor: theme.colors.default,
          renderIndicator: () => null,
        }}

【问题讨论】:

  • tabStyle: {minHeight: null} 有效

标签: react-native react-navigation


【解决方案1】:

试试tabBarOptions下的样式

tabBarOptions={{
    labelStyle: { fontSize: 12 },
    tabStyle: { width: 100, height: 100 },
    style: { backgroundColor: 'powderblue' },
}}

详情请看这里tabnavigator-extra-padding

【讨论】:

  • 谢谢,但是我找到了解决办法,源代码有minHeight:48,所以只设置tabStyle: {minHeight: null} 有效。
猜你喜欢
  • 2023-03-30
  • 2012-01-26
  • 2018-12-03
  • 1970-01-01
  • 1970-01-01
  • 2022-11-17
  • 2018-11-17
  • 2012-04-17
  • 2016-04-16
相关资源
最近更新 更多