首页 > 解决方案 > 反应导航选项卡不可点击的绝对位置

问题描述

我有 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它是完美的工作。

在此处输入图像描述

标签: react-nativereact-native-androidreact-navigation

解决方案


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

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

推荐阅读