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

Memoize tap GH state for sending proper value after releasing finger

Open osdnk opened this issue 5 years ago • 4 comments

Motivation

Issue happens on iOS. https://github.com/kmagiera/react-native-gesture-handler/issues/476.

After releasing finger in tap GH which is waiting for second GH and failure of second GH, values are being set zero and then zeros are send to JS instead on corrects values.

Changes

After reseting values are memoized and placed in nativeEvent. If this kind of situation is detected (no finger on screen) we fallback to memoized valued values instead of evaluating them.

osdnk avatar Feb 27 '19 11:02 osdnk

@kmagiera i think i fixed this the way you wanted. I actually use your Native code for a Nativescript module. Here is the commit if that is of any interest to you https://github.com/Akylas/nativescript-gesturehandler/commit/6c3ed76e958660ea83364f1e3e9e6fcef8e7a43b

farfromrefug avatar Jan 13 '20 11:01 farfromrefug

This looks more like how I'd imagine. Thanks for sending @farfromrefug. Willing to send a PR with this change maybe?

kmagiera avatar Jan 23 '20 09:01 kmagiera

@kmagiera sorry i dont use your code nor react-native

farfromrefug avatar Jan 23 '20 09:01 farfromrefug

@kmagiera @jakub-gonet I can apply changes that @farfromrefug proposed. Is it still relevant?

jkadamczyk avatar Sep 01 '20 11:09 jkadamczyk