react-native-gesture-handler 2.16.0 → 2.16.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/lib/commonjs/RNGestureHandlerModule.js +97 -4
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.native.js +16 -0
- package/lib/commonjs/RNGestureHandlerModule.native.js.map +1 -0
- package/lib/commonjs/RNRenderer.js +5 -10
- package/lib/commonjs/RNRenderer.js.map +1 -1
- package/lib/commonjs/RNRenderer.native.js +16 -0
- package/lib/commonjs/RNRenderer.native.js.map +1 -0
- package/lib/commonjs/components/GestureComponents.js +19 -82
- package/lib/commonjs/components/GestureComponents.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.native.js +115 -0
- package/lib/commonjs/components/GestureComponents.native.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerButton.js +13 -3
- package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerButton.native.js +14 -0
- package/lib/commonjs/components/GestureHandlerButton.native.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerRootView.js +0 -6
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/components/{GestureHandlerRootView.web.js → GestureHandlerRootView.native.js} +7 -1
- package/lib/commonjs/components/GestureHandlerRootView.native.js.map +1 -0
- package/lib/commonjs/getReactNativeVersion.js +1 -12
- package/lib/commonjs/getReactNativeVersion.js.map +1 -1
- package/lib/commonjs/getReactNativeVersion.native.js +22 -0
- package/lib/commonjs/getReactNativeVersion.native.js.map +1 -0
- package/lib/commonjs/getShadowNodeFromRef.js +5 -34
- package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.native.js +44 -0
- package/lib/commonjs/getShadowNodeFromRef.native.js.map +1 -0
- package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PressabilityDebugView.js +5 -7
- package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -1
- package/lib/commonjs/handlers/PressabilityDebugView.native.js +14 -0
- package/lib/commonjs/handlers/PressabilityDebugView.native.js.map +1 -0
- package/lib/commonjs/handlers/createHandler.js +9 -3
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.js +5 -8
- package/lib/commonjs/handlers/customDirectEventTypes.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.native.js +14 -0
- package/lib/commonjs/handlers/customDirectEventTypes.native.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js +15 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/commonjs/handlers/gestures/flingGesture.js +13 -0
- package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js +17 -0
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gesture.js +135 -0
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureObjects.js +66 -0
- package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js.map +1 -1
- package/lib/commonjs/handlers/gestures/hoverGesture.js +1 -1
- package/lib/commonjs/handlers/gestures/hoverGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/longPressGesture.js +12 -0
- package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/nativeGesture.js +10 -0
- package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/panGesture.js +76 -0
- package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/tapGesture.js +42 -0
- package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/commonjs/utils.js +5 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +7 -7
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +3 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/interfaces.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.js +84 -4
- package/lib/module/RNGestureHandlerModule.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.native.js +5 -0
- package/lib/module/RNGestureHandlerModule.native.js.map +1 -0
- package/lib/module/RNRenderer.js +3 -3
- package/lib/module/RNRenderer.js.map +1 -1
- package/lib/module/RNRenderer.native.js +4 -0
- package/lib/module/RNRenderer.native.js.map +1 -0
- package/lib/module/components/GestureComponents.js +18 -80
- package/lib/module/components/GestureComponents.js.map +1 -1
- package/lib/module/components/GestureComponents.native.js +90 -0
- package/lib/module/components/GestureComponents.native.js.map +1 -0
- package/lib/module/components/GestureHandlerButton.js +8 -2
- package/lib/module/components/GestureHandlerButton.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.native.js +3 -0
- package/lib/module/components/GestureHandlerButton.native.js.map +1 -0
- package/lib/module/components/GestureHandlerRootView.js +0 -5
- package/lib/module/components/GestureHandlerRootView.js.map +1 -1
- package/lib/module/components/{GestureHandlerRootView.web.js → GestureHandlerRootView.native.js} +6 -1
- package/lib/module/components/GestureHandlerRootView.native.js.map +1 -0
- package/lib/module/getReactNativeVersion.js +1 -7
- package/lib/module/getReactNativeVersion.js.map +1 -1
- package/lib/module/getReactNativeVersion.native.js +10 -0
- package/lib/module/getReactNativeVersion.native.js.map +1 -0
- package/lib/module/getShadowNodeFromRef.js +4 -33
- package/lib/module/getShadowNodeFromRef.js.map +1 -1
- package/lib/module/getShadowNodeFromRef.native.js +37 -0
- package/lib/module/getShadowNodeFromRef.native.js.map +1 -0
- package/lib/module/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/handlers/PressabilityDebugView.js +4 -2
- package/lib/module/handlers/PressabilityDebugView.js.map +1 -1
- package/lib/module/handlers/PressabilityDebugView.native.js +3 -0
- package/lib/module/handlers/PressabilityDebugView.native.js.map +1 -0
- package/lib/module/handlers/createHandler.js +9 -3
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/customDirectEventTypes.js +4 -2
- package/lib/module/handlers/customDirectEventTypes.js.map +1 -1
- package/lib/module/handlers/customDirectEventTypes.native.js +3 -0
- package/lib/module/handlers/customDirectEventTypes.native.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector.js +15 -0
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/module/handlers/gestures/flingGesture.js +13 -0
- package/lib/module/handlers/gestures/flingGesture.js.map +1 -1
- package/lib/module/handlers/gestures/forceTouchGesture.js +17 -0
- package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/module/handlers/gestures/gesture.js +135 -0
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/handlers/gestures/gestureObjects.js +67 -0
- package/lib/module/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.web.js +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.web.js.map +1 -1
- package/lib/module/handlers/gestures/hoverGesture.js +1 -1
- package/lib/module/handlers/gestures/hoverGesture.js.map +1 -1
- package/lib/module/handlers/gestures/longPressGesture.js +12 -0
- package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/module/handlers/gestures/nativeGesture.js +10 -0
- package/lib/module/handlers/gestures/nativeGesture.js.map +1 -1
- package/lib/module/handlers/gestures/panGesture.js +76 -0
- package/lib/module/handlers/gestures/panGesture.js.map +1 -1
- package/lib/module/handlers/gestures/tapGesture.js +42 -0
- package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/module/utils.js +5 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +7 -7
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +3 -1
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/interfaces.js.map +1 -1
- package/lib/typescript/RNGestureHandlerModule.d.ts +15 -2
- package/lib/typescript/RNGestureHandlerModule.native.d.ts +2 -0
- package/lib/typescript/RNRenderer.d.ts +3 -1
- package/lib/typescript/RNRenderer.native.d.ts +1 -0
- package/lib/typescript/components/GestureComponents.d.ts +7 -21
- package/lib/typescript/components/GestureComponents.native.d.ts +22 -0
- package/lib/typescript/components/GestureHandlerButton.d.ts +3 -3
- package/lib/typescript/components/GestureHandlerButton.native.d.ts +4 -0
- package/lib/typescript/getReactNativeVersion.d.ts +1 -4
- package/lib/typescript/getReactNativeVersion.native.d.ts +4 -0
- package/lib/typescript/getShadowNodeFromRef.d.ts +1 -1
- package/lib/typescript/getShadowNodeFromRef.native.d.ts +1 -0
- package/lib/typescript/handlers/PanGestureHandler.d.ts +4 -4
- package/lib/typescript/handlers/PressabilityDebugView.d.ts +1 -1
- package/lib/typescript/handlers/PressabilityDebugView.native.d.ts +1 -0
- package/lib/typescript/handlers/customDirectEventTypes.d.ts +2 -1
- package/lib/typescript/handlers/customDirectEventTypes.native.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts +36 -0
- package/lib/typescript/handlers/gestures/flingGesture.d.ts +11 -0
- package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +14 -0
- package/lib/typescript/handlers/gestures/gesture.d.ts +113 -0
- package/lib/typescript/handlers/gestures/gestureObjects.d.ts +57 -0
- package/lib/typescript/handlers/gestures/hoverGesture.d.ts +1 -1
- package/lib/typescript/handlers/gestures/longPressGesture.d.ts +10 -0
- package/lib/typescript/handlers/gestures/nativeGesture.d.ts +8 -0
- package/lib/typescript/handlers/gestures/panGesture.d.ts +67 -4
- package/lib/typescript/handlers/gestures/tapGesture.d.ts +35 -0
- package/lib/typescript/web/handlers/GestureHandler.d.ts +2 -2
- package/lib/typescript/web/handlers/IGestureHandler.d.ts +1 -1
- package/lib/typescript/web/interfaces.d.ts +1 -0
- package/package.json +3 -2
- package/src/RNGestureHandlerModule.native.ts +5 -0
- package/src/RNGestureHandlerModule.ts +104 -4
- package/src/RNRenderer.native.ts +3 -0
- package/src/RNRenderer.ts +3 -3
- package/src/components/GestureComponents.native.tsx +148 -0
- package/src/components/GestureComponents.tsx +24 -131
- package/src/components/GestureHandlerButton.native.tsx +5 -0
- package/src/components/GestureHandlerButton.tsx +5 -4
- package/src/components/{GestureHandlerRootView.web.tsx → GestureHandlerRootView.native.tsx} +6 -0
- package/src/components/GestureHandlerRootView.tsx +0 -6
- package/src/getReactNativeVersion.native.ts +11 -0
- package/src/getReactNativeVersion.ts +1 -9
- package/src/getShadowNodeFromRef.native.ts +44 -0
- package/src/getShadowNodeFromRef.ts +4 -41
- package/src/handlers/PanGestureHandler.ts +8 -4
- package/src/handlers/PressabilityDebugView.native.tsx +2 -0
- package/src/handlers/PressabilityDebugView.tsx +4 -2
- package/src/handlers/createHandler.tsx +14 -10
- package/src/handlers/customDirectEventTypes.native.ts +2 -0
- package/src/handlers/customDirectEventTypes.ts +5 -2
- package/src/handlers/gestures/GestureDetector.tsx +47 -4
- package/src/handlers/gestures/flingGesture.ts +11 -0
- package/src/handlers/gestures/forceTouchGesture.ts +14 -0
- package/src/handlers/gestures/gesture.ts +113 -0
- package/src/handlers/gestures/gestureObjects.ts +57 -0
- package/src/handlers/gestures/gestureStateManager.web.ts +1 -1
- package/src/handlers/gestures/hoverGesture.ts +1 -1
- package/src/handlers/gestures/longPressGesture.ts +10 -0
- package/src/handlers/gestures/nativeGesture.ts +8 -0
- package/src/handlers/gestures/panGesture.ts +75 -4
- package/src/handlers/gestures/tapGesture.ts +35 -0
- package/src/utils.ts +9 -2
- package/src/web/handlers/GestureHandler.ts +9 -9
- package/src/web/handlers/IGestureHandler.ts +1 -1
- package/src/web/handlers/PanGestureHandler.ts +4 -0
- package/src/web/interfaces.ts +1 -0
- package/lib/commonjs/RNGestureHandlerModule.web.js +0 -109
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +0 -1
- package/lib/commonjs/RNRenderer.web.js +0 -11
- package/lib/commonjs/RNRenderer.web.js.map +0 -1
- package/lib/commonjs/components/GestureComponents.web.js +0 -52
- package/lib/commonjs/components/GestureComponents.web.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerButton.web.js +0 -24
- package/lib/commonjs/components/GestureHandlerButton.web.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +0 -1
- package/lib/commonjs/getReactNativeVersion.web.js +0 -11
- package/lib/commonjs/getReactNativeVersion.web.js.map +0 -1
- package/lib/commonjs/getShadowNodeFromRef.web.js +0 -15
- package/lib/commonjs/getShadowNodeFromRef.web.js.map +0 -1
- package/lib/commonjs/handlers/PressabilityDebugView.web.js +0 -12
- package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +0 -1
- package/lib/commonjs/handlers/customDirectEventTypes.web.js +0 -11
- package/lib/commonjs/handlers/customDirectEventTypes.web.js.map +0 -1
- package/lib/module/RNGestureHandlerModule.web.js +0 -85
- package/lib/module/RNGestureHandlerModule.web.js.map +0 -1
- package/lib/module/RNRenderer.web.js +0 -4
- package/lib/module/RNRenderer.web.js.map +0 -1
- package/lib/module/components/GestureComponents.web.js +0 -28
- package/lib/module/components/GestureComponents.web.js.map +0 -1
- package/lib/module/components/GestureHandlerButton.web.js +0 -9
- package/lib/module/components/GestureHandlerButton.web.js.map +0 -1
- package/lib/module/components/GestureHandlerRootView.web.js.map +0 -1
- package/lib/module/getReactNativeVersion.web.js +0 -4
- package/lib/module/getReactNativeVersion.web.js.map +0 -1
- package/lib/module/getShadowNodeFromRef.web.js +0 -8
- package/lib/module/getShadowNodeFromRef.web.js.map +0 -1
- package/lib/module/handlers/PressabilityDebugView.web.js +0 -5
- package/lib/module/handlers/PressabilityDebugView.web.js.map +0 -1
- package/lib/module/handlers/customDirectEventTypes.web.js +0 -5
- package/lib/module/handlers/customDirectEventTypes.web.js.map +0 -1
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +0 -15
- package/lib/typescript/RNRenderer.web.d.ts +0 -3
- package/lib/typescript/components/GestureComponents.web.d.ts +0 -8
- package/lib/typescript/components/GestureHandlerButton.web.d.ts +0 -4
- package/lib/typescript/getReactNativeVersion.web.d.ts +0 -1
- package/lib/typescript/getShadowNodeFromRef.web.d.ts +0 -1
- package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +0 -1
- package/lib/typescript/handlers/customDirectEventTypes.web.d.ts +0 -2
- package/src/RNGestureHandlerModule.web.ts +0 -105
- package/src/RNRenderer.web.ts +0 -3
- package/src/components/GestureComponents.web.tsx +0 -41
- package/src/components/GestureHandlerButton.web.tsx +0 -6
- package/src/getReactNativeVersion.web.ts +0 -3
- package/src/getShadowNodeFromRef.web.ts +0 -7
- package/src/handlers/PressabilityDebugView.web.tsx +0 -4
- package/src/handlers/customDirectEventTypes.web.ts +0 -5
- /package/lib/typescript/components/{GestureHandlerRootView.web.d.ts → GestureHandlerRootView.native.d.ts} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["GestureDetector.tsx"],"names":["React","useContext","useEffect","useRef","useState","BaseGesture","CALLBACK_TYPE","Reanimated","registerHandler","unregisterHandler","RNGestureHandlerModule","baseGestureHandlerWithMonitorProps","filterConfig","findNodeHandle","scheduleFlushOperations","GestureStateManager","flingGestureHandlerProps","forceTouchGestureHandlerProps","longPressGestureHandlerProps","panGestureHandlerProps","panGestureHandlerCustomNativeProps","tapGestureHandlerProps","hoverGestureHandlerProps","State","TouchEventType","ActionType","isFabric","isJestEnv","tagMessage","getReactNativeVersion","getShadowNodeFromRef","Platform","onGestureHandlerEvent","RNRenderer","isNewWebImplementationEnabled","nativeViewGestureHandlerProps","GestureHandlerRootViewContext","ghQueueMicrotask","ALLOWED_PROPS","convertToHandlerTag","ref","handlerTag","current","extractValidHandlerTags","interactionGroup","map","filter","tag","dropHandlers","preparedGesture","handler","config","dropGestureHandler","testId","checkGestureCallbacksForWorklets","gesture","runOnJS","areSomeNotWorklets","handlers","isWorklet","includes","areSomeWorklets","console","error","attachHandlers","gestureConfig","viewTag","webEventHandlersRef","mountedRef","firstExecution","initialize","prepare","createGestureHandler","handlerName","requireToFail","simultaneousWith","blocksHandlers","updateGestureHandler","simultaneousHandlers","waitFor","actionType","shouldUseReanimated","REANIMATED_WORKLET","JS_FUNCTION_NEW_API","OS","attachGestureHandler","JS_FUNCTION_OLD_API","animatedHandlers","isAnimatedGesture","g","value","updateHandlers","i","length","previousHandlersValue","newHandlersValue","shouldUpdateSharedValue","gestureId","needsToReattach","isStateChangeEvent","event","oldState","isTouchEvent","eventType","getHandler","type","BEGAN","onBegin","START","onStart","UPDATE","onUpdate","CHANGE","onChange","END","onEnd","FINALIZE","onFinalize","TOUCHES_DOWN","onTouchesDown","TOUCHES_MOVE","onTouchesMove","TOUCHES_UP","onTouchesUp","TOUCHES_CANCELLED","onTouchesCancelled","touchEventTypeToCallbackType","UNDEFINED","runWorklet","args","warn","useAnimatedGesture","needsRebuild","sharedHandlersCallbacks","useSharedValue","lastUpdateEvent","stateControllers","callback","currentCallback","UNDETERMINED","state","ACTIVE","undefined","FAILED","CANCELLED","create","changeEventCalculator","useEvent","animatedEventHandler","validateDetectorChildren","__DEV__","REACT_NATIVE_VERSION","wrapType","minor","major","_reactInternals","elementType","_reactInternalFiber","instance","findHostInstance_DEPRECATED","_internalFiberInstanceHandleDEV","sibling","Error","return","applyUserSelectProp","userSelect","toGestureArray","applyEnableContextMenuProp","enableContextMenu","applyTouchActionProp","touchAction","GestureDetector","props","rootViewContext","useReanimatedHook","some","firstRender","viewRef","previousViewTag","forceReattach","e","nativeEvent","onGestureHandlerStateChange","renderState","setRenderState","forceRender","onHandlersUpdate","skipConfigUpdate","needsToRebuildReanimatedEvent","refFunction","global","isFormsStackingContext","node","children","Wrap","Component","render","child","Children","only","cloneElement","collapsable","AnimatedWrap","default","createAnimatedComponent"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,SAA5B,EAAuCC,MAAvC,EAA+CC,QAA/C,QAA+D,OAA/D;AACA,SAGEC,WAHF,EAKEC,aALF,QAMO,WANP;AAOA,SAASC,UAAT,QAAwC,qBAAxC;AACA,SAASC,eAAT,EAA0BC,iBAA1B,QAAmD,qBAAnD;AACA,OAAOC,sBAAP,MAAmC,8BAAnC;AACA,SACEC,kCADF,EAEEC,YAFF,EAGEC,cAHF,EAQEC,uBARF,QAWO,yBAXP;AAYA,SACEC,mBADF,QAGO,uBAHP;AAIA,SAASC,wBAAT,QAAyC,wBAAzC;AACA,SAASC,6BAAT,QAA8C,6BAA9C;AACA,SAASC,4BAAT,QAA6C,4BAA7C;AACA,SACEC,sBADF,EAEEC,kCAFF,QAGO,sBAHP;AAIA,SAASC,sBAAT,QAAuC,sBAAvC;AACA,SAASC,wBAAT,QAAyC,gBAAzC;AACA,SAASC,KAAT,QAAsB,aAAtB;AACA,SAASC,cAAT,QAA+B,sBAA/B;AAEA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,QAAT,EAAmBC,SAAnB,EAA8BC,UAA9B,QAAgD,aAAhD;AACA,SAASC,qBAAT,QAAsC,6BAAtC;AACA,SAASC,oBAAT,QAAqC,4BAArC;AACA,SAASC,QAAT,QAAyB,cAAzB;AAEA,SAASC,qBAAT,QAAsC,iBAAtC;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,6BAAT,QAA8C,kCAA9C;AACA,SAASC,6BAAT,QAA8C,6BAA9C;AACA,OAAOC,6BAAP,MAA0C,qCAA1C;AACA,SAASC,gBAAT,QAAiC,wBAAjC;AAMA,MAAMC,aAAa,GAAG,CACpB,GAAG3B,kCADiB,EAEpB,GAAGU,sBAFiB,EAGpB,GAAGF,sBAHiB,EAIpB,GAAGC,kCAJiB,EAKpB,GAAGF,4BALiB,EAM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EAAuB;AACrB,wBACE,oBAAC,YAAD;AACE,MAAA,GAAG,EAAEe,WADP;AAEE,MAAA,qBAAqB,EAAE5I,eAAe,CAACmG;AAFzC,OAGGwB,KAAK,CAACqB,QAHT,CADF;AAOD,GARD,MAQO;AACL,wBAAO,oBAAC,IAAD;AAAM,MAAA,GAAG,EAAEJ;AAAX,OAAyBjB,KAAK,CAACqB,QAA/B,CAAP;AACD;AACF,CApLM;;AAsLP,MAAMC,IAAN,SAAmBlM,KAAK,CAACmM,SAAzB,CAIG;AACDC,EAAAA,MAAM,GAAG;AACP,QAAI;AACF;AACA;AACA;AACA;AACA;AACA,YAAMC,KAAU,GAAGrM,KAAK,CAACsM,QAAN,CAAeC,IAAf,CAAoB,KAAK3B,KAAL,CAAWqB,QAA/B,CAAnB;AACA,0BAAOjM,KAAK,CAACwM,YAAN,CACLH,KADK,EAEL;AAAEI,QAAAA,WAAW,EAAE;AAAf,OAFK,EAGL;AACAJ,MAAAA,KAAK,CAACzB,KAAN,CAAYqB,QAJP,CAAP;AAMD,KAbD,CAaE,OAAOb,CAAP,EAAU;AACV,YAAM,IAAIlB,KAAJ,CACJtI,UAAU,CACP,2KADO,CADN,CAAN;AAKD;AACF;;AAtBA;;AAyBH,MAAM8K,YAAY,4BAAGnM,UAAH,aAAGA,UAAH,8CAAGA,UAAU,CAAEoM,OAAf,wDAAG,oBAAqBC,uBAArB,CAA6CV,IAA7C,CAAH,yEAAyDA,IAA3E","sourcesContent":["import React, { useContext, useEffect, useRef, useState } from 'react';\nimport {\n GestureType,\n HandlerCallbacks,\n BaseGesture,\n GestureRef,\n CALLBACK_TYPE,\n} from './gesture';\nimport { Reanimated, SharedValue } from './reanimatedWrapper';\nimport { registerHandler, unregisterHandler } from '../handlersRegistry';\nimport RNGestureHandlerModule from '../../RNGestureHandlerModule';\nimport {\n baseGestureHandlerWithMonitorProps,\n filterConfig,\n findNodeHandle,\n GestureTouchEvent,\n GestureUpdateEvent,\n GestureStateChangeEvent,\n HandlerStateChangeEvent,\n scheduleFlushOperations,\n UserSelect,\n TouchAction,\n} from '../gestureHandlerCommon';\nimport {\n GestureStateManager,\n GestureStateManagerType,\n} from './gestureStateManager';\nimport { flingGestureHandlerProps } from '../FlingGestureHandler';\nimport { forceTouchGestureHandlerProps } from '../ForceTouchGestureHandler';\nimport { longPressGestureHandlerProps } from '../LongPressGestureHandler';\nimport {\n panGestureHandlerProps,\n panGestureHandlerCustomNativeProps,\n} from '../PanGestureHandler';\nimport { tapGestureHandlerProps } from '../TapGestureHandler';\nimport { hoverGestureHandlerProps } from './hoverGesture';\nimport { State } from '../../State';\nimport { TouchEventType } from '../../TouchEventType';\nimport { ComposedGesture } from './gestureComposition';\nimport { ActionType } from '../../ActionType';\nimport { isFabric, isJestEnv, tagMessage } from '../../utils';\nimport { getReactNativeVersion } from '../../getReactNativeVersion';\nimport { getShadowNodeFromRef } from '../../getShadowNodeFromRef';\nimport { Platform } from 'react-native';\nimport type RNGestureHandlerModuleWeb from '../../RNGestureHandlerModule.web';\nimport { onGestureHandlerEvent } from './eventReceiver';\nimport { RNRenderer } from '../../RNRenderer';\nimport { isNewWebImplementationEnabled } from '../../EnableNewWebImplementation';\nimport { nativeViewGestureHandlerProps } from '../NativeViewGestureHandler';\nimport GestureHandlerRootViewContext from '../../GestureHandlerRootViewContext';\nimport { ghQueueMicrotask } from '../../ghQueueMicrotask';\n\ndeclare const global: {\n isFormsStackingContext: (node: unknown) => boolean | null; // JSI function\n};\n\nconst ALLOWED_PROPS = [\n ...baseGestureHandlerWithMonitorProps,\n ...tapGestureHandlerProps,\n ...panGestureHandlerProps,\n ...panGestureHandlerCustomNativeProps,\n ...longPressGestureHandlerProps,\n ...forceTouchGestureHandlerProps,\n ...flingGestureHandlerProps,\n ...hoverGestureHandlerProps,\n ...nativeViewGestureHandlerProps,\n];\n\nexport type GestureConfigReference = {\n config: GestureType[];\n animatedEventHandler: unknown;\n animatedHandlers: SharedValue<\n HandlerCallbacks<Record<string, unknown>>[] | null\n > | null;\n firstExecution: boolean;\n useReanimatedHook: boolean;\n};\n\nfunction convertToHandlerTag(ref: GestureRef): number {\n if (typeof ref === 'number') {\n return ref;\n } else if (ref instanceof BaseGesture) {\n return ref.handlerTag;\n } else {\n // @ts-ignore in this case it should be a ref either to gesture object or\n // a gesture handler component, in both cases handlerTag property exists\n return ref.current?.handlerTag ?? -1;\n }\n}\n\nfunction extractValidHandlerTags(interactionGroup: GestureRef[] | undefined) {\n return (\n interactionGroup?.map(convertToHandlerTag)?.filter((tag) => tag > 0) ?? []\n );\n}\n\nfunction dropHandlers(preparedGesture: GestureConfigReference) {\n for (const handler of preparedGesture.config) {\n RNGestureHandlerModule.dropGestureHandler(handler.handlerTag);\n\n unregisterHandler(handler.handlerTag, handler.config.testId);\n }\n\n scheduleFlushOperations();\n}\n\nfunction checkGestureCallbacksForWorklets(gesture: GestureType) {\n // if a gesture is explicitly marked to run on the JS thread there is no need to check\n // if callbacks are worklets as the user is aware they will be ran on the JS thread\n if (gesture.config.runOnJS) {\n return;\n }\n\n const areSomeNotWorklets = gesture.handlers.isWorklet.includes(false);\n const areSomeWorklets = gesture.handlers.isWorklet.includes(true);\n\n // if some of the callbacks are worklets and some are not, and the gesture is not\n // explicitly marked with `.runOnJS(true)` show an error\n if (areSomeNotWorklets && areSomeWorklets) {\n console.error(\n tagMessage(\n `Some of the callbacks in the gesture are worklets and some are not. Either make sure that all calbacks are marked as 'worklet' if you wish to run them on the UI thread or use '.runOnJS(true)' modifier on the gesture explicitly to run all callbacks on the JS thread.`\n )\n );\n }\n}\n\ninterface WebEventHandler {\n onGestureHandlerEvent: (event: HandlerStateChangeEvent<unknown>) => void;\n onGestureHandlerStateChange?: (\n event: HandlerStateChangeEvent<unknown>\n ) => void;\n}\n\ninterface AttachHandlersConfig {\n preparedGesture: GestureConfigReference;\n gestureConfig: ComposedGesture | GestureType;\n gesture: GestureType[];\n viewTag: number;\n webEventHandlersRef: React.RefObject<WebEventHandler>;\n mountedRef: React.RefObject<boolean>;\n}\n\nfunction attachHandlers({\n preparedGesture,\n gestureConfig,\n gesture,\n viewTag,\n webEventHandlersRef,\n mountedRef,\n}: AttachHandlersConfig) {\n if (!preparedGesture.firstExecution) {\n gestureConfig.initialize();\n } else {\n preparedGesture.firstExecution = false;\n }\n\n // use queueMicrotask to extract handlerTags, because all refs should be initialized\n // when it's ran\n ghQueueMicrotask(() => {\n if (!mountedRef.current) {\n return;\n }\n gestureConfig.prepare();\n });\n\n for (const handler of gesture) {\n checkGestureCallbacksForWorklets(handler);\n RNGestureHandlerModule.createGestureHandler(\n handler.handlerName,\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS)\n );\n\n registerHandler(handler.handlerTag, handler, handler.config.testId);\n }\n\n // use queueMicrotask to extract handlerTags, because all refs should be initialized\n // when it's ran\n ghQueueMicrotask(() => {\n if (!mountedRef.current) {\n return;\n }\n for (const handler of gesture) {\n let requireToFail: number[] = [];\n if (handler.config.requireToFail) {\n requireToFail = extractValidHandlerTags(handler.config.requireToFail);\n }\n\n let simultaneousWith: number[] = [];\n if (handler.config.simultaneousWith) {\n simultaneousWith = extractValidHandlerTags(\n handler.config.simultaneousWith\n );\n }\n\n let blocksHandlers: number[] = [];\n if (handler.config.blocksHandlers) {\n blocksHandlers = extractValidHandlerTags(handler.config.blocksHandlers);\n }\n\n RNGestureHandlerModule.updateGestureHandler(\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS, {\n simultaneousHandlers: simultaneousWith,\n waitFor: requireToFail,\n blocksHandlers: blocksHandlers,\n })\n );\n }\n\n scheduleFlushOperations();\n });\n\n preparedGesture.config = gesture;\n\n for (const gesture of preparedGesture.config) {\n const actionType = gesture.shouldUseReanimated\n ? ActionType.REANIMATED_WORKLET\n : ActionType.JS_FUNCTION_NEW_API;\n\n if (Platform.OS === 'web') {\n (\n RNGestureHandlerModule.attachGestureHandler as typeof RNGestureHandlerModuleWeb.attachGestureHandler\n )(\n gesture.handlerTag,\n viewTag,\n ActionType.JS_FUNCTION_OLD_API, // ignored on web\n webEventHandlersRef\n );\n } else {\n RNGestureHandlerModule.attachGestureHandler(\n gesture.handlerTag,\n viewTag,\n actionType\n );\n }\n }\n\n if (preparedGesture.animatedHandlers) {\n const isAnimatedGesture = (g: GestureType) => g.shouldUseReanimated;\n\n preparedGesture.animatedHandlers.value = gesture\n .filter(isAnimatedGesture)\n .map((g) => g.handlers) as unknown as HandlerCallbacks<\n Record<string, unknown>\n >[];\n }\n}\n\nfunction updateHandlers(\n preparedGesture: GestureConfigReference,\n gestureConfig: ComposedGesture | GestureType,\n gesture: GestureType[],\n mountedRef: React.RefObject<boolean>\n) {\n gestureConfig.prepare();\n\n for (let i = 0; i < gesture.length; i++) {\n const handler = preparedGesture.config[i];\n checkGestureCallbacksForWorklets(handler);\n\n // only update handlerTag when it's actually different, it may be the same\n // if gesture config object is wrapped with useMemo\n if (gesture[i].handlerTag !== handler.handlerTag) {\n gesture[i].handlerTag = handler.handlerTag;\n gesture[i].handlers.handlerTag = handler.handlerTag;\n }\n }\n\n // use queueMicrotask to extract handlerTags, because when it's ran, all refs should be updated\n // and handlerTags in BaseGesture references should be updated in the loop above (we need to wait\n // in case of external relations)\n ghQueueMicrotask(() => {\n if (!mountedRef.current) {\n return;\n }\n for (let i = 0; i < gesture.length; i++) {\n const handler = preparedGesture.config[i];\n\n handler.config = gesture[i].config;\n handler.handlers = gesture[i].handlers;\n\n const requireToFail = extractValidHandlerTags(\n handler.config.requireToFail\n );\n\n const simultaneousWith = extractValidHandlerTags(\n handler.config.simultaneousWith\n );\n\n RNGestureHandlerModule.updateGestureHandler(\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS, {\n simultaneousHandlers: simultaneousWith,\n waitFor: requireToFail,\n })\n );\n\n registerHandler(handler.handlerTag, handler, handler.config.testId);\n }\n\n if (preparedGesture.animatedHandlers) {\n const previousHandlersValue =\n preparedGesture.animatedHandlers.value ?? [];\n const newHandlersValue = preparedGesture.config\n .filter((g) => g.shouldUseReanimated) // ignore gestures that shouldn't run on UI\n .map((g) => g.handlers) as unknown as HandlerCallbacks<\n Record<string, unknown>\n >[];\n\n // if amount of gesture configs changes, we need to update the callbacks in shared value\n let shouldUpdateSharedValue =\n previousHandlersValue.length !== newHandlersValue.length;\n\n if (!shouldUpdateSharedValue) {\n // if the amount is the same, we need to check if any of the configs inside has changed\n for (let i = 0; i < newHandlersValue.length; i++) {\n if (\n // we can use the `gestureId` prop as it's unique for every config instance\n newHandlersValue[i].gestureId !== previousHandlersValue[i].gestureId\n ) {\n shouldUpdateSharedValue = true;\n break;\n }\n }\n }\n\n if (shouldUpdateSharedValue) {\n preparedGesture.animatedHandlers.value = newHandlersValue;\n }\n }\n\n scheduleFlushOperations();\n });\n}\n\nfunction needsToReattach(\n preparedGesture: GestureConfigReference,\n gesture: GestureType[]\n) {\n if (gesture.length !== preparedGesture.config.length) {\n return true;\n }\n for (let i = 0; i < gesture.length; i++) {\n if (\n gesture[i].handlerName !== preparedGesture.config[i].handlerName ||\n gesture[i].shouldUseReanimated !==\n preparedGesture.config[i].shouldUseReanimated\n ) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction isStateChangeEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n): event is GestureStateChangeEvent {\n 'worklet';\n // @ts-ignore Yes, the oldState prop is missing on GestureTouchEvent, that's the point\n return event.oldState != null;\n}\n\nfunction isTouchEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n): event is GestureTouchEvent {\n 'worklet';\n return event.eventType != null;\n}\n\nfunction getHandler(\n type: CALLBACK_TYPE,\n gesture: HandlerCallbacks<Record<string, unknown>>\n) {\n 'worklet';\n switch (type) {\n case CALLBACK_TYPE.BEGAN:\n return gesture.onBegin;\n case CALLBACK_TYPE.START:\n return gesture.onStart;\n case CALLBACK_TYPE.UPDATE:\n return gesture.onUpdate;\n case CALLBACK_TYPE.CHANGE:\n return gesture.onChange;\n case CALLBACK_TYPE.END:\n return gesture.onEnd;\n case CALLBACK_TYPE.FINALIZE:\n return gesture.onFinalize;\n case CALLBACK_TYPE.TOUCHES_DOWN:\n return gesture.onTouchesDown;\n case CALLBACK_TYPE.TOUCHES_MOVE:\n return gesture.onTouchesMove;\n case CALLBACK_TYPE.TOUCHES_UP:\n return gesture.onTouchesUp;\n case CALLBACK_TYPE.TOUCHES_CANCELLED:\n return gesture.onTouchesCancelled;\n }\n}\n\nfunction touchEventTypeToCallbackType(\n eventType: TouchEventType\n): CALLBACK_TYPE {\n 'worklet';\n switch (eventType) {\n case TouchEventType.TOUCHES_DOWN:\n return CALLBACK_TYPE.TOUCHES_DOWN;\n case TouchEventType.TOUCHES_MOVE:\n return CALLBACK_TYPE.TOUCHES_MOVE;\n case TouchEventType.TOUCHES_UP:\n return CALLBACK_TYPE.TOUCHES_UP;\n case TouchEventType.TOUCHES_CANCELLED:\n return CALLBACK_TYPE.TOUCHES_CANCELLED;\n }\n return CALLBACK_TYPE.UNDEFINED;\n}\n\nfunction runWorklet(\n type: CALLBACK_TYPE,\n gesture: HandlerCallbacks<Record<string, unknown>>,\n event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent,\n ...args: any[]\n) {\n 'worklet';\n const handler = getHandler(type, gesture);\n if (gesture.isWorklet[type]) {\n // @ts-ignore Logic below makes sure the correct event is send to the\n // correct handler.\n handler?.(event, ...args);\n } else if (handler) {\n console.warn(tagMessage('Animated gesture callback must be a worklet'));\n }\n}\n\nfunction useAnimatedGesture(\n preparedGesture: GestureConfigReference,\n needsRebuild: boolean\n) {\n if (!Reanimated) {\n return;\n }\n\n // Hooks are called conditionally, but the condition is whether the\n // react-native-reanimated is installed, which shouldn't change while running\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const sharedHandlersCallbacks = Reanimated.useSharedValue<\n HandlerCallbacks<Record<string, unknown>>[] | null\n >(null);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const lastUpdateEvent = Reanimated.useSharedValue<\n (GestureUpdateEvent | undefined)[]\n >([]);\n\n // not every gesture needs a state controller, init them lazily\n const stateControllers: GestureStateManagerType[] = [];\n\n const callback = (\n event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent\n ) => {\n 'worklet';\n\n const currentCallback = sharedHandlersCallbacks.value;\n if (!currentCallback) {\n return;\n }\n\n for (let i = 0; i < currentCallback.length; i++) {\n const gesture = currentCallback[i];\n\n if (event.handlerTag === gesture.handlerTag) {\n if (isStateChangeEvent(event)) {\n if (\n event.oldState === State.UNDETERMINED &&\n event.state === State.BEGAN\n ) {\n runWorklet(CALLBACK_TYPE.BEGAN, gesture, event);\n } else if (\n (event.oldState === State.BEGAN ||\n event.oldState === State.UNDETERMINED) &&\n event.state === State.ACTIVE\n ) {\n runWorklet(CALLBACK_TYPE.START, gesture, event);\n lastUpdateEvent.value[gesture.handlerTag] = undefined;\n } else if (\n event.oldState !== event.state &&\n event.state === State.END\n ) {\n if (event.oldState === State.ACTIVE) {\n runWorklet(CALLBACK_TYPE.END, gesture, event, true);\n }\n runWorklet(CALLBACK_TYPE.FINALIZE, gesture, event, true);\n } else if (\n (event.state === State.FAILED || event.state === State.CANCELLED) &&\n event.state !== event.oldState\n ) {\n if (event.oldState === State.ACTIVE) {\n runWorklet(CALLBACK_TYPE.END, gesture, event, false);\n }\n runWorklet(CALLBACK_TYPE.FINALIZE, gesture, event, false);\n }\n } else if (isTouchEvent(event)) {\n if (!stateControllers[i]) {\n stateControllers[i] = GestureStateManager.create(event.handlerTag);\n }\n\n if (event.eventType !== TouchEventType.UNDETERMINED) {\n runWorklet(\n touchEventTypeToCallbackType(event.eventType),\n gesture,\n event,\n stateControllers[i]\n );\n }\n } else {\n runWorklet(CALLBACK_TYPE.UPDATE, gesture, event);\n\n if (gesture.onChange && gesture.changeEventCalculator) {\n runWorklet(\n CALLBACK_TYPE.CHANGE,\n gesture,\n gesture.changeEventCalculator?.(\n event,\n lastUpdateEvent.value[gesture.handlerTag]\n )\n );\n\n lastUpdateEvent.value[gesture.handlerTag] = event;\n }\n }\n }\n }\n };\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const event = Reanimated.useEvent(\n callback,\n ['onGestureHandlerStateChange', 'onGestureHandlerEvent'],\n needsRebuild\n );\n\n preparedGesture.animatedEventHandler = event;\n preparedGesture.animatedHandlers = sharedHandlersCallbacks;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction validateDetectorChildren(ref: any) {\n // finds the first native view under the Wrap component and traverses the fiber tree upwards\n // to check whether there is more than one native view as a pseudo-direct child of GestureDetector\n // i.e. this is not ok:\n // Wrap\n // |\n // / \\\n // / \\\n // / \\\n // / \\\n // NativeView NativeView\n //\n // but this is fine:\n // Wrap\n // |\n // NativeView\n // |\n // / \\\n // / \\\n // / \\\n // / \\\n // NativeView NativeView\n if (__DEV__ && Platform.OS !== 'web') {\n const REACT_NATIVE_VERSION = getReactNativeVersion();\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const wrapType =\n REACT_NATIVE_VERSION.minor > 63 || REACT_NATIVE_VERSION.major > 0\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ref._reactInternals.elementType\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ref._reactInternalFiber.elementType;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let instance =\n RNRenderer.findHostInstance_DEPRECATED(\n ref\n )._internalFiberInstanceHandleDEV;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n while (instance && instance.elementType !== wrapType) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (instance.sibling) {\n throw new Error(\n 'GestureDetector has more than one native view as its children. This can happen if you are using a custom component that renders multiple views, like React.Fragment. You should wrap content of GestureDetector with a <View> or <Animated.View>.'\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n instance = instance.return;\n }\n }\n}\n\nconst applyUserSelectProp = (\n userSelect: UserSelect,\n gesture: ComposedGesture | GestureType\n): void => {\n for (const g of gesture.toGestureArray()) {\n g.config.userSelect = userSelect;\n }\n};\n\nconst applyEnableContextMenuProp = (\n enableContextMenu: boolean,\n gesture: ComposedGesture | GestureType\n): void => {\n for (const g of gesture.toGestureArray()) {\n g.config.enableContextMenu = enableContextMenu;\n }\n};\n\nconst applyTouchActionProp = (\n touchAction: TouchAction,\n gesture: ComposedGesture | GestureType\n): void => {\n for (const g of gesture.toGestureArray()) {\n g.config.touchAction = touchAction;\n }\n};\n\ninterface GestureDetectorProps {\n gesture: ComposedGesture | GestureType;\n children?: React.ReactNode;\n userSelect?: UserSelect;\n enableContextMenu?: boolean;\n touchAction?: TouchAction;\n}\ninterface GestureDetectorState {\n firstRender: boolean;\n viewRef: React.Component | null;\n previousViewTag: number;\n forceReattach: boolean;\n}\nexport const GestureDetector = (props: GestureDetectorProps) => {\n const rootViewContext = useContext(GestureHandlerRootViewContext);\n if (__DEV__ && !rootViewContext && !isJestEnv() && Platform.OS !== 'web') {\n throw new Error(\n 'GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.'\n );\n }\n\n const gestureConfig = props.gesture;\n\n if (props.userSelect) {\n applyUserSelectProp(props.userSelect, gestureConfig);\n }\n\n if (props.enableContextMenu !== undefined) {\n applyEnableContextMenuProp(props.enableContextMenu, gestureConfig);\n }\n\n if (props.touchAction !== undefined) {\n applyTouchActionProp(props.touchAction, gestureConfig);\n }\n\n const gesture = gestureConfig.toGestureArray();\n const useReanimatedHook = gesture.some((g) => g.shouldUseReanimated);\n\n // store state in ref to prevent unnecessary renders\n const state = useRef<GestureDetectorState>({\n firstRender: true,\n viewRef: null,\n previousViewTag: -1,\n forceReattach: false,\n }).current;\n const mountedRef = useRef(false);\n const webEventHandlersRef = useRef<WebEventHandler>({\n onGestureHandlerEvent: (e: HandlerStateChangeEvent<unknown>) => {\n onGestureHandlerEvent(e.nativeEvent);\n },\n onGestureHandlerStateChange: isNewWebImplementationEnabled()\n ? (e: HandlerStateChangeEvent<unknown>) => {\n onGestureHandlerEvent(e.nativeEvent);\n }\n : undefined,\n });\n\n const [renderState, setRenderState] = useState(false);\n function forceRender() {\n setRenderState(!renderState);\n }\n\n const preparedGesture = React.useRef<GestureConfigReference>({\n config: gesture,\n animatedEventHandler: null,\n animatedHandlers: null,\n firstExecution: true,\n useReanimatedHook: useReanimatedHook,\n }).current;\n\n if (useReanimatedHook !== preparedGesture.useReanimatedHook) {\n throw new Error(\n tagMessage(\n 'You cannot change the thread the callbacks are ran on while the app is running'\n )\n );\n }\n\n function onHandlersUpdate(skipConfigUpdate?: boolean) {\n // if the underlying view has changed we need to reattach handlers to the new view\n const viewTag = findNodeHandle(state.viewRef) as number;\n const forceReattach = viewTag !== state.previousViewTag;\n\n if (forceReattach || needsToReattach(preparedGesture, gesture)) {\n validateDetectorChildren(state.viewRef);\n dropHandlers(preparedGesture);\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesture,\n webEventHandlersRef,\n viewTag,\n mountedRef,\n });\n\n state.previousViewTag = viewTag;\n state.forceReattach = forceReattach;\n if (forceReattach) {\n forceRender();\n }\n } else if (!skipConfigUpdate) {\n updateHandlers(preparedGesture, gestureConfig, gesture, mountedRef);\n }\n }\n\n // Reanimated event should be rebuilt only when gestures are reattached, otherwise\n // config update will be enough as all necessary items are stored in shared values anyway\n const needsToRebuildReanimatedEvent =\n preparedGesture.firstExecution ||\n needsToReattach(preparedGesture, gesture) ||\n state.forceReattach;\n\n state.forceReattach = false;\n\n if (preparedGesture.firstExecution) {\n gestureConfig.initialize();\n }\n\n if (useReanimatedHook) {\n // Whether animatedGesture or gesture is used shouldn't change while the app is running\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useAnimatedGesture(preparedGesture, needsToRebuildReanimatedEvent);\n }\n\n useEffect(() => {\n const viewTag = findNodeHandle(state.viewRef) as number;\n state.firstRender = true;\n mountedRef.current = true;\n\n validateDetectorChildren(state.viewRef);\n\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesture,\n webEventHandlersRef,\n viewTag,\n mountedRef,\n });\n\n return () => {\n mountedRef.current = false;\n dropHandlers(preparedGesture);\n };\n }, []);\n\n useEffect(() => {\n if (!state.firstRender) {\n onHandlersUpdate();\n } else {\n state.firstRender = false;\n }\n }, [props]);\n\n const refFunction = (ref: unknown) => {\n if (ref !== null) {\n // @ts-ignore Just setting the view ref\n state.viewRef = ref;\n\n // if it's the first render, also set the previousViewTag to prevent reattaching gestures when not needed\n if (state.previousViewTag === -1) {\n state.previousViewTag = findNodeHandle(state.viewRef) as number;\n }\n\n // pass true as `skipConfigUpdate`, here we only want to trigger the eventual reattaching of handlers\n // in case the view has changed, while config update would be handled be the `useEffect` above\n onHandlersUpdate(true);\n\n if (isFabric() && global.isFormsStackingContext) {\n const node = getShadowNodeFromRef(ref);\n if (global.isFormsStackingContext(node) === false) {\n console.error(\n tagMessage(\n 'GestureDetector has received a child that may get view-flattened. ' +\n '\\nTo prevent it from misbehaving you need to wrap the child with a `<View collapsable={false}>`.'\n )\n );\n }\n }\n }\n };\n\n if (useReanimatedHook) {\n return (\n <AnimatedWrap\n ref={refFunction}\n onGestureHandlerEvent={preparedGesture.animatedEventHandler}>\n {props.children}\n </AnimatedWrap>\n );\n } else {\n return <Wrap ref={refFunction}>{props.children}</Wrap>;\n }\n};\n\nclass Wrap extends React.Component<{\n onGestureHandlerEvent?: unknown;\n // implicit `children` prop has been removed in @types/react^18.0.0\n children?: React.ReactNode;\n}> {\n render() {\n try {\n // I don't think that fighting with types over such a simple function is worth it\n // The only thing it does is add 'collapsable: false' to the child component\n // to make sure it is in the native view hierarchy so the detector can find\n // correct viewTag to attach to.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const child: any = React.Children.only(this.props.children);\n return React.cloneElement(\n child,\n { collapsable: false },\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n child.props.children\n );\n } catch (e) {\n throw new Error(\n tagMessage(\n `GestureDetector got more than one view as a child. If you want the gesture to work on multiple views, wrap them with a common parent and attach the gesture to that view.`\n )\n );\n }\n }\n}\n\nconst AnimatedWrap = Reanimated?.default?.createAnimatedComponent(Wrap) ?? Wrap;\n"]}
|
1
|
+
{"version":3,"sources":["GestureDetector.tsx"],"names":["React","useContext","useEffect","useRef","useState","BaseGesture","CALLBACK_TYPE","Reanimated","registerHandler","unregisterHandler","RNGestureHandlerModule","baseGestureHandlerWithMonitorProps","filterConfig","findNodeHandle","scheduleFlushOperations","GestureStateManager","flingGestureHandlerProps","forceTouchGestureHandlerProps","longPressGestureHandlerProps","panGestureHandlerProps","panGestureHandlerCustomNativeProps","tapGestureHandlerProps","hoverGestureHandlerProps","State","TouchEventType","ActionType","isFabric","isJestEnv","tagMessage","getReactNativeVersion","getShadowNodeFromRef","Platform","onGestureHandlerEvent","RNRenderer","isNewWebImplementationEnabled","nativeViewGestureHandlerProps","GestureHandlerRootViewContext","ghQueueMicrotask","ALLOWED_PROPS","convertToHandlerTag","ref","handlerTag","current","extractValidHandlerTags","interactionGroup","map","filter","tag","dropHandlers","preparedGesture","handler","config","dropGestureHandler","testId","checkGestureCallbacksForWorklets","gesture","runOnJS","areSomeNotWorklets","handlers","isWorklet","includes","areSomeWorklets","console","error","attachHandlers","gestureConfig","viewTag","webEventHandlersRef","mountedRef","firstExecution","initialize","prepare","createGestureHandler","handlerName","requireToFail","simultaneousWith","blocksHandlers","updateGestureHandler","simultaneousHandlers","waitFor","actionType","shouldUseReanimated","REANIMATED_WORKLET","JS_FUNCTION_NEW_API","OS","attachGestureHandler","JS_FUNCTION_OLD_API","animatedHandlers","isAnimatedGesture","g","value","updateHandlers","i","length","previousHandlersValue","newHandlersValue","shouldUpdateSharedValue","gestureId","needsToReattach","isStateChangeEvent","event","oldState","isTouchEvent","eventType","getHandler","type","BEGAN","onBegin","START","onStart","UPDATE","onUpdate","CHANGE","onChange","END","onEnd","FINALIZE","onFinalize","TOUCHES_DOWN","onTouchesDown","TOUCHES_MOVE","onTouchesMove","TOUCHES_UP","onTouchesUp","TOUCHES_CANCELLED","onTouchesCancelled","touchEventTypeToCallbackType","UNDEFINED","runWorklet","args","warn","useAnimatedGesture","needsRebuild","sharedHandlersCallbacks","useSharedValue","lastUpdateEvent","stateControllers","callback","currentCallback","UNDETERMINED","state","ACTIVE","undefined","FAILED","CANCELLED","create","changeEventCalculator","useEvent","animatedEventHandler","validateDetectorChildren","__DEV__","REACT_NATIVE_VERSION","wrapType","minor","major","_reactInternals","elementType","_reactInternalFiber","instance","findHostInstance_DEPRECATED","_internalFiberInstanceHandleDEV","sibling","Error","return","applyUserSelectProp","userSelect","toGestureArray","applyEnableContextMenuProp","enableContextMenu","applyTouchActionProp","touchAction","GestureDetector","props","rootViewContext","useReanimatedHook","some","firstRender","viewRef","previousViewTag","forceReattach","e","nativeEvent","onGestureHandlerStateChange","renderState","setRenderState","forceRender","onHandlersUpdate","skipConfigUpdate","needsToRebuildReanimatedEvent","refFunction","global","isFormsStackingContext","node","children","Wrap","Component","render","child","Children","only","cloneElement","collapsable","AnimatedWrap","default","createAnimatedComponent"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,SAA5B,EAAuCC,MAAvC,EAA+CC,QAA/C,QAA+D,OAA/D;AACA,SAGEC,WAHF,EAKEC,aALF,QAMO,WANP;AAOA,SAASC,UAAT,QAAwC,qBAAxC;AACA,SAASC,eAAT,EAA0BC,iBAA1B,QAAmD,qBAAnD;AACA,OAAOC,sBAAP,MAAmC,8BAAnC;AACA,SACEC,kCADF,EAEEC,YAFF,EAGEC,cAHF,EAQEC,uBARF,QAWO,yBAXP;AAYA,SACEC,mBADF,QAGO,uBAHP;AAIA,SAASC,wBAAT,QAAyC,wBAAzC;AACA,SAASC,6BAAT,QAA8C,6BAA9C;AACA,SAASC,4BAAT,QAA6C,4BAA7C;AACA,SACEC,sBADF,EAEEC,kCAFF,QAGO,sBAHP;AAIA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A,0BAAOjM,KAAK,CAACwM,YAAN,CACLH,KADK,EAEL;AAAEI,QAAAA,WAAW,EAAE;AAAf,OAFK,EAGL;AACAJ,MAAAA,KAAK,CAACzB,KAAN,CAAYqB,QAJP,CAAP;AAMD,KAbD,CAaE,OAAOb,CAAP,EAAU;AACV,YAAM,IAAIlB,KAAJ,CACJtI,UAAU,CACP,2KADO,CADN,CAAN;AAKD;AACF;;AAtBA;;AAyBH,MAAM8K,YAAY,4BAAGnM,UAAH,aAAGA,UAAH,8CAAGA,UAAU,CAAEoM,OAAf,wDAAG,oBAAqBC,uBAArB,CAA6CV,IAA7C,CAAH,yEAAyDA,IAA3E","sourcesContent":["import React, { useContext, useEffect, useRef, useState } from 'react';\nimport {\n GestureType,\n HandlerCallbacks,\n BaseGesture,\n GestureRef,\n CALLBACK_TYPE,\n} from './gesture';\nimport { Reanimated, SharedValue } from './reanimatedWrapper';\nimport { registerHandler, unregisterHandler } from '../handlersRegistry';\nimport RNGestureHandlerModule from '../../RNGestureHandlerModule';\nimport {\n baseGestureHandlerWithMonitorProps,\n filterConfig,\n findNodeHandle,\n GestureTouchEvent,\n GestureUpdateEvent,\n GestureStateChangeEvent,\n HandlerStateChangeEvent,\n scheduleFlushOperations,\n UserSelect,\n TouchAction,\n} from '../gestureHandlerCommon';\nimport {\n GestureStateManager,\n GestureStateManagerType,\n} from './gestureStateManager';\nimport { flingGestureHandlerProps } from '../FlingGestureHandler';\nimport { forceTouchGestureHandlerProps } from '../ForceTouchGestureHandler';\nimport { longPressGestureHandlerProps } from '../LongPressGestureHandler';\nimport {\n panGestureHandlerProps,\n panGestureHandlerCustomNativeProps,\n} from '../PanGestureHandler';\nimport { tapGestureHandlerProps } from '../TapGestureHandler';\nimport { hoverGestureHandlerProps } from './hoverGesture';\nimport { State } from '../../State';\nimport { TouchEventType } from '../../TouchEventType';\nimport { ComposedGesture } from './gestureComposition';\nimport { ActionType } from '../../ActionType';\nimport { isFabric, isJestEnv, tagMessage } from '../../utils';\nimport { getReactNativeVersion } from '../../getReactNativeVersion';\nimport { getShadowNodeFromRef } from '../../getShadowNodeFromRef';\nimport { Platform } from 'react-native';\nimport { onGestureHandlerEvent } from './eventReceiver';\nimport { RNRenderer } from '../../RNRenderer';\nimport { isNewWebImplementationEnabled } from '../../EnableNewWebImplementation';\nimport { nativeViewGestureHandlerProps } from '../NativeViewGestureHandler';\nimport GestureHandlerRootViewContext from '../../GestureHandlerRootViewContext';\nimport { ghQueueMicrotask } from '../../ghQueueMicrotask';\n\ntype AttachGestureHandlerWeb = (\n handlerTag: number,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n newView: any,\n _actionType: ActionType,\n propsRef: React.RefObject<unknown>\n) => void;\n\ndeclare const global: {\n isFormsStackingContext: (node: unknown) => boolean | null; // JSI function\n};\n\nconst ALLOWED_PROPS = [\n ...baseGestureHandlerWithMonitorProps,\n ...tapGestureHandlerProps,\n ...panGestureHandlerProps,\n ...panGestureHandlerCustomNativeProps,\n ...longPressGestureHandlerProps,\n ...forceTouchGestureHandlerProps,\n ...flingGestureHandlerProps,\n ...hoverGestureHandlerProps,\n ...nativeViewGestureHandlerProps,\n];\n\nexport type GestureConfigReference = {\n config: GestureType[];\n animatedEventHandler: unknown;\n animatedHandlers: SharedValue<\n HandlerCallbacks<Record<string, unknown>>[] | null\n > | null;\n firstExecution: boolean;\n useReanimatedHook: boolean;\n};\n\nfunction convertToHandlerTag(ref: GestureRef): number {\n if (typeof ref === 'number') {\n return ref;\n } else if (ref instanceof BaseGesture) {\n return ref.handlerTag;\n } else {\n // @ts-ignore in this case it should be a ref either to gesture object or\n // a gesture handler component, in both cases handlerTag property exists\n return ref.current?.handlerTag ?? -1;\n }\n}\n\nfunction extractValidHandlerTags(interactionGroup: GestureRef[] | undefined) {\n return (\n interactionGroup?.map(convertToHandlerTag)?.filter((tag) => tag > 0) ?? []\n );\n}\n\nfunction dropHandlers(preparedGesture: GestureConfigReference) {\n for (const handler of preparedGesture.config) {\n RNGestureHandlerModule.dropGestureHandler(handler.handlerTag);\n\n unregisterHandler(handler.handlerTag, handler.config.testId);\n }\n\n scheduleFlushOperations();\n}\n\nfunction checkGestureCallbacksForWorklets(gesture: GestureType) {\n // if a gesture is explicitly marked to run on the JS thread there is no need to check\n // if callbacks are worklets as the user is aware they will be ran on the JS thread\n if (gesture.config.runOnJS) {\n return;\n }\n\n const areSomeNotWorklets = gesture.handlers.isWorklet.includes(false);\n const areSomeWorklets = gesture.handlers.isWorklet.includes(true);\n\n // if some of the callbacks are worklets and some are not, and the gesture is not\n // explicitly marked with `.runOnJS(true)` show an error\n if (areSomeNotWorklets && areSomeWorklets) {\n console.error(\n tagMessage(\n `Some of the callbacks in the gesture are worklets and some are not. Either make sure that all calbacks are marked as 'worklet' if you wish to run them on the UI thread or use '.runOnJS(true)' modifier on the gesture explicitly to run all callbacks on the JS thread.`\n )\n );\n }\n}\n\ninterface WebEventHandler {\n onGestureHandlerEvent: (event: HandlerStateChangeEvent<unknown>) => void;\n onGestureHandlerStateChange?: (\n event: HandlerStateChangeEvent<unknown>\n ) => void;\n}\n\ninterface AttachHandlersConfig {\n preparedGesture: GestureConfigReference;\n gestureConfig: ComposedGesture | GestureType;\n gesture: GestureType[];\n viewTag: number;\n webEventHandlersRef: React.RefObject<WebEventHandler>;\n mountedRef: React.RefObject<boolean>;\n}\n\nfunction attachHandlers({\n preparedGesture,\n gestureConfig,\n gesture,\n viewTag,\n webEventHandlersRef,\n mountedRef,\n}: AttachHandlersConfig) {\n if (!preparedGesture.firstExecution) {\n gestureConfig.initialize();\n } else {\n preparedGesture.firstExecution = false;\n }\n\n // use queueMicrotask to extract handlerTags, because all refs should be initialized\n // when it's ran\n ghQueueMicrotask(() => {\n if (!mountedRef.current) {\n return;\n }\n gestureConfig.prepare();\n });\n\n for (const handler of gesture) {\n checkGestureCallbacksForWorklets(handler);\n RNGestureHandlerModule.createGestureHandler(\n handler.handlerName,\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS)\n );\n\n registerHandler(handler.handlerTag, handler, handler.config.testId);\n }\n\n // use queueMicrotask to extract handlerTags, because all refs should be initialized\n // when it's ran\n ghQueueMicrotask(() => {\n if (!mountedRef.current) {\n return;\n }\n for (const handler of gesture) {\n let requireToFail: number[] = [];\n if (handler.config.requireToFail) {\n requireToFail = extractValidHandlerTags(handler.config.requireToFail);\n }\n\n let simultaneousWith: number[] = [];\n if (handler.config.simultaneousWith) {\n simultaneousWith = extractValidHandlerTags(\n handler.config.simultaneousWith\n );\n }\n\n let blocksHandlers: number[] = [];\n if (handler.config.blocksHandlers) {\n blocksHandlers = extractValidHandlerTags(handler.config.blocksHandlers);\n }\n\n RNGestureHandlerModule.updateGestureHandler(\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS, {\n simultaneousHandlers: simultaneousWith,\n waitFor: requireToFail,\n blocksHandlers: blocksHandlers,\n })\n );\n }\n\n scheduleFlushOperations();\n });\n\n preparedGesture.config = gesture;\n\n for (const gesture of preparedGesture.config) {\n const actionType = gesture.shouldUseReanimated\n ? ActionType.REANIMATED_WORKLET\n : ActionType.JS_FUNCTION_NEW_API;\n\n if (Platform.OS === 'web') {\n (RNGestureHandlerModule.attachGestureHandler as AttachGestureHandlerWeb)(\n gesture.handlerTag,\n viewTag,\n ActionType.JS_FUNCTION_OLD_API, // ignored on web\n webEventHandlersRef\n );\n } else {\n RNGestureHandlerModule.attachGestureHandler(\n gesture.handlerTag,\n viewTag,\n actionType\n );\n }\n }\n\n if (preparedGesture.animatedHandlers) {\n const isAnimatedGesture = (g: GestureType) => g.shouldUseReanimated;\n\n preparedGesture.animatedHandlers.value = gesture\n .filter(isAnimatedGesture)\n .map((g) => g.handlers) as unknown as HandlerCallbacks<\n Record<string, unknown>\n >[];\n }\n}\n\nfunction updateHandlers(\n preparedGesture: GestureConfigReference,\n gestureConfig: ComposedGesture | GestureType,\n gesture: GestureType[],\n mountedRef: React.RefObject<boolean>\n) {\n gestureConfig.prepare();\n\n for (let i = 0; i < gesture.length; i++) {\n const handler = preparedGesture.config[i];\n checkGestureCallbacksForWorklets(handler);\n\n // only update handlerTag when it's actually different, it may be the same\n // if gesture config object is wrapped with useMemo\n if (gesture[i].handlerTag !== handler.handlerTag) {\n gesture[i].handlerTag = handler.handlerTag;\n gesture[i].handlers.handlerTag = handler.handlerTag;\n }\n }\n\n // use queueMicrotask to extract handlerTags, because when it's ran, all refs should be updated\n // and handlerTags in BaseGesture references should be updated in the loop above (we need to wait\n // in case of external relations)\n ghQueueMicrotask(() => {\n if (!mountedRef.current) {\n return;\n }\n for (let i = 0; i < gesture.length; i++) {\n const handler = preparedGesture.config[i];\n\n handler.config = gesture[i].config;\n handler.handlers = gesture[i].handlers;\n\n const requireToFail = extractValidHandlerTags(\n handler.config.requireToFail\n );\n\n const simultaneousWith = extractValidHandlerTags(\n handler.config.simultaneousWith\n );\n\n RNGestureHandlerModule.updateGestureHandler(\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS, {\n simultaneousHandlers: simultaneousWith,\n waitFor: requireToFail,\n })\n );\n\n registerHandler(handler.handlerTag, handler, handler.config.testId);\n }\n\n if (preparedGesture.animatedHandlers) {\n const previousHandlersValue =\n preparedGesture.animatedHandlers.value ?? [];\n const newHandlersValue = preparedGesture.config\n .filter((g) => g.shouldUseReanimated) // ignore gestures that shouldn't run on UI\n .map((g) => g.handlers) as unknown as HandlerCallbacks<\n Record<string, unknown>\n >[];\n\n // if amount of gesture configs changes, we need to update the callbacks in shared value\n let shouldUpdateSharedValue =\n previousHandlersValue.length !== newHandlersValue.length;\n\n if (!shouldUpdateSharedValue) {\n // if the amount is the same, we need to check if any of the configs inside has changed\n for (let i = 0; i < newHandlersValue.length; i++) {\n if (\n // we can use the `gestureId` prop as it's unique for every config instance\n newHandlersValue[i].gestureId !== previousHandlersValue[i].gestureId\n ) {\n shouldUpdateSharedValue = true;\n break;\n }\n }\n }\n\n if (shouldUpdateSharedValue) {\n preparedGesture.animatedHandlers.value = newHandlersValue;\n }\n }\n\n scheduleFlushOperations();\n });\n}\n\nfunction needsToReattach(\n preparedGesture: GestureConfigReference,\n gesture: GestureType[]\n) {\n if (gesture.length !== preparedGesture.config.length) {\n return true;\n }\n for (let i = 0; i < gesture.length; i++) {\n if (\n gesture[i].handlerName !== preparedGesture.config[i].handlerName ||\n gesture[i].shouldUseReanimated !==\n preparedGesture.config[i].shouldUseReanimated\n ) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction isStateChangeEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n): event is GestureStateChangeEvent {\n 'worklet';\n // @ts-ignore Yes, the oldState prop is missing on GestureTouchEvent, that's the point\n return event.oldState != null;\n}\n\nfunction isTouchEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n): event is GestureTouchEvent {\n 'worklet';\n return event.eventType != null;\n}\n\nfunction getHandler(\n type: CALLBACK_TYPE,\n gesture: HandlerCallbacks<Record<string, unknown>>\n) {\n 'worklet';\n switch (type) {\n case CALLBACK_TYPE.BEGAN:\n return gesture.onBegin;\n case CALLBACK_TYPE.START:\n return gesture.onStart;\n case CALLBACK_TYPE.UPDATE:\n return gesture.onUpdate;\n case CALLBACK_TYPE.CHANGE:\n return gesture.onChange;\n case CALLBACK_TYPE.END:\n return gesture.onEnd;\n case CALLBACK_TYPE.FINALIZE:\n return gesture.onFinalize;\n case CALLBACK_TYPE.TOUCHES_DOWN:\n return gesture.onTouchesDown;\n case CALLBACK_TYPE.TOUCHES_MOVE:\n return gesture.onTouchesMove;\n case CALLBACK_TYPE.TOUCHES_UP:\n return gesture.onTouchesUp;\n case CALLBACK_TYPE.TOUCHES_CANCELLED:\n return gesture.onTouchesCancelled;\n }\n}\n\nfunction touchEventTypeToCallbackType(\n eventType: TouchEventType\n): CALLBACK_TYPE {\n 'worklet';\n switch (eventType) {\n case TouchEventType.TOUCHES_DOWN:\n return CALLBACK_TYPE.TOUCHES_DOWN;\n case TouchEventType.TOUCHES_MOVE:\n return CALLBACK_TYPE.TOUCHES_MOVE;\n case TouchEventType.TOUCHES_UP:\n return CALLBACK_TYPE.TOUCHES_UP;\n case TouchEventType.TOUCHES_CANCELLED:\n return CALLBACK_TYPE.TOUCHES_CANCELLED;\n }\n return CALLBACK_TYPE.UNDEFINED;\n}\n\nfunction runWorklet(\n type: CALLBACK_TYPE,\n gesture: HandlerCallbacks<Record<string, unknown>>,\n event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent,\n ...args: any[]\n) {\n 'worklet';\n const handler = getHandler(type, gesture);\n if (gesture.isWorklet[type]) {\n // @ts-ignore Logic below makes sure the correct event is send to the\n // correct handler.\n handler?.(event, ...args);\n } else if (handler) {\n console.warn(tagMessage('Animated gesture callback must be a worklet'));\n }\n}\n\nfunction useAnimatedGesture(\n preparedGesture: GestureConfigReference,\n needsRebuild: boolean\n) {\n if (!Reanimated) {\n return;\n }\n\n // Hooks are called conditionally, but the condition is whether the\n // react-native-reanimated is installed, which shouldn't change while running\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const sharedHandlersCallbacks = Reanimated.useSharedValue<\n HandlerCallbacks<Record<string, unknown>>[] | null\n >(null);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const lastUpdateEvent = Reanimated.useSharedValue<\n (GestureUpdateEvent | undefined)[]\n >([]);\n\n // not every gesture needs a state controller, init them lazily\n const stateControllers: GestureStateManagerType[] = [];\n\n const callback = (\n event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent\n ) => {\n 'worklet';\n\n const currentCallback = sharedHandlersCallbacks.value;\n if (!currentCallback) {\n return;\n }\n\n for (let i = 0; i < currentCallback.length; i++) {\n const gesture = currentCallback[i];\n\n if (event.handlerTag === gesture.handlerTag) {\n if (isStateChangeEvent(event)) {\n if (\n event.oldState === State.UNDETERMINED &&\n event.state === State.BEGAN\n ) {\n runWorklet(CALLBACK_TYPE.BEGAN, gesture, event);\n } else if (\n (event.oldState === State.BEGAN ||\n event.oldState === State.UNDETERMINED) &&\n event.state === State.ACTIVE\n ) {\n runWorklet(CALLBACK_TYPE.START, gesture, event);\n lastUpdateEvent.value[gesture.handlerTag] = undefined;\n } else if (\n event.oldState !== event.state &&\n event.state === State.END\n ) {\n if (event.oldState === State.ACTIVE) {\n runWorklet(CALLBACK_TYPE.END, gesture, event, true);\n }\n runWorklet(CALLBACK_TYPE.FINALIZE, gesture, event, true);\n } else if (\n (event.state === State.FAILED || event.state === State.CANCELLED) &&\n event.state !== event.oldState\n ) {\n if (event.oldState === State.ACTIVE) {\n runWorklet(CALLBACK_TYPE.END, gesture, event, false);\n }\n runWorklet(CALLBACK_TYPE.FINALIZE, gesture, event, false);\n }\n } else if (isTouchEvent(event)) {\n if (!stateControllers[i]) {\n stateControllers[i] = GestureStateManager.create(event.handlerTag);\n }\n\n if (event.eventType !== TouchEventType.UNDETERMINED) {\n runWorklet(\n touchEventTypeToCallbackType(event.eventType),\n gesture,\n event,\n stateControllers[i]\n );\n }\n } else {\n runWorklet(CALLBACK_TYPE.UPDATE, gesture, event);\n\n if (gesture.onChange && gesture.changeEventCalculator) {\n runWorklet(\n CALLBACK_TYPE.CHANGE,\n gesture,\n gesture.changeEventCalculator?.(\n event,\n lastUpdateEvent.value[gesture.handlerTag]\n )\n );\n\n lastUpdateEvent.value[gesture.handlerTag] = event;\n }\n }\n }\n }\n };\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const event = Reanimated.useEvent(\n callback,\n ['onGestureHandlerStateChange', 'onGestureHandlerEvent'],\n needsRebuild\n );\n\n preparedGesture.animatedEventHandler = event;\n preparedGesture.animatedHandlers = sharedHandlersCallbacks;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction validateDetectorChildren(ref: any) {\n // finds the first native view under the Wrap component and traverses the fiber tree upwards\n // to check whether there is more than one native view as a pseudo-direct child of GestureDetector\n // i.e. this is not ok:\n // Wrap\n // |\n // / \\\n // / \\\n // / \\\n // / \\\n // NativeView NativeView\n //\n // but this is fine:\n // Wrap\n // |\n // NativeView\n // |\n // / \\\n // / \\\n // / \\\n // / \\\n // NativeView NativeView\n if (__DEV__ && Platform.OS !== 'web') {\n const REACT_NATIVE_VERSION = getReactNativeVersion();\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const wrapType =\n REACT_NATIVE_VERSION.minor > 63 || REACT_NATIVE_VERSION.major > 0\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ref._reactInternals.elementType\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ref._reactInternalFiber.elementType;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let instance =\n RNRenderer.findHostInstance_DEPRECATED(\n ref\n )._internalFiberInstanceHandleDEV;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n while (instance && instance.elementType !== wrapType) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (instance.sibling) {\n throw new Error(\n 'GestureDetector has more than one native view as its children. This can happen if you are using a custom component that renders multiple views, like React.Fragment. You should wrap content of GestureDetector with a <View> or <Animated.View>.'\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n instance = instance.return;\n }\n }\n}\n\nconst applyUserSelectProp = (\n userSelect: UserSelect,\n gesture: ComposedGesture | GestureType\n): void => {\n for (const g of gesture.toGestureArray()) {\n g.config.userSelect = userSelect;\n }\n};\n\nconst applyEnableContextMenuProp = (\n enableContextMenu: boolean,\n gesture: ComposedGesture | GestureType\n): void => {\n for (const g of gesture.toGestureArray()) {\n g.config.enableContextMenu = enableContextMenu;\n }\n};\n\nconst applyTouchActionProp = (\n touchAction: TouchAction,\n gesture: ComposedGesture | GestureType\n): void => {\n for (const g of gesture.toGestureArray()) {\n g.config.touchAction = touchAction;\n }\n};\n\ninterface GestureDetectorProps {\n /**\n * A gesture object containing the configuration and callbacks.\n * Can be any of:\n * - base gestures (`Tap`, `Pan`, ...)\n * - `ComposedGesture` (`Race`, `Simultaneous`, `Exclusive`)\n */\n gesture: ComposedGesture | GestureType;\n children?: React.ReactNode;\n\n /**\n * #### Web only\n * This parameter allows to specify which `userSelect` property should be applied to underlying view.\n * Possible values are `\"none\" | \"auto\" | \"text\"`. Default value is set to `\"none\"`.\n */\n userSelect?: UserSelect;\n /**\n * #### Web only\n * Specifies whether context menu should be enabled after clicking on underlying view with right mouse button.\n * Default value is set to `false`.\n */\n enableContextMenu?: boolean;\n /**\n * #### Web only\n * This parameter allows to specify which `touchAction` property should be applied to underlying view.\n * Supports all CSS touch-action values (e.g. `\"none\"`, `\"pan-y\"`). Default value is set to `\"none\"`.\n */\n touchAction?: TouchAction;\n}\ninterface GestureDetectorState {\n firstRender: boolean;\n viewRef: React.Component | null;\n previousViewTag: number;\n forceReattach: boolean;\n}\n\n/**\n * `GestureDetector` is responsible for creating and updating native gesture handlers based on the config of provided gesture.\n *\n * ### Props\n * - `gesture`\n * - `userSelect` (**Web only**)\n * - `enableContextMenu` (**Web only**)\n * - `touchAction` (**Web only**)\n *\n * ### Remarks\n * - Gesture Detector will use first native view in its subtree to recognize gestures, however if this view is used only to group its children it may get automatically collapsed.\n * - Using the same instance of a gesture across multiple Gesture Detectors is not possible.\n *\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/gesture-detector\n */\nexport const GestureDetector = (props: GestureDetectorProps) => {\n const rootViewContext = useContext(GestureHandlerRootViewContext);\n if (__DEV__ && !rootViewContext && !isJestEnv() && Platform.OS !== 'web') {\n throw new Error(\n 'GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.'\n );\n }\n\n const gestureConfig = props.gesture;\n\n if (props.userSelect) {\n applyUserSelectProp(props.userSelect, gestureConfig);\n }\n\n if (props.enableContextMenu !== undefined) {\n applyEnableContextMenuProp(props.enableContextMenu, gestureConfig);\n }\n\n if (props.touchAction !== undefined) {\n applyTouchActionProp(props.touchAction, gestureConfig);\n }\n\n const gesture = gestureConfig.toGestureArray();\n const useReanimatedHook = gesture.some((g) => g.shouldUseReanimated);\n\n // store state in ref to prevent unnecessary renders\n const state = useRef<GestureDetectorState>({\n firstRender: true,\n viewRef: null,\n previousViewTag: -1,\n forceReattach: false,\n }).current;\n const mountedRef = useRef(false);\n const webEventHandlersRef = useRef<WebEventHandler>({\n onGestureHandlerEvent: (e: HandlerStateChangeEvent<unknown>) => {\n onGestureHandlerEvent(e.nativeEvent);\n },\n onGestureHandlerStateChange: isNewWebImplementationEnabled()\n ? (e: HandlerStateChangeEvent<unknown>) => {\n onGestureHandlerEvent(e.nativeEvent);\n }\n : undefined,\n });\n\n const [renderState, setRenderState] = useState(false);\n function forceRender() {\n setRenderState(!renderState);\n }\n\n const preparedGesture = React.useRef<GestureConfigReference>({\n config: gesture,\n animatedEventHandler: null,\n animatedHandlers: null,\n firstExecution: true,\n useReanimatedHook: useReanimatedHook,\n }).current;\n\n if (useReanimatedHook !== preparedGesture.useReanimatedHook) {\n throw new Error(\n tagMessage(\n 'You cannot change the thread the callbacks are ran on while the app is running'\n )\n );\n }\n\n function onHandlersUpdate(skipConfigUpdate?: boolean) {\n // if the underlying view has changed we need to reattach handlers to the new view\n const viewTag = findNodeHandle(state.viewRef) as number;\n const forceReattach = viewTag !== state.previousViewTag;\n\n if (forceReattach || needsToReattach(preparedGesture, gesture)) {\n validateDetectorChildren(state.viewRef);\n dropHandlers(preparedGesture);\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesture,\n webEventHandlersRef,\n viewTag,\n mountedRef,\n });\n\n state.previousViewTag = viewTag;\n state.forceReattach = forceReattach;\n if (forceReattach) {\n forceRender();\n }\n } else if (!skipConfigUpdate) {\n updateHandlers(preparedGesture, gestureConfig, gesture, mountedRef);\n }\n }\n\n // Reanimated event should be rebuilt only when gestures are reattached, otherwise\n // config update will be enough as all necessary items are stored in shared values anyway\n const needsToRebuildReanimatedEvent =\n preparedGesture.firstExecution ||\n needsToReattach(preparedGesture, gesture) ||\n state.forceReattach;\n\n state.forceReattach = false;\n\n if (preparedGesture.firstExecution) {\n gestureConfig.initialize();\n }\n\n if (useReanimatedHook) {\n // Whether animatedGesture or gesture is used shouldn't change while the app is running\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useAnimatedGesture(preparedGesture, needsToRebuildReanimatedEvent);\n }\n\n useEffect(() => {\n const viewTag = findNodeHandle(state.viewRef) as number;\n state.firstRender = true;\n mountedRef.current = true;\n\n validateDetectorChildren(state.viewRef);\n\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesture,\n webEventHandlersRef,\n viewTag,\n mountedRef,\n });\n\n return () => {\n mountedRef.current = false;\n dropHandlers(preparedGesture);\n };\n }, []);\n\n useEffect(() => {\n if (!state.firstRender) {\n onHandlersUpdate();\n } else {\n state.firstRender = false;\n }\n }, [props]);\n\n const refFunction = (ref: unknown) => {\n if (ref !== null) {\n // @ts-ignore Just setting the view ref\n state.viewRef = ref;\n\n // if it's the first render, also set the previousViewTag to prevent reattaching gestures when not needed\n if (state.previousViewTag === -1) {\n state.previousViewTag = findNodeHandle(state.viewRef) as number;\n }\n\n // pass true as `skipConfigUpdate`, here we only want to trigger the eventual reattaching of handlers\n // in case the view has changed, while config update would be handled be the `useEffect` above\n onHandlersUpdate(true);\n\n if (isFabric() && global.isFormsStackingContext) {\n const node = getShadowNodeFromRef(ref);\n if (global.isFormsStackingContext(node) === false) {\n console.error(\n tagMessage(\n 'GestureDetector has received a child that may get view-flattened. ' +\n '\\nTo prevent it from misbehaving you need to wrap the child with a `<View collapsable={false}>`.'\n )\n );\n }\n }\n }\n };\n\n if (useReanimatedHook) {\n return (\n <AnimatedWrap\n ref={refFunction}\n onGestureHandlerEvent={preparedGesture.animatedEventHandler}>\n {props.children}\n </AnimatedWrap>\n );\n } else {\n return <Wrap ref={refFunction}>{props.children}</Wrap>;\n }\n};\n\nclass Wrap extends React.Component<{\n onGestureHandlerEvent?: unknown;\n // implicit `children` prop has been removed in @types/react^18.0.0\n children?: React.ReactNode;\n}> {\n render() {\n try {\n // I don't think that fighting with types over such a simple function is worth it\n // The only thing it does is add 'collapsable: false' to the child component\n // to make sure it is in the native view hierarchy so the detector can find\n // correct viewTag to attach to.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const child: any = React.Children.only(this.props.children);\n return React.cloneElement(\n child,\n { collapsable: false },\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n child.props.children\n );\n } catch (e) {\n throw new Error(\n tagMessage(\n `GestureDetector got more than one view as a child. If you want the gesture to work on multiple views, wrap them with a common parent and attach the gesture to that view.`\n )\n );\n }\n }\n}\n\nconst AnimatedWrap = Reanimated?.default?.createAnimatedComponent(Wrap) ?? Wrap;\n"]}
|
@@ -9,11 +9,24 @@ export class FlingGesture extends BaseGesture {
|
|
9
9
|
|
10
10
|
this.handlerName = 'FlingGestureHandler';
|
11
11
|
}
|
12
|
+
/**
|
13
|
+
* Determine exact number of points required to handle the fling gesture.
|
14
|
+
* @param pointers
|
15
|
+
*/
|
16
|
+
|
12
17
|
|
13
18
|
numberOfPointers(pointers) {
|
14
19
|
this.config.numberOfPointers = pointers;
|
15
20
|
return this;
|
16
21
|
}
|
22
|
+
/**
|
23
|
+
* Expressed allowed direction of movement.
|
24
|
+
* Expected values are exported as constants in the Directions object.
|
25
|
+
* Arguments can be combined using `|` operator. Default value is set to `MouseButton.LEFT`.
|
26
|
+
* @param direction
|
27
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/fling-gesture/#directionvalue-directions
|
28
|
+
*/
|
29
|
+
|
17
30
|
|
18
31
|
direction(direction) {
|
19
32
|
this.config.direction = direction;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["flingGesture.ts"],"names":["BaseGesture","FlingGesture","constructor","handlerName","numberOfPointers","pointers","config","direction"],"mappings":";;AAAA,SAASA,WAAT,QAA+C,WAA/C;AAMA,OAAO,MAAMC,YAAN,SAA2BD,WAA3B,CAAwE;AAG7EE,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF0C,EAE1C;;AAGZ,SAAKC,WAAL,GAAmB,qBAAnB;AACD
|
1
|
+
{"version":3,"sources":["flingGesture.ts"],"names":["BaseGesture","FlingGesture","constructor","handlerName","numberOfPointers","pointers","config","direction"],"mappings":";;AAAA,SAASA,WAAT,QAA+C,WAA/C;AAMA,OAAO,MAAMC,YAAN,SAA2BD,WAA3B,CAAwE;AAG7EE,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF0C,EAE1C;;AAGZ,SAAKC,WAAL,GAAmB,qBAAnB;AACD;AAED;AACF;AACA;AACA;;;AACEC,EAAAA,gBAAgB,CAACC,QAAD,EAAmB;AACjC,SAAKC,MAAL,CAAYF,gBAAZ,GAA+BC,QAA/B;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;;;AACEE,EAAAA,SAAS,CAACA,SAAD,EAAoB;AAC3B,SAAKD,MAAL,CAAYC,SAAZ,GAAwBA,SAAxB;AACA,WAAO,IAAP;AACD;;AA5B4E","sourcesContent":["import { BaseGesture, BaseGestureConfig } from './gesture';\nimport {\n FlingGestureConfig,\n FlingGestureHandlerEventPayload,\n} from '../FlingGestureHandler';\n\nexport class FlingGesture extends BaseGesture<FlingGestureHandlerEventPayload> {\n public config: BaseGestureConfig & FlingGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'FlingGestureHandler';\n }\n\n /**\n * Determine exact number of points required to handle the fling gesture.\n * @param pointers\n */\n numberOfPointers(pointers: number) {\n this.config.numberOfPointers = pointers;\n return this;\n }\n\n /**\n * Expressed allowed direction of movement.\n * Expected values are exported as constants in the Directions object.\n * Arguments can be combined using `|` operator. Default value is set to `MouseButton.LEFT`.\n * @param direction\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/fling-gesture/#directionvalue-directions\n */\n direction(direction: number) {\n this.config.direction = direction;\n return this;\n }\n}\n\nexport type FlingGestureType = InstanceType<typeof FlingGesture>;\n"]}
|
@@ -30,16 +30,33 @@ export class ForceTouchGesture extends ContinousBaseGesture {
|
|
30
30
|
|
31
31
|
this.handlerName = 'ForceTouchGestureHandler';
|
32
32
|
}
|
33
|
+
/**
|
34
|
+
* A minimal pressure that is required before gesture can activate.
|
35
|
+
* Should be a value from range [0.0, 1.0]. Default is 0.2.
|
36
|
+
* @param force
|
37
|
+
*/
|
38
|
+
|
33
39
|
|
34
40
|
minForce(force) {
|
35
41
|
this.config.minForce = force;
|
36
42
|
return this;
|
37
43
|
}
|
44
|
+
/**
|
45
|
+
* A maximal pressure that could be applied for gesture.
|
46
|
+
* If the pressure is greater, gesture fails. Should be a value from range [0.0, 1.0].
|
47
|
+
* @param force
|
48
|
+
*/
|
49
|
+
|
38
50
|
|
39
51
|
maxForce(force) {
|
40
52
|
this.config.maxForce = force;
|
41
53
|
return this;
|
42
54
|
}
|
55
|
+
/**
|
56
|
+
* Value defining if haptic feedback has to be performed on activation.
|
57
|
+
* @param value
|
58
|
+
*/
|
59
|
+
|
43
60
|
|
44
61
|
feedbackOnActivation(value) {
|
45
62
|
this.config.feedbackOnActivation = value;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["forceTouchGesture.ts"],"names":["ContinousBaseGesture","changeEventCalculator","current","previous","changePayload","undefined","forceChange","force","ForceTouchGesture","constructor","handlerName","minForce","config","maxForce","feedbackOnActivation","value","onChange","callback","handlers"],"mappings":";;AAAA,SAA4BA,oBAA5B,QAAwD,WAAxD;;AAWA,SAASC,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;AACA;;AACA,MAAIC,aAAJ;;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1BD,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK;AADP,KAAhB;AAGD,GAJD,MAIO;AACLH,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK,KAAR,GAAgBJ,QAAQ,CAACI;AADxB,KAAhB;AAGD;;AAED,SAAO,EAAE,GAAGL,OAAL;AAAc,OAAGE;AAAjB,GAAP;AACD;;AAED,OAAO,MAAMI,iBAAN,SAAgCR,oBAAhC,CAGL;AAGAS,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF+C,EAE/C;;AAGZ,SAAKC,WAAL,GAAmB,0BAAnB;AACD
|
1
|
+
{"version":3,"sources":["forceTouchGesture.ts"],"names":["ContinousBaseGesture","changeEventCalculator","current","previous","changePayload","undefined","forceChange","force","ForceTouchGesture","constructor","handlerName","minForce","config","maxForce","feedbackOnActivation","value","onChange","callback","handlers"],"mappings":";;AAAA,SAA4BA,oBAA5B,QAAwD,WAAxD;;AAWA,SAASC,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;AACA;;AACA,MAAIC,aAAJ;;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1BD,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK;AADP,KAAhB;AAGD,GAJD,MAIO;AACLH,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK,KAAR,GAAgBJ,QAAQ,CAACI;AADxB,KAAhB;AAGD;;AAED,SAAO,EAAE,GAAGL,OAAL;AAAc,OAAGE;AAAjB,GAAP;AACD;;AAED,OAAO,MAAMI,iBAAN,SAAgCR,oBAAhC,CAGL;AAGAS,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF+C,EAE/C;;AAGZ,SAAKC,WAAL,GAAmB,0BAAnB;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEC,EAAAA,QAAQ,CAACJ,KAAD,EAAgB;AACtB,SAAKK,MAAL,CAAYD,QAAZ,GAAuBJ,KAAvB;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEM,EAAAA,QAAQ,CAACN,KAAD,EAAgB;AACtB,SAAKK,MAAL,CAAYC,QAAZ,GAAuBN,KAAvB;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;;;AACEO,EAAAA,oBAAoB,CAACC,KAAD,EAAiB;AACnC,SAAKH,MAAL,CAAYE,oBAAZ,GAAmCC,KAAnC;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,QAAQ,CACNC,QADM,EASN;AACA;AACA,SAAKC,QAAL,CAAcjB,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAMe,QAAN,CAAeC,QAAf,CAAP;AACD;;AAnDD","sourcesContent":["import { BaseGestureConfig, ContinousBaseGesture } from './gesture';\nimport {\n ForceTouchGestureConfig,\n ForceTouchGestureHandlerEventPayload,\n} from '../ForceTouchGestureHandler';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\n\nexport type ForceTouchGestureChangeEventPayload = {\n forceChange: number;\n};\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent<ForceTouchGestureHandlerEventPayload>,\n previous?: GestureUpdateEvent<ForceTouchGestureHandlerEventPayload>\n) {\n 'worklet';\n let changePayload: ForceTouchGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n forceChange: current.force,\n };\n } else {\n changePayload = {\n forceChange: current.force - previous.force,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class ForceTouchGesture extends ContinousBaseGesture<\n ForceTouchGestureHandlerEventPayload,\n ForceTouchGestureChangeEventPayload\n> {\n public config: BaseGestureConfig & ForceTouchGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'ForceTouchGestureHandler';\n }\n\n /**\n * A minimal pressure that is required before gesture can activate.\n * Should be a value from range [0.0, 1.0]. Default is 0.2.\n * @param force\n */\n minForce(force: number) {\n this.config.minForce = force;\n return this;\n }\n\n /**\n * A maximal pressure that could be applied for gesture.\n * If the pressure is greater, gesture fails. Should be a value from range [0.0, 1.0].\n * @param force\n */\n maxForce(force: number) {\n this.config.maxForce = force;\n return this;\n }\n\n /**\n * Value defining if haptic feedback has to be performed on activation.\n * @param value\n */\n feedbackOnActivation(value: boolean) {\n this.config.feedbackOnActivation = value;\n return this;\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n GestureUpdateEvent<\n ForceTouchGestureHandlerEventPayload &\n ForceTouchGestureChangeEventPayload\n >\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, ForceTouchGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type ForceTouchGestureType = InstanceType<typeof ForceTouchGesture>;\n"]}
|
@@ -49,6 +49,11 @@ export class BaseGesture extends Gesture {
|
|
49
49
|
const value = this.config[key];
|
50
50
|
this.config[key] = value ? Array().concat(value, gesture) : [gesture];
|
51
51
|
}
|
52
|
+
/**
|
53
|
+
* Sets a `ref` to the gesture object, allowing for interoperability with the old API.
|
54
|
+
* @param ref
|
55
|
+
*/
|
56
|
+
|
52
57
|
|
53
58
|
withRef(ref) {
|
54
59
|
this.config.ref = ref;
|
@@ -60,18 +65,35 @@ export class BaseGesture extends Gesture {
|
|
60
65
|
//@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
|
61
66
|
return callback.__workletHash !== undefined;
|
62
67
|
}
|
68
|
+
/**
|
69
|
+
* Set the callback that is being called when given gesture handler starts receiving touches.
|
70
|
+
* At the moment of this callback the handler is in `BEGAN` state and we don't know yet if it will recognize the gesture at all.
|
71
|
+
* @param callback
|
72
|
+
*/
|
73
|
+
|
63
74
|
|
64
75
|
onBegin(callback) {
|
65
76
|
this.handlers.onBegin = callback;
|
66
77
|
this.handlers.isWorklet[CALLBACK_TYPE.BEGAN] = this.isWorklet(callback);
|
67
78
|
return this;
|
68
79
|
}
|
80
|
+
/**
|
81
|
+
* Set the callback that is being called when the gesture is recognized by the handler and it transitions to the `ACTIVE` state.
|
82
|
+
* @param callback
|
83
|
+
*/
|
84
|
+
|
69
85
|
|
70
86
|
onStart(callback) {
|
71
87
|
this.handlers.onStart = callback;
|
72
88
|
this.handlers.isWorklet[CALLBACK_TYPE.START] = this.isWorklet(callback);
|
73
89
|
return this;
|
74
90
|
}
|
91
|
+
/**
|
92
|
+
* Set the callback that is being called when the gesture that was recognized by the handler finishes and handler reaches `END` state.
|
93
|
+
* It will be called only if the handler was previously in the `ACTIVE` state.
|
94
|
+
* @param callback
|
95
|
+
*/
|
96
|
+
|
75
97
|
|
76
98
|
onEnd(callback) {
|
77
99
|
this.handlers.onEnd = callback; //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
|
@@ -79,6 +101,11 @@ export class BaseGesture extends Gesture {
|
|
79
101
|
this.handlers.isWorklet[CALLBACK_TYPE.END] = this.isWorklet(callback);
|
80
102
|
return this;
|
81
103
|
}
|
104
|
+
/**
|
105
|
+
* Set the callback that is being called when the handler finalizes handling gesture - the gesture was recognized and has finished or it failed to recognize.
|
106
|
+
* @param callback
|
107
|
+
*/
|
108
|
+
|
82
109
|
|
83
110
|
onFinalize(callback) {
|
84
111
|
this.handlers.onFinalize = callback; //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
|
@@ -86,6 +113,11 @@ export class BaseGesture extends Gesture {
|
|
86
113
|
this.handlers.isWorklet[CALLBACK_TYPE.FINALIZE] = this.isWorklet(callback);
|
87
114
|
return this;
|
88
115
|
}
|
116
|
+
/**
|
117
|
+
* Set the `onTouchesDown` callback which is called every time a pointer is placed on the screen.
|
118
|
+
* @param callback
|
119
|
+
*/
|
120
|
+
|
89
121
|
|
90
122
|
onTouchesDown(callback) {
|
91
123
|
this.config.needsPointerData = true;
|
@@ -93,6 +125,11 @@ export class BaseGesture extends Gesture {
|
|
93
125
|
this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_DOWN] = this.isWorklet(callback);
|
94
126
|
return this;
|
95
127
|
}
|
128
|
+
/**
|
129
|
+
* Set the `onTouchesMove` callback which is called every time a pointer is moved on the screen.
|
130
|
+
* @param callback
|
131
|
+
*/
|
132
|
+
|
96
133
|
|
97
134
|
onTouchesMove(callback) {
|
98
135
|
this.config.needsPointerData = true;
|
@@ -100,6 +137,11 @@ export class BaseGesture extends Gesture {
|
|
100
137
|
this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_MOVE] = this.isWorklet(callback);
|
101
138
|
return this;
|
102
139
|
}
|
140
|
+
/**
|
141
|
+
* Set the `onTouchesUp` callback which is called every time a pointer is lifted from the screen.
|
142
|
+
* @param callback
|
143
|
+
*/
|
144
|
+
|
103
145
|
|
104
146
|
onTouchesUp(callback) {
|
105
147
|
this.config.needsPointerData = true;
|
@@ -107,6 +149,11 @@ export class BaseGesture extends Gesture {
|
|
107
149
|
this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_UP] = this.isWorklet(callback);
|
108
150
|
return this;
|
109
151
|
}
|
152
|
+
/**
|
153
|
+
* Set the `onTouchesCancelled` callback which is called every time a pointer stops being tracked, for example when the gesture finishes.
|
154
|
+
* @param callback
|
155
|
+
*/
|
156
|
+
|
110
157
|
|
111
158
|
onTouchesCancelled(callback) {
|
112
159
|
this.config.needsPointerData = true;
|
@@ -114,36 +161,84 @@ export class BaseGesture extends Gesture {
|
|
114
161
|
this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_CANCELLED] = this.isWorklet(callback);
|
115
162
|
return this;
|
116
163
|
}
|
164
|
+
/**
|
165
|
+
* Indicates whether the given handler should be analyzing stream of touch events or not.
|
166
|
+
* @param enabled
|
167
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#enabledvalue-boolean
|
168
|
+
*/
|
169
|
+
|
117
170
|
|
118
171
|
enabled(enabled) {
|
119
172
|
this.config.enabled = enabled;
|
120
173
|
return this;
|
121
174
|
}
|
175
|
+
/**
|
176
|
+
* When true the handler will cancel or fail recognition (depending on its current state) whenever the finger leaves the area of the connected view.
|
177
|
+
* @param value
|
178
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#shouldcancelwhenoutsidevalue-boolean
|
179
|
+
*/
|
180
|
+
|
122
181
|
|
123
182
|
shouldCancelWhenOutside(value) {
|
124
183
|
this.config.shouldCancelWhenOutside = value;
|
125
184
|
return this;
|
126
185
|
}
|
186
|
+
/**
|
187
|
+
* This parameter enables control over what part of the connected view area can be used to begin recognizing the gesture.
|
188
|
+
* When a negative number is provided the bounds of the view will reduce the area by the given number of points in each of the sides evenly.
|
189
|
+
* @param hitSlop
|
190
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#hitslopsettings
|
191
|
+
*/
|
192
|
+
|
127
193
|
|
128
194
|
hitSlop(hitSlop) {
|
129
195
|
this.config.hitSlop = hitSlop;
|
130
196
|
return this;
|
131
197
|
}
|
198
|
+
/**
|
199
|
+
* #### Web only
|
200
|
+
* This parameter allows to specify which `cursor` should be used when gesture activates.
|
201
|
+
* Supports all CSS cursor values (e.g. `"grab"`, `"zoom-in"`). Default value is set to `"auto"`.
|
202
|
+
* @param activeCursor
|
203
|
+
*/
|
204
|
+
|
132
205
|
|
133
206
|
activeCursor(activeCursor) {
|
134
207
|
this.config.activeCursor = activeCursor;
|
135
208
|
return this;
|
136
209
|
}
|
210
|
+
/**
|
211
|
+
* #### Web & Android only
|
212
|
+
* Allows users to choose which mouse button should handler respond to.
|
213
|
+
* Arguments can be combined using `|` operator, e.g. `mouseButton(MouseButton.LEFT | MouseButton.RIGHT)`.
|
214
|
+
* Default value is set to `MouseButton.LEFT`.
|
215
|
+
* @param mouseButton
|
216
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#mousebuttonvalue-mousebutton-web--android-only
|
217
|
+
*/
|
218
|
+
|
137
219
|
|
138
220
|
mouseButton(mouseButton) {
|
139
221
|
this.config.mouseButton = mouseButton;
|
140
222
|
return this;
|
141
223
|
}
|
224
|
+
/**
|
225
|
+
* When `react-native-reanimated` is installed, the callbacks passed to the gestures are automatically workletized and run on the UI thread when called.
|
226
|
+
* This option allows for changing this behavior: when `true`, all the callbacks will be run on the JS thread instead of the UI thread, regardless of whether they are worklets or not.
|
227
|
+
* Defaults to `false`.
|
228
|
+
* @param runOnJS
|
229
|
+
*/
|
230
|
+
|
142
231
|
|
143
232
|
runOnJS(runOnJS) {
|
144
233
|
this.config.runOnJS = runOnJS;
|
145
234
|
return this;
|
146
235
|
}
|
236
|
+
/**
|
237
|
+
* Allows gestures across different components to be recognized simultaneously.
|
238
|
+
* @param gestures
|
239
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#simultaneouswithexternalgesture
|
240
|
+
*/
|
241
|
+
|
147
242
|
|
148
243
|
simultaneousWithExternalGesture(...gestures) {
|
149
244
|
for (const gesture of gestures) {
|
@@ -152,6 +247,12 @@ export class BaseGesture extends Gesture {
|
|
152
247
|
|
153
248
|
return this;
|
154
249
|
}
|
250
|
+
/**
|
251
|
+
* Allows to delay activation of the handler until all handlers passed as arguments to this method fail (or don't begin at all).
|
252
|
+
* @param gestures
|
253
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#requireexternalgesturetofail
|
254
|
+
*/
|
255
|
+
|
155
256
|
|
156
257
|
requireExternalGestureToFail(...gestures) {
|
157
258
|
for (const gesture of gestures) {
|
@@ -160,6 +261,12 @@ export class BaseGesture extends Gesture {
|
|
160
261
|
|
161
262
|
return this;
|
162
263
|
}
|
264
|
+
/**
|
265
|
+
* Works similarily to `requireExternalGestureToFail` but the direction of the relation is reversed - instead of being one-to-many relation, it's many-to-one.
|
266
|
+
* @param gestures
|
267
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#blocksexternalgesture
|
268
|
+
*/
|
269
|
+
|
163
270
|
|
164
271
|
blocksExternalGesture(...gestures) {
|
165
272
|
for (const gesture of gestures) {
|
@@ -168,11 +275,23 @@ export class BaseGesture extends Gesture {
|
|
168
275
|
|
169
276
|
return this;
|
170
277
|
}
|
278
|
+
/**
|
279
|
+
* Sets a `testID` property for gesture object, allowing for querying for it in tests.
|
280
|
+
* @param id
|
281
|
+
*/
|
282
|
+
|
171
283
|
|
172
284
|
withTestId(id) {
|
173
285
|
this.config.testId = id;
|
174
286
|
return this;
|
175
287
|
}
|
288
|
+
/**
|
289
|
+
* #### iOS only
|
290
|
+
* When `true`, the handler will cancel touches for native UI components (`UIButton`, `UISwitch`, etc) it's attached to when it becomes `ACTIVE`.
|
291
|
+
* Default value is `true`.
|
292
|
+
* @param value
|
293
|
+
*/
|
294
|
+
|
176
295
|
|
177
296
|
cancelsTouchesInView(value) {
|
178
297
|
this.config.cancelsTouchesInView = value;
|
@@ -206,17 +325,33 @@ export class BaseGesture extends Gesture {
|
|
206
325
|
|
207
326
|
}
|
208
327
|
export class ContinousBaseGesture extends BaseGesture {
|
328
|
+
/**
|
329
|
+
* Set the callback that is being called every time the gesture receives an update while it's active.
|
330
|
+
* @param callback
|
331
|
+
*/
|
209
332
|
onUpdate(callback) {
|
210
333
|
this.handlers.onUpdate = callback;
|
211
334
|
this.handlers.isWorklet[CALLBACK_TYPE.UPDATE] = this.isWorklet(callback);
|
212
335
|
return this;
|
213
336
|
}
|
337
|
+
/**
|
338
|
+
* Set the callback that is being called every time the gesture receives an update while it's active.
|
339
|
+
* This callback will receive information about change in value in relation to the last received event.
|
340
|
+
* @param callback
|
341
|
+
*/
|
342
|
+
|
214
343
|
|
215
344
|
onChange(callback) {
|
216
345
|
this.handlers.onChange = callback;
|
217
346
|
this.handlers.isWorklet[CALLBACK_TYPE.CHANGE] = this.isWorklet(callback);
|
218
347
|
return this;
|
219
348
|
}
|
349
|
+
/**
|
350
|
+
* When `true` the handler will not activate by itself even if its activation criteria are met.
|
351
|
+
* Instead you can manipulate its state using state manager.
|
352
|
+
* @param manualActivation
|
353
|
+
*/
|
354
|
+
|
220
355
|
|
221
356
|
manualActivation(manualActivation) {
|
222
357
|
this.config.manualActivation = manualActivation;
|