开始滚动时,使TouchableOpacity不突出显示元素[React Native] [英] Make TouchableOpacity not highlight element when starting to scroll [React Native]

查看:217
本文介绍了开始滚动时,使TouchableOpacity不突出显示元素[React Native]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TouchableOpacity使事情变得可触摸,或如React Native所说:

TouchableOpacity makes things touchable, or as React Native says:

用于使视图正确响应触摸的包装器.

A wrapper for making views respond properly to touches.

但是当我们(或至少是我)不想要它时,在ScrollViewListView内部使用它会导致突出显示.

But using it inside a ScrollView or ListView results in highlighting when we (or at least I) do not want that.

向下滚动填充元素的ListView涉及以下三个步骤:

These are three steps involved in scrolling down a ListView filled with elements:

  • 触摸元素
  • 向上移动手指
  • 松开手指

触摸该元素会立即生成一个高光动画.但是在这种情况下,我们只想滚动.我们不想对该元素做任何事情,无论是突出显示还是打开详细视图等.

Touching the element immediately results in a highlight animation. But in this case, we just want to scroll. We do not want to do anything with that element, be it highlighting or opening a detail view etc.

这并非一直发生,而是在我的Android设备上大多数情况下发生.

This does not happen all the time but most of the times on my Android device.

处理此问题的正确方法是什么?

What is a proper way of handling this?

推荐答案

滚动手势应取消TouchableOpacity触摸响应器,但是如果您认为TouchableOpacity高亮显示触发得很早,则可以尝试调整属性.

A scroll gesture should cancel the TouchableOpacity touch responder, but if you think the TouchableOpacity highlight is triggered to early, you can try tweaking the delayPressIn property.

这篇关于开始滚动时,使TouchableOpacity不突出显示元素[React Native]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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