如何在 React Native 上捕捉点击事件? [英] How to catch the tap down event on React Native?

查看:84
本文介绍了如何在 React Native 上捕捉点击事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在用户点击视图时捕捉事件.目前,我使用 TouchableXXX 组件来捕获用户 onPress(似乎 onPress 只捕获 onTapDown 事件).

I want to catch the event when a user taps on the view. Currently, I use the TouchableXXX components to catch user onPress (seems like onPress catches the onTapDown event only).

推荐答案

接受的答案不再有效.正确的方法是使用Touchable的onPressIn()

The accepted answer does not work anymore. The correct way is to use Touchable's onPressIn()

https://facebook.github.io/react-native/docs/touchablewithoutfeedback.html#onpressin

这篇关于如何在 React Native 上捕捉点击事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆