react native 给View添加点击事件

http://www.voidcn.com/article/p-vijhprhu-buo.html

直接在View上绑定点击事件,是没有用的。要使任何元素处理React-Native UI中的触摸/单击事件,您需要将元素放在TouchableOpacity,TouchableWithoutFeedback,TouchableNativeFeedback或TouchableHighlight元素中:

<TouchableHighlight onPress = { this.onClick }>
    <View style={styles.container}>
    <Text style={styles.welcome}>
        Tap to change the background
    </Text>
    </View>
</TouchableHighlight>
此文仅为鄙人学习笔记之用,朋友你来了,如有不明白或者建议又或者想给我指点一二,请私信我。liuw_flexi@163.com/QQ群:582039935. 我的gitHub: (学习代码都在gitHub) https://github.com/nwgdegitHub/
原文地址:https://www.cnblogs.com/liuw-flexi/p/12202281.html