react-native-gesture-handler 2.1.2 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. package/README.md +3 -2
  2. package/android/build.gradle +1 -1
  3. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandler.kt +42 -11
  4. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.kt +36 -2
  5. package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.kt +7 -4
  6. package/android/lib/src/main/java/com/swmansion/gesturehandler/PinchGestureHandler.kt +6 -4
  7. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureHandler.kt +6 -4
  8. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +8 -8
  9. package/ios/RNGestureHandler.xcodeproj/project.xcworkspace/xcuserdata/jakubpiasecki.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  10. package/ios/RNGestureHandler.xcodeproj/xcuserdata/jakubpiasecki.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
  11. package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -1
  12. package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
  13. package/lib/commonjs/handlers/gestures/GestureDetector.js +37 -13
  14. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
  15. package/lib/commonjs/handlers/gestures/eventReceiver.js +1 -0
  16. package/lib/commonjs/handlers/gestures/eventReceiver.js.map +1 -1
  17. package/lib/commonjs/index.js +0 -106
  18. package/lib/commonjs/index.js.map +1 -1
  19. package/lib/commonjs/web/GestureHandler.js +4 -1
  20. package/lib/commonjs/web/GestureHandler.js.map +1 -1
  21. package/lib/module/handlers/LongPressGestureHandler.js.map +1 -1
  22. package/lib/module/handlers/PanGestureHandler.js.map +1 -1
  23. package/lib/module/handlers/gestures/GestureDetector.js +35 -13
  24. package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
  25. package/lib/module/handlers/gestures/eventReceiver.js +1 -2
  26. package/lib/module/handlers/gestures/eventReceiver.js.map +1 -1
  27. package/lib/module/index.js +0 -11
  28. package/lib/module/index.js.map +1 -1
  29. package/lib/module/web/GestureHandler.js +4 -1
  30. package/lib/module/web/GestureHandler.js.map +1 -1
  31. package/lib/typescript/handlers/LongPressGestureHandler.d.ts +2 -2
  32. package/lib/typescript/handlers/PanGestureHandler.d.ts +2 -2
  33. package/lib/typescript/handlers/gestures/eventReceiver.d.ts +2 -0
  34. package/lib/typescript/index.d.ts +11 -11
  35. package/lib/typescript/web/GestureHandler.d.ts +1 -1
  36. package/package.json +1 -1
  37. package/src/handlers/LongPressGestureHandler.ts +2 -2
  38. package/src/handlers/PanGestureHandler.ts +2 -2
  39. package/src/handlers/gestures/GestureDetector.tsx +48 -11
  40. package/src/handlers/gestures/eventReceiver.ts +1 -1
  41. package/src/index.ts +11 -11
  42. package/src/web/GestureHandler.ts +7 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["PanGestureHandler.ts"],"names":["createHandler","baseGestureHandlerProps","panGestureHandlerProps","panGestureHandlerCustomNativeProps","PanGestureHandler","name","allowedProps","config","transformProps","managePanProps","customNativeProps","validatePanGestureHandlerProps","props","Array","isArray","activeOffsetX","Error","activeOffsetY","failOffsetX","failOffsetY","minDist","transformPanGestureHandlerProps","res","undefined","activeOffsetXStart","activeOffsetXEnd","activeOffsetYStart","activeOffsetYEnd","failOffsetXStart","failOffsetXEnd","failOffsetYStart","failOffsetYEnd","__DEV__"],"mappings":"AAAA,OAAOA,aAAP,MAA0B,iBAA1B;AACA,SAEEC,uBAFF,QAGO,wBAHP;AAKA,OAAO,MAAMC,sBAAsB,GAAG,CACpC,eADoC,EAEpC,eAFoC,EAGpC,aAHoC,EAIpC,aAJoC,EAKpC,SALoC,EAMpC,aANoC,EAOpC,cAPoC,EAQpC,cARoC,EASpC,aAToC,EAUpC,aAVoC,EAWpC,YAXoC,EAYpC,gCAZoC,CAA/B;AAeP,OAAO,MAAMC,kCAAkC,GAAG,CAChD,oBADgD,EAE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AAxB,EAA2B;AAChCG,MAAAA,GAAG,CAACQ,gBAAJ,GAAuBlB,KAAK,CAACO,WAA7B;AACD,KAFM,MAEA;AACLG,MAAAA,GAAG,CAACS,cAAJ,GAAqBnB,KAAK,CAACO,WAA3B;AACD;AACF;;AAED,SAAOG,GAAP;AACD;;AAED,OAAO,SAASb,cAAT,CAAwBG,KAAxB,EAAuD;AAC5D,MAAIoB,OAAJ,EAAa;AACXrB,IAAAA,8BAA8B,CAACC,KAAD,CAA9B;AACD;;AACD,SAAOS,+BAA+B,CAACT,KAAD,CAAtC;AACD","sourcesContent":["import createHandler from './createHandler';\nimport {\n BaseGestureHandlerProps,\n baseGestureHandlerProps,\n} from './gestureHandlerCommon';\n\nexport const panGestureHandlerProps = [\n 'activeOffsetY',\n 'activeOffsetX',\n 'failOffsetY',\n 'failOffsetX',\n 'minDist',\n 'minVelocity',\n 'minVelocityX',\n 'minVelocityY',\n 'minPointers',\n 'maxPointers',\n 'avgTouches',\n 'enableTrackpadTwoFingerGesture',\n] as const;\n\nexport const panGestureHandlerCustomNativeProps = [\n 'activeOffsetYStart',\n 'activeOffsetYEnd',\n 'activeOffsetXStart',\n 'activeOffsetXEnd',\n 'failOffsetYStart',\n 'failOffsetYEnd',\n 'failOffsetXStart',\n 'failOffsetXEnd',\n] as const;\n\nexport type PanGestureHandlerEventPayload = {\n /**\n * X coordinate of the current position of the pointer (finger or a leading\n * pointer when there are multiple fingers placed) relative to the view\n * attached to the handler. Expressed in point units.\n */\n x: number;\n\n /**\n * Y coordinate of the current position of the pointer (finger or a leading\n * pointer when there are multiple fingers placed) relative to the view\n * attached to the handler. Expressed in point units.\n */\n y: number;\n\n /**\n * X coordinate of the current position of the pointer (finger or a leading\n * pointer when there are multiple fingers placed) relative to the root view.\n * The value is expressed in point units. It is recommended to use it instead\n * of `x` in cases when the original view can be transformed as an effect of\n * the gesture.\n */\n absoluteX: number;\n\n /**\n * Y coordinate of the current position of the pointer (finger or a leading\n * pointer when there are multiple fingers placed) relative to the root view.\n * The value is expressed in point units. It is recommended to use it instead\n * of `y` in cases when the original view can be transformed as an\n * effect of the gesture.\n */\n absoluteY: number;\n\n /**\n * Translation of the pan gesture along X axis accumulated over the time of\n * the gesture. The value is expressed in the point units.\n */\n translationX: number;\n\n /**\n * Translation of the pan gesture along Y axis accumulated over the time of\n * the gesture. The value is expressed in the point units.\n */\n translationY: number;\n\n /**\n * Velocity of the pan gesture along the X axis in the current moment. The\n * value is expressed in point units per second.\n */\n velocityX: number;\n\n /**\n * Velocity of the pan gesture along the Y axis in the current moment. The\n * value is expressed in point units per second.\n */\n velocityY: number;\n};\n\ninterface CommonPanProperties {\n /**\n * Minimum distance the finger (or multiple finger) need to travel before the\n * handler activates. Expressed in points.\n */\n minDist?: number;\n\n /**\n * Android only.\n */\n avgTouches?: boolean;\n\n /**\n * Enables two-finger gestures on supported devices, for example iPads with\n * trackpads. If not enabled the gesture will require click + drag, with\n * enableTrackpadTwoFingerGesture swiping with two fingers will also trigger\n * the gesture.\n */\n enableTrackpadTwoFingerGesture?: boolean;\n\n /**\n * A number of fingers that is required to be placed before handler can\n * activate. Should be a higher or equal to 0 integer.\n */\n minPointers?: number;\n\n /**\n * When the given number of fingers is placed on the screen and handler hasn't\n * yet activated it will fail recognizing the gesture. Should be a higher or\n * equal to 0 integer.\n */\n maxPointers?: number;\n\n minVelocity?: number;\n minVelocityX?: number;\n minVelocityY?: number;\n}\n\nexport interface PanGestureConfig extends CommonPanProperties {\n activeOffsetYStart?: number;\n activeOffsetYEnd?: number;\n activeOffsetXStart?: number;\n activeOffsetXEnd?: number;\n failOffsetYStart?: number;\n failOffsetYEnd?: number;\n failOffsetXStart?: number;\n failOffsetXEnd?: number;\n}\n\nexport interface PanGestureHandlerProps\n extends BaseGestureHandlerProps<PanGestureHandlerEventPayload>,\n CommonPanProperties {\n /**\n * Range along X axis (in points) where fingers travels without activation of\n * handler. Moving outside of this range implies activation of handler. Range\n * can be given as an array or a single number. If range is set as an array,\n * first value must be lower or equal to 0, a the second one higher or equal\n * to 0. If only one number `p` is given a range of `(-inf, p)` will be used\n * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.\n */\n activeOffsetY?: number | number[];\n\n /**\n * Range along X axis (in points) where fingers travels without activation of\n * handler. Moving outside of this range implies activation of handler. Range\n * can be given as an array or a single number. If range is set as an array,\n * first value must be lower or equal to 0, a the second one higher or equal\n * to 0. If only one number `p` is given a range of `(-inf, p)` will be used\n * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.\n */\n activeOffsetX?: number | number[];\n\n /**\n * When the finger moves outside this range (in points) along Y axis and\n * handler hasn't yet activated it will fail recognizing the gesture. Range\n * can be given as an array or a single number. If range is set as an array,\n * first value must be lower or equal to 0, a the second one higher or equal\n * to 0. If only one number `p` is given a range of `(-inf, p)` will be used\n * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.\n */\n failOffsetY?: number | number[];\n\n /**\n * When the finger moves outside this range (in points) along X axis and\n * handler hasn't yet activated it will fail recognizing the gesture. Range\n * can be given as an array or a single number. If range is set as an array,\n * first value must be lower or equal to 0, a the second one higher or equal\n * to 0. If only one number `p` is given a range of `(-inf, p)` will be used\n * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.\n */\n failOffsetX?: number | number[];\n}\n\nexport type PanGestureHandler = typeof PanGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file\nexport const PanGestureHandler = createHandler<\n PanGestureHandlerProps,\n PanGestureHandlerEventPayload\n>({\n name: 'PanGestureHandler',\n allowedProps: [\n ...baseGestureHandlerProps,\n ...panGestureHandlerProps,\n ] as const,\n config: {},\n transformProps: managePanProps,\n customNativeProps: panGestureHandlerCustomNativeProps,\n});\n\nfunction validatePanGestureHandlerProps(props: PanGestureHandlerProps) {\n if (\n Array.isArray(props.activeOffsetX) &&\n (props.activeOffsetX[0] > 0 || props.activeOffsetX[1] < 0)\n ) {\n throw new Error(\n `First element of activeOffsetX should be negative, a the second one should be positive`\n );\n }\n\n if (\n Array.isArray(props.activeOffsetY) &&\n (props.activeOffsetY[0] > 0 || props.activeOffsetY[1] < 0)\n ) {\n throw new Error(\n `First element of activeOffsetY should be negative, a the second one should be positive`\n );\n }\n\n if (\n Array.isArray(props.failOffsetX) &&\n (props.failOffsetX[0] > 0 || props.failOffsetX[1] < 0)\n ) {\n throw new Error(\n `First element of failOffsetX should be negative, a the second one should be positive`\n );\n }\n\n if (\n Array.isArray(props.failOffsetY) &&\n (props.failOffsetY[0] > 0 || props.failOffsetY[1] < 0)\n ) {\n throw new Error(\n `First element of failOffsetY should be negative, a the second one should be positive`\n );\n }\n\n if (props.minDist && (props.failOffsetX || props.failOffsetY)) {\n throw new Error(\n `It is not supported to use minDist with failOffsetX or failOffsetY, use activeOffsetX and activeOffsetY instead`\n );\n }\n\n if (props.minDist && (props.activeOffsetX || props.activeOffsetY)) {\n throw new Error(\n `It is not supported to use minDist with activeOffsetX or activeOffsetY`\n );\n }\n}\n\nfunction transformPanGestureHandlerProps(props: PanGestureHandlerProps) {\n type InternalPanGHKeys =\n | 'activeOffsetXStart'\n | 'activeOffsetXEnd'\n | 'failOffsetXStart'\n | 'failOffsetXEnd'\n | 'activeOffsetYStart'\n | 'activeOffsetYEnd'\n | 'failOffsetYStart'\n | 'failOffsetYEnd';\n type PanGestureHandlerInternalProps = PanGestureHandlerProps &\n Partial<Record<InternalPanGHKeys, number>>;\n\n const res: PanGestureHandlerInternalProps = { ...props };\n\n if (props.activeOffsetX !== undefined) {\n delete res.activeOffsetX;\n if (Array.isArray(props.activeOffsetX)) {\n res.activeOffsetXStart = props.activeOffsetX[0];\n res.activeOffsetXEnd = props.activeOffsetX[1];\n } else if (props.activeOffsetX < 0) {\n res.activeOffsetXStart = props.activeOffsetX;\n } else {\n res.activeOffsetXEnd = props.activeOffsetX;\n }\n }\n\n if (props.activeOffsetY !== undefined) {\n delete res.activeOffsetY;\n if (Array.isArray(props.activeOffsetY)) {\n res.activeOffsetYStart = props.activeOffsetY[0];\n res.activeOffsetYEnd = props.activeOffsetY[1];\n } else if (props.activeOffsetY < 0) {\n res.activeOffsetYStart = props.activeOffsetY;\n } else {\n res.activeOffsetYEnd = props.activeOffsetY;\n }\n }\n\n if (props.failOffsetX !== undefined) {\n delete res.failOffsetX;\n if (Array.isArray(props.failOffsetX)) {\n res.failOffsetXStart = props.failOffsetX[0];\n res.failOffsetXEnd = props.failOffsetX[1];\n } else if (props.failOffsetX < 0) {\n res.failOffsetXStart = props.failOffsetX;\n } else {\n res.failOffsetXEnd = props.failOffsetX;\n }\n }\n\n if (props.failOffsetY !== undefined) {\n delete res.failOffsetY;\n if (Array.isArray(props.failOffsetY)) {\n res.failOffsetYStart = props.failOffsetY[0];\n res.failOffsetYEnd = props.failOffsetY[1];\n } else if (props.failOffsetY < 0) {\n res.failOffsetYStart = props.failOffsetY;\n } else {\n res.failOffsetYEnd = props.failOffsetY;\n }\n }\n\n return res;\n}\n\nexport function managePanProps(props: PanGestureHandlerProps) {\n if (__DEV__) {\n validatePanGestureHandlerProps(props);\n }\n return transformPanGestureHandlerProps(props);\n}\n"]}
1
+ {"version":3,"sources":["PanGestureHandler.ts"],"names":["createHandler","baseGestureHandlerProps","panGestureHandlerProps","panGestureHandlerCustomNativeProps","PanGestureHandler","name","allowedProps","config","transformProps","managePanProps","customNativeProps","validatePanGestureHandlerProps","props","Array","isArray","activeOffsetX","Error","activeOffsetY","failOffsetX","failOffsetY","minDist","transformPanGestureHandlerProps","res","undefined","activeOffsetXStart","activeOffsetXEnd","activeOffsetYStart","activeOffsetYEnd","failOffsetXStart","failOffsetXEnd","failOffsetYStart","failOffsetYEnd","__DEV__"],"mappings":"AAAA,OAAOA,aAAP,MAA0B,iBAA1B;AACA,SAEEC,uBAFF,QAGO,wBAHP;AAKA,OAAO,MAAMC,sBAAsB,GAAG,CACpC,eADoC,EAEpC,eAFoC,EAGpC,aAHoC,EAIpC,aAJoC,EAKpC,SALoC,EAMpC,aANoC,E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B,CAAvB;AACAG,MAAAA,GAAG,CAACS,cAAJ,GAAqBnB,KAAK,CAACO,WAAN,CAAkB,CAAlB,CAArB;AACD,KAHD,MAGO,IAAIP,KAAK,CAACO,WAAN,GAAoB,CAAxB,EAA2B;AAChCG,MAAAA,GAAG,CAACQ,gBAAJ,GAAuBlB,KAAK,CAACO,WAA7B;AACD,KAFM,MAEA;AACLG,MAAAA,GAAG,CAACS,cAAJ,GAAqBnB,KAAK,CAACO,WAA3B;AACD;AACF;;AAED,SAAOG,GAAP;AACD;;AAED,OAAO,SAASb,cAAT,CAAwBG,KAAxB,EAAuD;AAC5D,MAAIoB,OAAJ,EAAa;AACXrB,IAAAA,8BAA8B,CAACC,KAAD,CAA9B;AACD;;AACD,SAAOS,+BAA+B,CAACT,KAAD,CAAtC;AACD","sourcesContent":["import createHandler from './createHandler';\nimport {\n BaseGestureHandlerProps,\n baseGestureHandlerProps,\n} from './gestureHandlerCommon';\n\nexport const panGestureHandlerProps = [\n 'activeOffsetY',\n 'activeOffsetX',\n 'failOffsetY',\n 'failOffsetX',\n 'minDist',\n 'minVelocity',\n 'minVelocityX',\n 'minVelocityY',\n 'minPointers',\n 'maxPointers',\n 'avgTouches',\n 'enableTrackpadTwoFingerGesture',\n] as const;\n\nexport const panGestureHandlerCustomNativeProps = [\n 'activeOffsetYStart',\n 'activeOffsetYEnd',\n 'activeOffsetXStart',\n 'activeOffsetXEnd',\n 'failOffsetYStart',\n 'failOffsetYEnd',\n 'failOffsetXStart',\n 'failOffsetXEnd',\n] as const;\n\nexport type PanGestureHandlerEventPayload = {\n /**\n * X coordinate of the current position of the pointer (finger or a leading\n * pointer when there are multiple fingers placed) relative to the view\n * attached to the handler. Expressed in point units.\n */\n x: number;\n\n /**\n * Y coordinate of the current position of the pointer (finger or a leading\n * pointer when there are multiple fingers placed) relative to the view\n * attached to the handler. Expressed in point units.\n */\n y: number;\n\n /**\n * X coordinate of the current position of the pointer (finger or a leading\n * pointer when there are multiple fingers placed) relative to the window.\n * The value is expressed in point units. It is recommended to use it instead\n * of `x` in cases when the original view can be transformed as an effect of\n * the gesture.\n */\n absoluteX: number;\n\n /**\n * Y coordinate of the current position of the pointer (finger or a leading\n * pointer when there are multiple fingers placed) relative to the window.\n * The value is expressed in point units. It is recommended to use it instead\n * of `y` in cases when the original view can be transformed as an\n * effect of the gesture.\n */\n absoluteY: number;\n\n /**\n * Translation of the pan gesture along X axis accumulated over the time of\n * the gesture. The value is expressed in the point units.\n */\n translationX: number;\n\n /**\n * Translation of the pan gesture along Y axis accumulated over the time of\n * the gesture. The value is expressed in the point units.\n */\n translationY: number;\n\n /**\n * Velocity of the pan gesture along the X axis in the current moment. The\n * value is expressed in point units per second.\n */\n velocityX: number;\n\n /**\n * Velocity of the pan gesture along the Y axis in the current moment. The\n * value is expressed in point units per second.\n */\n velocityY: number;\n};\n\ninterface CommonPanProperties {\n /**\n * Minimum distance the finger (or multiple finger) need to travel before the\n * handler activates. Expressed in points.\n */\n minDist?: number;\n\n /**\n * Android only.\n */\n avgTouches?: boolean;\n\n /**\n * Enables two-finger gestures on supported devices, for example iPads with\n * trackpads. If not enabled the gesture will require click + drag, with\n * enableTrackpadTwoFingerGesture swiping with two fingers will also trigger\n * the gesture.\n */\n enableTrackpadTwoFingerGesture?: boolean;\n\n /**\n * A number of fingers that is required to be placed before handler can\n * activate. Should be a higher or equal to 0 integer.\n */\n minPointers?: number;\n\n /**\n * When the given number of fingers is placed on the screen and handler hasn't\n * yet activated it will fail recognizing the gesture. Should be a higher or\n * equal to 0 integer.\n */\n maxPointers?: number;\n\n minVelocity?: number;\n minVelocityX?: number;\n minVelocityY?: number;\n}\n\nexport interface PanGestureConfig extends CommonPanProperties {\n activeOffsetYStart?: number;\n activeOffsetYEnd?: number;\n activeOffsetXStart?: number;\n activeOffsetXEnd?: number;\n failOffsetYStart?: number;\n failOffsetYEnd?: number;\n failOffsetXStart?: number;\n failOffsetXEnd?: number;\n}\n\nexport interface PanGestureHandlerProps\n extends BaseGestureHandlerProps<PanGestureHandlerEventPayload>,\n CommonPanProperties {\n /**\n * Range along X axis (in points) where fingers travels without activation of\n * handler. Moving outside of this range implies activation of handler. Range\n * can be given as an array or a single number. If range is set as an array,\n * first value must be lower or equal to 0, a the second one higher or equal\n * to 0. If only one number `p` is given a range of `(-inf, p)` will be used\n * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.\n */\n activeOffsetY?: number | number[];\n\n /**\n * Range along X axis (in points) where fingers travels without activation of\n * handler. Moving outside of this range implies activation of handler. Range\n * can be given as an array or a single number. If range is set as an array,\n * first value must be lower or equal to 0, a the second one higher or equal\n * to 0. If only one number `p` is given a range of `(-inf, p)` will be used\n * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.\n */\n activeOffsetX?: number | number[];\n\n /**\n * When the finger moves outside this range (in points) along Y axis and\n * handler hasn't yet activated it will fail recognizing the gesture. Range\n * can be given as an array or a single number. If range is set as an array,\n * first value must be lower or equal to 0, a the second one higher or equal\n * to 0. If only one number `p` is given a range of `(-inf, p)` will be used\n * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.\n */\n failOffsetY?: number | number[];\n\n /**\n * When the finger moves outside this range (in points) along X axis and\n * handler hasn't yet activated it will fail recognizing the gesture. Range\n * can be given as an array or a single number. If range is set as an array,\n * first value must be lower or equal to 0, a the second one higher or equal\n * to 0. If only one number `p` is given a range of `(-inf, p)` will be used\n * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.\n */\n failOffsetX?: number | number[];\n}\n\nexport type PanGestureHandler = typeof PanGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file\nexport const PanGestureHandler = createHandler<\n PanGestureHandlerProps,\n PanGestureHandlerEventPayload\n>({\n name: 'PanGestureHandler',\n allowedProps: [\n ...baseGestureHandlerProps,\n ...panGestureHandlerProps,\n ] as const,\n config: {},\n transformProps: managePanProps,\n customNativeProps: panGestureHandlerCustomNativeProps,\n});\n\nfunction validatePanGestureHandlerProps(props: PanGestureHandlerProps) {\n if (\n Array.isArray(props.activeOffsetX) &&\n (props.activeOffsetX[0] > 0 || props.activeOffsetX[1] < 0)\n ) {\n throw new Error(\n `First element of activeOffsetX should be negative, a the second one should be positive`\n );\n }\n\n if (\n Array.isArray(props.activeOffsetY) &&\n (props.activeOffsetY[0] > 0 || props.activeOffsetY[1] < 0)\n ) {\n throw new Error(\n `First element of activeOffsetY should be negative, a the second one should be positive`\n );\n }\n\n if (\n Array.isArray(props.failOffsetX) &&\n (props.failOffsetX[0] > 0 || props.failOffsetX[1] < 0)\n ) {\n throw new Error(\n `First element of failOffsetX should be negative, a the second one should be positive`\n );\n }\n\n if (\n Array.isArray(props.failOffsetY) &&\n (props.failOffsetY[0] > 0 || props.failOffsetY[1] < 0)\n ) {\n throw new Error(\n `First element of failOffsetY should be negative, a the second one should be positive`\n );\n }\n\n if (props.minDist && (props.failOffsetX || props.failOffsetY)) {\n throw new Error(\n `It is not supported to use minDist with failOffsetX or failOffsetY, use activeOffsetX and activeOffsetY instead`\n );\n }\n\n if (props.minDist && (props.activeOffsetX || props.activeOffsetY)) {\n throw new Error(\n `It is not supported to use minDist with activeOffsetX or activeOffsetY`\n );\n }\n}\n\nfunction transformPanGestureHandlerProps(props: PanGestureHandlerProps) {\n type InternalPanGHKeys =\n | 'activeOffsetXStart'\n | 'activeOffsetXEnd'\n | 'failOffsetXStart'\n | 'failOffsetXEnd'\n | 'activeOffsetYStart'\n | 'activeOffsetYEnd'\n | 'failOffsetYStart'\n | 'failOffsetYEnd';\n type PanGestureHandlerInternalProps = PanGestureHandlerProps &\n Partial<Record<InternalPanGHKeys, number>>;\n\n const res: PanGestureHandlerInternalProps = { ...props };\n\n if (props.activeOffsetX !== undefined) {\n delete res.activeOffsetX;\n if (Array.isArray(props.activeOffsetX)) {\n res.activeOffsetXStart = props.activeOffsetX[0];\n res.activeOffsetXEnd = props.activeOffsetX[1];\n } else if (props.activeOffsetX < 0) {\n res.activeOffsetXStart = props.activeOffsetX;\n } else {\n res.activeOffsetXEnd = props.activeOffsetX;\n }\n }\n\n if (props.activeOffsetY !== undefined) {\n delete res.activeOffsetY;\n if (Array.isArray(props.activeOffsetY)) {\n res.activeOffsetYStart = props.activeOffsetY[0];\n res.activeOffsetYEnd = props.activeOffsetY[1];\n } else if (props.activeOffsetY < 0) {\n res.activeOffsetYStart = props.activeOffsetY;\n } else {\n res.activeOffsetYEnd = props.activeOffsetY;\n }\n }\n\n if (props.failOffsetX !== undefined) {\n delete res.failOffsetX;\n if (Array.isArray(props.failOffsetX)) {\n res.failOffsetXStart = props.failOffsetX[0];\n res.failOffsetXEnd = props.failOffsetX[1];\n } else if (props.failOffsetX < 0) {\n res.failOffsetXStart = props.failOffsetX;\n } else {\n res.failOffsetXEnd = props.failOffsetX;\n }\n }\n\n if (props.failOffsetY !== undefined) {\n delete res.failOffsetY;\n if (Array.isArray(props.failOffsetY)) {\n res.failOffsetYStart = props.failOffsetY[0];\n res.failOffsetYEnd = props.failOffsetY[1];\n } else if (props.failOffsetY < 0) {\n res.failOffsetYStart = props.failOffsetY;\n } else {\n res.failOffsetYEnd = props.failOffsetY;\n }\n }\n\n return res;\n}\n\nexport function managePanProps(props: PanGestureHandlerProps) {\n if (__DEV__) {\n validatePanGestureHandlerProps(props);\n }\n return transformPanGestureHandlerProps(props);\n}\n"]}
@@ -14,6 +14,8 @@ import { panGestureHandlerProps, panGestureHandlerCustomNativeProps } from '../P
14
14
  import { tapGestureHandlerProps } from '../TapGestureHandler';
15
15
  import { State } from '../../State';
16
16
  import { EventType } from '../../EventType';
17
+ import { Platform } from 'react-native';
18
+ import { onGestureHandlerEvent } from './eventReceiver';
17
19
  const ALLOWED_PROPS = [...baseGestureHandlerWithMonitorProps, ...tapGestureHandlerProps, ...panGestureHandlerProps, ...panGestureHandlerCustomNativeProps, ...longPressGestureHandlerProps, ...forceTouchGestureHandlerProps, ...flingGestureHandlerProps];
18
20
 
19
21
  function convertToHandlerTag(ref) {
@@ -48,7 +50,8 @@ function attachHandlers({
48
50
  gestureConfig,
49
51
  gesture,
50
52
  viewTag,
51
- useAnimated
53
+ useAnimated,
54
+ webEventHandlersRef
52
55
  }) {
53
56
  if (!preparedGesture.firstExecution) {
54
57
  gestureConfig === null || gestureConfig === void 0 ? void 0 : gestureConfig.initialize();
@@ -90,8 +93,13 @@ function attachHandlers({
90
93
  preparedGesture.config = gesture;
91
94
 
92
95
  for (const gesture of preparedGesture.config) {
93
- RNGestureHandlerModule.attachGestureHandler(gesture.handlerTag, viewTag, !useAnimated // send direct events when using animatedGesture, device events otherwise
94
- );
96
+ if (Platform.OS === 'web') {
97
+ RNGestureHandlerModule.attachGestureHandler(gesture.handlerTag, viewTag, !useAnimated, // send direct events when using animatedGesture, device events otherwise
98
+ webEventHandlersRef);
99
+ } else {
100
+ RNGestureHandlerModule.attachGestureHandler(gesture.handlerTag, viewTag, !useAnimated // send direct events when using animatedGesture, device events otherwise
101
+ );
102
+ }
95
103
  }
96
104
 
97
105
  if (preparedGesture.animatedHandlers) {
@@ -103,9 +111,13 @@ function updateHandlers(preparedGesture, gestureConfig, gesture) {
103
111
  gestureConfig === null || gestureConfig === void 0 ? void 0 : gestureConfig.prepare();
104
112
 
105
113
  for (let i = 0; i < gesture.length; i++) {
106
- const handler = preparedGesture.config[i];
107
- gesture[i].handlerTag = handler.handlerTag;
108
- gesture[i].handlers.handlerTag = handler.handlerTag;
114
+ const handler = preparedGesture.config[i]; // only update handlerTag when it's actually different, it may be the same
115
+ // if gesture config object is wrapped with useMemo
116
+
117
+ if (gesture[i].handlerTag !== handler.handlerTag) {
118
+ gesture[i].handlerTag = handler.handlerTag;
119
+ gesture[i].handlers.handlerTag = handler.handlerTag;
120
+ }
109
121
  } // use setImmediate to extract handlerTags, because when it's ran, all refs should be updated
110
122
  // and handlerTags in BaseGesture references should be updated in the loop above (we need to wait
111
123
  // in case of external relations)
@@ -116,7 +128,6 @@ function updateHandlers(preparedGesture, gestureConfig, gesture) {
116
128
  const handler = preparedGesture.config[i];
117
129
  handler.config = gesture[i].config;
118
130
  handler.handlers = gesture[i].handlers;
119
- handler.handlers.handlerTag = handler.handlerTag;
120
131
  const requireToFail = extractValidHandlerTags(handler.config.requireToFail);
121
132
  const simultaneousWith = extractValidHandlerTags(handler.config.simultaneousWith);
122
133
  RNGestureHandlerModule.updateGestureHandler(handler.handlerTag, filterConfig(handler.config, ALLOWED_PROPS, {
@@ -146,7 +157,7 @@ function needsToReattach(preparedGesture, gesture) {
146
157
  return false;
147
158
  }
148
159
 
149
- function useAnimatedGesture(preparedGesture) {
160
+ function useAnimatedGesture(preparedGesture, needsRebuild) {
150
161
  if (!Reanimated) {
151
162
  return;
152
163
  }
@@ -297,7 +308,7 @@ function useAnimatedGesture(preparedGesture) {
297
308
  }; // eslint-disable-next-line react-hooks/rules-of-hooks
298
309
 
299
310
 
300
- const event = Reanimated.useEvent(callback, ['onGestureHandlerStateChange', 'onGestureHandlerEvent'], true);
311
+ const event = Reanimated.useEvent(callback, ['onGestureHandlerStateChange', 'onGestureHandlerEvent'], needsRebuild);
301
312
  preparedGesture.animatedEventHandler = event;
302
313
  preparedGesture.animatedHandlers = sharedHandlersCallbacks;
303
314
  }
@@ -310,6 +321,11 @@ export const GestureDetector = props => {
310
321
  const useAnimated = gesture.find(gesture => gesture.handlers.isWorklet.reduce((prev, current) => prev || current)) != null;
311
322
  const viewRef = useRef(null);
312
323
  const firstRenderRef = useRef(true);
324
+ const webEventHandlersRef = useRef({
325
+ onGestureHandlerEvent: e => {
326
+ onGestureHandlerEvent(e.nativeEvent);
327
+ }
328
+ });
313
329
  const preparedGesture = React.useRef({
314
330
  config: gesture,
315
331
  animatedEventHandler: null,
@@ -320,7 +336,11 @@ export const GestureDetector = props => {
320
336
 
321
337
  if (useAnimated !== preparedGesture.useAnimated) {
322
338
  throw new Error('You cannot change whether you are using gesture or animatedGesture while the app is running');
323
- }
339
+ } // Reanimated event should be rebuilt only when gestures are reattached, otherwise
340
+ // config update will be enough as all necessary items are stored in shared values anyway
341
+
342
+
343
+ const needsToRebuildReanimatedEvent = preparedGesture.firstExecution || needsToReattach(preparedGesture, gesture);
324
344
 
325
345
  if (preparedGesture.firstExecution) {
326
346
  var _gestureConfig$initia;
@@ -332,7 +352,7 @@ export const GestureDetector = props => {
332
352
  // Whether animatedGesture or gesture is used shouldn't change
333
353
  // during while an app is running
334
354
  // eslint-disable-next-line react-hooks/rules-of-hooks
335
- useAnimatedGesture(preparedGesture);
355
+ useAnimatedGesture(preparedGesture, needsToRebuildReanimatedEvent);
336
356
  }
337
357
 
338
358
  useEffect(() => {
@@ -343,7 +363,8 @@ export const GestureDetector = props => {
343
363
  gestureConfig,
344
364
  gesture,
345
365
  viewTag,
346
- useAnimated
366
+ useAnimated,
367
+ webEventHandlersRef
347
368
  });
348
369
  return () => {
349
370
  dropHandlers(preparedGesture);
@@ -360,7 +381,8 @@ export const GestureDetector = props => {
360
381
  gestureConfig,
361
382
  gesture,
362
383
  viewTag,
363
- useAnimated
384
+ useAnimated,
385
+ webEventHandlersRef
364
386
  });
365
387
  } else {
366
388
  updateHandlers(preparedGesture, gestureConfig, gesture);
@@ -1 +1 @@
1
- {"version":3,"sources":["GestureDetector.tsx"],"names":["React","useEffect","useRef","BaseGesture","CALLBACK_TYPE","Reanimated","registerHandler","unregisterHandler","RNGestureHandlerModule","baseGestureHandlerWithMonitorProps","filterConfig","findNodeHandle","GestureStateManager","flingGestureHandlerProps","forceTouchGestureHandlerProps","longPressGestureHandlerProps","panGestureHandlerProps","panGestureHandlerCustomNativeProps","tapGestureHandlerProps","State","EventType","ALLOWED_PROPS","convertToHandlerTag","ref","handlerTag","current","extractValidHandlerTags","interactionGroup","map","filter","tag","dropHandlers","preparedGesture","handler","config","dropGestureHandler","attachHandlers","gestureConfig","gesture","viewTag","useAnimated","firstExecution","initialize","setImmediate","prepare","createGestureHandler","handlerName","requireToFail","simultaneousWith","updateGestureHandler","simultaneousHandlers","waitFor","attachGestureHandler","animatedHandlers","value","g","handlers","updateHandlers","i","length","needsToReattach","useAnimatedGesture","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","isWorklet","console","warn","sharedHandlersCallbacks","useSharedValue","lastUpdateEvent","stateControllers","callback","currentCallback","UNDETERMINED","state","ACTIVE","undefined","FAILED","CANCELLED","create","changeEventCalculator","useEvent","animatedEventHandler","GestureDetector","props","toGestureArray","find","reduce","prev","viewRef","firstRenderRef","Error","children","Wrap","Component","render","child","Children","only","cloneElement","collapsable","AnimatedWrap","default","createAnimatedComponent"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,MAA3B,QAAyC,OAAzC;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,QAOO,yBAPP;AAQA,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,KAAT,QAAsB,aAAtB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAGA,MAAMC,aAAa,GAAG,CACpB,GAAGZ,kCADiB,EAEpB,GAAGS,sBAFiB,EAGpB,GAAGF,sBAHiB,EAIpB,GAAGC,kCAJiB,EAKpB,GAA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CArFM;;AAuFP,MAAMC,IAAN,SAAmB1H,KAAK,CAAC2H,SAAzB,CAAwE;AACtEC,EAAAA,MAAM,GAAG;AACP;AACA;AACA;AACA;AACA;AACA,UAAMC,KAAU,GAAG7H,KAAK,CAAC8H,QAAN,CAAeC,IAAf,CAAoB,KAAKd,KAAL,CAAWQ,QAA/B,CAAnB;AAEA,wBAAOzH,KAAK,CAACgI,YAAN,CACLH,KADK,EAEL;AAAEI,MAAAA,WAAW,EAAE;AAAf,KAFK,EAGL;AACAJ,IAAAA,KAAK,CAACZ,KAAN,CAAYQ,QAJP,CAAP;AAMD;;AAfqE;;AAkBxE,MAAMS,YAAY,4BAAG7H,UAAH,aAAGA,UAAH,8CAAGA,UAAU,CAAE8H,OAAf,wDAAG,oBAAqBC,uBAArB,CAA6CV,IAA7C,CAAH,yEAAyDA,IAA3E","sourcesContent":["import React, { useEffect, useRef } 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} 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 { State } from '../../State';\nimport { EventType } from '../../EventType';\nimport { ComposedGesture } from './gestureComposition';\n\nconst ALLOWED_PROPS = [\n ...baseGestureHandlerWithMonitorProps,\n ...tapGestureHandlerProps,\n ...panGestureHandlerProps,\n ...panGestureHandlerCustomNativeProps,\n ...longPressGestureHandlerProps,\n ...forceTouchGestureHandlerProps,\n ...flingGestureHandlerProps,\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 useAnimated: 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);\n }\n}\n\ninterface AttachHandlersConfig {\n preparedGesture: GestureConfigReference;\n gestureConfig: ComposedGesture | GestureType | undefined;\n gesture: GestureType[];\n viewTag: number;\n useAnimated: boolean;\n}\n\nfunction attachHandlers({\n preparedGesture,\n gestureConfig,\n gesture,\n viewTag,\n useAnimated,\n}: AttachHandlersConfig) {\n if (!preparedGesture.firstExecution) {\n gestureConfig?.initialize();\n } else {\n preparedGesture.firstExecution = false;\n }\n\n // use setImmediate to extract handlerTags, because all refs should be initialized\n // when it's ran\n setImmediate(() => {\n gestureConfig?.prepare();\n });\n\n for (const handler of gesture) {\n RNGestureHandlerModule.createGestureHandler(\n handler.handlerName,\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS)\n );\n\n registerHandler(handler.handlerTag, handler);\n\n // use setImmediate to extract handlerTags, because all refs should be initialized\n // when it's ran\n setImmediate(() => {\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 RNGestureHandlerModule.updateGestureHandler(\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS, {\n simultaneousHandlers: simultaneousWith,\n waitFor: requireToFail,\n })\n );\n });\n }\n preparedGesture.config = gesture;\n\n for (const gesture of preparedGesture.config) {\n RNGestureHandlerModule.attachGestureHandler(\n gesture.handlerTag,\n viewTag,\n !useAnimated // send direct events when using animatedGesture, device events otherwise\n );\n }\n\n if (preparedGesture.animatedHandlers) {\n preparedGesture.animatedHandlers.value = (gesture.map(\n (g) => g.handlers\n ) as unknown) as HandlerCallbacks<Record<string, unknown>>[];\n }\n}\n\nfunction updateHandlers(\n preparedGesture: GestureConfigReference,\n gestureConfig: ComposedGesture | GestureType | undefined,\n gesture: GestureType[]\n) {\n gestureConfig?.prepare();\n\n for (let i = 0; i < gesture.length; i++) {\n const handler = preparedGesture.config[i];\n\n gesture[i].handlerTag = handler.handlerTag;\n gesture[i].handlers.handlerTag = handler.handlerTag;\n }\n\n // use setImmediate 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 setImmediate(() => {\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 handler.handlers.handlerTag = handler.handlerTag;\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);\n }\n\n if (preparedGesture.animatedHandlers) {\n preparedGesture.animatedHandlers.value = (preparedGesture.config.map(\n (g) => g.handlers\n ) as unknown) as HandlerCallbacks<Record<string, unknown>>[];\n }\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 (gesture[i].handlerName !== preparedGesture.config[i].handlerName) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction useAnimatedGesture(preparedGesture: GestureConfigReference) {\n if (!Reanimated) {\n return;\n }\n\n function 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\n function isTouchEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n ): event is GestureTouchEvent {\n 'worklet';\n return event.eventType != null;\n }\n\n function 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\n function touchEventTypeToCallbackType(eventType: EventType): CALLBACK_TYPE {\n 'worklet';\n switch (eventType) {\n case EventType.TOUCHES_DOWN:\n return CALLBACK_TYPE.TOUCHES_DOWN;\n case EventType.TOUCHES_MOVE:\n return CALLBACK_TYPE.TOUCHES_MOVE;\n case EventType.TOUCHES_UP:\n return CALLBACK_TYPE.TOUCHES_UP;\n case EventType.TOUCHES_CANCELLED:\n return CALLBACK_TYPE.TOUCHES_CANCELLED;\n }\n return CALLBACK_TYPE.UNDEFINED;\n }\n\n function 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('Animated gesture callback must be a worklet');\n }\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 !== EventType.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 true\n );\n\n preparedGesture.animatedEventHandler = event;\n preparedGesture.animatedHandlers = sharedHandlersCallbacks;\n}\n\ninterface GestureDetectorProps {\n gesture?: ComposedGesture | GestureType;\n}\nexport const GestureDetector: React.FunctionComponent<GestureDetectorProps> = (\n props\n) => {\n const gestureConfig = props.gesture;\n const gesture = gestureConfig?.toGestureArray?.() ?? [];\n const useAnimated =\n gesture.find((gesture) =>\n gesture.handlers.isWorklet.reduce((prev, current) => prev || current)\n ) != null;\n const viewRef = useRef(null);\n const firstRenderRef = useRef(true);\n\n const preparedGesture = React.useRef<GestureConfigReference>({\n config: gesture,\n animatedEventHandler: null,\n animatedHandlers: null,\n firstExecution: true,\n useAnimated: useAnimated,\n }).current;\n\n if (useAnimated !== preparedGesture.useAnimated) {\n throw new Error(\n 'You cannot change whether you are using gesture or animatedGesture while the app is running'\n );\n }\n\n if (preparedGesture.firstExecution) {\n gestureConfig?.initialize?.();\n }\n\n if (useAnimated) {\n // Whether animatedGesture or gesture is used shouldn't change\n // during while an app is running\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useAnimatedGesture(preparedGesture);\n }\n\n useEffect(() => {\n firstRenderRef.current = true;\n const viewTag = findNodeHandle(viewRef.current) as number;\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesture,\n viewTag,\n useAnimated,\n });\n\n return () => {\n dropHandlers(preparedGesture);\n };\n }, []);\n\n useEffect(() => {\n if (!firstRenderRef.current) {\n const viewTag = findNodeHandle(viewRef.current) as number;\n\n if (needsToReattach(preparedGesture, gesture)) {\n dropHandlers(preparedGesture);\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesture,\n viewTag,\n useAnimated,\n });\n } else {\n updateHandlers(preparedGesture, gestureConfig, gesture);\n }\n } else {\n firstRenderRef.current = false;\n }\n }, [props]);\n\n if (useAnimated) {\n return (\n <AnimatedWrap\n ref={viewRef}\n onGestureHandlerEvent={preparedGesture.animatedEventHandler}>\n {props.children}\n </AnimatedWrap>\n );\n } else {\n return <Wrap ref={viewRef}>{props.children}</Wrap>;\n }\n};\n\nclass Wrap extends React.Component<{ onGestureHandlerEvent?: unknown }> {\n render() {\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\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 }\n}\n\nconst AnimatedWrap = Reanimated?.default?.createAnimatedComponent(Wrap) ?? Wrap;\n"]}
1
+ {"version":3,"sources":["GestureDetector.tsx"],"names":["React","useEffect","useRef","BaseGesture","CALLBACK_TYPE","Reanimated","registerHandler","unregisterHandler","RNGestureHandlerModule","baseGestureHandlerWithMonitorProps","filterConfig","findNodeHandle","GestureStateManager","flingGestureHandlerProps","forceTouchGestureHandlerProps","longPressGestureHandlerProps","panGestureHandlerProps","panGestureHandlerCustomNativeProps","tapGestureHandlerProps","State","EventType","Platform","onGestureHandlerEvent","ALLOWED_PROPS","convertToHandlerTag","ref","handlerTag","current","extractValidHandlerTags","interactionGroup","map","filter","tag","dropHandlers","preparedGesture","handler","config","dropGestureHandler","attachHandlers","gestureConfig","gesture","viewTag","useAnimated","webEventHandlersRef","firstExecution","initialize","setImmediate","prepare","createGestureHandler","handlerName","requireToFail","simultaneousWith","updateGestureHandler","simultaneousHandlers","waitFor","OS","attachGestureHandler","animatedHandlers","value","g","handlers","updateHandlers","i","length","needsToReattach","useAnimatedGesture","needsRebuild","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","isWorklet","console","warn","sharedHandlersCallbacks","useSharedValue","lastUpdateEvent","stateControllers","callback","currentCallback","UNDETERMINED","state","ACTIVE","undefined","FAILED","CANCELLED","create","changeEventCalculator","useEvent","animatedEventHandler","GestureDetector","props","toGestureArray","find","reduce","prev","viewRef","firstRenderRef","e","nativeEvent","Error","needsToRebuildReanimatedEvent","children","Wrap","Component","render","child","Children","only","cloneElement","collapsable","AnimatedWrap","default","createAnimatedComponent"],"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OAGGE,KAAK,CAACW,QAHT,CADF;AAOD,GARD,MAQO;AACL,wBAAO,oBAAC,IAAD;AAAM,MAAA,GAAG,EAAEN;AAAX,OAAqBL,KAAK,CAACW,QAA3B,CAAP;AACD;AACF,CAjGM;;AAmGP,MAAMC,IAAN,SAAmBlI,KAAK,CAACmI,SAAzB,CAAwE;AACtEC,EAAAA,MAAM,GAAG;AACP;AACA;AACA;AACA;AACA;AACA,UAAMC,KAAU,GAAGrI,KAAK,CAACsI,QAAN,CAAeC,IAAf,CAAoB,KAAKjB,KAAL,CAAWW,QAA/B,CAAnB;AAEA,wBAAOjI,KAAK,CAACwI,YAAN,CACLH,KADK,EAEL;AAAEI,MAAAA,WAAW,EAAE;AAAf,KAFK,EAGL;AACAJ,IAAAA,KAAK,CAACf,KAAN,CAAYW,QAJP,CAAP;AAMD;;AAfqE;;AAkBxE,MAAMS,YAAY,4BAAGrI,UAAH,aAAGA,UAAH,8CAAGA,UAAU,CAAEsI,OAAf,wDAAG,oBAAqBC,uBAArB,CAA6CV,IAA7C,CAAH,yEAAyDA,IAA3E","sourcesContent":["import React, { useEffect, useRef } 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} 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 { State } from '../../State';\nimport { EventType } from '../../EventType';\nimport { ComposedGesture } from './gestureComposition';\nimport { Platform } from 'react-native';\nimport type RNGestureHandlerModuleWeb from '../../RNGestureHandlerModule.web';\nimport { onGestureHandlerEvent } from './eventReceiver';\n\nconst ALLOWED_PROPS = [\n ...baseGestureHandlerWithMonitorProps,\n ...tapGestureHandlerProps,\n ...panGestureHandlerProps,\n ...panGestureHandlerCustomNativeProps,\n ...longPressGestureHandlerProps,\n ...forceTouchGestureHandlerProps,\n ...flingGestureHandlerProps,\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 useAnimated: 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);\n }\n}\n\ninterface WebEventHandler {\n onGestureHandlerEvent: (event: HandlerStateChangeEvent<unknown>) => void;\n}\n\ninterface AttachHandlersConfig {\n preparedGesture: GestureConfigReference;\n gestureConfig: ComposedGesture | GestureType | undefined;\n gesture: GestureType[];\n viewTag: number;\n useAnimated: boolean;\n webEventHandlersRef: React.RefObject<WebEventHandler>;\n}\n\nfunction attachHandlers({\n preparedGesture,\n gestureConfig,\n gesture,\n viewTag,\n useAnimated,\n webEventHandlersRef,\n}: AttachHandlersConfig) {\n if (!preparedGesture.firstExecution) {\n gestureConfig?.initialize();\n } else {\n preparedGesture.firstExecution = false;\n }\n\n // use setImmediate to extract handlerTags, because all refs should be initialized\n // when it's ran\n setImmediate(() => {\n gestureConfig?.prepare();\n });\n\n for (const handler of gesture) {\n RNGestureHandlerModule.createGestureHandler(\n handler.handlerName,\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS)\n );\n\n registerHandler(handler.handlerTag, handler);\n\n // use setImmediate to extract handlerTags, because all refs should be initialized\n // when it's ran\n setImmediate(() => {\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 RNGestureHandlerModule.updateGestureHandler(\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS, {\n simultaneousHandlers: simultaneousWith,\n waitFor: requireToFail,\n })\n );\n });\n }\n preparedGesture.config = gesture;\n\n for (const gesture of preparedGesture.config) {\n if (Platform.OS === 'web') {\n (RNGestureHandlerModule.attachGestureHandler as typeof RNGestureHandlerModuleWeb.attachGestureHandler)(\n gesture.handlerTag,\n viewTag,\n !useAnimated, // send direct events when using animatedGesture, device events otherwise\n webEventHandlersRef\n );\n } else {\n RNGestureHandlerModule.attachGestureHandler(\n gesture.handlerTag,\n viewTag,\n !useAnimated // send direct events when using animatedGesture, device events otherwise\n );\n }\n }\n\n if (preparedGesture.animatedHandlers) {\n preparedGesture.animatedHandlers.value = (gesture.map(\n (g) => g.handlers\n ) as unknown) as HandlerCallbacks<Record<string, unknown>>[];\n }\n}\n\nfunction updateHandlers(\n preparedGesture: GestureConfigReference,\n gestureConfig: ComposedGesture | GestureType | undefined,\n gesture: GestureType[]\n) {\n gestureConfig?.prepare();\n\n for (let i = 0; i < gesture.length; i++) {\n const handler = preparedGesture.config[i];\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 setImmediate 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 setImmediate(() => {\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);\n }\n\n if (preparedGesture.animatedHandlers) {\n preparedGesture.animatedHandlers.value = (preparedGesture.config.map(\n (g) => g.handlers\n ) as unknown) as HandlerCallbacks<Record<string, unknown>>[];\n }\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 (gesture[i].handlerName !== preparedGesture.config[i].handlerName) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction useAnimatedGesture(\n preparedGesture: GestureConfigReference,\n needsRebuild: boolean\n) {\n if (!Reanimated) {\n return;\n }\n\n function 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\n function isTouchEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n ): event is GestureTouchEvent {\n 'worklet';\n return event.eventType != null;\n }\n\n function 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\n function touchEventTypeToCallbackType(eventType: EventType): CALLBACK_TYPE {\n 'worklet';\n switch (eventType) {\n case EventType.TOUCHES_DOWN:\n return CALLBACK_TYPE.TOUCHES_DOWN;\n case EventType.TOUCHES_MOVE:\n return CALLBACK_TYPE.TOUCHES_MOVE;\n case EventType.TOUCHES_UP:\n return CALLBACK_TYPE.TOUCHES_UP;\n case EventType.TOUCHES_CANCELLED:\n return CALLBACK_TYPE.TOUCHES_CANCELLED;\n }\n return CALLBACK_TYPE.UNDEFINED;\n }\n\n function 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('Animated gesture callback must be a worklet');\n }\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 !== EventType.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\ninterface GestureDetectorProps {\n gesture?: ComposedGesture | GestureType;\n}\nexport const GestureDetector: React.FunctionComponent<GestureDetectorProps> = (\n props\n) => {\n const gestureConfig = props.gesture;\n const gesture = gestureConfig?.toGestureArray?.() ?? [];\n const useAnimated =\n gesture.find((gesture) =>\n gesture.handlers.isWorklet.reduce((prev, current) => prev || current)\n ) != null;\n const viewRef = useRef(null);\n const firstRenderRef = useRef(true);\n const webEventHandlersRef = useRef<WebEventHandler>({\n onGestureHandlerEvent: (e: HandlerStateChangeEvent<unknown>) => {\n onGestureHandlerEvent(e.nativeEvent);\n },\n });\n\n const preparedGesture = React.useRef<GestureConfigReference>({\n config: gesture,\n animatedEventHandler: null,\n animatedHandlers: null,\n firstExecution: true,\n useAnimated: useAnimated,\n }).current;\n\n if (useAnimated !== preparedGesture.useAnimated) {\n throw new Error(\n 'You cannot change whether you are using gesture or animatedGesture while the app is running'\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 || needsToReattach(preparedGesture, gesture);\n\n if (preparedGesture.firstExecution) {\n gestureConfig?.initialize?.();\n }\n\n if (useAnimated) {\n // Whether animatedGesture or gesture is used shouldn't change\n // during while an app is running\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useAnimatedGesture(preparedGesture, needsToRebuildReanimatedEvent);\n }\n\n useEffect(() => {\n firstRenderRef.current = true;\n const viewTag = findNodeHandle(viewRef.current) as number;\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesture,\n viewTag,\n useAnimated,\n webEventHandlersRef,\n });\n\n return () => {\n dropHandlers(preparedGesture);\n };\n }, []);\n\n useEffect(() => {\n if (!firstRenderRef.current) {\n const viewTag = findNodeHandle(viewRef.current) as number;\n\n if (needsToReattach(preparedGesture, gesture)) {\n dropHandlers(preparedGesture);\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesture,\n viewTag,\n useAnimated,\n webEventHandlersRef,\n });\n } else {\n updateHandlers(preparedGesture, gestureConfig, gesture);\n }\n } else {\n firstRenderRef.current = false;\n }\n }, [props]);\n\n if (useAnimated) {\n return (\n <AnimatedWrap\n ref={viewRef}\n onGestureHandlerEvent={preparedGesture.animatedEventHandler}>\n {props.children}\n </AnimatedWrap>\n );\n } else {\n return <Wrap ref={viewRef}>{props.children}</Wrap>;\n }\n};\n\nclass Wrap extends React.Component<{ onGestureHandlerEvent?: unknown }> {\n render() {\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\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 }\n}\n\nconst AnimatedWrap = Reanimated?.default?.createAnimatedComponent(Wrap) ?? Wrap;\n"]}
@@ -29,7 +29,7 @@ function isTouchEvent(event) {
29
29
  return event.eventType != null;
30
30
  }
31
31
 
32
- function onGestureHandlerEvent(event) {
32
+ export function onGestureHandlerEvent(event) {
33
33
  var _handler$handlers7, _handler$handlers7$on, _handler$handlers8, _handler$handlers8$on, _handler$handlers9, _handler$handlers9$on, _handler$handlers10, _handler$handlers10$o;
34
34
 
35
35
  const handler = findHandler(event.handlerTag);
@@ -100,7 +100,6 @@ function onGestureHandlerEvent(event) {
100
100
  }
101
101
  }
102
102
  }
103
-
104
103
  export function startListening() {
105
104
  stopListening();
106
105
  gestureHandlerEventSubscription = DeviceEventEmitter.addListener('onGestureHandlerEvent', onGestureHandlerEvent);
@@ -1 +1 @@
1
- {"version":3,"sources":["eventReceiver.ts"],"names":["DeviceEventEmitter","State","EventType","findHandler","gestureHandlerEventSubscription","gestureHandlerStateChangeEventSubscription","dummyStateManager","begin","console","warn","activate","end","fail","lastUpdateEvent","isStateChangeEvent","event","oldState","isTouchEvent","eventType","onGestureHandlerEvent","handler","handlerTag","UNDETERMINED","state","BEGAN","handlers","onBegin","ACTIVE","onStart","END","onEnd","onFinalize","undefined","FAILED","CANCELLED","TOUCHES_DOWN","onTouchesDown","TOUCHES_MOVE","onTouchesMove","TOUCHES_UP","onTouchesUp","TOUCHES_CANCELLED","onTouchesCancelled","onUpdate","onChange","changeEventCalculator","startListening","stopListening","addListener","removeSubscription"],"mappings":"AAAA,SAASA,kBAAT,QAAwD,cAAxD;AACA,SAASC,KAAT,QAAsB,aAAtB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAOA,SAASC,WAAT,QAA4B,qBAA5B;AAGA,IAAIC,+BAA2D,GAAG,IAAlE;AACA,IAAIC,0CAAsE,GAAG,IAA7E;AAEA,MAAMC,iBAA0C,GAAG;AACjDC,EAAAA,KAAK,EAAE,MAAM;AACXC,IAAAA,OAAO,CAACC,IAAR,CACE,uFADF;AAGD,GALgD;AAMjDC,EAAAA,QAAQ,EAAE,MAAM;AACdF,IAAAA,OAAO,CAACC,IAAR,CACE,uFADF;AAGD,GAVgD;AAWjDE,EAAAA,GAAG,EAAE,MAAM;AACTH,IAAAA,OAAO,CAACC,IAAR,CACE,uFADF;AAGD,GAfgD;AAgBjDG,EAAAA,IAAI,EAAE,MAAM;AACVJ,IAAAA,OAAO,CAACC,IAAR,CACE,u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CAACK,QAAR,qGAAkBiB,kBAAlB,0GAAuC3B,KAAvC,EAA8CT,iBAA9C;AACA;AAZJ;AAcD,KAfM,MAeA;AAAA;;AACL,sDAAAc,OAAO,CAACK,QAAR,EAAiBkB,QAAjB,0GAA4B5B,KAA5B;;AAEA,UAAIK,OAAO,CAACK,QAAR,CAAiBmB,QAAjB,IAA6BxB,OAAO,CAACK,QAAR,CAAiBoB,qBAAlD,EAAyE;AAAA;;AACvE,wDAAAzB,OAAO,CAACK,QAAR,EAAiBmB,QAAjB,mIACE,uBAAAxB,OAAO,CAACK,QAAR,EAAiBoB,qBADnB,0DACE,gDACE9B,KADF,EAEEF,eAAe,CAACO,OAAO,CAACK,QAAR,CAAiBJ,UAAlB,CAFjB,CADF;AAOAR,QAAAA,eAAe,CAACO,OAAO,CAACK,QAAR,CAAiBJ,UAAlB,CAAf,GAA+CN,KAA/C;AACD;AACF;AACF;AACF;;AAED,OAAO,SAAS+B,cAAT,GAA0B;AAC/BC,EAAAA,aAAa;AAEb3C,EAAAA,+BAA+B,GAAGJ,kBAAkB,CAACgD,WAAnB,CAChC,uBADgC,EAEhC7B,qBAFgC,CAAlC;AAKAd,EAAAA,0CAA0C,GAAGL,kBAAkB,CAACgD,WAAnB,CAC3C,6BAD2C,EAE3C7B,qBAF2C,CAA7C;AAID;AAED,OAAO,SAAS4B,aAAT,GAAyB;AAC9B,MAAI3C,+BAAJ,EAAqC;AACnCJ,IAAAA,kBAAkB,CAACiD,kBAAnB,CAAsC7C,+BAAtC;AAEAA,IAAAA,+BAA+B,GAAG,IAAlC;AACD;;AAED,MAAIC,0CAAJ,EAAgD;AAC9CL,IAAAA,kBAAkB,CAACiD,kBAAnB,CACE5C,0CADF;AAIAA,IAAAA,0CAA0C,GAAG,IAA7C;AACD;AACF","sourcesContent":["import { DeviceEventEmitter, EmitterSubscription } from 'react-native';\nimport { State } from '../../State';\nimport { EventType } from '../../EventType';\nimport {\n GestureTouchEvent,\n GestureUpdateEvent,\n GestureStateChangeEvent,\n} from '../gestureHandlerCommon';\nimport { GestureStateManagerType } from './gestureStateManager';\nimport { findHandler } from '../handlersRegistry';\nimport { BaseGesture } from './gesture';\n\nlet gestureHandlerEventSubscription: EmitterSubscription | null = null;\nlet gestureHandlerStateChangeEventSubscription: EmitterSubscription | null = null;\n\nconst dummyStateManager: GestureStateManagerType = {\n begin: () => {\n console.warn(\n 'You have to use react-native-reanimated in order to control the state of the gesture.'\n );\n },\n activate: () => {\n console.warn(\n 'You have to use react-native-reanimated in order to control the state of the gesture.'\n );\n },\n end: () => {\n console.warn(\n 'You have to use react-native-reanimated in order to control the state of the gesture.'\n );\n },\n fail: () => {\n console.warn(\n 'You have to use react-native-reanimated in order to control the state of the gesture.'\n );\n },\n};\n\nconst lastUpdateEvent: (GestureUpdateEvent | undefined)[] = [];\n\nfunction isStateChangeEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n): event is GestureStateChangeEvent {\n // @ts-ignore oldState doesn't exist on GestureTouchEvent and that's the point\n return event.oldState != null;\n}\n\nfunction isTouchEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n): event is GestureTouchEvent {\n return event.eventType != null;\n}\n\nfunction onGestureHandlerEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n) {\n const handler = findHandler(event.handlerTag) as BaseGesture<\n Record<string, unknown>\n >;\n\n if (handler) {\n if (isStateChangeEvent(event)) {\n if (\n event.oldState === State.UNDETERMINED &&\n event.state === State.BEGAN\n ) {\n handler.handlers.onBegin?.(event);\n } else if (\n (event.oldState === State.BEGAN ||\n event.oldState === State.UNDETERMINED) &&\n event.state === State.ACTIVE\n ) {\n handler.handlers.onStart?.(event);\n lastUpdateEvent[handler.handlers.handlerTag] = event;\n } else if (event.oldState !== event.state && event.state === State.END) {\n if (event.oldState === State.ACTIVE) {\n handler.handlers.onEnd?.(event, true);\n }\n handler.handlers.onFinalize?.(event, true);\n lastUpdateEvent[handler.handlers.handlerTag] = undefined;\n } else if (\n (event.state === State.FAILED || event.state === State.CANCELLED) &&\n event.oldState !== event.state\n ) {\n if (event.oldState === State.ACTIVE) {\n handler.handlers.onEnd?.(event, false);\n }\n handler.handlers.onFinalize?.(event, false);\n lastUpdateEvent[handler.handlers.handlerTag] = undefined;\n }\n } else if (isTouchEvent(event)) {\n switch (event.eventType) {\n case EventType.TOUCHES_DOWN:\n handler.handlers?.onTouchesDown?.(event, dummyStateManager);\n break;\n case EventType.TOUCHES_MOVE:\n handler.handlers?.onTouchesMove?.(event, dummyStateManager);\n break;\n case EventType.TOUCHES_UP:\n handler.handlers?.onTouchesUp?.(event, dummyStateManager);\n break;\n case EventType.TOUCHES_CANCELLED:\n handler.handlers?.onTouchesCancelled?.(event, dummyStateManager);\n break;\n }\n } else {\n handler.handlers.onUpdate?.(event);\n\n if (handler.handlers.onChange && handler.handlers.changeEventCalculator) {\n handler.handlers.onChange?.(\n handler.handlers.changeEventCalculator?.(\n event,\n lastUpdateEvent[handler.handlers.handlerTag]\n )\n );\n\n lastUpdateEvent[handler.handlers.handlerTag] = event;\n }\n }\n }\n}\n\nexport function startListening() {\n stopListening();\n\n gestureHandlerEventSubscription = DeviceEventEmitter.addListener(\n 'onGestureHandlerEvent',\n onGestureHandlerEvent\n );\n\n gestureHandlerStateChangeEventSubscription = DeviceEventEmitter.addListener(\n 'onGestureHandlerStateChange',\n onGestureHandlerEvent\n );\n}\n\nexport function stopListening() {\n if (gestureHandlerEventSubscription) {\n DeviceEventEmitter.removeSubscription(gestureHandlerEventSubscription);\n\n gestureHandlerEventSubscription = null;\n }\n\n if (gestureHandlerStateChangeEventSubscription) {\n DeviceEventEmitter.removeSubscription(\n gestureHandlerStateChangeEventSubscription\n );\n\n gestureHandlerStateChangeEventSubscription = null;\n }\n}\n"]}
1
+ {"version":3,"sources":["eventReceiver.ts"],"names":["DeviceEventEmitter","State","EventType","findHandler","gestureHandlerEventSubscription","gestureHandlerStateChangeEventSubscription","dummyStateManager","begin","console","warn","activate","end","fail","lastUpdateEvent","isStateChangeEvent","event","oldState","isTouchEvent","eventType","onGestureHandlerEvent","handler","handlerTag","UNDETERMINED","state","BEGAN","handlers","onBegin","ACTIVE","onStart","END","onEnd","onFinalize","undefined","FAILED","CANCELLED","TOUCHES_DOWN","onTouchesDown","TOUCHES_MOVE","onTouchesMove","TOUCHES_UP","onTouchesUp","TOUCHES_CANCELLED","onTouchesCancelled","onUpdate","onChange","changeEventCalculator","startListening","stopListening","addListener","removeSubscription"],"mappings":"AAAA,SAASA,kBAAT,QAAwD,cAAxD;AACA,SAASC,KAAT,QAAsB,aAAtB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAOA,SAASC,WAAT,QAA4B,qBAA5B;AAGA,IAAIC,+BAA2D,GAAG,IAAlE;AACA,IAAIC,0CAAsE,GAAG,IAA7E;AAEA,MAAMC,iBAA0C,GAAG;AACjDC,EAAAA,KAAK,EAAE,MAAM;AACXC,IAAAA,OAAO,CAACC,IAAR,CACE,uFADF;AAGD,GALgD;AAMjDC,EAAAA,QAAQ,EAAE,MAAM;AACdF,IAAAA,OAAO,CAACC,IAAR,CACE,uFADF;AAGD,GAVgD;AAWjDE,EAAAA,GAAG,EAAE,MAAM;AACTH,IAAAA,OAAO,CAACC,IAAR,CACE,uFADF;AAGD,GAfgD;AAgBjDG,EAAAA,IAAI,EAAE,MAAM;AACVJ,IAAAA,OAAO,CAACC,IAAR,CACE,uFADF;AAGD;AApBgD,CAAnD;AAuBA,MAAMI,eAAmD,GAAG,EAA5D;;AAEA,SAASC,kBAAT,CACEC,KADF,EAEoC;AAClC;AACA,SAAOA,KAAK,CAACC,QAAN,IAAkB,IAAzB;AACD;;AAED,SAASC,YAAT,CACEF,KADF,EAE8B;AAC5B,SAAOA,KAAK,CAACG,SAAN,IAAmB,IAA1B;AACD;;AAED,OAAO,SAASC,qBAAT,CACLJ,KADK,EAEL;AAAA;;AACA,QAAMK,OAAO,GAAGjB,WAAW,CAACY,KAAK,CAACM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uBAAAxB,OAAO,CAACK,QAAR,EAAiBoB,qBADnB,0DACE,gDACE9B,KADF,EAEEF,eAAe,CAACO,OAAO,CAACK,QAAR,CAAiBJ,UAAlB,CAFjB,CADF;AAOAR,QAAAA,eAAe,CAACO,OAAO,CAACK,QAAR,CAAiBJ,UAAlB,CAAf,GAA+CN,KAA/C;AACD;AACF;AACF;AACF;AAED,OAAO,SAAS+B,cAAT,GAA0B;AAC/BC,EAAAA,aAAa;AAEb3C,EAAAA,+BAA+B,GAAGJ,kBAAkB,CAACgD,WAAnB,CAChC,uBADgC,EAEhC7B,qBAFgC,CAAlC;AAKAd,EAAAA,0CAA0C,GAAGL,kBAAkB,CAACgD,WAAnB,CAC3C,6BAD2C,EAE3C7B,qBAF2C,CAA7C;AAID;AAED,OAAO,SAAS4B,aAAT,GAAyB;AAC9B,MAAI3C,+BAAJ,EAAqC;AACnCJ,IAAAA,kBAAkB,CAACiD,kBAAnB,CAAsC7C,+BAAtC;AAEAA,IAAAA,+BAA+B,GAAG,IAAlC;AACD;;AAED,MAAIC,0CAAJ,EAAgD;AAC9CL,IAAAA,kBAAkB,CAACiD,kBAAnB,CACE5C,0CADF;AAIAA,IAAAA,0CAA0C,GAAG,IAA7C;AACD;AACF","sourcesContent":["import { DeviceEventEmitter, EmitterSubscription } from 'react-native';\nimport { State } from '../../State';\nimport { EventType } from '../../EventType';\nimport {\n GestureTouchEvent,\n GestureUpdateEvent,\n GestureStateChangeEvent,\n} from '../gestureHandlerCommon';\nimport { GestureStateManagerType } from './gestureStateManager';\nimport { findHandler } from '../handlersRegistry';\nimport { BaseGesture } from './gesture';\n\nlet gestureHandlerEventSubscription: EmitterSubscription | null = null;\nlet gestureHandlerStateChangeEventSubscription: EmitterSubscription | null = null;\n\nconst dummyStateManager: GestureStateManagerType = {\n begin: () => {\n console.warn(\n 'You have to use react-native-reanimated in order to control the state of the gesture.'\n );\n },\n activate: () => {\n console.warn(\n 'You have to use react-native-reanimated in order to control the state of the gesture.'\n );\n },\n end: () => {\n console.warn(\n 'You have to use react-native-reanimated in order to control the state of the gesture.'\n );\n },\n fail: () => {\n console.warn(\n 'You have to use react-native-reanimated in order to control the state of the gesture.'\n );\n },\n};\n\nconst lastUpdateEvent: (GestureUpdateEvent | undefined)[] = [];\n\nfunction isStateChangeEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n): event is GestureStateChangeEvent {\n // @ts-ignore oldState doesn't exist on GestureTouchEvent and that's the point\n return event.oldState != null;\n}\n\nfunction isTouchEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n): event is GestureTouchEvent {\n return event.eventType != null;\n}\n\nexport function onGestureHandlerEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n) {\n const handler = findHandler(event.handlerTag) as BaseGesture<\n Record<string, unknown>\n >;\n\n if (handler) {\n if (isStateChangeEvent(event)) {\n if (\n event.oldState === State.UNDETERMINED &&\n event.state === State.BEGAN\n ) {\n handler.handlers.onBegin?.(event);\n } else if (\n (event.oldState === State.BEGAN ||\n event.oldState === State.UNDETERMINED) &&\n event.state === State.ACTIVE\n ) {\n handler.handlers.onStart?.(event);\n lastUpdateEvent[handler.handlers.handlerTag] = event;\n } else if (event.oldState !== event.state && event.state === State.END) {\n if (event.oldState === State.ACTIVE) {\n handler.handlers.onEnd?.(event, true);\n }\n handler.handlers.onFinalize?.(event, true);\n lastUpdateEvent[handler.handlers.handlerTag] = undefined;\n } else if (\n (event.state === State.FAILED || event.state === State.CANCELLED) &&\n event.oldState !== event.state\n ) {\n if (event.oldState === State.ACTIVE) {\n handler.handlers.onEnd?.(event, false);\n }\n handler.handlers.onFinalize?.(event, false);\n lastUpdateEvent[handler.handlers.handlerTag] = undefined;\n }\n } else if (isTouchEvent(event)) {\n switch (event.eventType) {\n case EventType.TOUCHES_DOWN:\n handler.handlers?.onTouchesDown?.(event, dummyStateManager);\n break;\n case EventType.TOUCHES_MOVE:\n handler.handlers?.onTouchesMove?.(event, dummyStateManager);\n break;\n case EventType.TOUCHES_UP:\n handler.handlers?.onTouchesUp?.(event, dummyStateManager);\n break;\n case EventType.TOUCHES_CANCELLED:\n handler.handlers?.onTouchesCancelled?.(event, dummyStateManager);\n break;\n }\n } else {\n handler.handlers.onUpdate?.(event);\n\n if (handler.handlers.onChange && handler.handlers.changeEventCalculator) {\n handler.handlers.onChange?.(\n handler.handlers.changeEventCalculator?.(\n event,\n lastUpdateEvent[handler.handlers.handlerTag]\n )\n );\n\n lastUpdateEvent[handler.handlers.handlerTag] = event;\n }\n }\n }\n}\n\nexport function startListening() {\n stopListening();\n\n gestureHandlerEventSubscription = DeviceEventEmitter.addListener(\n 'onGestureHandlerEvent',\n onGestureHandlerEvent\n );\n\n gestureHandlerStateChangeEventSubscription = DeviceEventEmitter.addListener(\n 'onGestureHandlerStateChange',\n onGestureHandlerEvent\n );\n}\n\nexport function stopListening() {\n if (gestureHandlerEventSubscription) {\n DeviceEventEmitter.removeSubscription(gestureHandlerEventSubscription);\n\n gestureHandlerEventSubscription = null;\n }\n\n if (gestureHandlerStateChangeEventSubscription) {\n DeviceEventEmitter.removeSubscription(\n gestureHandlerStateChangeEventSubscription\n );\n\n gestureHandlerStateChangeEventSubscription = null;\n }\n}\n"]}
@@ -13,17 +13,6 @@ export { FlingGestureHandler } from './handlers/FlingGestureHandler';
13
13
  export { default as createNativeWrapper } from './handlers/createNativeWrapper';
14
14
  export { GestureDetector } from './handlers/gestures/GestureDetector';
15
15
  export { GestureObjects as Gesture } from './handlers/gestures/gestureObjects';
16
- export { TapGestureType as TapGesture } from './handlers/gestures/tapGesture';
17
- export { PanGestureType as PanGesture } from './handlers/gestures/panGesture';
18
- export { FlingGestureType as FlingGesture } from './handlers/gestures/flingGesture';
19
- export { LongPressGestureType as LongPressGesture } from './handlers/gestures/longPressGesture';
20
- export { PinchGestureType as PinchGesture } from './handlers/gestures/pinchGesture';
21
- export { RotationGestureType as RotationGesture } from './handlers/gestures/rotationGesture';
22
- export { ForceTouchGestureType as ForceTouchGesture } from './handlers/gestures/forceTouchGesture';
23
- export { NativeGestureType as NativeGesture } from './handlers/gestures/nativeGesture';
24
- export { ManualGestureType as ManualGesture } from './handlers/gestures/manualGesture';
25
- export { ComposedGestureType as ComposedGesture, RaceGestureType as RaceGesture, SimultaneousGestureType as SimultaneousGesture, ExclusiveGestureType as ExclusiveGesture } from './handlers/gestures/gestureComposition';
26
- export { GestureStateManagerType as GestureStateManager } from './handlers/gestures/gestureStateManager';
27
16
  export { NativeViewGestureHandler } from './handlers/NativeViewGestureHandler';
28
17
  export { RawButton, BaseButton, RectButton, BorderlessButton } from './components/GestureButtons';
29
18
  export { TouchableHighlight, TouchableNativeFeedback, TouchableOpacity, TouchableWithoutFeedback } from './components/touchables';
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["initialize","Directions","State","default","gestureHandlerRootHOC","GestureHandlerRootView","TapGestureHandler","ForceTouchGestureHandler","LongPressGestureHandler","PanGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","createNativeWrapper","GestureDetector","GestureObjects","Gesture","TapGestureType","TapGesture","PanGestureType","PanGesture","FlingGestureType","FlingGesture","LongPressGestureType","LongPressGesture","PinchGestureType","PinchGesture","RotationGestureType","RotationGesture","ForceTouchGestureType","ForceTouchGesture","NativeGestureType","NativeGesture","ManualGestureType","ManualGesture","ComposedGestureType","ComposedGesture","RaceGestureType","RaceGesture","SimultaneousGestureType","SimultaneousGesture","ExclusiveGestureType","ExclusiveGesture","GestureStateManagerType","GestureStateManager","NativeViewGestureHandler","RawButton","BaseButton","RectButton","BorderlessButton","TouchableHighlight","TouchableNativeFeedback","TouchableOpacity","TouchableWithoutFeedback","ScrollView","Switch","TextInput","DrawerLayoutAndroid","FlatList","Swipeable","DrawerLayout"],"mappings":"AAAA,SAASA,UAAT,QAA2B,QAA3B;AAEA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,OA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AJF,QAKO,yBALP;AAMA,SACEC,UADF,EAEEC,MAFF,EAGEC,SAHF,EAIEC,mBAJF,EAKEC,QALF,QAMO,gCANP;AA8CA,SAASvD,OAAO,IAAIwD,SAApB,QAAqC,wBAArC;AASA,SAASxD,OAAO,IAAIyD,YAApB,QAAwC,2BAAxC;AAEA5D,UAAU","sourcesContent":["import { initialize } from './init';\n\nexport { Directions } from './Directions';\nexport { State } from './State';\nexport { default as gestureHandlerRootHOC } from './gestureHandlerRootHOC';\nexport { default as GestureHandlerRootView } from './GestureHandlerRootView';\nexport type {\n // event types\n GestureEvent,\n HandlerStateChangeEvent,\n // event payloads types\n GestureEventPayload,\n HandlerStateChangeEventPayload,\n // pointer events\n GestureTouchEvent,\n TouchData,\n // new api event types\n GestureUpdateEvent,\n GestureStateChangeEvent,\n} from './handlers/gestureHandlerCommon';\nexport type { GestureType } from './handlers/gestures/gesture';\nexport type {\n TapGestureHandlerEventPayload,\n TapGestureHandlerProps,\n} from './handlers/TapGestureHandler';\nexport type {\n ForceTouchGestureHandlerEventPayload,\n ForceTouchGestureHandlerProps,\n} from './handlers/ForceTouchGestureHandler';\nexport type {\n LongPressGestureHandlerEventPayload,\n LongPressGestureHandlerProps,\n} from './handlers/LongPressGestureHandler';\nexport type {\n PanGestureHandlerEventPayload,\n PanGestureHandlerProps,\n} from './handlers/PanGestureHandler';\nexport type {\n PinchGestureHandlerEventPayload,\n PinchGestureHandlerProps,\n} from './handlers/PinchGestureHandler';\nexport type {\n RotationGestureHandlerEventPayload,\n RotationGestureHandlerProps,\n} from './handlers/RotationGestureHandler';\nexport type {\n FlingGestureHandlerEventPayload,\n FlingGestureHandlerProps,\n} from './handlers/FlingGestureHandler';\nexport { TapGestureHandler } from './handlers/TapGestureHandler';\nexport { ForceTouchGestureHandler } from './handlers/ForceTouchGestureHandler';\nexport { LongPressGestureHandler } from './handlers/LongPressGestureHandler';\nexport { PanGestureHandler } from './handlers/PanGestureHandler';\nexport { PinchGestureHandler } from './handlers/PinchGestureHandler';\nexport { RotationGestureHandler } from './handlers/RotationGestureHandler';\nexport { FlingGestureHandler } from './handlers/FlingGestureHandler';\nexport { default as createNativeWrapper } from './handlers/createNativeWrapper';\nexport type {\n NativeViewGestureHandlerPayload,\n NativeViewGestureHandlerProps,\n} from './handlers/NativeViewGestureHandler';\nexport { GestureDetector } from './handlers/gestures/GestureDetector';\nexport { GestureObjects as Gesture } from './handlers/gestures/gestureObjects';\nexport { TapGestureType as TapGesture } from './handlers/gestures/tapGesture';\nexport { PanGestureType as PanGesture } from './handlers/gestures/panGesture';\nexport { FlingGestureType as FlingGesture } from './handlers/gestures/flingGesture';\nexport { LongPressGestureType as LongPressGesture } from './handlers/gestures/longPressGesture';\nexport { PinchGestureType as PinchGesture } from './handlers/gestures/pinchGesture';\nexport { RotationGestureType as RotationGesture } from './handlers/gestures/rotationGesture';\nexport { ForceTouchGestureType as ForceTouchGesture } from './handlers/gestures/forceTouchGesture';\nexport { NativeGestureType as NativeGesture } from './handlers/gestures/nativeGesture';\nexport { ManualGestureType as ManualGesture } from './handlers/gestures/manualGesture';\nexport {\n ComposedGestureType as ComposedGesture,\n RaceGestureType as RaceGesture,\n SimultaneousGestureType as SimultaneousGesture,\n ExclusiveGestureType as ExclusiveGesture,\n} from './handlers/gestures/gestureComposition';\nexport { GestureStateManagerType as GestureStateManager } from './handlers/gestures/gestureStateManager';\nexport { NativeViewGestureHandler } from './handlers/NativeViewGestureHandler';\nexport type {\n RawButtonProps,\n BaseButtonProps,\n RectButtonProps,\n BorderlessButtonProps,\n} from './components/GestureButtons';\nexport {\n RawButton,\n BaseButton,\n RectButton,\n BorderlessButton,\n} from './components/GestureButtons';\nexport {\n TouchableHighlight,\n TouchableNativeFeedback,\n TouchableOpacity,\n TouchableWithoutFeedback,\n} from './components/touchables';\nexport {\n ScrollView,\n Switch,\n TextInput,\n DrawerLayoutAndroid,\n FlatList,\n} from './components/GestureComponents';\nexport type {\n //events\n GestureHandlerGestureEvent,\n GestureHandlerStateChangeEvent,\n //event payloads\n GestureHandlerGestureEventNativeEvent,\n GestureHandlerStateChangeNativeEvent,\n NativeViewGestureHandlerGestureEvent,\n NativeViewGestureHandlerStateChangeEvent,\n TapGestureHandlerGestureEvent,\n TapGestureHandlerStateChangeEvent,\n ForceTouchGestureHandlerGestureEvent,\n ForceTouchGestureHandlerStateChangeEvent,\n LongPressGestureHandlerGestureEvent,\n LongPressGestureHandlerStateChangeEvent,\n PanGestureHandlerGestureEvent,\n PanGestureHandlerStateChangeEvent,\n PinchGestureHandlerGestureEvent,\n PinchGestureHandlerStateChangeEvent,\n RotationGestureHandlerGestureEvent,\n RotationGestureHandlerStateChangeEvent,\n FlingGestureHandlerGestureEvent,\n FlingGestureHandlerStateChangeEvent,\n // handlers props\n NativeViewGestureHandlerProperties,\n TapGestureHandlerProperties,\n LongPressGestureHandlerProperties,\n PanGestureHandlerProperties,\n PinchGestureHandlerProperties,\n RotationGestureHandlerProperties,\n FlingGestureHandlerProperties,\n ForceTouchGestureHandlerProperties,\n // buttons props\n RawButtonProperties,\n BaseButtonProperties,\n RectButtonProperties,\n BorderlessButtonProperties,\n} from './handlers/gestureHandlerTypesCompat';\n\nexport { default as Swipeable } from './components/Swipeable';\nexport type {\n DrawerLayoutProps,\n DrawerPosition,\n DrawerState,\n DrawerType,\n DrawerLockMode,\n DrawerKeyboardDismissMode,\n} from './components/DrawerLayout';\nexport { default as DrawerLayout } from './components/DrawerLayout';\n\ninitialize();\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":["initialize","Directions","State","default","gestureHandlerRootHOC","GestureHandlerRootView","TapGestureHandler","ForceTouchGestureHandler","LongPressGestureHandler","PanGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","createNativeWrapper","GestureDetector","GestureObjects","Gesture","NativeViewGestureHandler","RawButton","BaseButton","RectButton","BorderlessButton","TouchableHighlight","TouchableNativeFeedback","TouchableOpacity","TouchableWithoutFeedback","ScrollView","Switch","TextInput","DrawerLayoutAndroid","FlatList","Swipeable","DrawerLayout"],"mappings":"AAAA,SAASA,UAAT,QAA2B,QAA3B;AAEA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,OAAO,IAAIC,qBAApB,QAAiD,yBAAjD;AACA,SAASD,OAAO,IAAIE,sBAApB,QAAkD,0BAAlD;AA4CA,SAASC,iBAAT,QAAkC,8BAAlC;AACA,SAASC,wBAAT,QAAyC,qCAAzC;AACA,SAASC,uBAAT,QAAwC,oCAAxC;AACA,SAASC,iBAAT,QAAkC,8BAAlC;AACA,SAASC,mBAAT,QAAoC,gCAApC;AACA,SAASC,sBAAT,QAAuC,mCAAvC;AACA,SAASC,mBAAT,QAAoC,gCAApC;AACA,SAAST,OAAO,IAAIU,mBAApB,QAA+C,gCAA/C;AAKA,SAASC,eAAT,QAAgC,qCAAhC;AACA,SAASC,cAAc,IAAIC,OAA3B,QAA0C,oCAA1C;AAiBA,SAASC,wBAAT,QAAyC,qCAAzC;AAOA,SACEC,SADF,EAEEC,UAFF,EAGEC,UAHF,EAIEC,gBAJF,QAKO,6BALP;AAMA,SACEC,kBADF,EAEEC,uBAFF,EAGEC,gBAHF,EAIEC,wBAJF,QAKO,yBALP;AAMA,SACEC,UADF,EAEEC,MAFF,EAGEC,SAHF,EAIEC,mBAJF,EAKEC,QALF,QAMO,gCANP;AA8CA,SAAS3B,OAAO,IAAI4B,SAApB,QAAqC,wBAArC;AASA,SAAS5B,OAAO,IAAI6B,YAApB,QAAwC,2BAAxC;AAEAhC,UAAU","sourcesContent":["import { initialize } from './init';\n\nexport { Directions } from './Directions';\nexport { State } from './State';\nexport { default as gestureHandlerRootHOC } from './gestureHandlerRootHOC';\nexport { default as GestureHandlerRootView } from './GestureHandlerRootView';\nexport type {\n // event types\n GestureEvent,\n HandlerStateChangeEvent,\n // event payloads types\n GestureEventPayload,\n HandlerStateChangeEventPayload,\n // pointer events\n GestureTouchEvent,\n TouchData,\n // new api event types\n GestureUpdateEvent,\n GestureStateChangeEvent,\n} from './handlers/gestureHandlerCommon';\nexport type { GestureType } from './handlers/gestures/gesture';\nexport type {\n TapGestureHandlerEventPayload,\n TapGestureHandlerProps,\n} from './handlers/TapGestureHandler';\nexport type {\n ForceTouchGestureHandlerEventPayload,\n ForceTouchGestureHandlerProps,\n} from './handlers/ForceTouchGestureHandler';\nexport type {\n LongPressGestureHandlerEventPayload,\n LongPressGestureHandlerProps,\n} from './handlers/LongPressGestureHandler';\nexport type {\n PanGestureHandlerEventPayload,\n PanGestureHandlerProps,\n} from './handlers/PanGestureHandler';\nexport type {\n PinchGestureHandlerEventPayload,\n PinchGestureHandlerProps,\n} from './handlers/PinchGestureHandler';\nexport type {\n RotationGestureHandlerEventPayload,\n RotationGestureHandlerProps,\n} from './handlers/RotationGestureHandler';\nexport type {\n FlingGestureHandlerEventPayload,\n FlingGestureHandlerProps,\n} from './handlers/FlingGestureHandler';\nexport { TapGestureHandler } from './handlers/TapGestureHandler';\nexport { ForceTouchGestureHandler } from './handlers/ForceTouchGestureHandler';\nexport { LongPressGestureHandler } from './handlers/LongPressGestureHandler';\nexport { PanGestureHandler } from './handlers/PanGestureHandler';\nexport { PinchGestureHandler } from './handlers/PinchGestureHandler';\nexport { RotationGestureHandler } from './handlers/RotationGestureHandler';\nexport { FlingGestureHandler } from './handlers/FlingGestureHandler';\nexport { default as createNativeWrapper } from './handlers/createNativeWrapper';\nexport type {\n NativeViewGestureHandlerPayload,\n NativeViewGestureHandlerProps,\n} from './handlers/NativeViewGestureHandler';\nexport { GestureDetector } from './handlers/gestures/GestureDetector';\nexport { GestureObjects as Gesture } from './handlers/gestures/gestureObjects';\nexport type { TapGestureType as TapGesture } from './handlers/gestures/tapGesture';\nexport type { PanGestureType as PanGesture } from './handlers/gestures/panGesture';\nexport type { FlingGestureType as FlingGesture } from './handlers/gestures/flingGesture';\nexport type { LongPressGestureType as LongPressGesture } from './handlers/gestures/longPressGesture';\nexport type { PinchGestureType as PinchGesture } from './handlers/gestures/pinchGesture';\nexport type { RotationGestureType as RotationGesture } from './handlers/gestures/rotationGesture';\nexport type { ForceTouchGestureType as ForceTouchGesture } from './handlers/gestures/forceTouchGesture';\nexport type { NativeGestureType as NativeGesture } from './handlers/gestures/nativeGesture';\nexport type { ManualGestureType as ManualGesture } from './handlers/gestures/manualGesture';\nexport type {\n ComposedGestureType as ComposedGesture,\n RaceGestureType as RaceGesture,\n SimultaneousGestureType as SimultaneousGesture,\n ExclusiveGestureType as ExclusiveGesture,\n} from './handlers/gestures/gestureComposition';\nexport type { GestureStateManagerType as GestureStateManager } from './handlers/gestures/gestureStateManager';\nexport { NativeViewGestureHandler } from './handlers/NativeViewGestureHandler';\nexport type {\n RawButtonProps,\n BaseButtonProps,\n RectButtonProps,\n BorderlessButtonProps,\n} from './components/GestureButtons';\nexport {\n RawButton,\n BaseButton,\n RectButton,\n BorderlessButton,\n} from './components/GestureButtons';\nexport {\n TouchableHighlight,\n TouchableNativeFeedback,\n TouchableOpacity,\n TouchableWithoutFeedback,\n} from './components/touchables';\nexport {\n ScrollView,\n Switch,\n TextInput,\n DrawerLayoutAndroid,\n FlatList,\n} from './components/GestureComponents';\nexport type {\n //events\n GestureHandlerGestureEvent,\n GestureHandlerStateChangeEvent,\n //event payloads\n GestureHandlerGestureEventNativeEvent,\n GestureHandlerStateChangeNativeEvent,\n NativeViewGestureHandlerGestureEvent,\n NativeViewGestureHandlerStateChangeEvent,\n TapGestureHandlerGestureEvent,\n TapGestureHandlerStateChangeEvent,\n ForceTouchGestureHandlerGestureEvent,\n ForceTouchGestureHandlerStateChangeEvent,\n LongPressGestureHandlerGestureEvent,\n LongPressGestureHandlerStateChangeEvent,\n PanGestureHandlerGestureEvent,\n PanGestureHandlerStateChangeEvent,\n PinchGestureHandlerGestureEvent,\n PinchGestureHandlerStateChangeEvent,\n RotationGestureHandlerGestureEvent,\n RotationGestureHandlerStateChangeEvent,\n FlingGestureHandlerGestureEvent,\n FlingGestureHandlerStateChangeEvent,\n // handlers props\n NativeViewGestureHandlerProperties,\n TapGestureHandlerProperties,\n LongPressGestureHandlerProperties,\n PanGestureHandlerProperties,\n PinchGestureHandlerProperties,\n RotationGestureHandlerProperties,\n FlingGestureHandlerProperties,\n ForceTouchGestureHandlerProperties,\n // buttons props\n RawButtonProperties,\n BaseButtonProperties,\n RectButtonProperties,\n BorderlessButtonProperties,\n} from './handlers/gestureHandlerTypesCompat';\n\nexport { default as Swipeable } from './components/Swipeable';\nexport type {\n DrawerLayoutProps,\n DrawerPosition,\n DrawerState,\n DrawerType,\n DrawerLockMode,\n DrawerKeyboardDismissMode,\n} from './components/DrawerLayout';\nexport { default as DrawerLayout } from './components/DrawerLayout';\n\ninitialize();\n"]}
@@ -272,7 +272,10 @@ class GestureHandler {
272
272
  // onHandlerStateChange only
273
273
  handlerTag: this.handlerTag,
274
274
  target: this.ref,
275
- oldState: this.oldState
275
+ // send oldState only when the state was changed, or is different than ACTIVE
276
+ // GestureDetector relies on the presence of `oldState` to differentiate between
277
+ // update events and state change events
278
+ oldState: state !== this.previousState || state != 4 ? this.oldState : undefined
276
279
  },
277
280
  timeStamp: Date.now()
278
281
  };