Javascript 组件上的TouchableNativeFeedback不执行onPress功能
我有这样的想法:Javascript 组件上的TouchableNativeFeedback不执行onPress功能,javascript,react-native,Javascript,React Native,我有这样的想法: <TouchableNativeFeedback onPress={this._changeAccount.bind(this, user)} delayPressIn={0} delayPressOut={0} useForeground={true} background={RippleColor('#ccc')} > <PhotoStatus> </TouchableNativeFeedback> 当我点击
<TouchableNativeFeedback
onPress={this._changeAccount.bind(this, user)}
delayPressIn={0}
delayPressOut={0}
useForeground={true}
background={RippleColor('#ccc')}
>
<PhotoStatus>
</TouchableNativeFeedback>
当我点击“PhotoStatus”组件时,什么都没有发生
未调用onPress函数
这将是这样一件事:
光状态
<View>
<Image
source={image}
style={{
width: dim - 30,
height: dim - 30,
borderRadius: (dim - 30) / 2,
}}
/>
</View>
相反,如果我直接替换为其中包含的组件代码,它就可以工作
在世博会上的示例中,使用了下图中标记的两个红色正方形
linkexpo:在视图中包装您的组件,它将修复错误
<TouchableNativeFeedback
onPress={this._changeAccount.bind(this, user)}
delayPressIn={0}
delayPressOut={0}
useForeground={true}
background={RippleColor('#ccc')}
>
<View>
<PhotoStatus>
</View>
</TouchableNativeFeedback>
@PritishVaidya:只在android上,因为我使用的是DroperLayoutAndroid,它只在android上工作。非常感谢,但我没有解释为什么会发生这种情况。很可能是因为布局问题,android不像IOS那么宽容。尝试使用react DEVTOOL检查滤芯,请参阅。Ot。你觉得我要创建的模块怎么样?有什么建议吗?;)我不知道你想创建什么,但它看起来不错:-)你知道使用android的绘图布局。一个模块,允许指定参数使其发生。例如:谷歌电子邮件,谷歌游戏商店。另外,如果你有时间,你可以看看这个问题: