【发布时间】:2021-06-09 17:08:24
【问题描述】:
我在 react-native 中遇到了 TouchableOpacity 组件的间歇性问题。
我基本上点击元素,它正常执行不透明动画,但我的 console.log 随机运行。在 iOS 中可以正常工作。
我的代码:
<TouchableOpacity style={{backgroundColor:'red'}} onPress={async () => {
console.log('Button '+item.tag+' pressed.');
}}>
注意:我尝试在不使用异步的情况下调用此函数。
【问题讨论】:
-
我注意到 PanResponder 正在干扰 TouchableOpacity 的功能,但我仍然不知道如何解决。
标签: android react-native react-native-flatlist touchableopacity