我正面临一个奇怪的问题.在我的react-native 应用程序中,如果我将onPress
事件设置为View
,则不会触发,但如果我在View
中将其设置为Text
,则会触发.我错过了什么?
<View style={{backgroundColor: "red", padding: 20}}>
<Text onPress={()=> {
console.log('works');
}
}>X</Text>
</View>
<View style={{backgroundColor: "red", padding: 20}} onPress={()=> {
console.log('does not work');
}
}>
<Text>X</Text>
</View>
为什么会这样?这是React Native的问题吗?我用的是0.43版