react native 给View添加点击事件

    • 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/
      • 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/
     

    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/

posted on 2022-12-05 14:57  漫思  阅读(454)  评论(0编辑  收藏  举报

导航