react-native
react-native copied to clipboard
Pressable: onLongPress not fired after delay if finger is moved while pressing inside the button surface
Pressable: onLongPress not work after delay if finger is moved while pressing inside the button surface.
React Native 0.63
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
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? 🧐