react-native-gesture-handler 2.21.1 → 2.22.0-rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. package/README.md +1 -3
  2. package/android/build.gradle +11 -1
  3. package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +3 -2
  4. package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerDelegate.java +3 -2
  5. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +16 -0
  6. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +1 -1
  7. package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +45 -8
  8. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +18 -0
  9. package/apple/Handlers/RNFlingHandler.m +0 -1
  10. package/apple/Handlers/RNForceTouchHandler.m +0 -1
  11. package/apple/Handlers/RNLongPressHandler.m +0 -1
  12. package/apple/Handlers/RNManualHandler.m +0 -1
  13. package/apple/Handlers/RNPanHandler.m +0 -3
  14. package/apple/Handlers/RNPinchHandler.m +0 -1
  15. package/apple/Handlers/RNRotationHandler.m +0 -1
  16. package/apple/Handlers/RNTapHandler.m +0 -1
  17. package/apple/RNGestureHandlerButton.h +1 -0
  18. package/apple/RNGestureHandlerButton.mm +51 -0
  19. package/apple/RNGestureHandlerManager.mm +6 -1
  20. package/apple/RNManualActivationRecognizer.m +1 -0
  21. package/lib/commonjs/ActionType.js.map +1 -1
  22. package/lib/commonjs/Directions.js.map +1 -1
  23. package/lib/commonjs/EnableNewWebImplementation.js +14 -1
  24. package/lib/commonjs/EnableNewWebImplementation.js.map +1 -1
  25. package/lib/commonjs/State.js.map +1 -1
  26. package/lib/commonjs/TouchEventType.js.map +1 -1
  27. package/lib/commonjs/components/Pressable/Pressable.js +1 -1
  28. package/lib/commonjs/components/Pressable/Pressable.js.map +1 -1
  29. package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -1
  30. package/lib/commonjs/components/Swipeable.js.map +1 -1
  31. package/lib/commonjs/components/Text.js +61 -0
  32. package/lib/commonjs/components/Text.js.map +1 -0
  33. package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
  34. package/lib/commonjs/getShadowNodeFromRef.js +10 -2
  35. package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
  36. package/lib/commonjs/ghQueueMicrotask.js.map +1 -1
  37. package/lib/commonjs/handlers/createHandler.js +12 -0
  38. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  39. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
  40. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +4 -0
  41. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  42. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +4 -0
  43. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  44. package/lib/commonjs/handlers/gestures/GestureDetector/index.js +3 -0
  45. package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
  46. package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js +48 -0
  47. package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -0
  48. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
  49. package/lib/commonjs/handlers/utils.js +1 -0
  50. package/lib/commonjs/handlers/utils.js.map +1 -1
  51. package/lib/commonjs/index.js +8 -0
  52. package/lib/commonjs/index.js.map +1 -1
  53. package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
  54. package/lib/commonjs/mountRegistry.js +49 -0
  55. package/lib/commonjs/mountRegistry.js.map +1 -0
  56. package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
  57. package/lib/commonjs/web/handlers/FlingGestureHandler.js +0 -4
  58. package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
  59. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  60. package/lib/commonjs/web/handlers/HoverGestureHandler.js +0 -14
  61. package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -1
  62. package/lib/commonjs/web/handlers/ManualGestureHandler.js +0 -14
  63. package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
  64. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +3 -5
  65. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
  66. package/lib/commonjs/web/handlers/PanGestureHandler.js +0 -4
  67. package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
  68. package/lib/commonjs/web/handlers/PinchGestureHandler.js +0 -10
  69. package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
  70. package/lib/commonjs/web/handlers/RotationGestureHandler.js +0 -14
  71. package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
  72. package/lib/commonjs/web/handlers/TapGestureHandler.js +0 -4
  73. package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
  74. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  75. package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
  76. package/lib/commonjs/web_hammer/PressGestureHandler.js.map +1 -1
  77. package/lib/module/ActionType.js.map +1 -1
  78. package/lib/module/Directions.js.map +1 -1
  79. package/lib/module/EnableNewWebImplementation.js +14 -1
  80. package/lib/module/EnableNewWebImplementation.js.map +1 -1
  81. package/lib/module/State.js.map +1 -1
  82. package/lib/module/TouchEventType.js.map +1 -1
  83. package/lib/module/components/Pressable/Pressable.js +1 -1
  84. package/lib/module/components/Pressable/Pressable.js.map +1 -1
  85. package/lib/module/components/ReanimatedSwipeable.js.map +1 -1
  86. package/lib/module/components/Swipeable.js.map +1 -1
  87. package/lib/module/components/Text.js +44 -0
  88. package/lib/module/components/Text.js.map +1 -0
  89. package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
  90. package/lib/module/getShadowNodeFromRef.js +10 -2
  91. package/lib/module/getShadowNodeFromRef.js.map +1 -1
  92. package/lib/module/ghQueueMicrotask.js.map +1 -1
  93. package/lib/module/handlers/createHandler.js +11 -0
  94. package/lib/module/handlers/createHandler.js.map +1 -1
  95. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
  96. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +3 -0
  97. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  98. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +2 -0
  99. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  100. package/lib/module/handlers/gestures/GestureDetector/index.js +2 -0
  101. package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
  102. package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js +39 -0
  103. package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -0
  104. package/lib/module/handlers/gestures/gesture.js.map +1 -1
  105. package/lib/module/handlers/utils.js +1 -3
  106. package/lib/module/handlers/utils.js.map +1 -1
  107. package/lib/module/index.js +1 -0
  108. package/lib/module/index.js.map +1 -1
  109. package/lib/module/jestUtils/jestUtils.js.map +1 -1
  110. package/lib/module/mountRegistry.js +40 -0
  111. package/lib/module/mountRegistry.js.map +1 -0
  112. package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
  113. package/lib/module/web/handlers/FlingGestureHandler.js +0 -4
  114. package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
  115. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  116. package/lib/module/web/handlers/HoverGestureHandler.js +0 -14
  117. package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
  118. package/lib/module/web/handlers/ManualGestureHandler.js +0 -14
  119. package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
  120. package/lib/module/web/handlers/NativeViewGestureHandler.js +3 -5
  121. package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
  122. package/lib/module/web/handlers/PanGestureHandler.js +0 -4
  123. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
  124. package/lib/module/web/handlers/PinchGestureHandler.js +0 -10
  125. package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
  126. package/lib/module/web/handlers/RotationGestureHandler.js +0 -14
  127. package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
  128. package/lib/module/web/handlers/TapGestureHandler.js +0 -4
  129. package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
  130. package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  131. package/lib/module/web_hammer/GestureHandler.js.map +1 -1
  132. package/lib/module/web_hammer/PressGestureHandler.js.map +1 -1
  133. package/lib/typescript/ActionType.d.ts +1 -1
  134. package/lib/typescript/Directions.d.ts +2 -2
  135. package/lib/typescript/EnableNewWebImplementation.d.ts +6 -0
  136. package/lib/typescript/State.d.ts +1 -1
  137. package/lib/typescript/TouchEventType.d.ts +1 -1
  138. package/lib/typescript/components/GestureButtonsProps.d.ts +2 -2
  139. package/lib/typescript/components/Text.d.ts +4 -0
  140. package/lib/typescript/components/touchables/GenericTouchable.d.ts +1 -1
  141. package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +2 -2
  142. package/lib/typescript/handlers/gestures/GestureDetector/useMountReactions.d.ts +2 -0
  143. package/lib/typescript/handlers/gestures/gesture.d.ts +1 -1
  144. package/lib/typescript/handlers/utils.d.ts +1 -0
  145. package/lib/typescript/index.d.ts +1 -0
  146. package/lib/typescript/mocks.d.ts +3 -3
  147. package/lib/typescript/mountRegistry.d.ts +17 -0
  148. package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +0 -2
  149. package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +1 -4
  150. package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +1 -4
  151. package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +0 -1
  152. package/lib/typescript/web/handlers/PanGestureHandler.d.ts +0 -2
  153. package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +1 -2
  154. package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +1 -3
  155. package/lib/typescript/web/handlers/TapGestureHandler.d.ts +0 -2
  156. package/package.json +16 -17
  157. package/src/ActionType.ts +1 -1
  158. package/src/Directions.ts +2 -2
  159. package/src/EnableNewWebImplementation.ts +18 -0
  160. package/src/State.ts +1 -1
  161. package/src/TouchEventType.ts +2 -1
  162. package/src/components/GestureButtonsProps.ts +4 -2
  163. package/src/components/Pressable/Pressable.tsx +3 -3
  164. package/src/components/ReanimatedSwipeable.tsx +8 -8
  165. package/src/components/Swipeable.tsx +4 -4
  166. package/src/components/Text.tsx +60 -0
  167. package/src/components/touchables/GenericTouchable.tsx +1 -1
  168. package/src/getShadowNodeFromRef.ts +8 -2
  169. package/src/ghQueueMicrotask.ts +2 -2
  170. package/src/handlers/GestureHandlerEventPayload.ts +2 -2
  171. package/src/handlers/createHandler.tsx +14 -1
  172. package/src/handlers/gestureHandlerCommon.ts +3 -3
  173. package/src/handlers/gestures/GestureDetector/attachHandlers.ts +3 -0
  174. package/src/handlers/gestures/GestureDetector/dropHandlers.ts +3 -0
  175. package/src/handlers/gestures/GestureDetector/index.tsx +3 -0
  176. package/src/handlers/gestures/GestureDetector/useMountReactions.ts +51 -0
  177. package/src/handlers/gestures/gesture.ts +3 -3
  178. package/src/handlers/utils.ts +2 -1
  179. package/src/index.ts +1 -0
  180. package/src/jestUtils/jestUtils.ts +10 -12
  181. package/src/mountRegistry.ts +51 -0
  182. package/src/web/detectors/ScaleGestureDetector.ts +1 -1
  183. package/src/web/handlers/FlingGestureHandler.ts +0 -4
  184. package/src/web/handlers/GestureHandler.ts +1 -3
  185. package/src/web/handlers/HoverGestureHandler.ts +1 -9
  186. package/src/web/handlers/ManualGestureHandler.ts +1 -9
  187. package/src/web/handlers/NativeViewGestureHandler.ts +5 -5
  188. package/src/web/handlers/PanGestureHandler.ts +0 -4
  189. package/src/web/handlers/PinchGestureHandler.ts +1 -5
  190. package/src/web/handlers/RotationGestureHandler.ts +1 -9
  191. package/src/web/handlers/TapGestureHandler.ts +0 -4
  192. package/src/web/tools/GestureHandlerWebDelegate.ts +4 -4
  193. package/src/web_hammer/GestureHandler.ts +1 -1
  194. package/src/web_hammer/PressGestureHandler.ts +7 -4
  195. package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +0 -86
@@ -1 +1 @@
1
- {"version":3,"sources":["gesture.ts"],"names":["CALLBACK_TYPE","UNDEFINED","BEGAN","START","UPDATE","CHANGE","END","FINALIZE","TOUCHES_DOWN","TOUCHES_MOVE","TOUCHES_UP","TOUCHES_CANCELLED","Gesture","nextGestureId","BaseGesture","constructor","gestureId","handlerTag","isWorklet","handlers","addDependency","key","gesture","value","config","Array","concat","withRef","ref","callback","__workletHash","undefined","onBegin","onStart","onEnd","onFinalize","onTouchesDown","needsPointerData","onTouchesMove","onTouchesUp","onTouchesCancelled","enabled","shouldCancelWhenOutside","hitSlop","activeCursor","mouseButton","runOnJS","simultaneousWithExternalGesture","gestures","requireExternalGestureToFail","blocksExternalGesture","withTestId","id","testId","cancelsTouchesInView","initialize","current","toGestureArray","prepare","shouldUseReanimated","includes","ContinousBaseGesture","onUpdate","onChange","manualActivation"],"mappings":";;;;;;;AASA;;AAaA;;;;AAiEO,MAAMA,aAAa,GAAG;AAC3BC,EAAAA,SAAS,EAAE,CADgB;AAE3BC,EAAAA,KAAK,EAAE,CAFoB;AAG3BC,EAAAA,KAAK,EAAE,CAHoB;AAI3BC,EAAAA,MAAM,EAAE,CAJmB;AAK3BC,EAAAA,MAAM,EAAE,CALmB;AAM3BC,EAAAA,GAAG,EAAE,CANsB;AAO3BC,EAAAA,QAAQ,EAAE,CAPiB;AAQ3BC,EAAAA,YAAY,EAAE,CARa;AAS3BC,EAAAA,YAAY,EAAE,CATa;AAU3BC,EAAAA,UAAU,EAAE,CAVe;AAW3BC,EAAAA,iBAAiB,EAAE;AAXQ,CAAtB,C,CAcP;AACA;;;;AAGO,MAAeC,OA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Event,\n GestureStateChangeEvent,\n GestureUpdateEvent,\n ActiveCursor,\n MouseButton,\n} from '../gestureHandlerCommon';\nimport { getNextHandlerTag } from '../getNextHandlerTag';\nimport { GestureStateManagerType } from './gestureStateManager';\nimport type {\n FlingGestureHandlerEventPayload,\n ForceTouchGestureHandlerEventPayload,\n LongPressGestureHandlerEventPayload,\n PanGestureHandlerEventPayload,\n PinchGestureHandlerEventPayload,\n RotationGestureHandlerEventPayload,\n TapGestureHandlerEventPayload,\n NativeViewGestureHandlerPayload,\n HoverGestureHandlerEventPayload,\n} from '../GestureHandlerEventPayload';\nimport { isRemoteDebuggingEnabled } from '../../utils';\n\nexport type GestureType =\n | BaseGesture<Record<string, unknown>>\n | BaseGesture<Record<string, never>>\n | BaseGesture<TapGestureHandlerEventPayload>\n | BaseGesture<PanGestureHandlerEventPayload>\n | BaseGesture<LongPressGestureHandlerEventPayload>\n | BaseGesture<RotationGestureHandlerEventPayload>\n | BaseGesture<PinchGestureHandlerEventPayload>\n | BaseGesture<FlingGestureHandlerEventPayload>\n | BaseGesture<ForceTouchGestureHandlerEventPayload>\n | BaseGesture<NativeViewGestureHandlerPayload>\n | BaseGesture<HoverGestureHandlerEventPayload>;\n\nexport type GestureRef =\n | number\n | GestureType\n | React.RefObject<GestureType | undefined>\n | React.RefObject<React.ComponentType | undefined>; // Allow adding a ref to a gesture handler\nexport interface BaseGestureConfig\n extends CommonGestureConfig,\n Record<string, unknown> {\n ref?: React.MutableRefObject<GestureType | undefined>;\n requireToFail?: GestureRef[];\n simultaneousWith?: GestureRef[];\n blocksHandlers?: GestureRef[];\n needsPointerData?: boolean;\n manualActivation?: boolean;\n runOnJS?: boolean;\n testId?: string;\n cancelsTouchesInView?: boolean;\n}\n\ntype TouchEventHandlerType = (\n event: GestureTouchEvent,\n stateManager: GestureStateManagerType\n) => void;\n\nexport type HandlerCallbacks<EventPayloadT extends Record<string, unknown>> = {\n gestureId: number;\n handlerTag: number;\n onBegin?: (event: GestureStateChangeEvent<EventPayloadT>) => void;\n onStart?: (event: GestureStateChangeEvent<EventPayloadT>) => void;\n onEnd?: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void;\n onFinalize?: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void;\n onUpdate?: (event: GestureUpdateEvent<EventPayloadT>) => void;\n onChange?: (event: any) => void;\n onTouchesDown?: TouchEventHandlerType;\n onTouchesMove?: TouchEventHandlerType;\n onTouchesUp?: TouchEventHandlerType;\n onTouchesCancelled?: TouchEventHandlerType;\n changeEventCalculator?: (\n current: GestureUpdateEvent<Record<string, unknown>>,\n previous?: GestureUpdateEvent<Record<string, unknown>>\n ) => GestureUpdateEvent<Record<string, unknown>>;\n isWorklet: boolean[];\n};\n\nexport const CALLBACK_TYPE = {\n UNDEFINED: 0,\n BEGAN: 1,\n START: 2,\n UPDATE: 3,\n CHANGE: 4,\n END: 5,\n FINALIZE: 6,\n TOUCHES_DOWN: 7,\n TOUCHES_MOVE: 8,\n TOUCHES_UP: 9,\n TOUCHES_CANCELLED: 10,\n} as const;\n\n// Allow using CALLBACK_TYPE as object and type\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type CALLBACK_TYPE = typeof CALLBACK_TYPE[keyof typeof CALLBACK_TYPE];\n\nexport abstract class Gesture {\n /**\n * Return array of gestures, providing the same interface for creating and updating\n * handlers, no matter which object was used to create gesture instance.\n */\n abstract toGestureArray(): GestureType[];\n\n /**\n * Assign handlerTag to the gesture instance and set ref.current (if a ref is set)\n */\n abstract initialize(): void;\n\n /**\n * Make sure that values of properties defining relations are arrays. Do any necessary\n * preprocessing required to configure relations between handlers. Called just before\n * updating the handler on the native side.\n */\n abstract prepare(): void;\n}\n\nlet nextGestureId = 0;\nexport abstract class BaseGesture<\n EventPayloadT extends Record<string, unknown>\n> extends Gesture {\n private gestureId = -1;\n public handlerTag = -1;\n public handlerName = '';\n public config: BaseGestureConfig = {};\n public handlers: HandlerCallbacks<EventPayloadT> = {\n gestureId: -1,\n handlerTag: -1,\n isWorklet: [],\n };\n\n constructor() {\n super();\n\n // Used to check whether the gesture config has been updated when wrapping it\n // with `useMemo`. Since every config will have a unique id, when the dependencies\n // don't change, the config won't be recreated and the id will stay the same.\n // If the id is different, it means that the config has changed and the gesture\n // needs to be updated.\n this.gestureId = nextGestureId++;\n this.handlers.gestureId = this.gestureId;\n }\n\n private addDependency(\n key: 'simultaneousWith' | 'requireToFail' | 'blocksHandlers',\n gesture: Exclude<GestureRef, number>\n ) {\n const value = this.config[key];\n this.config[key] = value\n ? Array<GestureRef>().concat(value, gesture)\n : [gesture];\n }\n\n /**\n * Sets a `ref` to the gesture object, allowing for interoperability with the old API.\n * @param ref\n */\n withRef(ref: React.MutableRefObject<GestureType | undefined>) {\n this.config.ref = ref;\n return this;\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n protected isWorklet(callback: Function) {\n // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\n return callback.__workletHash !== undefined;\n }\n\n /**\n * Set the callback that is being called when given gesture handler starts receiving touches.\n * At the moment of this callback the handler is in `BEGAN` state and we don't know yet if it will recognize the gesture at all.\n * @param callback\n */\n onBegin(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void) {\n this.handlers.onBegin = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.BEGAN] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called when the gesture is recognized by the handler and it transitions to the `ACTIVE` state.\n * @param callback\n */\n onStart(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void) {\n this.handlers.onStart = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.START] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called when the gesture that was recognized by the handler finishes and handler reaches `END` state.\n * It will be called only if the handler was previously in the `ACTIVE` state.\n * @param callback\n */\n onEnd(\n callback: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void\n ) {\n this.handlers.onEnd = callback;\n // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\n this.handlers.isWorklet[CALLBACK_TYPE.END] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called when the handler finalizes handling gesture - the gesture was recognized and has finished or it failed to recognize.\n * @param callback\n */\n onFinalize(\n callback: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void\n ) {\n this.handlers.onFinalize = callback;\n // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\n this.handlers.isWorklet[CALLBACK_TYPE.FINALIZE] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the `onTouchesDown` callback which is called every time a pointer is placed on the screen.\n * @param callback\n */\n onTouchesDown(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesDown = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_DOWN] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Set the `onTouchesMove` callback which is called every time a pointer is moved on the screen.\n * @param callback\n */\n onTouchesMove(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesMove = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_MOVE] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Set the `onTouchesUp` callback which is called every time a pointer is lifted from the screen.\n * @param callback\n */\n onTouchesUp(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesUp = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_UP] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Set the `onTouchesCancelled` callback which is called every time a pointer stops being tracked, for example when the gesture finishes.\n * @param callback\n */\n onTouchesCancelled(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesCancelled = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_CANCELLED] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Indicates whether the given handler should be analyzing stream of touch events or not.\n * @param enabled\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#enabledvalue-boolean\n */\n enabled(enabled: boolean) {\n this.config.enabled = enabled;\n return this;\n }\n\n /**\n * When true the handler will cancel or fail recognition (depending on its current state) whenever the finger leaves the area of the connected view.\n * @param value\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#shouldcancelwhenoutsidevalue-boolean\n */\n shouldCancelWhenOutside(value: boolean) {\n this.config.shouldCancelWhenOutside = value;\n return this;\n }\n\n /**\n * This parameter enables control over what part of the connected view area can be used to begin recognizing the gesture.\n * When a negative number is provided the bounds of the view will reduce the area by the given number of points in each of the sides evenly.\n * @param hitSlop\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#hitslopsettings\n */\n hitSlop(hitSlop: HitSlop) {\n this.config.hitSlop = hitSlop;\n return this;\n }\n\n /**\n * #### Web only\n * This parameter allows to specify which `cursor` should be used when gesture activates.\n * Supports all CSS cursor values (e.g. `\"grab\"`, `\"zoom-in\"`). Default value is set to `\"auto\"`.\n * @param activeCursor\n */\n activeCursor(activeCursor: ActiveCursor) {\n this.config.activeCursor = activeCursor;\n return this;\n }\n\n /**\n * #### Web & Android only\n * Allows users to choose which mouse button should handler respond to.\n * Arguments can be combined using `|` operator, e.g. `mouseButton(MouseButton.LEFT | MouseButton.RIGHT)`.\n * Default value is set to `MouseButton.LEFT`.\n * @param mouseButton\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#mousebuttonvalue-mousebutton-web--android-only\n */\n mouseButton(mouseButton: MouseButton) {\n this.config.mouseButton = mouseButton;\n return this;\n }\n\n /**\n * When `react-native-reanimated` is installed, the callbacks passed to the gestures are automatically workletized and run on the UI thread when called.\n * This option allows for changing this behavior: when `true`, all the callbacks will be run on the JS thread instead of the UI thread, regardless of whether they are worklets or not.\n * Defaults to `false`.\n * @param runOnJS\n */\n runOnJS(runOnJS: boolean) {\n this.config.runOnJS = runOnJS;\n return this;\n }\n\n /**\n * Allows gestures across different components to be recognized simultaneously.\n * @param gestures\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#simultaneouswithexternalgesture\n */\n simultaneousWithExternalGesture(...gestures: Exclude<GestureRef, number>[]) {\n for (const gesture of gestures) {\n this.addDependency('simultaneousWith', gesture);\n }\n return this;\n }\n\n /**\n * Allows to delay activation of the handler until all handlers passed as arguments to this method fail (or don't begin at all).\n * @param gestures\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#requireexternalgesturetofail\n */\n requireExternalGestureToFail(...gestures: Exclude<GestureRef, number>[]) {\n for (const gesture of gestures) {\n this.addDependency('requireToFail', gesture);\n }\n return this;\n }\n\n /**\n * Works similarily to `requireExternalGestureToFail` but the direction of the relation is reversed - instead of being one-to-many relation, it's many-to-one.\n * @param gestures\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#blocksexternalgesture\n */\n blocksExternalGesture(...gestures: Exclude<GestureRef, number>[]) {\n for (const gesture of gestures) {\n this.addDependency('blocksHandlers', gesture);\n }\n return this;\n }\n\n /**\n * Sets a `testID` property for gesture object, allowing for querying for it in tests.\n * @param id\n */\n withTestId(id: string) {\n this.config.testId = id;\n return this;\n }\n\n /**\n * #### iOS only\n * When `true`, the handler will cancel touches for native UI components (`UIButton`, `UISwitch`, etc) it's attached to when it becomes `ACTIVE`.\n * Default value is `true`.\n * @param value\n */\n cancelsTouchesInView(value: boolean) {\n this.config.cancelsTouchesInView = value;\n return this;\n }\n\n initialize() {\n this.handlerTag = getNextHandlerTag();\n\n this.handlers = { ...this.handlers, handlerTag: this.handlerTag };\n\n if (this.config.ref) {\n this.config.ref.current = this as GestureType;\n }\n }\n\n toGestureArray(): GestureType[] {\n return [this as GestureType];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n prepare() {}\n\n get shouldUseReanimated(): boolean {\n // Use Reanimated when runOnJS isn't set explicitly,\n // all defined callbacks are worklets\n // and remote debugging is disabled\n return (\n this.config.runOnJS !== true &&\n !this.handlers.isWorklet.includes(false) &&\n !isRemoteDebuggingEnabled()\n );\n }\n}\n\nexport abstract class ContinousBaseGesture<\n EventPayloadT extends Record<string, unknown>,\n EventChangePayloadT extends Record<string, unknown>\n> extends BaseGesture<EventPayloadT> {\n /**\n * Set the callback that is being called every time the gesture receives an update while it's active.\n * @param callback\n */\n onUpdate(callback: (event: GestureUpdateEvent<EventPayloadT>) => void) {\n this.handlers.onUpdate = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.UPDATE] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called every time the gesture receives an update while it's active.\n * This callback will receive information about change in value in relation to the last received event.\n * @param callback\n */\n onChange(\n callback: (\n event: GestureUpdateEvent<EventPayloadT & EventChangePayloadT>\n ) => void\n ) {\n this.handlers.onChange = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.CHANGE] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * When `true` the handler will not activate by itself even if its activation criteria are met.\n * Instead you can manipulate its state using state manager.\n * @param manualActivation\n */\n manualActivation(manualActivation: boolean) {\n this.config.manualActivation = manualActivation;\n return this;\n }\n}\n"]}
1
+ {"version":3,"sources":["gesture.ts"],"names":["CALLBACK_TYPE","UNDEFINED","BEGAN","START","UPDATE","CHANGE","END","FINALIZE","TOUCHES_DOWN","TOUCHES_MOVE","TOUCHES_UP","TOUCHES_CANCELLED","Gesture","nextGestureId","BaseGesture","constructor","gestureId","handlerTag","isWorklet","handlers","addDependency","key","gesture","value","config","Array","concat","withRef","ref","callback","__workletHash","undefined","onBegin","onStart","onEnd","onFinalize","onTouchesDown","needsPointerData","onTouchesMove","onTouchesUp","onTouchesCancelled","enabled","shouldCancelWhenOutside","hitSlop","activeCursor","mouseButton","runOnJS","simultaneousWithExternalGesture","gestures","requireExternalGestureToFail","blocksExternalGesture","withTestId","id","testId","cancelsTouchesInView","initialize","current","toGestureArray","prepare","shouldUseReanimated","includes","ContinousBaseGesture","onUpdate","onChange","manualActivation"],"mappings":";;;;;;;AASA;;AAaA;;;;AAiEO,MAAMA,aAAa,GAAG;AAC3BC,EAAAA,SAAS,EAAE,CADgB;AAE3BC,EAAAA,KAAK,EAAE,CAFoB;AAG3BC,EAAAA,KAAK,EAAE,CAHoB;AAI3BC,EAAAA,MAAM,EAAE,CAJmB;AAK3BC,EAAAA,MAAM,EAAE,CALmB;AAM3BC,EAAAA,GAAG,EAAE,CANsB;AAO3BC,EAAAA,QAAQ,EAAE,CAPiB;AAQ3BC,EAAAA,YAAY,EAAE,CARa;AAS3BC,EAAAA,YAAY,EAAE,CATa;AAU3BC,EAAAA,UAAU,EAAE,CAVe;AAW3BC,EAAAA,iBAAiB,EAAE;AAXQ,CAAtB,C,CAcP;AACA;;;;AAGO,MAAeC,OAAf,CAAuB;;;AAoB9B,IAAIC,aAAa,GAAG,CAApB;;AACO,MAAeC,WAAf,SAEGF,OAFH,CAEW;AAWhBG,EAAAA,WAAW,GAAG;AACZ,YADY,CAGZ;AACA;AACA;AACA;AACA;;AAPY,uCAVM,CAAC,CAUP;;AAAA,wCATM,CAAC,CASP;;AAAA,yCARO,EAQP;;AAAA,oCAPqB,EAOrB;;AAAA,sCANqC;AACjDC,MAAAA,SAAS,EAAE,CAAC,CADqC;AAEjDC,MAAAA,UAAU,EAAE,CAAC,CAFoC;AAGjDC,MAAAA,SAAS,EAAE;AAHsC,KAMrC;;AAQZ,SAAKF,SAAL,GAAiBH,aAAa,EAA9B;AACA,SAAKM,QAAL,CAAcH,SAAd,GAA0B,KAAKA,SAA/B;AACD;;AAEOI,EAAAA,aAAa,CACnBC,GADmB,EAEnBC,OAFmB,EAGnB;AACA,UAAMC,KAAK,GAAG,KAAKC,MAAL,CAAYH,GAAZ,CAAd;AACA,SAAKG,MAAL,CAAYH,GAAZ,IAAmBE,KAAK,GACpBE,KAAK,GAAeC,MAApB,CAA2BH,KA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,QAAL,CAAcD,SAAd,CAAwBlB,aAAa,CAACI,MAAtC,IAAgD,KAAKc,SAAL,CAAeW,QAAf,CAAhD;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEkC,EAAAA,QAAQ,CACNlC,QADM,EAIN;AACA,SAAKV,QAAL,CAAc4C,QAAd,GAAyBlC,QAAzB;AACA,SAAKV,QAAL,CAAcD,SAAd,CAAwBlB,aAAa,CAACK,MAAtC,IAAgD,KAAKa,SAAL,CAAeW,QAAf,CAAhD;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEmC,EAAAA,gBAAgB,CAACA,gBAAD,EAA4B;AAC1C,SAAKxC,MAAL,CAAYwC,gBAAZ,GAA+BA,gBAA/B;AACA,WAAO,IAAP;AACD;;AAlCkC","sourcesContent":["import {\n HitSlop,\n CommonGestureConfig,\n GestureTouchEvent,\n GestureStateChangeEvent,\n GestureUpdateEvent,\n ActiveCursor,\n MouseButton,\n} from '../gestureHandlerCommon';\nimport { getNextHandlerTag } from '../getNextHandlerTag';\nimport { GestureStateManagerType } from './gestureStateManager';\nimport type {\n FlingGestureHandlerEventPayload,\n ForceTouchGestureHandlerEventPayload,\n LongPressGestureHandlerEventPayload,\n PanGestureHandlerEventPayload,\n PinchGestureHandlerEventPayload,\n RotationGestureHandlerEventPayload,\n TapGestureHandlerEventPayload,\n NativeViewGestureHandlerPayload,\n HoverGestureHandlerEventPayload,\n} from '../GestureHandlerEventPayload';\nimport { isRemoteDebuggingEnabled } from '../../utils';\n\nexport type GestureType =\n | BaseGesture<Record<string, unknown>>\n | BaseGesture<Record<string, never>>\n | BaseGesture<TapGestureHandlerEventPayload>\n | BaseGesture<PanGestureHandlerEventPayload>\n | BaseGesture<LongPressGestureHandlerEventPayload>\n | BaseGesture<RotationGestureHandlerEventPayload>\n | BaseGesture<PinchGestureHandlerEventPayload>\n | BaseGesture<FlingGestureHandlerEventPayload>\n | BaseGesture<ForceTouchGestureHandlerEventPayload>\n | BaseGesture<NativeViewGestureHandlerPayload>\n | BaseGesture<HoverGestureHandlerEventPayload>;\n\nexport type GestureRef =\n | number\n | GestureType\n | React.RefObject<GestureType | undefined>\n | React.RefObject<React.ComponentType | undefined>; // Allow adding a ref to a gesture handler\nexport interface BaseGestureConfig\n extends CommonGestureConfig,\n Record<string, unknown> {\n ref?: React.MutableRefObject<GestureType | undefined>;\n requireToFail?: GestureRef[];\n simultaneousWith?: GestureRef[];\n blocksHandlers?: GestureRef[];\n needsPointerData?: boolean;\n manualActivation?: boolean;\n runOnJS?: boolean;\n testId?: string;\n cancelsTouchesInView?: boolean;\n}\n\ntype TouchEventHandlerType = (\n event: GestureTouchEvent,\n stateManager: GestureStateManagerType\n) => void;\n\nexport type HandlerCallbacks<EventPayloadT extends Record<string, unknown>> = {\n gestureId: number;\n handlerTag: number;\n onBegin?: (event: GestureStateChangeEvent<EventPayloadT>) => void;\n onStart?: (event: GestureStateChangeEvent<EventPayloadT>) => void;\n onEnd?: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void;\n onFinalize?: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void;\n onUpdate?: (event: GestureUpdateEvent<EventPayloadT>) => void;\n onChange?: (event: any) => void;\n onTouchesDown?: TouchEventHandlerType;\n onTouchesMove?: TouchEventHandlerType;\n onTouchesUp?: TouchEventHandlerType;\n onTouchesCancelled?: TouchEventHandlerType;\n changeEventCalculator?: (\n current: GestureUpdateEvent<Record<string, unknown>>,\n previous?: GestureUpdateEvent<Record<string, unknown>>\n ) => GestureUpdateEvent<Record<string, unknown>>;\n isWorklet: boolean[];\n};\n\nexport const CALLBACK_TYPE = {\n UNDEFINED: 0,\n BEGAN: 1,\n START: 2,\n UPDATE: 3,\n CHANGE: 4,\n END: 5,\n FINALIZE: 6,\n TOUCHES_DOWN: 7,\n TOUCHES_MOVE: 8,\n TOUCHES_UP: 9,\n TOUCHES_CANCELLED: 10,\n} as const;\n\n// Allow using CALLBACK_TYPE as object and type\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type CALLBACK_TYPE = (typeof CALLBACK_TYPE)[keyof typeof CALLBACK_TYPE];\n\nexport abstract class Gesture {\n /**\n * Return array of gestures, providing the same interface for creating and updating\n * handlers, no matter which object was used to create gesture instance.\n */\n abstract toGestureArray(): GestureType[];\n\n /**\n * Assign handlerTag to the gesture instance and set ref.current (if a ref is set)\n */\n abstract initialize(): void;\n\n /**\n * Make sure that values of properties defining relations are arrays. Do any necessary\n * preprocessing required to configure relations between handlers. Called just before\n * updating the handler on the native side.\n */\n abstract prepare(): void;\n}\n\nlet nextGestureId = 0;\nexport abstract class BaseGesture<\n EventPayloadT extends Record<string, unknown>,\n> extends Gesture {\n private gestureId = -1;\n public handlerTag = -1;\n public handlerName = '';\n public config: BaseGestureConfig = {};\n public handlers: HandlerCallbacks<EventPayloadT> = {\n gestureId: -1,\n handlerTag: -1,\n isWorklet: [],\n };\n\n constructor() {\n super();\n\n // Used to check whether the gesture config has been updated when wrapping it\n // with `useMemo`. Since every config will have a unique id, when the dependencies\n // don't change, the config won't be recreated and the id will stay the same.\n // If the id is different, it means that the config has changed and the gesture\n // needs to be updated.\n this.gestureId = nextGestureId++;\n this.handlers.gestureId = this.gestureId;\n }\n\n private addDependency(\n key: 'simultaneousWith' | 'requireToFail' | 'blocksHandlers',\n gesture: Exclude<GestureRef, number>\n ) {\n const value = this.config[key];\n this.config[key] = value\n ? Array<GestureRef>().concat(value, gesture)\n : [gesture];\n }\n\n /**\n * Sets a `ref` to the gesture object, allowing for interoperability with the old API.\n * @param ref\n */\n withRef(ref: React.MutableRefObject<GestureType | undefined>) {\n this.config.ref = ref;\n return this;\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n protected isWorklet(callback: Function) {\n // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\n return callback.__workletHash !== undefined;\n }\n\n /**\n * Set the callback that is being called when given gesture handler starts receiving touches.\n * At the moment of this callback the handler is in `BEGAN` state and we don't know yet if it will recognize the gesture at all.\n * @param callback\n */\n onBegin(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void) {\n this.handlers.onBegin = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.BEGAN] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called when the gesture is recognized by the handler and it transitions to the `ACTIVE` state.\n * @param callback\n */\n onStart(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void) {\n this.handlers.onStart = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.START] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called when the gesture that was recognized by the handler finishes and handler reaches `END` state.\n * It will be called only if the handler was previously in the `ACTIVE` state.\n * @param callback\n */\n onEnd(\n callback: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void\n ) {\n this.handlers.onEnd = callback;\n // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\n this.handlers.isWorklet[CALLBACK_TYPE.END] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called when the handler finalizes handling gesture - the gesture was recognized and has finished or it failed to recognize.\n * @param callback\n */\n onFinalize(\n callback: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void\n ) {\n this.handlers.onFinalize = callback;\n // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\n this.handlers.isWorklet[CALLBACK_TYPE.FINALIZE] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the `onTouchesDown` callback which is called every time a pointer is placed on the screen.\n * @param callback\n */\n onTouchesDown(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesDown = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_DOWN] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Set the `onTouchesMove` callback which is called every time a pointer is moved on the screen.\n * @param callback\n */\n onTouchesMove(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesMove = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_MOVE] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Set the `onTouchesUp` callback which is called every time a pointer is lifted from the screen.\n * @param callback\n */\n onTouchesUp(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesUp = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_UP] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Set the `onTouchesCancelled` callback which is called every time a pointer stops being tracked, for example when the gesture finishes.\n * @param callback\n */\n onTouchesCancelled(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesCancelled = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_CANCELLED] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Indicates whether the given handler should be analyzing stream of touch events or not.\n * @param enabled\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#enabledvalue-boolean\n */\n enabled(enabled: boolean) {\n this.config.enabled = enabled;\n return this;\n }\n\n /**\n * When true the handler will cancel or fail recognition (depending on its current state) whenever the finger leaves the area of the connected view.\n * @param value\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#shouldcancelwhenoutsidevalue-boolean\n */\n shouldCancelWhenOutside(value: boolean) {\n this.config.shouldCancelWhenOutside = value;\n return this;\n }\n\n /**\n * This parameter enables control over what part of the connected view area can be used to begin recognizing the gesture.\n * When a negative number is provided the bounds of the view will reduce the area by the given number of points in each of the sides evenly.\n * @param hitSlop\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#hitslopsettings\n */\n hitSlop(hitSlop: HitSlop) {\n this.config.hitSlop = hitSlop;\n return this;\n }\n\n /**\n * #### Web only\n * This parameter allows to specify which `cursor` should be used when gesture activates.\n * Supports all CSS cursor values (e.g. `\"grab\"`, `\"zoom-in\"`). Default value is set to `\"auto\"`.\n * @param activeCursor\n */\n activeCursor(activeCursor: ActiveCursor) {\n this.config.activeCursor = activeCursor;\n return this;\n }\n\n /**\n * #### Web & Android only\n * Allows users to choose which mouse button should handler respond to.\n * Arguments can be combined using `|` operator, e.g. `mouseButton(MouseButton.LEFT | MouseButton.RIGHT)`.\n * Default value is set to `MouseButton.LEFT`.\n * @param mouseButton\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#mousebuttonvalue-mousebutton-web--android-only\n */\n mouseButton(mouseButton: MouseButton) {\n this.config.mouseButton = mouseButton;\n return this;\n }\n\n /**\n * When `react-native-reanimated` is installed, the callbacks passed to the gestures are automatically workletized and run on the UI thread when called.\n * This option allows for changing this behavior: when `true`, all the callbacks will be run on the JS thread instead of the UI thread, regardless of whether they are worklets or not.\n * Defaults to `false`.\n * @param runOnJS\n */\n runOnJS(runOnJS: boolean) {\n this.config.runOnJS = runOnJS;\n return this;\n }\n\n /**\n * Allows gestures across different components to be recognized simultaneously.\n * @param gestures\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#simultaneouswithexternalgesture\n */\n simultaneousWithExternalGesture(...gestures: Exclude<GestureRef, number>[]) {\n for (const gesture of gestures) {\n this.addDependency('simultaneousWith', gesture);\n }\n return this;\n }\n\n /**\n * Allows to delay activation of the handler until all handlers passed as arguments to this method fail (or don't begin at all).\n * @param gestures\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#requireexternalgesturetofail\n */\n requireExternalGestureToFail(...gestures: Exclude<GestureRef, number>[]) {\n for (const gesture of gestures) {\n this.addDependency('requireToFail', gesture);\n }\n return this;\n }\n\n /**\n * Works similarily to `requireExternalGestureToFail` but the direction of the relation is reversed - instead of being one-to-many relation, it's many-to-one.\n * @param gestures\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#blocksexternalgesture\n */\n blocksExternalGesture(...gestures: Exclude<GestureRef, number>[]) {\n for (const gesture of gestures) {\n this.addDependency('blocksHandlers', gesture);\n }\n return this;\n }\n\n /**\n * Sets a `testID` property for gesture object, allowing for querying for it in tests.\n * @param id\n */\n withTestId(id: string) {\n this.config.testId = id;\n return this;\n }\n\n /**\n * #### iOS only\n * When `true`, the handler will cancel touches for native UI components (`UIButton`, `UISwitch`, etc) it's attached to when it becomes `ACTIVE`.\n * Default value is `true`.\n * @param value\n */\n cancelsTouchesInView(value: boolean) {\n this.config.cancelsTouchesInView = value;\n return this;\n }\n\n initialize() {\n this.handlerTag = getNextHandlerTag();\n\n this.handlers = { ...this.handlers, handlerTag: this.handlerTag };\n\n if (this.config.ref) {\n this.config.ref.current = this as GestureType;\n }\n }\n\n toGestureArray(): GestureType[] {\n return [this as GestureType];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n prepare() {}\n\n get shouldUseReanimated(): boolean {\n // Use Reanimated when runOnJS isn't set explicitly,\n // all defined callbacks are worklets\n // and remote debugging is disabled\n return (\n this.config.runOnJS !== true &&\n !this.handlers.isWorklet.includes(false) &&\n !isRemoteDebuggingEnabled()\n );\n }\n}\n\nexport abstract class ContinousBaseGesture<\n EventPayloadT extends Record<string, unknown>,\n EventChangePayloadT extends Record<string, unknown>,\n> extends BaseGesture<EventPayloadT> {\n /**\n * Set the callback that is being called every time the gesture receives an update while it's active.\n * @param callback\n */\n onUpdate(callback: (event: GestureUpdateEvent<EventPayloadT>) => void) {\n this.handlers.onUpdate = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.UPDATE] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called every time the gesture receives an update while it's active.\n * This callback will receive information about change in value in relation to the last received event.\n * @param callback\n */\n onChange(\n callback: (\n event: GestureUpdateEvent<EventPayloadT & EventChangePayloadT>\n ) => void\n ) {\n this.handlers.onChange = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.CHANGE] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * When `true` the handler will not activate by itself even if its activation criteria are met.\n * Instead you can manipulate its state using state manager.\n * @param manualActivation\n */\n manualActivation(manualActivation: boolean) {\n this.config.manualActivation = manualActivation;\n return this;\n }\n}\n"]}
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.filterConfig = filterConfig;
7
+ exports.transformIntoHandlerTags = transformIntoHandlerTags;
7
8
  exports.findNodeHandle = findNodeHandle;
8
9
  exports.scheduleFlushOperations = scheduleFlushOperations;
9
10
 
@@ -1 +1 @@
1
- {"version":3,"sources":["utils.ts"],"names":["isConfigParam","param","name","undefined","Object","filterConfig","props","validProps","defaults","filteredConfig","key","value","transformIntoHandlerTags","top","left","bottom","right","handlerIDs","Platform","OS","map","current","filter","handle","handlerID","handlerIDToTag","handlerTag","findNodeHandle","node","flushOperationsScheduled","scheduleFlushOperations","RNGestureHandlerModule","flushOperations"],"mappings":";;;;;;;;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,SAASA,aAAT,CAAuBC,KAAvB,EAAuCC,IAAvC,EAAqD;AACnD;AACA;AACA,SACED,KAAK,KAAKE,SAAV,KACCF,KAAK,KAAKG,MAAM,CAACH,KAAD,CAAhB,IACC,EAAE,gBAAiBA,KAAnB,CAFF,KAGAC,IAAI,KAAK,sBAHT,IAIAA,IAAI,KAAK,gBALX;AAOD;;AAEM,SAASG,YAAT,CACLC,KADK,EAELC,UAFK,EAGLC,QAAiC,GAAG,EAH/B,EAIL;AACA,QAAMC,cAAc,GAAG,EAAE,GAAGD;AAAL,GAAvB;;AACA,OAAK,MAAME,GAAX,IAAkBH,UAAlB,EAA8B;AAC5B,QAAII,KAAK,GAAGL,KAAK,CAACI,GAAD,CAAjB;;AACA,QAAIV,aAAa,CAACW,KAAD,EAAQD,GAAR,CAAjB,EAA+B;AAC7B,UAAIA,GAAG,KAAK,sBAAR,IAAkCA,GAAG,KAAK,SAA9C,EAAyD;AACvDC,QAAAA,KAAK,GAAGC,wBAAwB,CAACN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AA,wBAAwB,GAAG,KAA3B;AACD,KAJD;AAKD;AACF","sourcesContent":["import * as React from 'react';\nimport { Platform, findNodeHandle as findNodeHandleRN } from 'react-native';\nimport { handlerIDToTag } from './handlersRegistry';\nimport { toArray } from '../utils';\nimport RNGestureHandlerModule from '../RNGestureHandlerModule';\nimport { ghQueueMicrotask } from '../ghQueueMicrotask';\n\nfunction isConfigParam(param: unknown, name: string) {\n // param !== Object(param) returns false if `param` is a function\n // or an object and returns true if `param` is null\n return (\n param !== undefined &&\n (param !== Object(param) ||\n !('__isNative' in (param as Record<string, unknown>))) &&\n name !== 'onHandlerStateChange' &&\n name !== 'onGestureEvent'\n );\n}\n\nexport function filterConfig(\n props: Record<string, unknown>,\n validProps: string[],\n defaults: Record<string, unknown> = {}\n) {\n const filteredConfig = { ...defaults };\n for (const key of validProps) {\n let value = props[key];\n if (isConfigParam(value, key)) {\n if (key === 'simultaneousHandlers' || key === 'waitFor') {\n value = transformIntoHandlerTags(props[key]);\n } else if (key === 'hitSlop' && typeof value !== 'object') {\n value = { top: value, left: value, bottom: value, right: value };\n }\n filteredConfig[key] = value;\n }\n }\n return filteredConfig;\n}\nfunction transformIntoHandlerTags(handlerIDs: any) {\n handlerIDs = toArray(handlerIDs);\n\n if (Platform.OS === 'web') {\n return handlerIDs\n .map(({ current }: { current: any }) => current)\n .filter((handle: any) => handle);\n }\n // converts handler string IDs into their numeric tags\n return handlerIDs\n .map(\n (handlerID: any) =>\n handlerIDToTag[handlerID] || handlerID.current?.handlerTag || -1\n )\n .filter((handlerTag: number) => handlerTag > 0);\n}\n\nexport function findNodeHandle(\n node: null | number | React.Component<any, any> | React.ComponentClass<any>\n): null | number | React.Component<any, any> | React.ComponentClass<any> {\n if (Platform.OS === 'web') {\n return node;\n }\n return findNodeHandleRN(node);\n}\nlet flushOperationsScheduled = false;\n\nexport function scheduleFlushOperations() {\n if (!flushOperationsScheduled) {\n flushOperationsScheduled = true;\n ghQueueMicrotask(() => {\n RNGestureHandlerModule.flushOperations();\n\n flushOperationsScheduled = false;\n });\n }\n}\n"]}
1
+ {"version":3,"sources":["utils.ts"],"names":["isConfigParam","param","name","undefined","Object","filterConfig","props","validProps","defaults","filteredConfig","key","value","transformIntoHandlerTags","top","left","bottom","right","handlerIDs","Platform","OS","map","current","filter","handle","handlerID","handlerIDToTag","handlerTag","findNodeHandle","node","flushOperationsScheduled","scheduleFlushOperations","RNGestureHandlerModule","flushOperations"],"mappings":";;;;;;;;;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,SAASA,aAAT,CAAuBC,KAAvB,EAAuCC,IAAvC,EAAqD;AACnD;AACA;AACA,SACED,KAAK,KAAKE,SAAV,KACCF,KAAK,KAAKG,MAAM,CAACH,KAAD,CAAhB,IACC,EAAE,gBAAiBA,KAAnB,CAFF,KAGAC,IAAI,KAAK,sBAHT,IAIAA,IAAI,KAAK,gBALX;AAOD;;AAEM,SAASG,YAAT,CACLC,KADK,EAELC,UAFK,EAGLC,QAAiC,GAAG,EAH/B,EAIL;AACA,QAAMC,cAAc,GAAG,EAAE,GAAGD;AAAL,GAAvB;;AACA,OAAK,MAAME,GAAX,IAAkBH,UAAlB,EAA8B;AAC5B,QAAII,KAAK,GAAGL,KAAK,CAACI,GAAD,CAAjB;;AACA,QAAIV,aAAa,CAACW,KAAD,EAAQD,GAAR,CAAjB,EAA+B;AAC7B,UAAIA,GAAG,KAAK,sBAAR,IAAkCA,GAAG,KAAK,SAA9C,EAAyD;AACvDC,QAAAA,KAAK,GAAGC,wBAAwB,CAACN,KAAK,CAACI,GAAD,CAAN,CAAhC;AACD,OAFD,MAEO,IAAIA,GAAG,KAAK,SAAR,IAAqB,OAAOC,KAAP,KAAiB,QAA1C,EAAoD;AACzDA,QAAAA,KAAK,GAAG;AAAEE,UAAAA,GAAG,EAAEF,KAAP;AAAcG,UAAAA,IAAI,EAAEH,KAApB;AAA2BI,UAAAA,MAAM,EAAEJ,KAAnC;AAA0CK,UAAAA,KAAK,EAAEL;AAAjD,SAAR;AACD;;AACDF,MAAAA,cAAc,CAACC,GAAD,CAAd,GAAsBC,KAAtB;AACD;AACF;;AACD,SAAOF,cAAP;AACD;;AAEM,SAASG,wBAAT,CAAkCK,UAAlC,EAAmD;AACxDA,EAAAA,UAAU,GAAG,oBAAQA,UAAR,CAAb;;AAEA,MAAIC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzB,WAAOF,UAAU,CACdG,GADI,CACA,CAAC;AAAEC,MAAAA;AAAF,KAAD,KAAmCA,OADnC,EAEJC,MAFI,CAEIC,MAAD,IAAiBA,MAFpB,CAAP;AAGD,GAPuD,CAQxD;;;AACA,SAAON,UAAU,CACdG,GADI,CAEFI,SAAD;AAAA;;AAAA,WACEC,iCAAeD,SAAf,4BAA6BA,SAAS,CAACH,OAAvC,uDAA6B,mBAAmBK,UAAhD,KAA8D,CAAC,CADjE;AAAA,GAFG,EAKJJ,MALI,CAKII,UAAD,IAAwBA,UAAU,GAAG,CALxC,CAAP;AAMD;;AAEM,SAASC,cAAT,CACLC,IADK,EAEkE;AACvE,MAAIV,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzB,WAAOS,IAAP;AACD;;AACD,SAAO,iCAAiBA,IAAjB,CAAP;AACD;;AACD,IAAIC,wBAAwB,GAAG,KAA/B;;AAEO,SAASC,uBAAT,GAAmC;AACxC,MAAI,CAACD,wBAAL,EAA+B;AAC7BA,IAAAA,wBAAwB,GAAG,IAA3B;AACA,4CAAiB,MAAM;AACrBE,sCAAuBC,eAAvB;;AAEAH,MAAAA,wBAAwB,GAAG,KAA3B;AACD,KAJD;AAKD;AACF","sourcesContent":["import * as React from 'react';\nimport { Platform, findNodeHandle as findNodeHandleRN } from 'react-native';\nimport { handlerIDToTag } from './handlersRegistry';\nimport { toArray } from '../utils';\nimport RNGestureHandlerModule from '../RNGestureHandlerModule';\nimport { ghQueueMicrotask } from '../ghQueueMicrotask';\n\nfunction isConfigParam(param: unknown, name: string) {\n // param !== Object(param) returns false if `param` is a function\n // or an object and returns true if `param` is null\n return (\n param !== undefined &&\n (param !== Object(param) ||\n !('__isNative' in (param as Record<string, unknown>))) &&\n name !== 'onHandlerStateChange' &&\n name !== 'onGestureEvent'\n );\n}\n\nexport function filterConfig(\n props: Record<string, unknown>,\n validProps: string[],\n defaults: Record<string, unknown> = {}\n) {\n const filteredConfig = { ...defaults };\n for (const key of validProps) {\n let value = props[key];\n if (isConfigParam(value, key)) {\n if (key === 'simultaneousHandlers' || key === 'waitFor') {\n value = transformIntoHandlerTags(props[key]);\n } else if (key === 'hitSlop' && typeof value !== 'object') {\n value = { top: value, left: value, bottom: value, right: value };\n }\n filteredConfig[key] = value;\n }\n }\n return filteredConfig;\n}\n\nexport function transformIntoHandlerTags(handlerIDs: any) {\n handlerIDs = toArray(handlerIDs);\n\n if (Platform.OS === 'web') {\n return handlerIDs\n .map(({ current }: { current: any }) => current)\n .filter((handle: any) => handle);\n }\n // converts handler string IDs into their numeric tags\n return handlerIDs\n .map(\n (handlerID: any) =>\n handlerIDToTag[handlerID] || handlerID.current?.handlerTag || -1\n )\n .filter((handlerTag: number) => handlerTag > 0);\n}\n\nexport function findNodeHandle(\n node: null | number | React.Component<any, any> | React.ComponentClass<any>\n): null | number | React.Component<any, any> | React.ComponentClass<any> {\n if (Platform.OS === 'web') {\n return node;\n }\n return findNodeHandleRN(node);\n}\nlet flushOperationsScheduled = false;\n\nexport function scheduleFlushOperations() {\n if (!flushOperationsScheduled) {\n flushOperationsScheduled = true;\n ghQueueMicrotask(() => {\n RNGestureHandlerModule.flushOperations();\n\n flushOperationsScheduled = false;\n });\n }\n}\n"]}
@@ -195,6 +195,12 @@ Object.defineProperty(exports, "RefreshControl", {
195
195
  return _GestureComponents.RefreshControl;
196
196
  }
197
197
  });
198
+ Object.defineProperty(exports, "Text", {
199
+ enumerable: true,
200
+ get: function () {
201
+ return _Text.Text;
202
+ }
203
+ });
198
204
  Object.defineProperty(exports, "HoverEffect", {
199
205
  enumerable: true,
200
206
  get: function () {
@@ -274,6 +280,8 @@ var _touchables = require("./components/touchables");
274
280
 
275
281
  var _GestureComponents = require("./components/GestureComponents");
276
282
 
283
+ var _Text = require("./components/Text");
284
+
277
285
  var _hoverGesture = require("./handlers/gestures/hoverGesture");
278
286
 
279
287
  var _Swipeable = _interopRequireDefault(require("./components/Swipeable"));
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAeA;;AAsBA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAkBA;;AAOA;;AAYA;;AAMA;;AAQA;;AAyCA;;AAEA;;AAUA;;AAEA;;;;AAKA","sourcesContent":["import { initialize } from './init';\n\nexport { Directions } from './Directions';\nexport { State } from './State';\nexport { PointerType } from './PointerType';\nexport { default as gestureHandlerRootHOC } from './components/gestureHandlerRootHOC';\nexport { default as GestureHandlerRootView } from './components/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 { MouseButton } from './handlers/gestureHandlerCommon';\nexport type { GestureType } from './handlers/gestures/gesture';\nexport type {\n TapGestureHandlerEventPayload,\n ForceTouchGestureHandlerEventPayload,\n LongPressGestureHandlerEventPayload,\n PanGestureHandlerEventPayload,\n PinchGestureHandlerEventPayload,\n RotationGestureHandlerEventPayload,\n NativeViewGestureHandlerPayload,\n FlingGestureHandlerEventPayload,\n} from './handlers/GestureHandlerEventPayload';\nexport type { TapGestureHandlerProps } from './handlers/TapGestureHandler';\nexport type { ForceTouchGestureHandlerProps } from './handlers/ForceTouchGestureHandler';\nexport type { ForceTouchGestureChangeEventPayload } from './handlers/gestures/forceTouchGesture';\nexport type { LongPressGestureHandlerProps } from './handlers/LongPressGestureHandler';\nexport type { PanGestureHandlerProps } from './handlers/PanGestureHandler';\nexport type { PanGestureChangeEventPayload } from './handlers/gestures/panGesture';\nexport type { PinchGestureHandlerProps } from './handlers/PinchGestureHandler';\nexport type { PinchGestureChangeEventPayload } from './handlers/gestures/pinchGesture';\nexport type { RotationGestureHandlerProps } from './handlers/RotationGestureHandler';\nexport type { FlingGestureHandlerProps } 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 { NativeViewGestureHandlerProps } 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 { HoverGestureType as HoverGesture } from './handlers/gestures/hoverGesture';\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/GestureButtonsProps';\nexport {\n RawButton,\n BaseButton,\n RectButton,\n BorderlessButton,\n PureNativeButton,\n} from './components/GestureButtons';\nexport type {\n TouchableHighlightProps,\n TouchableOpacityProps,\n TouchableWithoutFeedbackProps,\n} from './components/touchables';\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 RefreshControl,\n} from './components/GestureComponents';\nexport { HoverEffect } from './handlers/gestures/hoverGesture';\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 type { SwipeableProps } from './components/Swipeable';\nexport { default as Swipeable } from './components/Swipeable';\nexport type { PressableProps } from './components/Pressable';\nexport { default as Pressable } from './components/Pressable';\n\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\nexport {\n enableExperimentalWebImplementation,\n enableLegacyWebImplementation,\n} from './EnableNewWebImplementation';\n\ninitialize();\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAeA;;AAsBA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAkBA;;AAOA;;AAYA;;AAMA;;AAQA;;AACA;;AAyCA;;AAEA;;AAUA;;AAEA;;;;AAKA","sourcesContent":["import { initialize } from './init';\n\nexport { Directions } from './Directions';\nexport { State } from './State';\nexport { PointerType } from './PointerType';\nexport { default as gestureHandlerRootHOC } from './components/gestureHandlerRootHOC';\nexport { default as GestureHandlerRootView } from './components/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 { MouseButton } from './handlers/gestureHandlerCommon';\nexport type { GestureType } from './handlers/gestures/gesture';\nexport type {\n TapGestureHandlerEventPayload,\n ForceTouchGestureHandlerEventPayload,\n LongPressGestureHandlerEventPayload,\n PanGestureHandlerEventPayload,\n PinchGestureHandlerEventPayload,\n RotationGestureHandlerEventPayload,\n NativeViewGestureHandlerPayload,\n FlingGestureHandlerEventPayload,\n} from './handlers/GestureHandlerEventPayload';\nexport type { TapGestureHandlerProps } from './handlers/TapGestureHandler';\nexport type { ForceTouchGestureHandlerProps } from './handlers/ForceTouchGestureHandler';\nexport type { ForceTouchGestureChangeEventPayload } from './handlers/gestures/forceTouchGesture';\nexport type { LongPressGestureHandlerProps } from './handlers/LongPressGestureHandler';\nexport type { PanGestureHandlerProps } from './handlers/PanGestureHandler';\nexport type { PanGestureChangeEventPayload } from './handlers/gestures/panGesture';\nexport type { PinchGestureHandlerProps } from './handlers/PinchGestureHandler';\nexport type { PinchGestureChangeEventPayload } from './handlers/gestures/pinchGesture';\nexport type { RotationGestureHandlerProps } from './handlers/RotationGestureHandler';\nexport type { FlingGestureHandlerProps } 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 { NativeViewGestureHandlerProps } 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 { HoverGestureType as HoverGesture } from './handlers/gestures/hoverGesture';\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/GestureButtonsProps';\nexport {\n RawButton,\n BaseButton,\n RectButton,\n BorderlessButton,\n PureNativeButton,\n} from './components/GestureButtons';\nexport type {\n TouchableHighlightProps,\n TouchableOpacityProps,\n TouchableWithoutFeedbackProps,\n} from './components/touchables';\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 RefreshControl,\n} from './components/GestureComponents';\nexport { Text } from './components/Text';\nexport { HoverEffect } from './handlers/gestures/hoverGesture';\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 type { SwipeableProps } from './components/Swipeable';\nexport { default as Swipeable } from './components/Swipeable';\nexport type { PressableProps } from './components/Pressable';\nexport { default as Pressable } from './components/Pressable';\n\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\nexport {\n enableExperimentalWebImplementation,\n enableLegacyWebImplementation,\n} from './EnableNewWebImplementation';\n\ninitialize();\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["jestUtils.ts"],"names":["fireEvent","_element","_name","_data","require","_e","handlersDefaultEvents","flingHandlerName","x","y","absoluteX","absoluteY","numberOfPointers","forceTouchHandlerName","force","longPressHandlerName","duration","nativeViewHandlerName","pointerInside","panHandlerName","translationX","translationY","velocityX","velocityY","stylusData","undefined","pinchHandlerName","focalX","focalY","scale","velocity","rotationHandlerName","anchorX","anchorY","rotation","tapHandlerName","isGesture","componentOrGesture","BaseGesture","wrapWithNativeEvent","event","nativeEvent","fillOldStateChanges","previousEvent","currentEvent","isFirstEvent","oldState","State","UNDETERMINED","isGestureStateEvent","state","validateStateTransitions","stringify","JSON","errorMsgWithBothEvents","description","errorMsgWithCurrentEvent","BEGAN","fillMissingDefaultsFor","handlerType","handlerTag","isDiscreteHandler","fillMissingStatesTransitions","events","_events","lastEvent","length","firstEvent","shouldDuplicateFirstEvent","hasState","duplicated","unshift","shouldDuplicateLastEvent","END","FAILED","CANCELLED","push","isWithoutState","noEventsLeft","trueFn","fillEventsForCurrentState","shouldConsumeEvent","shouldTransitionToNextState","peekCurrentEvent","peekNextEvent","consumeCurrentEvent","shift","nextEvent","currentRequiredState","REQUIRED_EVENTS","currentStateIdx","eventData","shouldUseEvent","transformedEvents","ACTIVE","hasAllStates","iterations","nextRequiredState","e","getHandlerData","gesture","emitEvent","eventName","args","DeviceEventEmitter","emit","handlerName","enabled","config","gestureHandlerComponent","props","fireGestureHandler","eventList","_","map","lastSentEvent","hasChangedState","getByGestureTestId","testID","handler","Error"],"mappings":";;;;;;;;AAAA;;AACA;;AAEA;;AAIA;;AAWA;;AAOA;;AACA;;AAcA;;AAIA;;AAIA;;AAIA;;AAIA;;AAIA;;AACA;;;;AAEA;AACA,IAAIA,SAAS,GAAG,CACdC,QADc,EAEdC,KAFc,EAGd,GAAGC,KAHW,KAIX,CACH;AACD,CAND;;AAQA,IAAI;AACF;AACAH,EAAAA,SAAS,GA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AACD;;AACD,SAAOC,OAAP;AACD","sourcesContent":["import invariant from 'invariant';\nimport { DeviceEventEmitter } from 'react-native';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport {\n FlingGestureHandler,\n flingHandlerName,\n} from '../handlers/FlingGestureHandler';\nimport {\n ForceTouchGestureHandler,\n forceTouchHandlerName,\n} from '../handlers/ForceTouchGestureHandler';\nimport {\n BaseGestureHandlerProps,\n GestureEvent,\n HandlerStateChangeEvent,\n} from '../handlers/gestureHandlerCommon';\nimport { FlingGesture } from '../handlers/gestures/flingGesture';\nimport { ForceTouchGesture } from '../handlers/gestures/forceTouchGesture';\nimport { BaseGesture, GestureType } from '../handlers/gestures/gesture';\nimport { LongPressGesture } from '../handlers/gestures/longPressGesture';\nimport { NativeGesture } from '../handlers/gestures/nativeGesture';\nimport { PanGesture } from '../handlers/gestures/panGesture';\nimport { PinchGesture } from '../handlers/gestures/pinchGesture';\nimport { RotationGesture } from '../handlers/gestures/rotationGesture';\nimport { TapGesture } from '../handlers/gestures/tapGesture';\nimport { findHandlerByTestID } from '../handlers/handlersRegistry';\nimport {\n LongPressGestureHandler,\n longPressHandlerName,\n} from '../handlers/LongPressGestureHandler';\nimport type {\n FlingGestureHandlerEventPayload,\n ForceTouchGestureHandlerEventPayload,\n LongPressGestureHandlerEventPayload,\n NativeViewGestureHandlerPayload,\n PanGestureHandlerEventPayload,\n PinchGestureHandlerEventPayload,\n RotationGestureHandlerEventPayload,\n TapGestureHandlerEventPayload,\n} from '../handlers/GestureHandlerEventPayload';\nimport {\n NativeViewGestureHandler,\n nativeViewHandlerName,\n} from '../handlers/NativeViewGestureHandler';\nimport {\n PanGestureHandler,\n panHandlerName,\n} from '../handlers/PanGestureHandler';\nimport {\n PinchGestureHandler,\n pinchHandlerName,\n} from '../handlers/PinchGestureHandler';\nimport {\n RotationGestureHandler,\n rotationHandlerName,\n} from '../handlers/RotationGestureHandler';\nimport {\n TapGestureHandler,\n tapHandlerName,\n} from '../handlers/TapGestureHandler';\nimport { State } from '../State';\nimport { hasProperty, withPrevAndCurrent } from '../utils';\n\n// Load fireEvent conditionally, so RNGH may be used in setups without testing-library\nlet fireEvent = (\n _element: ReactTestInstance,\n _name: string,\n ..._data: any[]\n) => {\n // NOOP\n};\n\ntry {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n fireEvent = require('@testing-library/react-native').fireEvent;\n} catch (_e) {\n // Do nothing if not available\n}\n\ntype GestureHandlerTestEvent<\n TEventPayload extends Record<string, unknown> = Record<string, unknown>\n> = (\n | GestureEvent<TEventPayload>\n | HandlerStateChangeEvent<TEventPayload>\n)['nativeEvent'];\n\ntype HandlerNames = keyof DefaultEventsMapping;\n\ntype WithNumberOfPointers<T> = {\n [P in keyof T]: T[P] & { numberOfPointers: number };\n};\ntype DefaultEventsMapping = WithNumberOfPointers<{\n [flingHandlerName]: FlingGestureHandlerEventPayload;\n [forceTouchHandlerName]: ForceTouchGestureHandlerEventPayload;\n [longPressHandlerName]: LongPressGestureHandlerEventPayload;\n [nativeViewHandlerName]: NativeViewGestureHandlerPayload;\n [panHandlerName]: PanGestureHandlerEventPayload;\n [pinchHandlerName]: PinchGestureHandlerEventPayload;\n [rotationHandlerName]: RotationGestureHandlerEventPayload;\n [tapHandlerName]: TapGestureHandlerEventPayload;\n}>;\n\nconst handlersDefaultEvents: DefaultEventsMapping = {\n [flingHandlerName]: {\n x: 0,\n y: 0,\n absoluteX: 0,\n absoluteY: 0,\n numberOfPointers: 1,\n },\n [forceTouchHandlerName]: {\n x: 0,\n y: 0,\n absoluteX: 0,\n absoluteY: 0,\n force: 1,\n numberOfPointers: 1,\n },\n [longPressHandlerName]: {\n x: 0,\n y: 0,\n absoluteX: 0,\n absoluteY: 0,\n duration: 100,\n numberOfPointers: 1,\n },\n [nativeViewHandlerName]: {\n pointerInside: true,\n numberOfPointers: 1,\n },\n [panHandlerName]: {\n x: 0,\n y: 0,\n absoluteX: 0,\n absoluteY: 0,\n translationX: 100,\n translationY: 0,\n velocityX: 3,\n velocityY: 0,\n numberOfPointers: 1,\n stylusData: undefined,\n },\n [pinchHandlerName]: {\n focalX: 0,\n focalY: 0,\n scale: 2,\n velocity: 1,\n numberOfPointers: 2,\n },\n [rotationHandlerName]: {\n anchorX: 0,\n anchorY: 0,\n rotation: 3.14,\n velocity: 2,\n numberOfPointers: 2,\n },\n [tapHandlerName]: {\n x: 0,\n y: 0,\n absoluteX: 0,\n absoluteY: 0,\n numberOfPointers: 1,\n },\n};\n\nfunction isGesture(\n componentOrGesture: ReactTestInstance | GestureType\n): componentOrGesture is GestureType {\n return componentOrGesture instanceof BaseGesture;\n}\n\ninterface WrappedGestureHandlerTestEvent {\n nativeEvent: GestureHandlerTestEvent;\n}\nfunction wrapWithNativeEvent(\n event: GestureHandlerTestEvent\n): WrappedGestureHandlerTestEvent {\n return { nativeEvent: event };\n}\n\nfunction fillOldStateChanges(\n previousEvent: GestureHandlerTestEvent | null,\n currentEvent: Omit<GestureHandlerTestEvent, 'oldState'>\n): GestureHandlerTestEvent {\n const isFirstEvent = previousEvent === null;\n if (isFirstEvent) {\n return {\n oldState: State.UNDETERMINED,\n ...currentEvent,\n } as GestureHandlerTestEvent;\n }\n\n const isGestureStateEvent = previousEvent.state !== currentEvent.state;\n if (isGestureStateEvent) {\n return {\n oldState: previousEvent?.state,\n ...currentEvent,\n } as GestureHandlerTestEvent;\n } else {\n return currentEvent as GestureHandlerTestEvent;\n }\n}\n\ntype EventWithStates = Partial<\n Pick<GestureHandlerTestEvent, 'oldState' | 'state'>\n>;\nfunction validateStateTransitions(\n previousEvent: EventWithStates | null,\n currentEvent: EventWithStates\n) {\n function stringify(event: Record<string, unknown> | null) {\n return JSON.stringify(event, null, 2);\n }\n function errorMsgWithBothEvents(description: string) {\n return `${description}, invalid event: ${stringify(\n currentEvent\n )}, previous event: ${stringify(previousEvent)}`;\n }\n\n function errorMsgWithCurrentEvent(description: string) {\n return `${description}, invalid event: ${stringify(currentEvent)}`;\n }\n\n invariant(\n hasProperty(currentEvent, 'state'),\n errorMsgWithCurrentEvent('every event must have state')\n );\n\n const isFirstEvent = previousEvent === null;\n if (isFirstEvent) {\n invariant(\n currentEvent.state === State.BEGAN,\n errorMsgWithCurrentEvent('first event must have BEGAN state')\n );\n }\n\n if (previousEvent !== null) {\n if (previousEvent.state !== currentEvent.state) {\n invariant(\n hasProperty(currentEvent, 'oldState'),\n errorMsgWithCurrentEvent(\n 'when state changes, oldState field should be present'\n )\n );\n invariant(\n currentEvent.oldState === previousEvent.state,\n errorMsgWithBothEvents(\n \"when state changes, oldState should be the same as previous event' state\"\n )\n );\n }\n }\n\n return currentEvent;\n}\n\ntype EventWithoutStates = Omit<GestureHandlerTestEvent, 'oldState' | 'state'>;\ninterface HandlerInfo {\n handlerType: HandlerNames;\n handlerTag: number;\n}\nfunction fillMissingDefaultsFor({\n handlerType,\n handlerTag,\n}: HandlerInfo): (\n event: Partial<GestureHandlerTestEvent>\n) => EventWithoutStates {\n return (event) => {\n return {\n ...handlersDefaultEvents[handlerType],\n ...event,\n handlerTag,\n };\n };\n}\n\nfunction isDiscreteHandler(handlerType: HandlerNames) {\n return (\n handlerType === 'TapGestureHandler' ||\n handlerType === 'LongPressGestureHandler'\n );\n}\n\nfunction fillMissingStatesTransitions(\n events: EventWithoutStates[],\n isDiscreteHandler: boolean\n): EventWithoutStates[] {\n type Event = EventWithoutStates | null;\n const _events = [...events];\n const lastEvent = _events[_events.length - 1] ?? null;\n const firstEvent = _events[0] ?? null;\n\n const shouldDuplicateFirstEvent =\n !isDiscreteHandler && !hasState(State.BEGAN)(firstEvent);\n if (shouldDuplicateFirstEvent) {\n const duplicated = { ...firstEvent, state: State.BEGAN };\n // @ts-ignore badly typed, property may exist and we don't want to copy it\n delete duplicated.oldState;\n _events.unshift(duplicated);\n }\n\n const shouldDuplicateLastEvent =\n !hasState(State.END)(lastEvent) ||\n !hasState(State.FAILED)(lastEvent) ||\n !hasState(State.CANCELLED)(lastEvent);\n\n if (shouldDuplicateLastEvent) {\n const duplicated = { ...lastEvent, state: State.END };\n // @ts-ignore badly typed, property may exist and we don't want to copy it\n delete duplicated.oldState;\n _events.push(duplicated);\n }\n\n function isWithoutState(event: Event) {\n return event !== null && !hasProperty(event, 'state');\n }\n function hasState(state: State) {\n return (event: Event) => event !== null && event.state === state;\n }\n function noEventsLeft(event: Event) {\n return event === null;\n }\n\n function trueFn() {\n return true;\n }\n interface Args {\n shouldConsumeEvent?: (event: Event) => boolean;\n shouldTransitionToNextState?: (nextEvent: Event) => boolean;\n }\n function fillEventsForCurrentState({\n shouldConsumeEvent = trueFn,\n shouldTransitionToNextState = trueFn,\n }: Args) {\n function peekCurrentEvent(): Event {\n return _events[0] ?? null;\n }\n function peekNextEvent(): Event {\n return _events[1] ?? null;\n }\n function consumeCurrentEvent() {\n _events.shift();\n }\n const currentEvent = peekCurrentEvent();\n const nextEvent = peekNextEvent();\n const currentRequiredState = REQUIRED_EVENTS[currentStateIdx];\n\n let eventData = {};\n const shouldUseEvent = shouldConsumeEvent(currentEvent);\n if (shouldUseEvent) {\n eventData = currentEvent!;\n consumeCurrentEvent();\n }\n transformedEvents.push({ state: currentRequiredState, ...eventData });\n if (shouldTransitionToNextState(nextEvent)) {\n currentStateIdx++;\n }\n }\n\n const REQUIRED_EVENTS = [State.BEGAN, State.ACTIVE, State.END];\n\n let currentStateIdx = 0;\n const transformedEvents: EventWithoutStates[] = [];\n let hasAllStates;\n let iterations = 0;\n do {\n const nextRequiredState = REQUIRED_EVENTS[currentStateIdx];\n if (nextRequiredState === State.BEGAN) {\n fillEventsForCurrentState({\n shouldConsumeEvent: (e: Event) =>\n isWithoutState(e) || hasState(State.BEGAN)(e),\n });\n } else if (nextRequiredState === State.ACTIVE) {\n const shouldConsumeEvent = (e: Event) =>\n isWithoutState(e) || hasState(State.ACTIVE)(e);\n const shouldTransitionToNextState = (nextEvent: Event) =>\n noEventsLeft(nextEvent) ||\n hasState(State.END)(nextEvent) ||\n hasState(State.FAILED)(nextEvent) ||\n hasState(State.CANCELLED)(nextEvent);\n\n fillEventsForCurrentState({\n shouldConsumeEvent,\n shouldTransitionToNextState,\n });\n } else if (nextRequiredState === State.END) {\n fillEventsForCurrentState({});\n }\n hasAllStates = currentStateIdx === REQUIRED_EVENTS.length;\n\n invariant(\n iterations++ <= 500,\n 'exceeded max number of iterations, please report a bug in RNGH repository with your test case'\n );\n } while (!hasAllStates);\n\n return transformedEvents;\n}\n\ntype EventEmitter = (\n eventName: string,\n args: { nativeEvent: GestureHandlerTestEvent }\n) => void;\ninterface HandlerData {\n emitEvent: EventEmitter;\n handlerType: HandlerNames;\n handlerTag: number;\n enabled: boolean | undefined;\n}\nfunction getHandlerData(\n componentOrGesture: ReactTestInstance | GestureType\n): HandlerData {\n if (isGesture(componentOrGesture)) {\n const gesture = componentOrGesture;\n return {\n emitEvent: (eventName, args) => {\n DeviceEventEmitter.emit(eventName, args.nativeEvent);\n },\n handlerType: gesture.handlerName as HandlerNames,\n handlerTag: gesture.handlerTag,\n enabled: gesture.config.enabled,\n };\n }\n const gestureHandlerComponent = componentOrGesture;\n return {\n emitEvent: (eventName, args) => {\n fireEvent(gestureHandlerComponent, eventName, args);\n },\n handlerType: gestureHandlerComponent.props.handlerType as HandlerNames,\n handlerTag: gestureHandlerComponent.props.handlerTag as number,\n enabled: gestureHandlerComponent.props.enabled,\n };\n}\ntype AllGestures =\n | TapGesture\n | PanGesture\n | LongPressGesture\n | RotationGesture\n | PinchGesture\n | FlingGesture\n | ForceTouchGesture\n | NativeGesture;\n\ntype AllHandlers =\n | TapGestureHandler\n | PanGestureHandler\n | LongPressGestureHandler\n | RotationGestureHandler\n | PinchGestureHandler\n | FlingGestureHandler\n | ForceTouchGestureHandler\n | NativeViewGestureHandler;\n\n// prettier-ignore\ntype ClassComponentConstructor<P> = new (props: P) => React.Component<P, any, any>;\n\ntype ExtractPayloadFromProps<T> = T extends BaseGestureHandlerProps<\n infer TPayload\n>\n ? TPayload\n : never;\n\ntype ExtractConfig<T> = T extends BaseGesture<infer TGesturePayload>\n ? TGesturePayload\n : T extends ClassComponentConstructor<infer THandlerProps>\n ? ExtractPayloadFromProps<THandlerProps>\n : Record<string, unknown>;\n\nexport function fireGestureHandler<THandler extends AllGestures | AllHandlers>(\n componentOrGesture: ReactTestInstance | GestureType,\n eventList: Partial<GestureHandlerTestEvent<ExtractConfig<THandler>>>[] = []\n): void {\n const { emitEvent, handlerType, handlerTag, enabled } =\n getHandlerData(componentOrGesture);\n\n if (enabled === false) {\n return;\n }\n\n let _ = fillMissingStatesTransitions(\n eventList,\n isDiscreteHandler(handlerType)\n );\n _ = _.map(fillMissingDefaultsFor({ handlerTag, handlerType }));\n _ = withPrevAndCurrent(_, fillOldStateChanges);\n _ = withPrevAndCurrent(_, validateStateTransitions);\n // @ts-ignore TODO\n _ = _.map(wrapWithNativeEvent);\n\n const events = _ as unknown as WrappedGestureHandlerTestEvent[];\n\n const firstEvent = events.shift()!;\n\n emitEvent('onGestureHandlerStateChange', firstEvent);\n let lastSentEvent = firstEvent;\n for (const event of events) {\n const hasChangedState =\n lastSentEvent.nativeEvent.state !== event.nativeEvent.state;\n\n if (hasChangedState) {\n emitEvent('onGestureHandlerStateChange', event);\n } else {\n emitEvent('onGestureHandlerEvent', event);\n }\n lastSentEvent = event;\n }\n}\n\nexport function getByGestureTestId(testID: string) {\n const handler = findHandlerByTestID(testID);\n if (handler === null) {\n throw new Error(`Handler with id: '${testID}' cannot be found`);\n }\n return handler;\n}\n"]}
1
+ {"version":3,"sources":["jestUtils.ts"],"names":["fireEvent","_element","_name","_data","require","_e","handlersDefaultEvents","flingHandlerName","x","y","absoluteX","absoluteY","numberOfPointers","forceTouchHandlerName","force","longPressHandlerName","duration","nativeViewHandlerName","pointerInside","panHandlerName","translationX","translationY","velocityX","velocityY","stylusData","undefined","pinchHandlerName","focalX","focalY","scale","velocity","rotationHandlerName","anchorX","anchorY","rotation","tapHandlerName","isGesture","componentOrGesture","BaseGesture","wrapWithNativeEvent","event","nativeEvent","fillOldStateChanges","previousEvent","currentEvent","isFirstEvent","oldState","State","UNDETERMINED","isGestureStateEvent","state","validateStateTransitions","stringify","JSON","errorMsgWithBothEvents","description","errorMsgWithCurrentEvent","BEGAN","fillMissingDefaultsFor","handlerType","handlerTag","isDiscreteHandler","fillMissingStatesTransitions","events","_events","lastEvent","length","firstEvent","shouldDuplicateFirstEvent","hasState","duplicated","unshift","shouldDuplicateLastEvent","END","FAILED","CANCELLED","push","isWithoutState","noEventsLeft","trueFn","fillEventsForCurrentState","shouldConsumeEvent","shouldTransitionToNextState","peekCurrentEvent","peekNextEvent","consumeCurrentEvent","shift","nextEvent","currentRequiredState","REQUIRED_EVENTS","currentStateIdx","eventData","shouldUseEvent","transformedEvents","ACTIVE","hasAllStates","iterations","nextRequiredState","e","getHandlerData","gesture","emitEvent","eventName","args","DeviceEventEmitter","emit","handlerName","enabled","config","gestureHandlerComponent","props","fireGestureHandler","eventList","_","map","lastSentEvent","hasChangedState","getByGestureTestId","testID","handler","Error"],"mappings":";;;;;;;;AAAA;;AACA;;AAEA;;AAIA;;AAWA;;AAOA;;AACA;;AAcA;;AAIA;;AAIA;;AAIA;;AAIA;;AAIA;;AACA;;;;AAEA;AACA,IAAIA,SAAS,GAAG,CACdC,QADc,EAEdC,KAFc,EAGd,GAAGC,KAHW,KAIX,CACH;AACD,CAND;;AAQA,IAAI;AACF;AACAH,EAAAA,SAAS,GAAGI,OAAO,CAAC,+BAAD,CAAP,CAAyCJ,SAArD;AACD,CAHD,CAGE,OAAOK,EAAP,EAAW,CACX;AACD;;AAyBD,MAAMC,qBAA2C,GAAG;AAClD,GAACC,qCAAD,GAAoB;AAClBC,IAAAA,CAAC,EAAE,CADe;AAElBC,IAAAA,CAAC,EAAE,CAFe;AAGlBC,IAAAA,SAAS,EAAE,CAHO;AAIlBC,IAAAA,SAAS,EAAE,CAJO;AAKlBC,IAAAA,gBAAgB,EAAE;AALA,GAD8B;AAQlD,GAACC,+CAAD,GAAyB;AACvBL,IAAAA,CAAC,EA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BA,CAAnB,EAAsB9D,wBAAtB,CAAJ,CAdM,CAeN;;AACA8D,EAAAA,CAAC,GAAGA,CAAC,CAACC,GAAF,CAAM3E,mBAAN,CAAJ;AAEA,QAAMwB,MAAM,GAAGkD,CAAf;AAEA,QAAM9C,UAAU,GAAGJ,MAAM,CAACuB,KAAP,EAAnB;AAEAe,EAAAA,SAAS,CAAC,6BAAD,EAAgClC,UAAhC,CAAT;AACA,MAAIgD,aAAa,GAAGhD,UAApB;;AACA,OAAK,MAAM3B,KAAX,IAAoBuB,MAApB,EAA4B;AAC1B,UAAMqD,eAAe,GACnBD,aAAa,CAAC1E,WAAd,CAA0BS,KAA1B,KAAoCV,KAAK,CAACC,WAAN,CAAkBS,KADxD;;AAGA,QAAIkE,eAAJ,EAAqB;AACnBf,MAAAA,SAAS,CAAC,6BAAD,EAAgC7D,KAAhC,CAAT;AACD,KAFD,MAEO;AACL6D,MAAAA,SAAS,CAAC,uBAAD,EAA0B7D,KAA1B,CAAT;AACD;;AACD2E,IAAAA,aAAa,GAAG3E,KAAhB;AACD;AACF;;AAEM,SAAS6E,kBAAT,CAA4BC,MAA5B,EAA4C;AACjD,QAAMC,OAAO,GAAG,2CAAoBD,MAApB,CAAhB;;AACA,MAAIC,OAAO,KAAK,IAAhB,EAAsB;AACpB,UAAM,IAAIC,KAAJ,CAAW,qBAAoBF,MAAO,mBAAtC,CAAN;AACD;;AACD,SAAOC,OAAP;AACD","sourcesContent":["import invariant from 'invariant';\nimport { DeviceEventEmitter } from 'react-native';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport {\n FlingGestureHandler,\n flingHandlerName,\n} from '../handlers/FlingGestureHandler';\nimport {\n ForceTouchGestureHandler,\n forceTouchHandlerName,\n} from '../handlers/ForceTouchGestureHandler';\nimport {\n BaseGestureHandlerProps,\n GestureEvent,\n HandlerStateChangeEvent,\n} from '../handlers/gestureHandlerCommon';\nimport { FlingGesture } from '../handlers/gestures/flingGesture';\nimport { ForceTouchGesture } from '../handlers/gestures/forceTouchGesture';\nimport { BaseGesture, GestureType } from '../handlers/gestures/gesture';\nimport { LongPressGesture } from '../handlers/gestures/longPressGesture';\nimport { NativeGesture } from '../handlers/gestures/nativeGesture';\nimport { PanGesture } from '../handlers/gestures/panGesture';\nimport { PinchGesture } from '../handlers/gestures/pinchGesture';\nimport { RotationGesture } from '../handlers/gestures/rotationGesture';\nimport { TapGesture } from '../handlers/gestures/tapGesture';\nimport { findHandlerByTestID } from '../handlers/handlersRegistry';\nimport {\n LongPressGestureHandler,\n longPressHandlerName,\n} from '../handlers/LongPressGestureHandler';\nimport type {\n FlingGestureHandlerEventPayload,\n ForceTouchGestureHandlerEventPayload,\n LongPressGestureHandlerEventPayload,\n NativeViewGestureHandlerPayload,\n PanGestureHandlerEventPayload,\n PinchGestureHandlerEventPayload,\n RotationGestureHandlerEventPayload,\n TapGestureHandlerEventPayload,\n} from '../handlers/GestureHandlerEventPayload';\nimport {\n NativeViewGestureHandler,\n nativeViewHandlerName,\n} from '../handlers/NativeViewGestureHandler';\nimport {\n PanGestureHandler,\n panHandlerName,\n} from '../handlers/PanGestureHandler';\nimport {\n PinchGestureHandler,\n pinchHandlerName,\n} from '../handlers/PinchGestureHandler';\nimport {\n RotationGestureHandler,\n rotationHandlerName,\n} from '../handlers/RotationGestureHandler';\nimport {\n TapGestureHandler,\n tapHandlerName,\n} from '../handlers/TapGestureHandler';\nimport { State } from '../State';\nimport { hasProperty, withPrevAndCurrent } from '../utils';\n\n// Load fireEvent conditionally, so RNGH may be used in setups without testing-library\nlet fireEvent = (\n _element: ReactTestInstance,\n _name: string,\n ..._data: any[]\n) => {\n // NOOP\n};\n\ntry {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n fireEvent = require('@testing-library/react-native').fireEvent;\n} catch (_e) {\n // Do nothing if not available\n}\n\ntype GestureHandlerTestEvent<\n TEventPayload extends Record<string, unknown> = Record<string, unknown>,\n> = (\n | GestureEvent<TEventPayload>\n | HandlerStateChangeEvent<TEventPayload>\n)['nativeEvent'];\n\ntype HandlerNames = keyof DefaultEventsMapping;\n\ntype WithNumberOfPointers<T> = {\n [P in keyof T]: T[P] & { numberOfPointers: number };\n};\ntype DefaultEventsMapping = WithNumberOfPointers<{\n [flingHandlerName]: FlingGestureHandlerEventPayload;\n [forceTouchHandlerName]: ForceTouchGestureHandlerEventPayload;\n [longPressHandlerName]: LongPressGestureHandlerEventPayload;\n [nativeViewHandlerName]: NativeViewGestureHandlerPayload;\n [panHandlerName]: PanGestureHandlerEventPayload;\n [pinchHandlerName]: PinchGestureHandlerEventPayload;\n [rotationHandlerName]: RotationGestureHandlerEventPayload;\n [tapHandlerName]: TapGestureHandlerEventPayload;\n}>;\n\nconst handlersDefaultEvents: DefaultEventsMapping = {\n [flingHandlerName]: {\n x: 0,\n y: 0,\n absoluteX: 0,\n absoluteY: 0,\n numberOfPointers: 1,\n },\n [forceTouchHandlerName]: {\n x: 0,\n y: 0,\n absoluteX: 0,\n absoluteY: 0,\n force: 1,\n numberOfPointers: 1,\n },\n [longPressHandlerName]: {\n x: 0,\n y: 0,\n absoluteX: 0,\n absoluteY: 0,\n duration: 100,\n numberOfPointers: 1,\n },\n [nativeViewHandlerName]: {\n pointerInside: true,\n numberOfPointers: 1,\n },\n [panHandlerName]: {\n x: 0,\n y: 0,\n absoluteX: 0,\n absoluteY: 0,\n translationX: 100,\n translationY: 0,\n velocityX: 3,\n velocityY: 0,\n numberOfPointers: 1,\n stylusData: undefined,\n },\n [pinchHandlerName]: {\n focalX: 0,\n focalY: 0,\n scale: 2,\n velocity: 1,\n numberOfPointers: 2,\n },\n [rotationHandlerName]: {\n anchorX: 0,\n anchorY: 0,\n rotation: 3.14,\n velocity: 2,\n numberOfPointers: 2,\n },\n [tapHandlerName]: {\n x: 0,\n y: 0,\n absoluteX: 0,\n absoluteY: 0,\n numberOfPointers: 1,\n },\n};\n\nfunction isGesture(\n componentOrGesture: ReactTestInstance | GestureType\n): componentOrGesture is GestureType {\n return componentOrGesture instanceof BaseGesture;\n}\n\ninterface WrappedGestureHandlerTestEvent {\n nativeEvent: GestureHandlerTestEvent;\n}\nfunction wrapWithNativeEvent(\n event: GestureHandlerTestEvent\n): WrappedGestureHandlerTestEvent {\n return { nativeEvent: event };\n}\n\nfunction fillOldStateChanges(\n previousEvent: GestureHandlerTestEvent | null,\n currentEvent: Omit<GestureHandlerTestEvent, 'oldState'>\n): GestureHandlerTestEvent {\n const isFirstEvent = previousEvent === null;\n if (isFirstEvent) {\n return {\n oldState: State.UNDETERMINED,\n ...currentEvent,\n } as GestureHandlerTestEvent;\n }\n\n const isGestureStateEvent = previousEvent.state !== currentEvent.state;\n if (isGestureStateEvent) {\n return {\n oldState: previousEvent?.state,\n ...currentEvent,\n } as GestureHandlerTestEvent;\n } else {\n return currentEvent as GestureHandlerTestEvent;\n }\n}\n\ntype EventWithStates = Partial<\n Pick<GestureHandlerTestEvent, 'oldState' | 'state'>\n>;\nfunction validateStateTransitions(\n previousEvent: EventWithStates | null,\n currentEvent: EventWithStates\n) {\n function stringify(event: Record<string, unknown> | null) {\n return JSON.stringify(event, null, 2);\n }\n function errorMsgWithBothEvents(description: string) {\n return `${description}, invalid event: ${stringify(\n currentEvent\n )}, previous event: ${stringify(previousEvent)}`;\n }\n\n function errorMsgWithCurrentEvent(description: string) {\n return `${description}, invalid event: ${stringify(currentEvent)}`;\n }\n\n invariant(\n hasProperty(currentEvent, 'state'),\n errorMsgWithCurrentEvent('every event must have state')\n );\n\n const isFirstEvent = previousEvent === null;\n if (isFirstEvent) {\n invariant(\n currentEvent.state === State.BEGAN,\n errorMsgWithCurrentEvent('first event must have BEGAN state')\n );\n }\n\n if (previousEvent !== null) {\n if (previousEvent.state !== currentEvent.state) {\n invariant(\n hasProperty(currentEvent, 'oldState'),\n errorMsgWithCurrentEvent(\n 'when state changes, oldState field should be present'\n )\n );\n invariant(\n currentEvent.oldState === previousEvent.state,\n errorMsgWithBothEvents(\n \"when state changes, oldState should be the same as previous event' state\"\n )\n );\n }\n }\n\n return currentEvent;\n}\n\ntype EventWithoutStates = Omit<GestureHandlerTestEvent, 'oldState' | 'state'>;\ninterface HandlerInfo {\n handlerType: HandlerNames;\n handlerTag: number;\n}\nfunction fillMissingDefaultsFor({\n handlerType,\n handlerTag,\n}: HandlerInfo): (\n event: Partial<GestureHandlerTestEvent>\n) => EventWithoutStates {\n return (event) => {\n return {\n ...handlersDefaultEvents[handlerType],\n ...event,\n handlerTag,\n };\n };\n}\n\nfunction isDiscreteHandler(handlerType: HandlerNames) {\n return (\n handlerType === 'TapGestureHandler' ||\n handlerType === 'LongPressGestureHandler'\n );\n}\n\nfunction fillMissingStatesTransitions(\n events: EventWithoutStates[],\n isDiscreteHandler: boolean\n): EventWithoutStates[] {\n type Event = EventWithoutStates | null;\n const _events = [...events];\n const lastEvent = _events[_events.length - 1] ?? null;\n const firstEvent = _events[0] ?? null;\n\n const shouldDuplicateFirstEvent =\n !isDiscreteHandler && !hasState(State.BEGAN)(firstEvent);\n if (shouldDuplicateFirstEvent) {\n const duplicated = { ...firstEvent, state: State.BEGAN };\n // @ts-ignore badly typed, property may exist and we don't want to copy it\n delete duplicated.oldState;\n _events.unshift(duplicated);\n }\n\n const shouldDuplicateLastEvent =\n !hasState(State.END)(lastEvent) ||\n !hasState(State.FAILED)(lastEvent) ||\n !hasState(State.CANCELLED)(lastEvent);\n\n if (shouldDuplicateLastEvent) {\n const duplicated = { ...lastEvent, state: State.END };\n // @ts-ignore badly typed, property may exist and we don't want to copy it\n delete duplicated.oldState;\n _events.push(duplicated);\n }\n\n function isWithoutState(event: Event) {\n return event !== null && !hasProperty(event, 'state');\n }\n function hasState(state: State) {\n return (event: Event) => event !== null && event.state === state;\n }\n function noEventsLeft(event: Event) {\n return event === null;\n }\n\n function trueFn() {\n return true;\n }\n interface Args {\n shouldConsumeEvent?: (event: Event) => boolean;\n shouldTransitionToNextState?: (nextEvent: Event) => boolean;\n }\n function fillEventsForCurrentState({\n shouldConsumeEvent = trueFn,\n shouldTransitionToNextState = trueFn,\n }: Args) {\n function peekCurrentEvent(): Event {\n return _events[0] ?? null;\n }\n function peekNextEvent(): Event {\n return _events[1] ?? null;\n }\n function consumeCurrentEvent() {\n _events.shift();\n }\n const currentEvent = peekCurrentEvent();\n const nextEvent = peekNextEvent();\n const currentRequiredState = REQUIRED_EVENTS[currentStateIdx];\n\n let eventData = {};\n const shouldUseEvent = shouldConsumeEvent(currentEvent);\n if (shouldUseEvent) {\n eventData = currentEvent!;\n consumeCurrentEvent();\n }\n transformedEvents.push({ state: currentRequiredState, ...eventData });\n if (shouldTransitionToNextState(nextEvent)) {\n currentStateIdx++;\n }\n }\n\n const REQUIRED_EVENTS = [State.BEGAN, State.ACTIVE, State.END];\n\n let currentStateIdx = 0;\n const transformedEvents: EventWithoutStates[] = [];\n let hasAllStates;\n let iterations = 0;\n do {\n const nextRequiredState = REQUIRED_EVENTS[currentStateIdx];\n if (nextRequiredState === State.BEGAN) {\n fillEventsForCurrentState({\n shouldConsumeEvent: (e: Event) =>\n isWithoutState(e) || hasState(State.BEGAN)(e),\n });\n } else if (nextRequiredState === State.ACTIVE) {\n const shouldConsumeEvent = (e: Event) =>\n isWithoutState(e) || hasState(State.ACTIVE)(e);\n const shouldTransitionToNextState = (nextEvent: Event) =>\n noEventsLeft(nextEvent) ||\n hasState(State.END)(nextEvent) ||\n hasState(State.FAILED)(nextEvent) ||\n hasState(State.CANCELLED)(nextEvent);\n\n fillEventsForCurrentState({\n shouldConsumeEvent,\n shouldTransitionToNextState,\n });\n } else if (nextRequiredState === State.END) {\n fillEventsForCurrentState({});\n }\n hasAllStates = currentStateIdx === REQUIRED_EVENTS.length;\n\n invariant(\n iterations++ <= 500,\n 'exceeded max number of iterations, please report a bug in RNGH repository with your test case'\n );\n } while (!hasAllStates);\n\n return transformedEvents;\n}\n\ntype EventEmitter = (\n eventName: string,\n args: { nativeEvent: GestureHandlerTestEvent }\n) => void;\ninterface HandlerData {\n emitEvent: EventEmitter;\n handlerType: HandlerNames;\n handlerTag: number;\n enabled: boolean | undefined;\n}\nfunction getHandlerData(\n componentOrGesture: ReactTestInstance | GestureType\n): HandlerData {\n if (isGesture(componentOrGesture)) {\n const gesture = componentOrGesture;\n return {\n emitEvent: (eventName, args) => {\n DeviceEventEmitter.emit(eventName, args.nativeEvent);\n },\n handlerType: gesture.handlerName as HandlerNames,\n handlerTag: gesture.handlerTag,\n enabled: gesture.config.enabled,\n };\n }\n const gestureHandlerComponent = componentOrGesture;\n return {\n emitEvent: (eventName, args) => {\n fireEvent(gestureHandlerComponent, eventName, args);\n },\n handlerType: gestureHandlerComponent.props.handlerType as HandlerNames,\n handlerTag: gestureHandlerComponent.props.handlerTag as number,\n enabled: gestureHandlerComponent.props.enabled,\n };\n}\ntype AllGestures =\n | TapGesture\n | PanGesture\n | LongPressGesture\n | RotationGesture\n | PinchGesture\n | FlingGesture\n | ForceTouchGesture\n | NativeGesture;\n\ntype AllHandlers =\n | TapGestureHandler\n | PanGestureHandler\n | LongPressGestureHandler\n | RotationGestureHandler\n | PinchGestureHandler\n | FlingGestureHandler\n | ForceTouchGestureHandler\n | NativeViewGestureHandler;\n\n// prettier-ignore\ntype ClassComponentConstructor<P> = new (props: P) => React.Component<P, any, any>;\n\ntype ExtractPayloadFromProps<T> =\n T extends BaseGestureHandlerProps<infer TPayload> ? TPayload : never;\n\ntype ExtractConfig<T> =\n T extends BaseGesture<infer TGesturePayload>\n ? TGesturePayload\n : T extends ClassComponentConstructor<infer THandlerProps>\n ? ExtractPayloadFromProps<THandlerProps>\n : Record<string, unknown>;\n\nexport function fireGestureHandler<THandler extends AllGestures | AllHandlers>(\n componentOrGesture: ReactTestInstance | GestureType,\n eventList: Partial<GestureHandlerTestEvent<ExtractConfig<THandler>>>[] = []\n): void {\n const { emitEvent, handlerType, handlerTag, enabled } =\n getHandlerData(componentOrGesture);\n\n if (enabled === false) {\n return;\n }\n\n let _ = fillMissingStatesTransitions(\n eventList,\n isDiscreteHandler(handlerType)\n );\n _ = _.map(fillMissingDefaultsFor({ handlerTag, handlerType }));\n _ = withPrevAndCurrent(_, fillOldStateChanges);\n _ = withPrevAndCurrent(_, validateStateTransitions);\n // @ts-ignore TODO\n _ = _.map(wrapWithNativeEvent);\n\n const events = _ as unknown as WrappedGestureHandlerTestEvent[];\n\n const firstEvent = events.shift()!;\n\n emitEvent('onGestureHandlerStateChange', firstEvent);\n let lastSentEvent = firstEvent;\n for (const event of events) {\n const hasChangedState =\n lastSentEvent.nativeEvent.state !== event.nativeEvent.state;\n\n if (hasChangedState) {\n emitEvent('onGestureHandlerStateChange', event);\n } else {\n emitEvent('onGestureHandlerEvent', event);\n }\n lastSentEvent = event;\n }\n}\n\nexport function getByGestureTestId(testID: string) {\n const handler = findHandlerByTestID(testID);\n if (handler === null) {\n throw new Error(`Handler with id: '${testID}' cannot be found`);\n }\n return handler;\n}\n"]}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MountRegistry = void 0;
7
+
8
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+
10
+ // eslint-disable-next-line @typescript-eslint/no-extraneous-class
11
+ class MountRegistry {
12
+ static addMountListener(listener) {
13
+ this.mountListeners.add(listener);
14
+ return () => {
15
+ this.mountListeners.delete(listener);
16
+ };
17
+ }
18
+
19
+ static addUnmountListener(listener) {
20
+ this.unmountListeners.add(listener);
21
+ return () => {
22
+ this.unmountListeners.delete(listener);
23
+ };
24
+ }
25
+
26
+ static gestureHandlerWillMount(handler) {
27
+ this.mountListeners.forEach(listener => listener(handler));
28
+ }
29
+
30
+ static gestureHandlerWillUnmount(handler) {
31
+ this.unmountListeners.forEach(listener => listener(handler));
32
+ }
33
+
34
+ static gestureWillMount(gesture) {
35
+ this.mountListeners.forEach(listener => listener(gesture));
36
+ }
37
+
38
+ static gestureWillUnmount(gesture) {
39
+ this.unmountListeners.forEach(listener => listener(gesture));
40
+ }
41
+
42
+ }
43
+
44
+ exports.MountRegistry = MountRegistry;
45
+
46
+ _defineProperty(MountRegistry, "mountListeners", new Set());
47
+
48
+ _defineProperty(MountRegistry, "unmountListeners", new Set());
49
+ //# sourceMappingURL=mountRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["mountRegistry.ts"],"names":["MountRegistry","addMountListener","listener","mountListeners","add","delete","addUnmountListener","unmountListeners","gestureHandlerWillMount","handler","forEach","gestureHandlerWillUnmount","gestureWillMount","gesture","gestureWillUnmount","Set"],"mappings":";;;;;;;;;AAUA;AACO,MAAMA,aAAN,CAAoB;AAIF,SAAhBC,gBAAgB,CAACC,QAAD,EAA6C;AAClE,SAAKC,cAAL,CAAoBC,GAApB,CAAwBF,QAAxB;AAEA,WAAO,MAAM;AACX,WAAKC,cAAL,CAAoBE,MAApB,CAA2BH,QAA3B;AACD,KAFD;AAGD;;AAEwB,SAAlBI,kBAAkB,CAACJ,QAAD,EAA6C;AACpE,SAAKK,gBAAL,CAAsBH,GAAtB,CAA0BF,QAA1B;AAEA,WAAO,MAAM;AACX,WAAKK,gBAAL,CAAsBF,MAAtB,CAA6BH,QAA7B;AACD,KAFD;AAGD;;AAE6B,SAAvBM,uBAAuB,CAACC,OAAD,EAA2B;AACvD,SAAKN,cAAL,CAAoBO,OAApB,CAA6BR,QAAD,IAC1BA,QAAQ,CAACO,OAAD,CADV;AAGD;;AAE+B,SAAzBE,yBAAyB,CAACF,OAAD,EAA2B;AACzD,SAAKF,gBAAL,CAAsBG,OAAtB,CAA+BR,QAAD,IAC5BA,QAAQ,CAACO,OAAD,CADV;AAGD;;AAEsB,SAAhBG,gBAAgB,CAACC,OAAD,EAAuB;AAC5C,SAAKV,cAAL,CAAoBO,OAApB,CAA6BR,QAAD,IAAcA,QAAQ,CAACW,OAAD,CAAlD;AACD;;AAEwB,SAAlBC,kBAAkB,CAACD,OAAD,EAAuB;AAC9C,SAAKN,gBAAL,CAAsBG,OAAtB,CAA+BR,QAAD,IAAcA,QAAQ,CAACW,OAAD,CAApD;AACD;;AAtCwB;;;;gBAAdb,a,oBACqB,IAAIe,GAAJ,E;;gBADrBf,a,sBAEuB,IAAIe,GAAJ,E","sourcesContent":["import { GestureType } from './handlers/gestures/gesture';\n\ninterface ReactComponentWithHandlerTag extends React.Component {\n handlerTag: number;\n}\n\nexport type GestureMountListener = (\n gesture: GestureType | ReactComponentWithHandlerTag\n) => void;\n\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class\nexport class MountRegistry {\n private static mountListeners = new Set<GestureMountListener>();\n private static unmountListeners = new Set<GestureMountListener>();\n\n static addMountListener(listener: GestureMountListener): () => void {\n this.mountListeners.add(listener);\n\n return () => {\n this.mountListeners.delete(listener);\n };\n }\n\n static addUnmountListener(listener: GestureMountListener): () => void {\n this.unmountListeners.add(listener);\n\n return () => {\n this.unmountListeners.delete(listener);\n };\n }\n\n static gestureHandlerWillMount(handler: React.Component) {\n this.mountListeners.forEach((listener) =>\n listener(handler as ReactComponentWithHandlerTag)\n );\n }\n\n static gestureHandlerWillUnmount(handler: React.Component) {\n this.unmountListeners.forEach((listener) =>\n listener(handler as ReactComponentWithHandlerTag)\n );\n }\n\n static gestureWillMount(gesture: GestureType) {\n this.mountListeners.forEach((listener) => listener(gesture));\n }\n\n static gestureWillUnmount(gesture: GestureType) {\n this.unmountListeners.forEach((listener) => listener(gesture));\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["ScaleGestureDetector.ts"],"names":["ScaleGestureDetector","constructor","callbacks","onScaleBegin","onScale","onScaleEnd","spanSlop","DEFAULT_TOUCH_SLOP","minSpan","onTouchEvent","event","tracker","currentTime","time","action","eventType","numOfPointers","getTrackedPointersCount","streamComplete","EventTypes","UP","ADDITIONAL_POINTER_UP","CANCEL","DOWN","inProgress","initialSpan","configChanged","ADDITIONAL_POINTER_DOWN","pointerUp","ignoredPointer","pointerId","undefined","div","coordsSum","getAbsoluteCoordsSum","focusX","x","focusY","y","devSumX","devSumY","getData","forEach","value","key","Math","abs","abosoluteCoords","devX","devY","spanX","spanY","span","hypot","wasInProgress","prevSpan","currentSpan","prevTime","MOVE","getCurrentSpan","getFocusX","getFocusY","getTimeDelta","getScaleFactor"],"mappings":";;;;;;;AAAA;;AACA;;;;AAUe,MAAMA,oBAAN,CAA2D;AAoBjEC,EAAAA,WAAW,CAACC,SAAD,EAAkC;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,wCAL/B,KAK+B;;AAAA;;AAAA;;AAClD,SAAKC,YAAL,GAAoBD,SAAS,CAACC,YAA9B;AACA,SAAKC,OAAL,GAAeF,SAAS,CAACE,OAAzB;AACA,SAAKC,UAAL,GAAkBH,SAAS,CAACG,UAA5B;AAEA,SAAKC,QAAL,GAAgBC,gCAAqB,CAArC;AACA,SAAKC,OAAL,GAAe,CAAf;AACD;;AAEMC,EAAAA,YAAY,CAACC,KAAD,EAAsBC,OAAtB,EAAwD;AACzE,SAAKC,WAAL,GAAmBF,KAAK,CAACG,IAAzB;AAEA,UAAMC,MAAkB,GAAGJ,KAAK,CAACK,SAAjC;AACA,UAAMC,aAAa,GAAGL,OAAO,CAACM,uBAAR,EAAtB;AAEA,UAAMC,cAAuB,GAC3BJ,MAAM,KAAKK,uBAAWC,EAAtB,IACAN,MAAM,KAAKK,uBAAWE,qBADtB,IAEAP,MAAM,KAAKK,uBAAWG,MAHxB;;AAKA,QAAIR,MAAM,KAAKK,uBAAWI,IAAtB,IAA8BL,cAAlC,EAAkD;AAChD,UAAI,KAAKM,UAAT,EAAqB;AACnB,aAAKnB,UAAL,CAAgB,IAAhB;AACA,aAAKmB,UAAL,GAAkB,KAAlB;AACA,aAAKC,WAAL,GAAmB,CAAnB;AACD;;AAED,UAAIP,cAAJ,EAAoB;AAClB,eAAO,IAAP;AACD;AACF;;AAED,UAAMQ,aAAsB,GAC1BZ,MAAM,KAAK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AW;AACzB,WAAO,KAAKxB,MAAZ;AACD;;AAEMyB,EAAAA,YAAY,GAAW;AAC5B,WAAO,KAAKlD,WAAL,GAAmB,KAAK6C,QAA/B;AACD;;AAEMM,EAAAA,cAAc,CAAC/C,aAAD,EAAgC;AACnD,QAAIA,aAAa,GAAG,CAApB,EAAuB;AACrB,aAAO,CAAP;AACD;;AAED,WAAO,KAAKuC,QAAL,GAAgB,CAAhB,GAAoB,KAAKC,WAAL,GAAmB,KAAKD,QAA5C,GAAuD,CAA9D;AACD;;AA9JuE","sourcesContent":["import { DEFAULT_TOUCH_SLOP } from '../constants';\nimport { AdaptedEvent, EventTypes } from '../interfaces';\n\nimport PointerTracker from '../tools/PointerTracker';\n\nexport interface ScaleGestureListener {\n onScaleBegin: (detector: ScaleGestureDetector) => boolean;\n onScale: (detector: ScaleGestureDetector) => boolean;\n onScaleEnd: (detector: ScaleGestureDetector) => void;\n}\n\nexport default class ScaleGestureDetector implements ScaleGestureListener {\n public onScaleBegin: (detector: ScaleGestureDetector) => boolean;\n public onScale: (detector: ScaleGestureDetector) => boolean;\n public onScaleEnd: (detector: ScaleGestureDetector) => void;\n\n private focusX!: number;\n private focusY!: number;\n\n private currentSpan!: number;\n private prevSpan!: number;\n private initialSpan!: number;\n\n private currentTime!: number;\n private prevTime!: number;\n\n private inProgress = false;\n\n private spanSlop: number;\n private minSpan: number;\n\n public constructor(callbacks: ScaleGestureListener) {\n this.onScaleBegin = callbacks.onScaleBegin;\n this.onScale = callbacks.onScale;\n this.onScaleEnd = callbacks.onScaleEnd;\n\n this.spanSlop = DEFAULT_TOUCH_SLOP * 2;\n this.minSpan = 0;\n }\n\n public onTouchEvent(event: AdaptedEvent, tracker: PointerTracker): boolean {\n this.currentTime = event.time;\n\n const action: EventTypes = event.eventType;\n const numOfPointers = tracker.getTrackedPointersCount();\n\n const streamComplete: boolean =\n action === EventTypes.UP ||\n action === EventTypes.ADDITIONAL_POINTER_UP ||\n action === EventTypes.CANCEL;\n\n if (action === EventTypes.DOWN || streamComplete) {\n if (this.inProgress) {\n this.onScaleEnd(this);\n this.inProgress = false;\n this.initialSpan = 0;\n }\n\n if (streamComplete) {\n return true;\n }\n }\n\n const configChanged: boolean =\n action === EventTypes.DOWN ||\n action === EventTypes.ADDITIONAL_POINTER_UP ||\n action === EventTypes.ADDITIONAL_POINTER_DOWN;\n\n const pointerUp = action === EventTypes.ADDITIONAL_POINTER_UP;\n\n const ignoredPointer: number | undefined = pointerUp\n ? event.pointerId\n : undefined;\n\n // Determine focal point\n\n const div: number = pointerUp ? numOfPointers - 1 : numOfPointers;\n\n const coordsSum = tracker.getAbsoluteCoordsSum();\n\n const focusX = coordsSum.x / div;\n const focusY = coordsSum.y / div;\n\n // Determine average deviation from focal point\n\n let devSumX = 0;\n let devSumY = 0;\n\n tracker.getData().forEach((value, key) => {\n if (key === ignoredPointer) {\n return;\n }\n\n devSumX += Math.abs(value.abosoluteCoords.x - focusX);\n devSumY += Math.abs(value.abosoluteCoords.y - focusY);\n });\n\n const devX: number = devSumX / div;\n const devY: number = devSumY / div;\n\n const spanX: number = devX * 2;\n const spanY: number = devY * 2;\n\n const span = Math.hypot(spanX, spanY);\n\n // Begin/end events\n const wasInProgress: boolean = this.inProgress;\n this.focusX = focusX;\n this.focusY = focusY;\n\n if (this.inProgress && (span < this.minSpan || configChanged)) {\n this.onScaleEnd(this);\n this.inProgress = false;\n this.initialSpan = span;\n }\n\n if (configChanged) {\n this.initialSpan = this.prevSpan = this.currentSpan = span;\n }\n\n if (\n !this.inProgress &&\n span >= this.minSpan &&\n (wasInProgress || Math.abs(span - this.initialSpan) > this.spanSlop)\n ) {\n this.prevSpan = this.currentSpan = span;\n this.prevTime = this.currentTime;\n this.inProgress = this.onScaleBegin(this);\n }\n\n // Handle motion\n if (action !== EventTypes.MOVE) {\n return true;\n }\n\n this.currentSpan = span;\n\n if (this.inProgress && !this.onScale(this)) {\n return true;\n }\n\n this.prevSpan = this.currentSpan;\n this.prevTime = this.currentTime;\n\n return true;\n }\n\n public getCurrentSpan(): number {\n return this.currentSpan;\n }\n\n public getFocusX(): number {\n return this.focusX;\n }\n\n public getFocusY(): number {\n return this.focusY;\n }\n\n public getTimeDelta(): number {\n return this.currentTime - this.prevTime;\n }\n\n public getScaleFactor(numOfPointers: number): number {\n if (numOfPointers < 2) {\n return 1;\n }\n\n return this.prevSpan > 0 ? this.currentSpan / this.prevSpan : 1;\n }\n}\n"]}
1
+ {"version":3,"sources":["ScaleGestureDetector.ts"],"names":["ScaleGestureDetector","constructor","callbacks","onScaleBegin","onScale","onScaleEnd","spanSlop","DEFAULT_TOUCH_SLOP","minSpan","onTouchEvent","event","tracker","currentTime","time","action","eventType","numOfPointers","getTrackedPointersCount","streamComplete","EventTypes","UP","ADDITIONAL_POINTER_UP","CANCEL","DOWN","inProgress","initialSpan","configChanged","ADDITIONAL_POINTER_DOWN","pointerUp","ignoredPointer","pointerId","undefined","div","coordsSum","getAbsoluteCoordsSum","focusX","x","focusY","y","devSumX","devSumY","getData","forEach","value","key","Math","abs","abosoluteCoords","devX","devY","spanX","spanY","span","hypot","wasInProgress","prevSpan","currentSpan","prevTime","MOVE","getCurrentSpan","getFocusX","getFocusY","getTimeDelta","getScaleFactor"],"mappings":";;;;;;;AAAA;;AACA;;;;AAUe,MAAMA,oBAAN,CAA2D;AAoBxEC,EAAAA,WAAW,CAACC,SAAD,EAAkC;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,wCALxB,KAKwB;;AAAA;;AAAA;;AAC3C,SAAKC,YAAL,GAAoBD,SAAS,CAACC,YAA9B;AACA,SAAKC,OAAL,GAAeF,SAAS,CAACE,OAAzB;AACA,SAAKC,UAAL,GAAkBH,SAAS,CAACG,UAA5B;AAEA,SAAKC,QAAL,GAAgBC,gCAAqB,CAArC;AACA,SAAKC,OAAL,GAAe,CAAf;AACD;;AAEMC,EAAAA,YAAY,CAACC,KAAD,EAAsBC,OAAtB,E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AAKK,QAAL,GAAgB,KAAK7C,WAArB;AACA,WAAKY,UAAL,GAAkB,KAAKrB,YAAL,CAAkB,IAAlB,CAAlB;AACD,KAxFwE,CA0FzE;;;AACA,QAAIW,MAAM,KAAKK,uBAAWuC,IAA1B,EAAgC;AAC9B,aAAO,IAAP;AACD;;AAED,SAAKF,WAAL,GAAmBJ,IAAnB;;AAEA,QAAI,KAAK5B,UAAL,IAAmB,CAAC,KAAKpB,OAAL,CAAa,IAAb,CAAxB,EAA4C;AAC1C,aAAO,IAAP;AACD;;AAED,SAAKmD,QAAL,GAAgB,KAAKC,WAArB;AACA,SAAKC,QAAL,GAAgB,KAAK7C,WAArB;AAEA,WAAO,IAAP;AACD;;AAEM+C,EAAAA,cAAc,GAAW;AAC9B,WAAO,KAAKH,WAAZ;AACD;;AAEMI,EAAAA,SAAS,GAAW;AACzB,WAAO,KAAKzB,MAAZ;AACD;;AAEM0B,EAAAA,SAAS,GAAW;AACzB,WAAO,KAAKxB,MAAZ;AACD;;AAEMyB,EAAAA,YAAY,GAAW;AAC5B,WAAO,KAAKlD,WAAL,GAAmB,KAAK6C,QAA/B;AACD;;AAEMM,EAAAA,cAAc,CAAC/C,aAAD,EAAgC;AACnD,QAAIA,aAAa,GAAG,CAApB,EAAuB;AACrB,aAAO,CAAP;AACD;;AAED,WAAO,KAAKuC,QAAL,GAAgB,CAAhB,GAAoB,KAAKC,WAAL,GAAmB,KAAKD,QAA5C,GAAuD,CAA9D;AACD;;AA9JuE","sourcesContent":["import { DEFAULT_TOUCH_SLOP } from '../constants';\nimport { AdaptedEvent, EventTypes } from '../interfaces';\n\nimport PointerTracker from '../tools/PointerTracker';\n\nexport interface ScaleGestureListener {\n onScaleBegin: (detector: ScaleGestureDetector) => boolean;\n onScale: (detector: ScaleGestureDetector) => boolean;\n onScaleEnd: (detector: ScaleGestureDetector) => void;\n}\n\nexport default class ScaleGestureDetector implements ScaleGestureListener {\n public onScaleBegin: (detector: ScaleGestureDetector) => boolean;\n public onScale: (detector: ScaleGestureDetector) => boolean;\n public onScaleEnd: (detector: ScaleGestureDetector) => void;\n\n private focusX!: number;\n private focusY!: number;\n\n private currentSpan!: number;\n private prevSpan!: number;\n private initialSpan!: number;\n\n private currentTime!: number;\n private prevTime!: number;\n\n private inProgress = false;\n\n private spanSlop: number;\n private minSpan: number;\n\n constructor(callbacks: ScaleGestureListener) {\n this.onScaleBegin = callbacks.onScaleBegin;\n this.onScale = callbacks.onScale;\n this.onScaleEnd = callbacks.onScaleEnd;\n\n this.spanSlop = DEFAULT_TOUCH_SLOP * 2;\n this.minSpan = 0;\n }\n\n public onTouchEvent(event: AdaptedEvent, tracker: PointerTracker): boolean {\n this.currentTime = event.time;\n\n const action: EventTypes = event.eventType;\n const numOfPointers = tracker.getTrackedPointersCount();\n\n const streamComplete: boolean =\n action === EventTypes.UP ||\n action === EventTypes.ADDITIONAL_POINTER_UP ||\n action === EventTypes.CANCEL;\n\n if (action === EventTypes.DOWN || streamComplete) {\n if (this.inProgress) {\n this.onScaleEnd(this);\n this.inProgress = false;\n this.initialSpan = 0;\n }\n\n if (streamComplete) {\n return true;\n }\n }\n\n const configChanged: boolean =\n action === EventTypes.DOWN ||\n action === EventTypes.ADDITIONAL_POINTER_UP ||\n action === EventTypes.ADDITIONAL_POINTER_DOWN;\n\n const pointerUp = action === EventTypes.ADDITIONAL_POINTER_UP;\n\n const ignoredPointer: number | undefined = pointerUp\n ? event.pointerId\n : undefined;\n\n // Determine focal point\n\n const div: number = pointerUp ? numOfPointers - 1 : numOfPointers;\n\n const coordsSum = tracker.getAbsoluteCoordsSum();\n\n const focusX = coordsSum.x / div;\n const focusY = coordsSum.y / div;\n\n // Determine average deviation from focal point\n\n let devSumX = 0;\n let devSumY = 0;\n\n tracker.getData().forEach((value, key) => {\n if (key === ignoredPointer) {\n return;\n }\n\n devSumX += Math.abs(value.abosoluteCoords.x - focusX);\n devSumY += Math.abs(value.abosoluteCoords.y - focusY);\n });\n\n const devX: number = devSumX / div;\n const devY: number = devSumY / div;\n\n const spanX: number = devX * 2;\n const spanY: number = devY * 2;\n\n const span = Math.hypot(spanX, spanY);\n\n // Begin/end events\n const wasInProgress: boolean = this.inProgress;\n this.focusX = focusX;\n this.focusY = focusY;\n\n if (this.inProgress && (span < this.minSpan || configChanged)) {\n this.onScaleEnd(this);\n this.inProgress = false;\n this.initialSpan = span;\n }\n\n if (configChanged) {\n this.initialSpan = this.prevSpan = this.currentSpan = span;\n }\n\n if (\n !this.inProgress &&\n span >= this.minSpan &&\n (wasInProgress || Math.abs(span - this.initialSpan) > this.spanSlop)\n ) {\n this.prevSpan = this.currentSpan = span;\n this.prevTime = this.currentTime;\n this.inProgress = this.onScaleBegin(this);\n }\n\n // Handle motion\n if (action !== EventTypes.MOVE) {\n return true;\n }\n\n this.currentSpan = span;\n\n if (this.inProgress && !this.onScale(this)) {\n return true;\n }\n\n this.prevSpan = this.currentSpan;\n this.prevTime = this.currentTime;\n\n return true;\n }\n\n public getCurrentSpan(): number {\n return this.currentSpan;\n }\n\n public getFocusX(): number {\n return this.focusX;\n }\n\n public getFocusY(): number {\n return this.focusY;\n }\n\n public getTimeDelta(): number {\n return this.currentTime - this.prevTime;\n }\n\n public getScaleFactor(numOfPointers: number): number {\n if (numOfPointers < 2) {\n return 1;\n }\n\n return this.prevSpan > 0 ? this.currentSpan / this.prevSpan : 1;\n }\n}\n"]}
@@ -46,10 +46,6 @@ class FlingGestureHandler extends _GestureHandler.default {
46
46
  _defineProperty(this, "keyPointer", NaN);
47
47
  }
48
48
 
49
- init(ref, propsRef) {
50
- super.init(ref, propsRef);
51
- }
52
-
53
49
  updateGestureConfig({
54
50
  enabled = true,
55
51
  ...props
@@ -1 +1 @@
1
- {"version":3,"sources":["FlingGestureHandler.ts"],"names":["DEFAULT_MAX_DURATION_MS","DEFAULT_MIN_VELOCITY","DEFAULT_ALIGNMENT_CONE","DEFAULT_DIRECTION","Directions","RIGHT","DEFAULT_NUMBER_OF_TOUCHES_REQUIRED","AXIAL_DEVIATION_COSINE","DIAGONAL_DEVIATION_COSINE","FlingGestureHandler","GestureHandler","NaN","init","ref","propsRef","updateGestureConfig","enabled","props","config","direction","numberOfPointers","numberOfPointersRequired","startFling","begin","maxNumberOfPointersSimultaneously","delayTimeout","setTimeout","fail","maxDurationMs","tryEndFling","velocityVector","Vector","fromVelocity","tracker","keyPointer","getAlignment","minimalAlignmentCosine","isSimilar","fromDirection","axialDirectionsList","Object","values","diagonalDirectionsList","DiagonalDirections","axialAlignmentList","map","diagonalAlignmentList","isAligned","some","Boolean","isFast","magnitude","minVelocity","clearTimeout","activate","endFling","onPointerDown","event","isButtonInConfig","button","addToTracker","pointerId","newPointerAction","tryToSendTouchEvent","onPointerAdd","currentState","State","UNDETERMINED","BEGAN","getTrackedPointersCount","pointerMoveAction","track","onPointerMove","onPointerOutOfBounds","onPointerUp","onUp","onPointerRemove","removeFromTracker","force","end","resetConfig"],"mappings":";;;;;;;AAAA;;AACA;;AAGA;;AACA;;AACA;;;;;;AAEA,MAAMA,uBAAuB,GAAG,GAAhC;AACA,MAAMC,oBAAoB,GAAG,GAA7B;AACA,MAAMC,sBAAsB,GAAG,EAA/B;AACA,MAAMC,iBAAiB,GAAGC,uBAAWC,KAArC;AACA,MAAMC,kCAAkC,GAAG,CAA3C;AAEA,MAAMC,sBAAsB,GAAG,4BAAgBL,sBAAhB,CAA/B;AACA,MAAMM,yBAAyB,GAAG,4BAAgB,KAAKN,sBAArB,CAAlC;;AAEe,MAAMO,mBAAN,SAAkCC,uBAAlC,CAAiD;AAAA;AAAA;;AAAA,sDAC3BJ,kCAD2B;;AAAA,uCAE9BH,iBAF8B;;AAAA,2CAItCH,uBAJsC;;AAAA,yCAKxCC,oBALwC;;AAAA;;AAAA,+DAQlB,CARkB;;AAAA,wCASzCU,GATyC;AAAA;;AAWvDC,EAAAA,IAAI,CAACC,GAAD,EAAcC,QAAd,EAAwD;AACjE,UAAMF,IAAN,CAAWC,GAAX,EAAgBC,QAAhB;AACD;;AAEM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L,GAAiBhB,iBAAjB;AACD;;AAlL6D","sourcesContent":["import { State } from '../../State';\nimport { DiagonalDirections, Directions } from '../../Directions';\nimport { AdaptedEvent, Config } from '../interfaces';\n\nimport GestureHandler from './GestureHandler';\nimport Vector from '../tools/Vector';\nimport { coneToDeviation } from '../utils';\n\nconst DEFAULT_MAX_DURATION_MS = 800;\nconst DEFAULT_MIN_VELOCITY = 700;\nconst DEFAULT_ALIGNMENT_CONE = 30;\nconst DEFAULT_DIRECTION = Directions.RIGHT;\nconst DEFAULT_NUMBER_OF_TOUCHES_REQUIRED = 1;\n\nconst AXIAL_DEVIATION_COSINE = coneToDeviation(DEFAULT_ALIGNMENT_CONE);\nconst DIAGONAL_DEVIATION_COSINE = coneToDeviation(90 - DEFAULT_ALIGNMENT_CONE);\n\nexport default class FlingGestureHandler extends GestureHandler {\n private numberOfPointersRequired = DEFAULT_NUMBER_OF_TOUCHES_REQUIRED;\n private direction: Directions = DEFAULT_DIRECTION;\n\n private maxDurationMs = DEFAULT_MAX_DURATION_MS;\n private minVelocity = DEFAULT_MIN_VELOCITY;\n private delayTimeout!: number;\n\n private maxNumberOfPointersSimultaneously = 0;\n private keyPointer = NaN;\n\n public init(ref: number, propsRef: React.RefObject<unknown>): void {\n super.init(ref, propsRef);\n }\n\n public updateGestureConfig({ enabled = true, ...props }: Config): void {\n super.updateGestureConfig({ enabled: enabled, ...props });\n\n if (this.config.direction) {\n this.direction = this.config.direction;\n }\n\n if (this.config.numberOfPointers) {\n this.numberOfPointersRequired = this.config.numberOfPointers;\n }\n }\n\n private startFling(): void {\n this.begin();\n\n this.maxNumberOfPointersSimultaneously = 1;\n\n this.delayTimeout = setTimeout(() => this.fail(), this.maxDurationMs);\n }\n\n private tryEndFling(): boolean {\n const velocityVector = Vector.fromVelocity(this.tracker, this.keyPointer);\n\n const getAlignment = (\n direction: Directions | DiagonalDirections,\n minimalAlignmentCosine: number\n ) => {\n return (\n (direction & this.direction) === direction &&\n velocityVector.isSimilar(\n Vector.fromDirection(direction),\n minimalAlignmentCosine\n )\n );\n };\n\n const axialDirectionsList = Object.values(Directions);\n const diagonalDirectionsList = Object.values(DiagonalDirections);\n\n // List of alignments to all activated directions\n const axialAlignmentList = axialDirectionsList.map((direction) =>\n getAlignment(direction, AXIAL_DEVIATION_COSINE)\n );\n\n const diagonalAlignmentList = diagonalDirectionsList.map((direction) =>\n getAlignment(direction, DIAGONAL_DEVIATION_COSINE)\n );\n\n const isAligned =\n axialAlignmentList.some(Boolean) || diagonalAlignmentList.some(Boolean);\n\n const isFast = velocityVector.magnitude > this.minVelocity;\n\n if (\n this.maxNumberOfPointersSimultaneously ===\n this.numberOfPointersRequired &&\n isAligned &&\n isFast\n ) {\n clearTimeout(this.delayTimeout);\n this.activate();\n\n return true;\n }\n\n return false;\n }\n\n private endFling() {\n if (!this.tryEndFling()) {\n this.fail();\n }\n }\n\n protected onPointerDown(event: AdaptedEvent): void {\n if (!this.isButtonInConfig(event.button)) {\n return;\n }\n\n this.tracker.addToTracker(event);\n this.keyPointer = event.pointerId;\n\n super.onPointerDown(event);\n this.newPointerAction();\n\n this.tryToSendTouchEvent(event);\n }\n\n protected onPointerAdd(event: AdaptedEvent): void {\n this.tracker.addToTracker(event);\n super.onPointerAdd(event);\n this.newPointerAction();\n }\n\n private newPointerAction(): void {\n if (this.currentState === State.UNDETERMINED) {\n this.startFling();\n }\n\n if (this.currentState !== State.BEGAN) {\n return;\n }\n\n this.tryEndFling();\n\n if (\n this.tracker.getTrackedPointersCount() >\n this.maxNumberOfPointersSimultaneously\n ) {\n this.maxNumberOfPointersSimultaneously =\n this.tracker.getTrackedPointersCount();\n }\n }\n\n private pointerMoveAction(event: AdaptedEvent): void {\n this.tracker.track(event);\n\n if (this.currentState !== State.BEGAN) {\n return;\n }\n\n this.tryEndFling();\n }\n\n protected onPointerMove(event: AdaptedEvent): void {\n this.pointerMoveAction(event);\n super.onPointerMove(event);\n }\n\n protected onPointerOutOfBounds(event: AdaptedEvent): void {\n this.pointerMoveAction(event);\n super.onPointerOutOfBounds(event);\n }\n\n protected onPointerUp(event: AdaptedEvent): void {\n super.onPointerUp(event);\n this.onUp(event);\n\n this.keyPointer = NaN;\n }\n\n protected onPointerRemove(event: AdaptedEvent): void {\n super.onPointerRemove(event);\n this.onUp(event);\n }\n\n private onUp(event: AdaptedEvent): void {\n if (this.currentState === State.BEGAN) {\n this.endFling();\n }\n\n this.tracker.removeFromTracker(event.pointerId);\n }\n\n public activate(force?: boolean): void {\n super.activate(force);\n this.end();\n }\n\n protected resetConfig(): void {\n super.resetConfig();\n this.numberOfPointersRequired = DEFAULT_NUMBER_OF_TOUCHES_REQUIRED;\n this.direction = DEFAULT_DIRECTION;\n }\n}\n"]}
1
+ {"version":3,"sources":["FlingGestureHandler.ts"],"names":["DEFAULT_MAX_DURATION_MS","DEFAULT_MIN_VELOCITY","DEFAULT_ALIGNMENT_CONE","DEFAULT_DIRECTION","Directions","RIGHT","DEFAULT_NUMBER_OF_TOUCHES_REQUIRED","AXIAL_DEVIATION_COSINE","DIAGONAL_DEVIATION_COSINE","FlingGestureHandler","GestureHandler","NaN","updateGestureConfig","enabled","props","config","direction","numberOfPointers","numberOfPointersRequired","startFling","begin","maxNumberOfPointersSimultaneously","delayTimeout","setTimeout","fail","maxDurationMs","tryEndFling","velocityVector","Vector","fromVelocity","tracker","keyPointer","getAlignment","minimalAlignmentCosine","isSimilar","fromDirection","axialDirectionsList","Object","values","diagonalDirectionsList","DiagonalDirections","axialAlignmentList","map","diagonalAlignmentList","isAligned","some","Boolean","isFast","magnitude","minVelocity","clearTimeout","activate","endFling","onPointerDown","event","isButtonInConfig","button","addToTracker","pointerId","newPointerAction","tryToSendTouchEvent","onPointerAdd","currentState","State","UNDETERMINED","BEGAN","getTrackedPointersCount","pointerMoveAction","track","onPointerMove","onPointerOutOfBounds","onPointerUp","onUp","onPointerRemove","removeFromTracker","force","end","resetConfig"],"mappings":";;;;;;;AAAA;;AACA;;AAGA;;AACA;;AACA;;;;;;AA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8D,EAAAA,eAAe,CAACnB,KAAD,EAA4B;AACnD,UAAMmB,eAAN,CAAsBnB,KAAtB;AACA,SAAKkB,IAAL,CAAUlB,KAAV;AACD;;AAEOkB,EAAAA,IAAI,CAAClB,KAAD,EAA4B;AACtC,QAAI,KAAKQ,YAAL,KAAsBC,aAAME,KAAhC,EAAuC;AACrC,WAAKb,QAAL;AACD;;AAED,SAAKtB,OAAL,CAAa4C,iBAAb,CAA+BpB,KAAK,CAACI,SAArC;AACD;;AAEMP,EAAAA,QAAQ,CAACwB,KAAD,EAAwB;AACrC,UAAMxB,QAAN,CAAewB,KAAf;AACA,SAAKC,GAAL;AACD;;AAESC,EAAAA,WAAW,GAAS;AAC5B,UAAMA,WAAN;AACA,SAAK3D,wBAAL,GAAgCZ,kCAAhC;AACA,SAAKU,SAAL,GAAiBb,iBAAjB;AACD;;AA9K6D","sourcesContent":["import { State } from '../../State';\nimport { DiagonalDirections, Directions } from '../../Directions';\nimport { AdaptedEvent, Config } from '../interfaces';\n\nimport GestureHandler from './GestureHandler';\nimport Vector from '../tools/Vector';\nimport { coneToDeviation } from '../utils';\n\nconst DEFAULT_MAX_DURATION_MS = 800;\nconst DEFAULT_MIN_VELOCITY = 700;\nconst DEFAULT_ALIGNMENT_CONE = 30;\nconst DEFAULT_DIRECTION = Directions.RIGHT;\nconst DEFAULT_NUMBER_OF_TOUCHES_REQUIRED = 1;\n\nconst AXIAL_DEVIATION_COSINE = coneToDeviation(DEFAULT_ALIGNMENT_CONE);\nconst DIAGONAL_DEVIATION_COSINE = coneToDeviation(90 - DEFAULT_ALIGNMENT_CONE);\n\nexport default class FlingGestureHandler extends GestureHandler {\n private numberOfPointersRequired = DEFAULT_NUMBER_OF_TOUCHES_REQUIRED;\n private direction: Directions = DEFAULT_DIRECTION;\n\n private maxDurationMs = DEFAULT_MAX_DURATION_MS;\n private minVelocity = DEFAULT_MIN_VELOCITY;\n private delayTimeout!: number;\n\n private maxNumberOfPointersSimultaneously = 0;\n private keyPointer = NaN;\n\n public updateGestureConfig({ enabled = true, ...props }: Config): void {\n super.updateGestureConfig({ enabled: enabled, ...props });\n\n if (this.config.direction) {\n this.direction = this.config.direction;\n }\n\n if (this.config.numberOfPointers) {\n this.numberOfPointersRequired = this.config.numberOfPointers;\n }\n }\n\n private startFling(): void {\n this.begin();\n\n this.maxNumberOfPointersSimultaneously = 1;\n\n this.delayTimeout = setTimeout(() => this.fail(), this.maxDurationMs);\n }\n\n private tryEndFling(): boolean {\n const velocityVector = Vector.fromVelocity(this.tracker, this.keyPointer);\n\n const getAlignment = (\n direction: Directions | DiagonalDirections,\n minimalAlignmentCosine: number\n ) => {\n return (\n (direction & this.direction) === direction &&\n velocityVector.isSimilar(\n Vector.fromDirection(direction),\n minimalAlignmentCosine\n )\n );\n };\n\n const axialDirectionsList = Object.values(Directions);\n const diagonalDirectionsList = Object.values(DiagonalDirections);\n\n // List of alignments to all activated directions\n const axialAlignmentList = axialDirectionsList.map((direction) =>\n getAlignment(direction, AXIAL_DEVIATION_COSINE)\n );\n\n const diagonalAlignmentList = diagonalDirectionsList.map((direction) =>\n getAlignment(direction, DIAGONAL_DEVIATION_COSINE)\n );\n\n const isAligned =\n axialAlignmentList.some(Boolean) || diagonalAlignmentList.some(Boolean);\n\n const isFast = velocityVector.magnitude > this.minVelocity;\n\n if (\n this.maxNumberOfPointersSimultaneously ===\n this.numberOfPointersRequired &&\n isAligned &&\n isFast\n ) {\n clearTimeout(this.delayTimeout);\n this.activate();\n\n return true;\n }\n\n return false;\n }\n\n private endFling() {\n if (!this.tryEndFling()) {\n this.fail();\n }\n }\n\n protected onPointerDown(event: AdaptedEvent): void {\n if (!this.isButtonInConfig(event.button)) {\n return;\n }\n\n this.tracker.addToTracker(event);\n this.keyPointer = event.pointerId;\n\n super.onPointerDown(event);\n this.newPointerAction();\n\n this.tryToSendTouchEvent(event);\n }\n\n protected onPointerAdd(event: AdaptedEvent): void {\n this.tracker.addToTracker(event);\n super.onPointerAdd(event);\n this.newPointerAction();\n }\n\n private newPointerAction(): void {\n if (this.currentState === State.UNDETERMINED) {\n this.startFling();\n }\n\n if (this.currentState !== State.BEGAN) {\n return;\n }\n\n this.tryEndFling();\n\n if (\n this.tracker.getTrackedPointersCount() >\n this.maxNumberOfPointersSimultaneously\n ) {\n this.maxNumberOfPointersSimultaneously =\n this.tracker.getTrackedPointersCount();\n }\n }\n\n private pointerMoveAction(event: AdaptedEvent): void {\n this.tracker.track(event);\n\n if (this.currentState !== State.BEGAN) {\n return;\n }\n\n this.tryEndFling();\n }\n\n protected onPointerMove(event: AdaptedEvent): void {\n this.pointerMoveAction(event);\n super.onPointerMove(event);\n }\n\n protected onPointerOutOfBounds(event: AdaptedEvent): void {\n this.pointerMoveAction(event);\n super.onPointerOutOfBounds(event);\n }\n\n protected onPointerUp(event: AdaptedEvent): void {\n super.onPointerUp(event);\n this.onUp(event);\n\n this.keyPointer = NaN;\n }\n\n protected onPointerRemove(event: AdaptedEvent): void {\n super.onPointerRemove(event);\n this.onUp(event);\n }\n\n private onUp(event: AdaptedEvent): void {\n if (this.currentState === State.BEGAN) {\n this.endFling();\n }\n\n this.tracker.removeFromTracker(event.pointerId);\n }\n\n public activate(force?: boolean): void {\n super.activate(force);\n this.end();\n }\n\n protected resetConfig(): void {\n super.resetConfig();\n this.numberOfPointersRequired = DEFAULT_NUMBER_OF_TOUCHES_REQUIRED;\n this.direction = DEFAULT_DIRECTION;\n }\n}\n"]}