react-native - TouchableOpacity 无法在 android 中正常工作

我有一个带有 flatlist 的应用程序,我添加到覆盖整个屏幕的应用程序 TouchableOpacity,当我单击项目区域时效果很好,但当我单击没有项目的区域时不起作用这是 TouchableOpacity:

<View style={{position: "absolute",width:'100%',height:HEIGHT,backgroundColor: 'rgba(0,0,0,0.8)',zIndex:6}}>
  <TouchableOpacity onPress={()=>setEditing(false)} style={{flex:1,zIndex:6}}>
  </TouchableOpacity>

它看起来像平面列表阻止它下面的任何点击也在 ios 它的作品没有任何问题

回答1

尝试将其更改为:

<View style={{position: "absolute",width:'100%',height:HEIGHT,backgroundColor: 'rgba(0,0,0,0.8)',zIndex:6}}>
  <TouchableOpacity onPress={()=>setEditing(false)} style={{flex:1,zIndex:7}}>
  </TouchableOpacity>
</View>

并运行它

相似文章

随机推荐

最新文章