【问题标题】:React Navigation Tabs not Clickable with absolute position反应导航选项卡不可点击的绝对位置
【发布时间】:2019-05-16 05:24:27
【问题描述】:

我在 react native 中有 2 个屏幕,我想让标签导航器透明,它可以工作,但在添加 position: absolute 后导航器不可点击,如果我不使用绝对背景,则背景会变白(不能透明)

这是我的 tabBarOptions

tabBarOptions: {
        showIcon: true,
        showLabel: true,
        activeTintColor: 'orange',
        inactiveTintColor: '#fff',
        style: {
            width: '100%',
            height: 60,
            backgroundColor: 'transparent',
            borderTopWidth: 0,
            position: 'absolute',
            left: 0,
            right: 0,
            bottom: 10,
        },
        tabStyle: {
            paddingTop: 20,
        },
    },

当我点击 Create Order 选项卡时没有任何反应,但如果我评论 position: absolute 它就完美了。

【问题讨论】:

  • 你能创建一个零食来重现这个问题吗?我认为问题出在您应用于按钮或视图组件的一些附加样式上。这是一个具有绝对位置的透明标签栏的示例工作示例:snack.expo.io/@hristoeftimov/…
  • @HristoEftimov 我没有使用 expo,这是我项目的 git 存储库:github.com/anandabayu/fmc
  • 您可以使用整个页面背景并在 android 上为底部标签栏提供透明度,在 iOS 上绝对位置可以正常工作。请参阅平台特定代码。

标签: react-native react-native-android react-navigation


【解决方案1】:

在标签栏样式中添加“zIndex=1”

style: {
            width: '100%',
            height: 60,
            backgroundColor: 'transparent',
            borderTopWidth: 0,
            position: 'absolute',
            zIndex: 1,
            left: 0,
            right: 0,
            bottom: 10,
        },

【讨论】:

猜你喜欢
  • 2013-08-28
  • 1970-01-01
  • 2023-04-02
  • 2016-08-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-23
  • 1970-01-01
相关资源
最近更新 更多