While working on #2759 I've decided that it will be good idea to also introduce some changes into web version of orchestrator.
While this PR is mostly a refactor, it also brings other changes, for example it adds awaitingHandlersTagsset which is used on android (current implementation was unsafe).
Unfortunately change made in GestureHandler.ts reverts #2802, but it is necessary for orchestration process to work. We will find better way to solve this problem in follow-up PR.
Description
While working on #2759 I've decided that it will be good idea to also introduce some changes into web version of
orchestrator
.While this PR is mostly a refactor, it also brings other changes, for example it adds
awaitingHandlersTags
set
which is used on android (current implementation was unsafe).Unfortunately change made in
GestureHandler.ts
reverts #2802, but it is necessary for orchestration process to work. We will find better way to solve this problem in follow-up PR.Test plan
Tested on the following code:
```jsx import React from 'react'; import { StyleSheet, View } from 'react-native'; import { Gesture, GestureDetector } from 'react-native-gesture-handler'; import Animated from 'react-native-reanimated'; const log = (e: any, handler: string) => console.log(`[${e.handlerTag}][${handler}]: ${e.state}`); const orangeTapGesture = Gesture.Tap() .runOnJS(true) .maxDeltaX(5) .onBegin((e) => log(e, 'Orange tap')) .onStart((e) => log(e, 'Orange tap')) .onFinalize((e, success) => { log(e, 'Orange tap'); if (success) { console.log('---> Orange Tap <---'); } }); const orangeDoubleTapGesture = Gesture.Tap() .numberOfTaps(2) .runOnJS(true) .onBegin((e) => log(e, 'Orange Double Tap')) .onStart((e) => log(e, 'Orange Double Tap')) .onFinalize((e, success) => { log(e, 'Orange Double Tap'); if (success) { console.log('---> Orange Double Tap <---'); } }); const blueTapGesture = Gesture.Tap() .runOnJS(true) .requireExternalGestureToFail(orangeTapGesture, orangeDoubleTapGesture) .onBegin((e) => log(e, 'Blue Tap')) .onStart((e) => log(e, 'Blue Tap')) .onFinalize((e, success) => { log(e, 'Blue Tap'); if (success) { console.log('---> Blue Tap <---'); } }); const blueDoubleTapGesture = Gesture.Tap() .numberOfTaps(2) .runOnJS(true) .onBegin((e) => log(e, 'Blue Double Tap')) .onStart((e) => log(e, 'Blue Double Tap')) .onFinalize((e, success) => { log(e, 'Blue Double Tap'); if (success) { console.log('---> Blue Double Tap <---'); } }); const redLongPressGesture = Gesture.LongPress() .runOnJS(true) .onBegin((e) => log(e, 'Red Longpress')) .onStart((e) => log(e, 'Red Longpress')) .onFinalize((e, success) => { log(e, 'Red Longpress'); if (success) { console.log('---> Red Longpress <---'); } }); const redDoubleTapGesture = Gesture.Tap() .numberOfTaps(2) .runOnJS(true) .onBegin((e) => log(e, 'Red Double Tap')) .onStart((e) => log(e, 'Red Double Tap')) .onFinalize((e, success) => { log(e, 'Red Double Tap'); if (success) { console.log('---> Red Double Tap <---'); } }); const Showcase = () => { const gesture = Gesture.Race(redDoubleTapGesture, redLongPressGesture); return (