(仅限iOS系统)<TouchableOpacity>
如果它在一个叫 "T "的东西里面,就不会有反应。<ScrollView>
:
keyboardShouldPersistTaps="always"
无所谓<ScrollView style={styles.scrollView}>
<TouchableOpacity style={styles.xButton} onPress={() => this._onClose()}>
有什么建议吗?
--- 代码更新 -----
<ScrollView style={styles.scrollView}>
<TouchableOpacity style={styles.xButton} onPress={() => this._onClose()}>
<Image style = {styles.xImg} source = {require('../../images/xbtn.png')}/>
</TouchableOpacity>
{this._renderPricing()}
{this._renderServices()}
</ScrollView>
和造型是这样的。
scrollView:{
width: width,
height: height,
}, xButton: {
position: 'absolute',
zIndex: 1,
marginTop: '1%',
marginRight: '3%',
alignSelf: 'flex-end',
},xImg: {
resizeMode: 'contain',
aspectRatio: .6,
opacity: 0.5,
},
这个问题已经解决了。这是因为在我的单独的渲染方法中的 this._renderPricing
等我改变状态的次数太多"■▄▄■▓,因此JS线程被占用,所以TouchableOpacity无法对触摸事件做出响应"""。RN文件 如有需要,可向您索取更详细的解释。非常感谢您的回答。