react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Pressable: onLongPress not fired after delay if finger is moved while pressing inside the button surface

Open georgeMorales opened this issue 3 years ago • 2 comments

Pressable: onLongPress not work after delay if finger is moved while pressing inside the button surface.

React Native 0.63

georgeMorales avatar Feb 15 '21 19:02 georgeMorales

Yes this is intended behavior, i came across it as well, however its kind of annoying behavior. there is two longpress cancel actions: when the user moves their finger slightly, and the user moves their finger off the button area.

The weird behavior: https://github.com/facebook/react-native/blob/73b9f78e3316c3beed23e39f1c8b1d93260809d9/Libraries/Pressability/Pressability.js#L503

the behavior that makes sense https://github.com/facebook/react-native/blob/73b9f78e3316c3beed23e39f1c8b1d93260809d9/Libraries/Pressability/Pressability.js#L511

developerJuiceLozzoc avatar Apr 14 '21 13:04 developerJuiceLozzoc

I faced the same issue recently. It was reported as a BUG by my users.

The solution I found was, in my case, to use TouchableWithoutFeedback from react-native-gesture-handler. It looks like they took another decision in the implementation of the long press (i.e. even if you move inside the button during a long press the delay continues).

I asked some UX designers around me and they agreed that the correct behavior is the one from react-native-gesture-handler.

Should we change this behavior? 🧐

taboulot avatar Oct 25 '22 07:10 taboulot