【问题标题】:Overlapping React Navigation Header in react native app在反应本机应用程序中重叠反应导航标题
【发布时间】:2021-02-27 11:57:20
【问题描述】:

我在 react 本机应用程序中工作,对于我的导航,我使用了 react-navigation 4,在其中一个屏幕中,我想将 react-navigation 标题与卡片组件重叠,在 android 上,它工作正常,但在 iOS 上即使我将卡片 zIndex 设置为一个大数字,我也无法让它工作,它总是被 react-navigation 标题隐藏。 这是我的组件的代码:

<View style={global.container}>
                <View style={styles.info}>
                    <View style={styles.card}>
                        <Image style={styles.image} source={app.appLogo} />
                    </View>
                </View>
<View>

这是CSS:

card:{
    padding:0,
    borderRadius: 30,
    backgroundColor:"#fff",
    position: 'absolute',
    top: -70,
    zIndex:99,
    elevation:5
 
  },

在安卓上显示:

在 iOS 上显示:

【问题讨论】:

    标签: android ios react-native react-navigation


    【解决方案1】:

    请将 zIndex 添加到父视图。在 iOS 中,zIndex 不适用于嵌套的 parentView。你需要让parentView的zIndex高,然后再target View。

    .container {
       zIndex:101
    }
    .info {
       zIndex:100
    }
    

    【讨论】:

      猜你喜欢
      • 2021-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多