react-native-gesture-handler 2.23.0 → 2.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (601) hide show
  1. package/RNGestureHandler.podspec +8 -0
  2. package/apple/RNGestureHandlerButton.mm +12 -2
  3. package/lib/commonjs/ActionType.js +3 -3
  4. package/lib/commonjs/ActionType.js.map +1 -1
  5. package/lib/commonjs/Directions.js +8 -11
  6. package/lib/commonjs/Directions.js.map +1 -1
  7. package/lib/commonjs/EnableNewWebImplementation.js +10 -2
  8. package/lib/commonjs/EnableNewWebImplementation.js.map +1 -1
  9. package/lib/commonjs/GestureHandlerRootViewContext.js +7 -2
  10. package/lib/commonjs/GestureHandlerRootViewContext.js.map +1 -1
  11. package/lib/commonjs/PlatformConstants.js +6 -1
  12. package/lib/commonjs/PlatformConstants.js.map +1 -1
  13. package/lib/commonjs/PlatformConstants.web.js +3 -1
  14. package/lib/commonjs/PlatformConstants.web.js.map +1 -1
  15. package/lib/commonjs/PointerType.js +5 -3
  16. package/lib/commonjs/PointerType.js.map +1 -1
  17. package/lib/commonjs/RNGestureHandlerModule.js +6 -2
  18. package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
  19. package/lib/commonjs/RNGestureHandlerModule.web.js +37 -11
  20. package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
  21. package/lib/commonjs/RNGestureHandlerModule.windows.js +32 -22
  22. package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -1
  23. package/lib/commonjs/RNRenderer.js +3 -1
  24. package/lib/commonjs/RNRenderer.js.map +1 -1
  25. package/lib/commonjs/RNRenderer.web.js +2 -1
  26. package/lib/commonjs/RNRenderer.web.js.map +1 -1
  27. package/lib/commonjs/State.js +3 -4
  28. package/lib/commonjs/State.js.map +1 -1
  29. package/lib/commonjs/TouchEventType.js +3 -3
  30. package/lib/commonjs/TouchEventType.js.map +1 -1
  31. package/lib/commonjs/components/DrawerLayout.js +115 -90
  32. package/lib/commonjs/components/DrawerLayout.js.map +1 -1
  33. package/lib/commonjs/components/GestureButtons.js +81 -28
  34. package/lib/commonjs/components/GestureButtons.js.map +1 -1
  35. package/lib/commonjs/components/GestureButtonsProps.js.map +1 -1
  36. package/lib/commonjs/components/GestureComponents.js +37 -26
  37. package/lib/commonjs/components/GestureComponents.js.map +1 -1
  38. package/lib/commonjs/components/GestureComponents.web.js +27 -13
  39. package/lib/commonjs/components/GestureComponents.web.js.map +1 -1
  40. package/lib/commonjs/components/GestureHandlerButton.js +6 -2
  41. package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
  42. package/lib/commonjs/components/GestureHandlerButton.web.js +12 -4
  43. package/lib/commonjs/components/GestureHandlerButton.web.js.map +1 -1
  44. package/lib/commonjs/components/GestureHandlerRootView.android.js +15 -4
  45. package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -1
  46. package/lib/commonjs/components/GestureHandlerRootView.js +14 -4
  47. package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
  48. package/lib/commonjs/components/GestureHandlerRootView.web.js +13 -4
  49. package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -1
  50. package/lib/commonjs/components/Pressable/Pressable.js +77 -29
  51. package/lib/commonjs/components/Pressable/Pressable.js.map +1 -1
  52. package/lib/commonjs/components/Pressable/PressableProps.js.map +1 -1
  53. package/lib/commonjs/components/Pressable/index.js +3 -1
  54. package/lib/commonjs/components/Pressable/index.js.map +1 -1
  55. package/lib/commonjs/components/Pressable/utils.js +20 -5
  56. package/lib/commonjs/components/Pressable/utils.js.map +1 -1
  57. package/lib/commonjs/components/ReanimatedDrawerLayout.js +76 -38
  58. package/lib/commonjs/components/ReanimatedDrawerLayout.js.map +1 -1
  59. package/lib/commonjs/components/ReanimatedSwipeable.js +45 -18
  60. package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -1
  61. package/lib/commonjs/components/Swipeable.js +75 -34
  62. package/lib/commonjs/components/Swipeable.js.map +1 -1
  63. package/lib/commonjs/components/Text.js +23 -9
  64. package/lib/commonjs/components/Text.js.map +1 -1
  65. package/lib/commonjs/components/gestureHandlerRootHOC.js +14 -5
  66. package/lib/commonjs/components/gestureHandlerRootHOC.js.map +1 -1
  67. package/lib/commonjs/components/touchables/GenericTouchable.js +76 -40
  68. package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
  69. package/lib/commonjs/components/touchables/GenericTouchableProps.js.map +1 -1
  70. package/lib/commonjs/components/touchables/TouchableHighlight.js +34 -19
  71. package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -1
  72. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +32 -16
  73. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
  74. package/lib/commonjs/components/touchables/TouchableNativeFeedback.js +5 -2
  75. package/lib/commonjs/components/touchables/TouchableNativeFeedback.js.map +1 -1
  76. package/lib/commonjs/components/touchables/TouchableNativeFeedbackProps.js.map +1 -1
  77. package/lib/commonjs/components/touchables/TouchableOpacity.js +25 -16
  78. package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -1
  79. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +13 -9
  80. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -1
  81. package/lib/commonjs/components/touchables/index.js +12 -7
  82. package/lib/commonjs/components/touchables/index.js.map +1 -1
  83. package/lib/commonjs/findNodeHandle.js +4 -1
  84. package/lib/commonjs/findNodeHandle.js.map +1 -1
  85. package/lib/commonjs/findNodeHandle.web.js +14 -5
  86. package/lib/commonjs/findNodeHandle.web.js.map +1 -1
  87. package/lib/commonjs/getReactNativeVersion.js +6 -1
  88. package/lib/commonjs/getReactNativeVersion.js.map +1 -1
  89. package/lib/commonjs/getReactNativeVersion.web.js +1 -0
  90. package/lib/commonjs/getReactNativeVersion.web.js.map +1 -1
  91. package/lib/commonjs/getShadowNodeFromRef.js +14 -13
  92. package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
  93. package/lib/commonjs/getShadowNodeFromRef.web.js +1 -0
  94. package/lib/commonjs/getShadowNodeFromRef.web.js.map +1 -1
  95. package/lib/commonjs/ghQueueMicrotask.js +2 -1
  96. package/lib/commonjs/ghQueueMicrotask.js.map +1 -1
  97. package/lib/commonjs/handlers/FlingGestureHandler.js +11 -9
  98. package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -1
  99. package/lib/commonjs/handlers/ForceTouchGestureHandler.js +22 -15
  100. package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -1
  101. package/lib/commonjs/handlers/GestureHandlerEventPayload.js.map +1 -1
  102. package/lib/commonjs/handlers/LongPressGestureHandler.js +11 -9
  103. package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -1
  104. package/lib/commonjs/handlers/NativeViewGestureHandler.js +13 -10
  105. package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -1
  106. package/lib/commonjs/handlers/PanGestureHandler.js +32 -13
  107. package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
  108. package/lib/commonjs/handlers/PinchGestureHandler.js +9 -7
  109. package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -1
  110. package/lib/commonjs/handlers/PressabilityDebugView.js +1 -0
  111. package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -1
  112. package/lib/commonjs/handlers/PressabilityDebugView.web.js +1 -0
  113. package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +1 -1
  114. package/lib/commonjs/handlers/RotationGestureHandler.js +9 -7
  115. package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -1
  116. package/lib/commonjs/handlers/TapGestureHandler.js +11 -9
  117. package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -1
  118. package/lib/commonjs/handlers/createHandler.js +134 -50
  119. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  120. package/lib/commonjs/handlers/createNativeWrapper.js +27 -17
  121. package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -1
  122. package/lib/commonjs/handlers/customDirectEventTypes.js +1 -0
  123. package/lib/commonjs/handlers/customDirectEventTypes.js.map +1 -1
  124. package/lib/commonjs/handlers/customDirectEventTypes.web.js +2 -1
  125. package/lib/commonjs/handlers/customDirectEventTypes.web.js.map +1 -1
  126. package/lib/commonjs/handlers/gestureHandlerCommon.js +10 -9
  127. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
  128. package/lib/commonjs/handlers/gestureHandlerTypesCompat.js.map +1 -1
  129. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js +14 -5
  130. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
  131. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.web.js +20 -10
  132. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.web.js.map +1 -1
  133. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +29 -9
  134. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  135. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +10 -1
  136. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  137. package/lib/commonjs/handlers/gestures/GestureDetector/index.js +36 -11
  138. package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
  139. package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js +3 -0
  140. package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -1
  141. package/lib/commonjs/handlers/gestures/GestureDetector/types.js.map +1 -1
  142. package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js +24 -12
  143. package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
  144. package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js +48 -12
  145. package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -1
  146. package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js +13 -3
  147. package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
  148. package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js +9 -2
  149. package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -1
  150. package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js +14 -6
  151. package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -1
  152. package/lib/commonjs/handlers/gestures/GestureDetector/utils.js +55 -27
  153. package/lib/commonjs/handlers/gestures/GestureDetector/utils.js.map +1 -1
  154. package/lib/commonjs/handlers/gestures/eventReceiver.js +46 -14
  155. package/lib/commonjs/handlers/gestures/eventReceiver.js.map +1 -1
  156. package/lib/commonjs/handlers/gestures/flingGesture.js +12 -5
  157. package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -1
  158. package/lib/commonjs/handlers/gestures/forceTouchGesture.js +19 -8
  159. package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -1
  160. package/lib/commonjs/handlers/gestures/gesture.js +84 -44
  161. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
  162. package/lib/commonjs/handlers/gestures/gestureComposition.js +31 -17
  163. package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -1
  164. package/lib/commonjs/handlers/gestures/gestureObjects.js +27 -1
  165. package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -1
  166. package/lib/commonjs/handlers/gestures/gestureStateManager.js +9 -3
  167. package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -1
  168. package/lib/commonjs/handlers/gestures/gestureStateManager.web.js +7 -2
  169. package/lib/commonjs/handlers/gestures/gestureStateManager.web.js.map +1 -1
  170. package/lib/commonjs/handlers/gestures/hoverGesture.js +25 -11
  171. package/lib/commonjs/handlers/gestures/hoverGesture.js.map +1 -1
  172. package/lib/commonjs/handlers/gestures/longPressGesture.js +14 -6
  173. package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
  174. package/lib/commonjs/handlers/gestures/manualGesture.js +6 -0
  175. package/lib/commonjs/handlers/gestures/manualGesture.js.map +1 -1
  176. package/lib/commonjs/handlers/gestures/nativeGesture.js +12 -5
  177. package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -1
  178. package/lib/commonjs/handlers/gestures/panGesture.js +43 -18
  179. package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -1
  180. package/lib/commonjs/handlers/gestures/pinchGesture.js +9 -2
  181. package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -1
  182. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +8 -1
  183. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -1
  184. package/lib/commonjs/handlers/gestures/rotationGesture.js +9 -2
  185. package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -1
  186. package/lib/commonjs/handlers/gestures/tapGesture.js +22 -10
  187. package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
  188. package/lib/commonjs/handlers/getNextHandlerTag.js +1 -0
  189. package/lib/commonjs/handlers/getNextHandlerTag.js.map +1 -1
  190. package/lib/commonjs/handlers/handlersRegistry.js +21 -6
  191. package/lib/commonjs/handlers/handlersRegistry.js.map +1 -1
  192. package/lib/commonjs/handlers/utils.js +26 -6
  193. package/lib/commonjs/handlers/utils.js.map +1 -1
  194. package/lib/commonjs/index.js +104 -75
  195. package/lib/commonjs/index.js.map +1 -1
  196. package/lib/commonjs/init.js +11 -4
  197. package/lib/commonjs/init.js.map +1 -1
  198. package/lib/commonjs/jestUtils/index.js +5 -4
  199. package/lib/commonjs/jestUtils/index.js.map +1 -1
  200. package/lib/commonjs/jestUtils/jestUtils.js +83 -19
  201. package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
  202. package/lib/commonjs/mocks.js +15 -5
  203. package/lib/commonjs/mocks.js.map +1 -1
  204. package/lib/commonjs/mountRegistry.js +12 -3
  205. package/lib/commonjs/mountRegistry.js.map +1 -1
  206. package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +5 -1
  207. package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -1
  208. package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +7 -2
  209. package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
  210. package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +7 -2
  211. package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -1
  212. package/lib/commonjs/typeUtils.js.map +1 -1
  213. package/lib/commonjs/utils.js +28 -13
  214. package/lib/commonjs/utils.js.map +1 -1
  215. package/lib/commonjs/web/Gestures.js +23 -5
  216. package/lib/commonjs/web/Gestures.js.map +1 -1
  217. package/lib/commonjs/web/constants.js +4 -2
  218. package/lib/commonjs/web/constants.js.map +1 -1
  219. package/lib/commonjs/web/detectors/RotationGestureDetector.js +41 -5
  220. package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -1
  221. package/lib/commonjs/web/detectors/ScaleGestureDetector.js +42 -13
  222. package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
  223. package/lib/commonjs/web/handlers/FlingGestureHandler.js +49 -6
  224. package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
  225. package/lib/commonjs/web/handlers/GestureHandler.js +195 -62
  226. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  227. package/lib/commonjs/web/handlers/HoverGestureHandler.js +19 -6
  228. package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -1
  229. package/lib/commonjs/web/handlers/IGestureHandler.js.map +1 -1
  230. package/lib/commonjs/web/handlers/LongPressGestureHandler.js +47 -6
  231. package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
  232. package/lib/commonjs/web/handlers/ManualGestureHandler.js +11 -1
  233. package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
  234. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +49 -8
  235. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
  236. package/lib/commonjs/web/handlers/PanGestureHandler.js +123 -8
  237. package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
  238. package/lib/commonjs/web/handlers/PinchGestureHandler.js +41 -4
  239. package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
  240. package/lib/commonjs/web/handlers/RotationGestureHandler.js +42 -4
  241. package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
  242. package/lib/commonjs/web/handlers/TapGestureHandler.js +67 -6
  243. package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
  244. package/lib/commonjs/web/interfaces.js +17 -9
  245. package/lib/commonjs/web/interfaces.js.map +1 -1
  246. package/lib/commonjs/web/tools/CircularBuffer.js +15 -3
  247. package/lib/commonjs/web/tools/CircularBuffer.js.map +1 -1
  248. package/lib/commonjs/web/tools/EventManager.js +41 -7
  249. package/lib/commonjs/web/tools/EventManager.js.map +1 -1
  250. package/lib/commonjs/web/tools/GestureHandlerDelegate.js.map +1 -1
  251. package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +78 -11
  252. package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
  253. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +48 -8
  254. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  255. package/lib/commonjs/web/tools/InteractionManager.js +22 -5
  256. package/lib/commonjs/web/tools/InteractionManager.js.map +1 -1
  257. package/lib/commonjs/web/tools/KeyboardEventManager.js +26 -4
  258. package/lib/commonjs/web/tools/KeyboardEventManager.js.map +1 -1
  259. package/lib/commonjs/web/tools/LeastSquareSolver.js +67 -30
  260. package/lib/commonjs/web/tools/LeastSquareSolver.js.map +1 -1
  261. package/lib/commonjs/web/tools/NodeManager.js +14 -7
  262. package/lib/commonjs/web/tools/NodeManager.js.map +1 -1
  263. package/lib/commonjs/web/tools/PointerEventManager.js +45 -10
  264. package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
  265. package/lib/commonjs/web/tools/PointerTracker.js +45 -9
  266. package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
  267. package/lib/commonjs/web/tools/Vector.js +18 -3
  268. package/lib/commonjs/web/tools/Vector.js.map +1 -1
  269. package/lib/commonjs/web/tools/VelocityTracker.js +31 -9
  270. package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -1
  271. package/lib/commonjs/web/tools/WheelEventManager.js +17 -4
  272. package/lib/commonjs/web/tools/WheelEventManager.js.map +1 -1
  273. package/lib/commonjs/web/utils.js +55 -26
  274. package/lib/commonjs/web/utils.js.map +1 -1
  275. package/lib/commonjs/web_hammer/DiscreteGestureHandler.js +19 -7
  276. package/lib/commonjs/web_hammer/DiscreteGestureHandler.js.map +1 -1
  277. package/lib/commonjs/web_hammer/DraggingGestureHandler.js +13 -3
  278. package/lib/commonjs/web_hammer/DraggingGestureHandler.js.map +1 -1
  279. package/lib/commonjs/web_hammer/Errors.js +3 -0
  280. package/lib/commonjs/web_hammer/Errors.js.map +1 -1
  281. package/lib/commonjs/web_hammer/FlingGestureHandler.js +44 -13
  282. package/lib/commonjs/web_hammer/FlingGestureHandler.js.map +1 -1
  283. package/lib/commonjs/web_hammer/GestureHandler.js +142 -55
  284. package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
  285. package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js +11 -2
  286. package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js.map +1 -1
  287. package/lib/commonjs/web_hammer/LongPressGestureHandler.js +19 -5
  288. package/lib/commonjs/web_hammer/LongPressGestureHandler.js.map +1 -1
  289. package/lib/commonjs/web_hammer/NativeViewGestureHandler.js +24 -16
  290. package/lib/commonjs/web_hammer/NativeViewGestureHandler.js.map +1 -1
  291. package/lib/commonjs/web_hammer/NodeManager.js +16 -9
  292. package/lib/commonjs/web_hammer/NodeManager.js.map +1 -1
  293. package/lib/commonjs/web_hammer/PanGestureHandler.js +49 -8
  294. package/lib/commonjs/web_hammer/PanGestureHandler.js.map +1 -1
  295. package/lib/commonjs/web_hammer/PinchGestureHandler.js +11 -2
  296. package/lib/commonjs/web_hammer/PinchGestureHandler.js.map +1 -1
  297. package/lib/commonjs/web_hammer/PressGestureHandler.js +43 -15
  298. package/lib/commonjs/web_hammer/PressGestureHandler.js.map +1 -1
  299. package/lib/commonjs/web_hammer/RotationGestureHandler.js +13 -2
  300. package/lib/commonjs/web_hammer/RotationGestureHandler.js.map +1 -1
  301. package/lib/commonjs/web_hammer/TapGestureHandler.js +52 -33
  302. package/lib/commonjs/web_hammer/TapGestureHandler.js.map +1 -1
  303. package/lib/commonjs/web_hammer/constants.js +26 -13
  304. package/lib/commonjs/web_hammer/constants.js.map +1 -1
  305. package/lib/commonjs/web_hammer/utils.js +14 -4
  306. package/lib/commonjs/web_hammer/utils.js.map +1 -1
  307. package/lib/module/ActionType.js +1 -3
  308. package/lib/module/ActionType.js.map +1 -1
  309. package/lib/module/Directions.js +3 -9
  310. package/lib/module/Directions.js.map +1 -1
  311. package/lib/module/EnableNewWebImplementation.js +5 -2
  312. package/lib/module/EnableNewWebImplementation.js.map +1 -1
  313. package/lib/module/GestureHandlerRootViewContext.js.map +1 -1
  314. package/lib/module/PlatformConstants.js +1 -0
  315. package/lib/module/PlatformConstants.js.map +1 -1
  316. package/lib/module/PlatformConstants.web.js +1 -0
  317. package/lib/module/PlatformConstants.web.js.map +1 -1
  318. package/lib/module/PointerType.js +4 -3
  319. package/lib/module/PointerType.js.map +1 -1
  320. package/lib/module/RNGestureHandlerModule.js +0 -1
  321. package/lib/module/RNGestureHandlerModule.js.map +1 -1
  322. package/lib/module/RNGestureHandlerModule.web.js +20 -10
  323. package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
  324. package/lib/module/RNGestureHandlerModule.windows.js +17 -18
  325. package/lib/module/RNGestureHandlerModule.windows.js.map +1 -1
  326. package/lib/module/RNRenderer.js.map +1 -1
  327. package/lib/module/RNRenderer.web.js.map +1 -1
  328. package/lib/module/State.js +1 -4
  329. package/lib/module/State.js.map +1 -1
  330. package/lib/module/TouchEventType.js +1 -3
  331. package/lib/module/TouchEventType.js.map +1 -1
  332. package/lib/module/components/DrawerLayout.js +99 -80
  333. package/lib/module/components/DrawerLayout.js.map +1 -1
  334. package/lib/module/components/GestureButtons.js +55 -19
  335. package/lib/module/components/GestureButtons.js.map +1 -1
  336. package/lib/module/components/GestureButtonsProps.js.map +1 -1
  337. package/lib/module/components/GestureComponents.js +12 -17
  338. package/lib/module/components/GestureComponents.js.map +1 -1
  339. package/lib/module/components/GestureComponents.web.js +4 -4
  340. package/lib/module/components/GestureComponents.web.js.map +1 -1
  341. package/lib/module/components/GestureHandlerButton.js.map +1 -1
  342. package/lib/module/components/GestureHandlerButton.web.js +2 -1
  343. package/lib/module/components/GestureHandlerButton.web.js.map +1 -1
  344. package/lib/module/components/GestureHandlerRootView.android.js +2 -1
  345. package/lib/module/components/GestureHandlerRootView.android.js.map +1 -1
  346. package/lib/module/components/GestureHandlerRootView.js +2 -1
  347. package/lib/module/components/GestureHandlerRootView.js.map +1 -1
  348. package/lib/module/components/GestureHandlerRootView.web.js +2 -1
  349. package/lib/module/components/GestureHandlerRootView.web.js.map +1 -1
  350. package/lib/module/components/Pressable/Pressable.js +59 -26
  351. package/lib/module/components/Pressable/Pressable.js.map +1 -1
  352. package/lib/module/components/Pressable/PressableProps.js.map +1 -1
  353. package/lib/module/components/Pressable/index.js.map +1 -1
  354. package/lib/module/components/Pressable/utils.js +14 -4
  355. package/lib/module/components/Pressable/utils.js.map +1 -1
  356. package/lib/module/components/ReanimatedDrawerLayout.js +56 -34
  357. package/lib/module/components/ReanimatedDrawerLayout.js.map +1 -1
  358. package/lib/module/components/ReanimatedSwipeable.js +30 -14
  359. package/lib/module/components/ReanimatedSwipeable.js.map +1 -1
  360. package/lib/module/components/Swipeable.js +59 -28
  361. package/lib/module/components/Swipeable.js.map +1 -1
  362. package/lib/module/components/Text.js +10 -6
  363. package/lib/module/components/Text.js.map +1 -1
  364. package/lib/module/components/gestureHandlerRootHOC.js +2 -2
  365. package/lib/module/components/gestureHandlerRootHOC.js.map +1 -1
  366. package/lib/module/components/touchables/GenericTouchable.js +63 -34
  367. package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
  368. package/lib/module/components/touchables/GenericTouchableProps.js.map +1 -1
  369. package/lib/module/components/touchables/TouchableHighlight.js +24 -15
  370. package/lib/module/components/touchables/TouchableHighlight.js.map +1 -1
  371. package/lib/module/components/touchables/TouchableNativeFeedback.android.js +20 -10
  372. package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
  373. package/lib/module/components/touchables/TouchableNativeFeedback.js +2 -2
  374. package/lib/module/components/touchables/TouchableNativeFeedback.js.map +1 -1
  375. package/lib/module/components/touchables/TouchableNativeFeedbackProps.js.map +1 -1
  376. package/lib/module/components/touchables/TouchableOpacity.js +16 -10
  377. package/lib/module/components/touchables/TouchableOpacity.js.map +1 -1
  378. package/lib/module/components/touchables/TouchableWithoutFeedback.js +3 -6
  379. package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +1 -1
  380. package/lib/module/components/touchables/index.js.map +1 -1
  381. package/lib/module/findNodeHandle.js.map +1 -1
  382. package/lib/module/findNodeHandle.web.js +11 -5
  383. package/lib/module/findNodeHandle.web.js.map +1 -1
  384. package/lib/module/getReactNativeVersion.js.map +1 -1
  385. package/lib/module/getReactNativeVersion.web.js.map +1 -1
  386. package/lib/module/getShadowNodeFromRef.js +13 -13
  387. package/lib/module/getShadowNodeFromRef.js.map +1 -1
  388. package/lib/module/getShadowNodeFromRef.web.js.map +1 -1
  389. package/lib/module/ghQueueMicrotask.js.map +1 -1
  390. package/lib/module/handlers/FlingGestureHandler.js +0 -6
  391. package/lib/module/handlers/FlingGestureHandler.js.map +1 -1
  392. package/lib/module/handlers/ForceTouchGestureHandler.js +8 -12
  393. package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -1
  394. package/lib/module/handlers/GestureHandlerEventPayload.js.map +1 -1
  395. package/lib/module/handlers/LongPressGestureHandler.js +0 -6
  396. package/lib/module/handlers/LongPressGestureHandler.js.map +1 -1
  397. package/lib/module/handlers/NativeViewGestureHandler.js +0 -6
  398. package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -1
  399. package/lib/module/handlers/PanGestureHandler.js +19 -8
  400. package/lib/module/handlers/PanGestureHandler.js.map +1 -1
  401. package/lib/module/handlers/PinchGestureHandler.js +0 -2
  402. package/lib/module/handlers/PinchGestureHandler.js.map +1 -1
  403. package/lib/module/handlers/PressabilityDebugView.js.map +1 -1
  404. package/lib/module/handlers/PressabilityDebugView.web.js.map +1 -1
  405. package/lib/module/handlers/RotationGestureHandler.js +0 -2
  406. package/lib/module/handlers/RotationGestureHandler.js.map +1 -1
  407. package/lib/module/handlers/TapGestureHandler.js +0 -6
  408. package/lib/module/handlers/TapGestureHandler.js.map +1 -1
  409. package/lib/module/handlers/createHandler.js +106 -47
  410. package/lib/module/handlers/createHandler.js.map +1 -1
  411. package/lib/module/handlers/createNativeWrapper.js +17 -12
  412. package/lib/module/handlers/createNativeWrapper.js.map +1 -1
  413. package/lib/module/handlers/customDirectEventTypes.js.map +1 -1
  414. package/lib/module/handlers/customDirectEventTypes.web.js.map +1 -1
  415. package/lib/module/handlers/gestureHandlerCommon.js +4 -9
  416. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
  417. package/lib/module/handlers/gestureHandlerTypesCompat.js.map +1 -1
  418. package/lib/module/handlers/gestures/GestureDetector/Wrap.js +4 -3
  419. package/lib/module/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
  420. package/lib/module/handlers/gestures/GestureDetector/Wrap.web.js +6 -5
  421. package/lib/module/handlers/gestures/GestureDetector/Wrap.web.js.map +1 -1
  422. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +16 -8
  423. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  424. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +1 -0
  425. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  426. package/lib/module/handlers/gestures/GestureDetector/index.js +13 -7
  427. package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
  428. package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js +2 -0
  429. package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -1
  430. package/lib/module/handlers/gestures/GestureDetector/types.js.map +1 -1
  431. package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js +14 -11
  432. package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
  433. package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js +39 -12
  434. package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -1
  435. package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js +5 -5
  436. package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
  437. package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js +6 -2
  438. package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -1
  439. package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js +7 -5
  440. package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -1
  441. package/lib/module/handlers/gestures/GestureDetector/utils.js +28 -23
  442. package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -1
  443. package/lib/module/handlers/gestures/eventReceiver.js +38 -14
  444. package/lib/module/handlers/gestures/eventReceiver.js.map +1 -1
  445. package/lib/module/handlers/gestures/flingGesture.js +9 -5
  446. package/lib/module/handlers/gestures/flingGesture.js.map +1 -1
  447. package/lib/module/handlers/gestures/forceTouchGesture.js +17 -8
  448. package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -1
  449. package/lib/module/handlers/gestures/gesture.js +73 -44
  450. package/lib/module/handlers/gestures/gesture.js.map +1 -1
  451. package/lib/module/handlers/gestures/gestureComposition.js +24 -16
  452. package/lib/module/handlers/gestures/gestureComposition.js.map +1 -1
  453. package/lib/module/handlers/gestures/gestureObjects.js +14 -1
  454. package/lib/module/handlers/gestures/gestureObjects.js.map +1 -1
  455. package/lib/module/handlers/gestures/gestureStateManager.js +4 -3
  456. package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
  457. package/lib/module/handlers/gestures/gestureStateManager.web.js +1 -0
  458. package/lib/module/handlers/gestures/gestureStateManager.web.js.map +1 -1
  459. package/lib/module/handlers/gestures/hoverGesture.js +18 -9
  460. package/lib/module/handlers/gestures/hoverGesture.js.map +1 -1
  461. package/lib/module/handlers/gestures/longPressGesture.js +11 -6
  462. package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
  463. package/lib/module/handlers/gestures/manualGesture.js +4 -0
  464. package/lib/module/handlers/gestures/manualGesture.js.map +1 -1
  465. package/lib/module/handlers/gestures/nativeGesture.js +9 -5
  466. package/lib/module/handlers/gestures/nativeGesture.js.map +1 -1
  467. package/lib/module/handlers/gestures/panGesture.js +41 -18
  468. package/lib/module/handlers/gestures/panGesture.js.map +1 -1
  469. package/lib/module/handlers/gestures/pinchGesture.js +7 -2
  470. package/lib/module/handlers/gestures/pinchGesture.js.map +1 -1
  471. package/lib/module/handlers/gestures/reanimatedWrapper.js +5 -0
  472. package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
  473. package/lib/module/handlers/gestures/rotationGesture.js +7 -2
  474. package/lib/module/handlers/gestures/rotationGesture.js.map +1 -1
  475. package/lib/module/handlers/gestures/tapGesture.js +19 -10
  476. package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
  477. package/lib/module/handlers/getNextHandlerTag.js.map +1 -1
  478. package/lib/module/handlers/handlersRegistry.js +5 -0
  479. package/lib/module/handlers/handlersRegistry.js.map +1 -1
  480. package/lib/module/handlers/utils.js +13 -4
  481. package/lib/module/handlers/utils.js.map +1 -1
  482. package/lib/module/index.js.map +1 -1
  483. package/lib/module/init.js +2 -3
  484. package/lib/module/init.js.map +1 -1
  485. package/lib/module/jestUtils/index.js.map +1 -1
  486. package/lib/module/jestUtils/jestUtils.js +66 -20
  487. package/lib/module/jestUtils/jestUtils.js.map +1 -1
  488. package/lib/module/mocks.js +7 -3
  489. package/lib/module/mocks.js.map +1 -1
  490. package/lib/module/mountRegistry.js +10 -3
  491. package/lib/module/mountRegistry.js.map +1 -1
  492. package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -1
  493. package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
  494. package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -1
  495. package/lib/module/typeUtils.js.map +1 -1
  496. package/lib/module/utils.js +11 -6
  497. package/lib/module/utils.js.map +1 -1
  498. package/lib/module/web/Gestures.js +1 -2
  499. package/lib/module/web/Gestures.js.map +1 -1
  500. package/lib/module/web/constants.js.map +1 -1
  501. package/lib/module/web/detectors/RotationGestureDetector.js +38 -5
  502. package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -1
  503. package/lib/module/web/detectors/ScaleGestureDetector.js +38 -13
  504. package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
  505. package/lib/module/web/handlers/FlingGestureHandler.js +39 -5
  506. package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
  507. package/lib/module/web/handlers/GestureHandler.js +181 -61
  508. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  509. package/lib/module/web/handlers/HoverGestureHandler.js +11 -5
  510. package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
  511. package/lib/module/web/handlers/IGestureHandler.js.map +1 -1
  512. package/lib/module/web/handlers/LongPressGestureHandler.js +40 -5
  513. package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
  514. package/lib/module/web/handlers/ManualGestureHandler.js +6 -0
  515. package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
  516. package/lib/module/web/handlers/NativeViewGestureHandler.js +41 -7
  517. package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
  518. package/lib/module/web/handlers/PanGestureHandler.js +114 -7
  519. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
  520. package/lib/module/web/handlers/PinchGestureHandler.js +33 -3
  521. package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
  522. package/lib/module/web/handlers/RotationGestureHandler.js +34 -3
  523. package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
  524. package/lib/module/web/handlers/TapGestureHandler.js +59 -5
  525. package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
  526. package/lib/module/web/interfaces.js +14 -9
  527. package/lib/module/web/interfaces.js.map +1 -1
  528. package/lib/module/web/tools/CircularBuffer.js +13 -3
  529. package/lib/module/web/tools/CircularBuffer.js.map +1 -1
  530. package/lib/module/web/tools/EventManager.js +39 -7
  531. package/lib/module/web/tools/EventManager.js.map +1 -1
  532. package/lib/module/web/tools/GestureHandlerDelegate.js.map +1 -1
  533. package/lib/module/web/tools/GestureHandlerOrchestrator.js +71 -10
  534. package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
  535. package/lib/module/web/tools/GestureHandlerWebDelegate.js +37 -7
  536. package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  537. package/lib/module/web/tools/InteractionManager.js +19 -5
  538. package/lib/module/web/tools/InteractionManager.js.map +1 -1
  539. package/lib/module/web/tools/KeyboardEventManager.js +19 -3
  540. package/lib/module/web/tools/KeyboardEventManager.js.map +1 -1
  541. package/lib/module/web/tools/LeastSquareSolver.js +65 -30
  542. package/lib/module/web/tools/LeastSquareSolver.js.map +1 -1
  543. package/lib/module/web/tools/NodeManager.js +12 -7
  544. package/lib/module/web/tools/NodeManager.js.map +1 -1
  545. package/lib/module/web/tools/PointerEventManager.js +35 -9
  546. package/lib/module/web/tools/PointerEventManager.js.map +1 -1
  547. package/lib/module/web/tools/PointerTracker.js +39 -8
  548. package/lib/module/web/tools/PointerTracker.js.map +1 -1
  549. package/lib/module/web/tools/Vector.js +14 -3
  550. package/lib/module/web/tools/Vector.js.map +1 -1
  551. package/lib/module/web/tools/VelocityTracker.js +25 -8
  552. package/lib/module/web/tools/VelocityTracker.js.map +1 -1
  553. package/lib/module/web/tools/WheelEventManager.js +10 -3
  554. package/lib/module/web/tools/WheelEventManager.js.map +1 -1
  555. package/lib/module/web/utils.js +40 -21
  556. package/lib/module/web/utils.js.map +1 -1
  557. package/lib/module/web_hammer/DiscreteGestureHandler.js +13 -4
  558. package/lib/module/web_hammer/DiscreteGestureHandler.js.map +1 -1
  559. package/lib/module/web_hammer/DraggingGestureHandler.js +5 -0
  560. package/lib/module/web_hammer/DraggingGestureHandler.js.map +1 -1
  561. package/lib/module/web_hammer/Errors.js +1 -0
  562. package/lib/module/web_hammer/Errors.js.map +1 -1
  563. package/lib/module/web_hammer/FlingGestureHandler.js +35 -10
  564. package/lib/module/web_hammer/FlingGestureHandler.js.map +1 -1
  565. package/lib/module/web_hammer/GestureHandler.js +130 -53
  566. package/lib/module/web_hammer/GestureHandler.js.map +1 -1
  567. package/lib/module/web_hammer/IndiscreteGestureHandler.js +6 -1
  568. package/lib/module/web_hammer/IndiscreteGestureHandler.js.map +1 -1
  569. package/lib/module/web_hammer/LongPressGestureHandler.js +11 -2
  570. package/lib/module/web_hammer/LongPressGestureHandler.js.map +1 -1
  571. package/lib/module/web_hammer/NativeViewGestureHandler.js +12 -12
  572. package/lib/module/web_hammer/NativeViewGestureHandler.js.map +1 -1
  573. package/lib/module/web_hammer/NodeManager.js +8 -6
  574. package/lib/module/web_hammer/NodeManager.js.map +1 -1
  575. package/lib/module/web_hammer/PanGestureHandler.js +40 -6
  576. package/lib/module/web_hammer/PanGestureHandler.js.map +1 -1
  577. package/lib/module/web_hammer/PinchGestureHandler.js +5 -0
  578. package/lib/module/web_hammer/PinchGestureHandler.js.map +1 -1
  579. package/lib/module/web_hammer/PressGestureHandler.js +34 -13
  580. package/lib/module/web_hammer/PressGestureHandler.js.map +1 -1
  581. package/lib/module/web_hammer/RotationGestureHandler.js +6 -0
  582. package/lib/module/web_hammer/RotationGestureHandler.js.map +1 -1
  583. package/lib/module/web_hammer/TapGestureHandler.js +45 -31
  584. package/lib/module/web_hammer/TapGestureHandler.js.map +1 -1
  585. package/lib/module/web_hammer/constants.js +1 -2
  586. package/lib/module/web_hammer/constants.js.map +1 -1
  587. package/lib/module/web_hammer/utils.js +2 -2
  588. package/lib/module/web_hammer/utils.js.map +1 -1
  589. package/lib/typescript/components/touchables/TouchableHighlight.d.ts +2 -2
  590. package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +1 -1
  591. package/lib/typescript/components/touchables/TouchableNativeFeedback.d.ts +1 -1
  592. package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.d.ts +1 -1
  593. package/lib/typescript/components/touchables/TouchableOpacity.d.ts +2 -2
  594. package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +2 -2
  595. package/package.json +1 -1
  596. package/src/components/touchables/TouchableHighlight.tsx +2 -2
  597. package/src/components/touchables/TouchableNativeFeedback.android.tsx +1 -1
  598. package/src/components/touchables/TouchableNativeFeedback.tsx +1 -1
  599. package/src/components/touchables/TouchableNativeFeedbackProps.tsx +1 -1
  600. package/src/components/touchables/TouchableOpacity.tsx +2 -2
  601. package/src/components/touchables/TouchableWithoutFeedback.tsx +2 -2
@@ -1,11 +1,7 @@
1
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
+ 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; }
2
+
4
3
  import { getNextHandlerTag } from '../getNextHandlerTag';
5
4
  import { isRemoteDebuggingEnabled } from '../../utils';
6
-
7
- // Allow adding a ref to a gesture handler
8
-
9
5
  export const CALLBACK_TYPE = {
10
6
  UNDEFINED: 0,
11
7
  BEGAN: 1,
@@ -18,184 +14,199 @@ export const CALLBACK_TYPE = {
18
14
  TOUCHES_MOVE: 8,
19
15
  TOUCHES_UP: 9,
20
16
  TOUCHES_CANCELLED: 10
21
- };
22
-
23
- // Allow using CALLBACK_TYPE as object and type
17
+ }; // Allow using CALLBACK_TYPE as object and type
24
18
  // eslint-disable-next-line @typescript-eslint/no-redeclare
25
19
 
26
20
  export class Gesture {}
27
21
  let nextGestureId = 0;
28
22
  export class BaseGesture extends Gesture {
29
23
  constructor() {
30
- super();
31
-
32
- // Used to check whether the gesture config has been updated when wrapping it
24
+ super(); // Used to check whether the gesture config has been updated when wrapping it
33
25
  // with `useMemo`. Since every config will have a unique id, when the dependencies
34
26
  // don't change, the config won't be recreated and the id will stay the same.
35
27
  // If the id is different, it means that the config has changed and the gesture
36
28
  // needs to be updated.
29
+
37
30
  _defineProperty(this, "gestureId", -1);
31
+
38
32
  _defineProperty(this, "handlerTag", -1);
33
+
39
34
  _defineProperty(this, "handlerName", '');
35
+
40
36
  _defineProperty(this, "config", {});
37
+
41
38
  _defineProperty(this, "handlers", {
42
39
  gestureId: -1,
43
40
  handlerTag: -1,
44
41
  isWorklet: []
45
42
  });
43
+
46
44
  this.gestureId = nextGestureId++;
47
45
  this.handlers.gestureId = this.gestureId;
48
46
  }
47
+
49
48
  addDependency(key, gesture) {
50
49
  const value = this.config[key];
51
50
  this.config[key] = value ? Array().concat(value, gesture) : [gesture];
52
51
  }
53
-
54
52
  /**
55
53
  * Sets a `ref` to the gesture object, allowing for interoperability with the old API.
56
54
  * @param ref
57
55
  */
56
+
57
+
58
58
  withRef(ref) {
59
59
  this.config.ref = ref;
60
60
  return this;
61
- }
61
+ } // eslint-disable-next-line @typescript-eslint/ban-types
62
+
62
63
 
63
- // eslint-disable-next-line @typescript-eslint/ban-types
64
64
  isWorklet(callback) {
65
65
  // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
66
66
  return callback.__workletHash !== undefined;
67
67
  }
68
-
69
68
  /**
70
69
  * Set the callback that is being called when given gesture handler starts receiving touches.
71
70
  * At the moment of this callback the handler is in `BEGAN` state and we don't know yet if it will recognize the gesture at all.
72
71
  * @param callback
73
72
  */
73
+
74
+
74
75
  onBegin(callback) {
75
76
  this.handlers.onBegin = callback;
76
77
  this.handlers.isWorklet[CALLBACK_TYPE.BEGAN] = this.isWorklet(callback);
77
78
  return this;
78
79
  }
79
-
80
80
  /**
81
81
  * Set the callback that is being called when the gesture is recognized by the handler and it transitions to the `ACTIVE` state.
82
82
  * @param callback
83
83
  */
84
+
85
+
84
86
  onStart(callback) {
85
87
  this.handlers.onStart = callback;
86
88
  this.handlers.isWorklet[CALLBACK_TYPE.START] = this.isWorklet(callback);
87
89
  return this;
88
90
  }
89
-
90
91
  /**
91
92
  * Set the callback that is being called when the gesture that was recognized by the handler finishes and handler reaches `END` state.
92
93
  * It will be called only if the handler was previously in the `ACTIVE` state.
93
94
  * @param callback
94
95
  */
96
+
97
+
95
98
  onEnd(callback) {
96
- this.handlers.onEnd = callback;
97
- // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
99
+ this.handlers.onEnd = callback; // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
100
+
98
101
  this.handlers.isWorklet[CALLBACK_TYPE.END] = this.isWorklet(callback);
99
102
  return this;
100
103
  }
101
-
102
104
  /**
103
105
  * Set the callback that is being called when the handler finalizes handling gesture - the gesture was recognized and has finished or it failed to recognize.
104
106
  * @param callback
105
107
  */
108
+
109
+
106
110
  onFinalize(callback) {
107
- this.handlers.onFinalize = callback;
108
- // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
111
+ this.handlers.onFinalize = callback; // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
112
+
109
113
  this.handlers.isWorklet[CALLBACK_TYPE.FINALIZE] = this.isWorklet(callback);
110
114
  return this;
111
115
  }
112
-
113
116
  /**
114
117
  * Set the `onTouchesDown` callback which is called every time a pointer is placed on the screen.
115
118
  * @param callback
116
119
  */
120
+
121
+
117
122
  onTouchesDown(callback) {
118
123
  this.config.needsPointerData = true;
119
124
  this.handlers.onTouchesDown = callback;
120
125
  this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_DOWN] = this.isWorklet(callback);
121
126
  return this;
122
127
  }
123
-
124
128
  /**
125
129
  * Set the `onTouchesMove` callback which is called every time a pointer is moved on the screen.
126
130
  * @param callback
127
131
  */
132
+
133
+
128
134
  onTouchesMove(callback) {
129
135
  this.config.needsPointerData = true;
130
136
  this.handlers.onTouchesMove = callback;
131
137
  this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_MOVE] = this.isWorklet(callback);
132
138
  return this;
133
139
  }
134
-
135
140
  /**
136
141
  * Set the `onTouchesUp` callback which is called every time a pointer is lifted from the screen.
137
142
  * @param callback
138
143
  */
144
+
145
+
139
146
  onTouchesUp(callback) {
140
147
  this.config.needsPointerData = true;
141
148
  this.handlers.onTouchesUp = callback;
142
149
  this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_UP] = this.isWorklet(callback);
143
150
  return this;
144
151
  }
145
-
146
152
  /**
147
153
  * Set the `onTouchesCancelled` callback which is called every time a pointer stops being tracked, for example when the gesture finishes.
148
154
  * @param callback
149
155
  */
156
+
157
+
150
158
  onTouchesCancelled(callback) {
151
159
  this.config.needsPointerData = true;
152
160
  this.handlers.onTouchesCancelled = callback;
153
161
  this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_CANCELLED] = this.isWorklet(callback);
154
162
  return this;
155
163
  }
156
-
157
164
  /**
158
165
  * Indicates whether the given handler should be analyzing stream of touch events or not.
159
166
  * @param enabled
160
167
  * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#enabledvalue-boolean
161
168
  */
169
+
170
+
162
171
  enabled(enabled) {
163
172
  this.config.enabled = enabled;
164
173
  return this;
165
174
  }
166
-
167
175
  /**
168
176
  * When true the handler will cancel or fail recognition (depending on its current state) whenever the finger leaves the area of the connected view.
169
177
  * @param value
170
178
  * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#shouldcancelwhenoutsidevalue-boolean
171
179
  */
180
+
181
+
172
182
  shouldCancelWhenOutside(value) {
173
183
  this.config.shouldCancelWhenOutside = value;
174
184
  return this;
175
185
  }
176
-
177
186
  /**
178
187
  * This parameter enables control over what part of the connected view area can be used to begin recognizing the gesture.
179
188
  * When a negative number is provided the bounds of the view will reduce the area by the given number of points in each of the sides evenly.
180
189
  * @param hitSlop
181
190
  * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#hitslopsettings
182
191
  */
192
+
193
+
183
194
  hitSlop(hitSlop) {
184
195
  this.config.hitSlop = hitSlop;
185
196
  return this;
186
197
  }
187
-
188
198
  /**
189
199
  * #### Web only
190
200
  * This parameter allows to specify which `cursor` should be used when gesture activates.
191
201
  * Supports all CSS cursor values (e.g. `"grab"`, `"zoom-in"`). Default value is set to `"auto"`.
192
202
  * @param activeCursor
193
203
  */
204
+
205
+
194
206
  activeCursor(activeCursor) {
195
207
  this.config.activeCursor = activeCursor;
196
208
  return this;
197
209
  }
198
-
199
210
  /**
200
211
  * #### Web & Android only
201
212
  * Allows users to choose which mouse button should handler respond to.
@@ -204,99 +215,114 @@ export class BaseGesture extends Gesture {
204
215
  * @param mouseButton
205
216
  * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#mousebuttonvalue-mousebutton-web--android-only
206
217
  */
218
+
219
+
207
220
  mouseButton(mouseButton) {
208
221
  this.config.mouseButton = mouseButton;
209
222
  return this;
210
223
  }
211
-
212
224
  /**
213
225
  * When `react-native-reanimated` is installed, the callbacks passed to the gestures are automatically workletized and run on the UI thread when called.
214
226
  * This option allows for changing this behavior: when `true`, all the callbacks will be run on the JS thread instead of the UI thread, regardless of whether they are worklets or not.
215
227
  * Defaults to `false`.
216
228
  * @param runOnJS
217
229
  */
230
+
231
+
218
232
  runOnJS(runOnJS) {
219
233
  this.config.runOnJS = runOnJS;
220
234
  return this;
221
235
  }
222
-
223
236
  /**
224
237
  * Allows gestures across different components to be recognized simultaneously.
225
238
  * @param gestures
226
239
  * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#simultaneouswithexternalgesture
227
240
  */
241
+
242
+
228
243
  simultaneousWithExternalGesture(...gestures) {
229
244
  for (const gesture of gestures) {
230
245
  this.addDependency('simultaneousWith', gesture);
231
246
  }
247
+
232
248
  return this;
233
249
  }
234
-
235
250
  /**
236
251
  * Allows to delay activation of the handler until all handlers passed as arguments to this method fail (or don't begin at all).
237
252
  * @param gestures
238
253
  * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#requireexternalgesturetofail
239
254
  */
255
+
256
+
240
257
  requireExternalGestureToFail(...gestures) {
241
258
  for (const gesture of gestures) {
242
259
  this.addDependency('requireToFail', gesture);
243
260
  }
261
+
244
262
  return this;
245
263
  }
246
-
247
264
  /**
248
265
  * Works similarily to `requireExternalGestureToFail` but the direction of the relation is reversed - instead of being one-to-many relation, it's many-to-one.
249
266
  * @param gestures
250
267
  * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#blocksexternalgesture
251
268
  */
269
+
270
+
252
271
  blocksExternalGesture(...gestures) {
253
272
  for (const gesture of gestures) {
254
273
  this.addDependency('blocksHandlers', gesture);
255
274
  }
275
+
256
276
  return this;
257
277
  }
258
-
259
278
  /**
260
279
  * Sets a `testID` property for gesture object, allowing for querying for it in tests.
261
280
  * @param id
262
281
  */
282
+
283
+
263
284
  withTestId(id) {
264
285
  this.config.testId = id;
265
286
  return this;
266
287
  }
267
-
268
288
  /**
269
289
  * #### iOS only
270
290
  * When `true`, the handler will cancel touches for native UI components (`UIButton`, `UISwitch`, etc) it's attached to when it becomes `ACTIVE`.
271
291
  * Default value is `true`.
272
292
  * @param value
273
293
  */
294
+
295
+
274
296
  cancelsTouchesInView(value) {
275
297
  this.config.cancelsTouchesInView = value;
276
298
  return this;
277
299
  }
300
+
278
301
  initialize() {
279
302
  this.handlerTag = getNextHandlerTag();
280
- this.handlers = {
281
- ...this.handlers,
303
+ this.handlers = { ...this.handlers,
282
304
  handlerTag: this.handlerTag
283
305
  };
306
+
284
307
  if (this.config.ref) {
285
308
  this.config.ref.current = this;
286
309
  }
287
310
  }
311
+
288
312
  toGestureArray() {
289
313
  return [this];
290
- }
314
+ } // eslint-disable-next-line @typescript-eslint/no-empty-function
315
+
291
316
 
292
- // eslint-disable-next-line @typescript-eslint/no-empty-function
293
317
  prepare() {}
318
+
294
319
  get shouldUseReanimated() {
295
320
  // Use Reanimated when runOnJS isn't set explicitly,
296
321
  // all defined callbacks are worklets
297
322
  // and remote debugging is disabled
298
323
  return this.config.runOnJS !== true && !this.handlers.isWorklet.includes(false) && !isRemoteDebuggingEnabled();
299
324
  }
325
+
300
326
  }
301
327
  export class ContinousBaseGesture extends BaseGesture {
302
328
  /**
@@ -308,26 +334,29 @@ export class ContinousBaseGesture extends BaseGesture {
308
334
  this.handlers.isWorklet[CALLBACK_TYPE.UPDATE] = this.isWorklet(callback);
309
335
  return this;
310
336
  }
311
-
312
337
  /**
313
338
  * Set the callback that is being called every time the gesture receives an update while it's active.
314
339
  * This callback will receive information about change in value in relation to the last received event.
315
340
  * @param callback
316
341
  */
342
+
343
+
317
344
  onChange(callback) {
318
345
  this.handlers.onChange = callback;
319
346
  this.handlers.isWorklet[CALLBACK_TYPE.CHANGE] = this.isWorklet(callback);
320
347
  return this;
321
348
  }
322
-
323
349
  /**
324
350
  * When `true` the handler will not activate by itself even if its activation criteria are met.
325
351
  * Instead you can manipulate its state using state manager.
326
352
  * @param manualActivation
327
353
  */
354
+
355
+
328
356
  manualActivation(manualActivation) {
329
357
  this.config.manualActivation = manualActivation;
330
358
  return this;
331
359
  }
360
+
332
361
  }
333
362
  //# sourceMappingURL=gesture.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getNextHandlerTag","isRemoteDebuggingEnabled","CALLBACK_TYPE","UNDEFINED","BEGAN","START","UPDATE","CHANGE","END","FINALIZE","TOUCHES_DOWN","TOUCHES_MOVE","TOUCHES_UP","TOUCHES_CANCELLED","Gesture","nextGestureId","BaseGesture","constructor","_defineProperty","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"],"sources":["gesture.ts"],"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"],"mappings":";;;AASA,SAASA,iBAAiB,QAAQ,sBAAsB;AAaxD,SAASC,wBAAwB,QAAQ,aAAa;;AAmBA;;AA8CtD,OAAO,MAAMC,aAAa,GAAG;EAC3BC,SAAS,EAAE,CAAC;EACZC,KAAK,EAAE,CAAC;EACRC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTC,MAAM,EAAE,CAAC;EACTC,GAAG,EAAE,CAAC;EACNC,QAAQ,EAAE,CAAC;EACXC,YAAY,EAAE,CAAC;EACfC,YAAY,EAAE,CAAC;EACfC,UAAU,EAAE,CAAC;EACbC,iBAAiB,EAAE;AACrB,CAAU;;AAEV;AACA;;AAGA,OAAO,MAAeC,OAAO,CAAC;AAoB9B,IAAIC,aAAa,GAAG,CAAC;AACrB,OAAO,MAAeC,WAAW,SAEvBF,OAAO,CAAC;EAWhBG,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,CAAC;;IAEP;IACA;IACA;IACA;IACA;IAAAC,eAAA,oBAjBkB,CAAC,CAAC;IAAAA,eAAA,qBACF,CAAC,CAAC;IAAAA,eAAA,sBACD,EAAE;IAAAA,eAAA,iBACY,CAAC,CAAC;IAAAA,eAAA,mBACc;MACjDC,SAAS,EAAE,CAAC,CAAC;MACbC,UAAU,EAAE,CAAC,CAAC;MACdC,SAAS,EAAE;IACb,CAAC;IAUC,IAAI,CAACF,SAAS,GAAGJ,aAAa,EAAE;IAChC,IAAI,CAACO,QAAQ,CAACH,SAAS,GAAG,IAAI,CAACA,SAAS;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AK,IAAI,IAC5B,CAAC,IAAI,CAAC3B,QAAQ,CAACD,SAAS,CAAC0C,QAAQ,CAAC,KAAK,CAAC,IACxC,CAAC9D,wBAAwB,CAAC,CAAC;EAE/B;AACF;AAEA,OAAO,MAAe+D,oBAAoB,SAGhChD,WAAW,CAAgB;EACnC;AACF;AACA;AACA;EACEiD,QAAQA,CAACjC,QAA4D,EAAE;IACrE,IAAI,CAACV,QAAQ,CAAC2C,QAAQ,GAAGjC,QAAQ;IACjC,IAAI,CAACV,QAAQ,CAACD,SAAS,CAACnB,aAAa,CAACI,MAAM,CAAC,GAAG,IAAI,CAACe,SAAS,CAACW,QAAQ,CAAC;IACxE,OAAO,IAAI;EACb;;EAEA;AACF;AACA;AACA;AACA;EACEkC,QAAQA,CACNlC,QAES,EACT;IACA,IAAI,CAACV,QAAQ,CAAC4C,QAAQ,GAAGlC,QAAQ;IACjC,IAAI,CAACV,QAAQ,CAACD,SAAS,CAACnB,aAAa,CAACK,MAAM,CAAC,GAAG,IAAI,CAACc,SAAS,CAACW,QAAQ,CAAC;IACxE,OAAO,IAAI;EACb;;EAEA;AACF;AACA;AACA;AACA;EACEmC,gBAAgBA,CAACA,gBAAyB,EAAE;IAC1C,IAAI,CAACxC,MAAM,CAACwC,gBAAgB,GAAGA,gBAAgB;IAC/C,OAAO,IAAI;EACb;AACF","ignoreList":[]}
1
+ {"version":3,"sources":["gesture.ts"],"names":["getNextHandlerTag","isRemoteDebuggingEnabled","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,SAASA,iBAAT,QAAkC,sBAAlC;AAaA,SAASC,wBAAT,QAAyC,aAAzC;AAiEA,OAAO,MAAMC,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;;AAGA,OAAO,MAAeC,OAAf,CAAuB;AAoB9B,IAAIC,aAAa,GAAG,CAApB;AACA,OAAO,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;A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OAAO,MAAe8D,oBAAf,SAGG/C,WAHH,CAG8B;AACnC;AACF;AACA;AACA;AACEgD,EAAAA,QAAQ,CAACjC,QAAD,EAA+D;AACrE,SAAKV,QAAL,CAAc2C,QAAd,GAAyBjC,QAAzB;AACA,SAAKV,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"]}
@@ -1,7 +1,7 @@
1
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
+ 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; }
2
+
4
3
  import { BaseGesture, Gesture } from './gesture';
4
+
5
5
  function extendRelation(currentRelation, extendWith) {
6
6
  if (currentRelation === undefined) {
7
7
  return [...extendWith];
@@ -9,22 +9,26 @@ function extendRelation(currentRelation, extendWith) {
9
9
  return [...currentRelation, ...extendWith];
10
10
  }
11
11
  }
12
+
12
13
  export class ComposedGesture extends Gesture {
13
14
  constructor(...gestures) {
14
15
  super();
16
+
15
17
  _defineProperty(this, "gestures", []);
18
+
16
19
  _defineProperty(this, "simultaneousGestures", []);
20
+
17
21
  _defineProperty(this, "requireGesturesToFail", []);
22
+
18
23
  this.gestures = gestures;
19
24
  }
25
+
20
26
  prepareSingleGesture(gesture, simultaneousGestures, requireGesturesToFail) {
21
27
  if (gesture instanceof BaseGesture) {
22
- const newConfig = {
23
- ...gesture.config
24
- };
25
-
26
- // No need to extend `blocksHandlers` here, because it's not changed in composition.
28
+ const newConfig = { ...gesture.config
29
+ }; // No need to extend `blocksHandlers` here, because it's not changed in composition.
27
30
  // The same effect is achieved by reversing the order of 2 gestures in `Exclusive`
31
+
28
32
  newConfig.simultaneousWith = extendRelation(newConfig.simultaneousWith, simultaneousGestures);
29
33
  newConfig.requireToFail = extendRelation(newConfig.requireToFail, requireGesturesToFail);
30
34
  gesture.config = newConfig;
@@ -34,38 +38,41 @@ export class ComposedGesture extends Gesture {
34
38
  gesture.prepare();
35
39
  }
36
40
  }
41
+
37
42
  prepare() {
38
43
  for (const gesture of this.gestures) {
39
44
  this.prepareSingleGesture(gesture, this.simultaneousGestures, this.requireGesturesToFail);
40
45
  }
41
46
  }
47
+
42
48
  initialize() {
43
49
  for (const gesture of this.gestures) {
44
50
  gesture.initialize();
45
51
  }
46
52
  }
53
+
47
54
  toGestureArray() {
48
55
  return this.gestures.flatMap(gesture => gesture.toGestureArray());
49
56
  }
57
+
50
58
  }
51
59
  export class SimultaneousGesture extends ComposedGesture {
52
60
  prepare() {
53
61
  // This piece of magic works something like this:
54
62
  // for every gesture in the array
55
- const simultaneousArrays = this.gestures.map(gesture =>
56
- // we take the array it's in
57
- this.gestures
58
- // and make a copy without it
59
- .filter(x => x !== gesture)
60
- // then we flatmap the result to get list of raw (not composed) gestures
63
+ const simultaneousArrays = this.gestures.map(gesture => // we take the array it's in
64
+ this.gestures // and make a copy without it
65
+ .filter(x => x !== gesture) // then we flatmap the result to get list of raw (not composed) gestures
61
66
  // this way we don't make the gestures simultaneous with themselves, which is
62
67
  // important when the gesture is `ExclusiveGesture` - we don't want to make
63
68
  // exclusive gestures simultaneous
64
69
  .flatMap(x => x.toGestureArray()));
70
+
65
71
  for (let i = 0; i < this.gestures.length; i++) {
66
72
  this.prepareSingleGesture(this.gestures[i], simultaneousArrays[i], this.requireGesturesToFail);
67
73
  }
68
74
  }
75
+
69
76
  }
70
77
  export class ExclusiveGesture extends ComposedGesture {
71
78
  prepare() {
@@ -73,12 +80,13 @@ export class ExclusiveGesture extends ComposedGesture {
73
80
  // i.e. [gesture1, gesture2, ComposedGesture(gesture3, gesture4)] -> [[gesture1], [gesture2], [gesture3, gesture4]]
74
81
  const gestureArrays = this.gestures.map(gesture => gesture.toGestureArray());
75
82
  let requireToFail = [];
83
+
76
84
  for (let i = 0; i < this.gestures.length; i++) {
77
- this.prepareSingleGesture(this.gestures[i], this.simultaneousGestures, this.requireGesturesToFail.concat(requireToFail));
85
+ this.prepareSingleGesture(this.gestures[i], this.simultaneousGestures, this.requireGesturesToFail.concat(requireToFail)); // Every group gets to wait for all groups before it
78
86
 
79
- // Every group gets to wait for all groups before it
80
87
  requireToFail = requireToFail.concat(gestureArrays[i]);
81
88
  }
82
89
  }
90
+
83
91
  }
84
92
  //# sourceMappingURL=gestureComposition.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BaseGesture","Gesture","extendRelation","currentRelation","extendWith","undefined","ComposedGesture","constructor","gestures","_defineProperty","prepareSingleGesture","gesture","simultaneousGestures","requireGesturesToFail","newConfig","config","simultaneousWith","requireToFail","prepare","initialize","toGestureArray","flatMap","SimultaneousGesture","simultaneousArrays","map","filter","x","i","length","ExclusiveGesture","gestureArrays","concat"],"sources":["gestureComposition.ts"],"sourcesContent":["import { BaseGesture, Gesture, GestureRef, GestureType } from './gesture';\n\nfunction extendRelation(\n currentRelation: GestureRef[] | undefined,\n extendWith: GestureType[]\n) {\n if (currentRelation === undefined) {\n return [...extendWith];\n } else {\n return [...currentRelation, ...extendWith];\n }\n}\n\nexport class ComposedGesture extends Gesture {\n protected gestures: Gesture[] = [];\n protected simultaneousGestures: GestureType[] = [];\n protected requireGesturesToFail: GestureType[] = [];\n\n constructor(...gestures: Gesture[]) {\n super();\n this.gestures = gestures;\n }\n\n protected prepareSingleGesture(\n gesture: Gesture,\n simultaneousGestures: GestureType[],\n requireGesturesToFail: GestureType[]\n ) {\n if (gesture instanceof BaseGesture) {\n const newConfig = { ...gesture.config };\n\n // No need to extend `blocksHandlers` here, because it's not changed in composition.\n // The same effect is achieved by reversing the order of 2 gestures in `Exclusive`\n newConfig.simultaneousWith = extendRelation(\n newConfig.simultaneousWith,\n simultaneousGestures\n );\n newConfig.requireToFail = extendRelation(\n newConfig.requireToFail,\n requireGesturesToFail\n );\n\n gesture.config = newConfig;\n } else if (gesture instanceof ComposedGesture) {\n gesture.simultaneousGestures = simultaneousGestures;\n gesture.requireGesturesToFail = requireGesturesToFail;\n gesture.prepare();\n }\n }\n\n prepare() {\n for (const gesture of this.gestures) {\n this.prepareSingleGesture(\n gesture,\n this.simultaneousGestures,\n this.requireGesturesToFail\n );\n }\n }\n\n initialize() {\n for (const gesture of this.gestures) {\n gesture.initialize();\n }\n }\n\n toGestureArray(): GestureType[] {\n return this.gestures.flatMap((gesture) => gesture.toGestureArray());\n }\n}\n\nexport class SimultaneousGesture extends ComposedGesture {\n prepare() {\n // This piece of magic works something like this:\n // for every gesture in the array\n const simultaneousArrays = this.gestures.map((gesture) =>\n // we take the array it's in\n this.gestures\n // and make a copy without it\n .filter((x) => x !== gesture)\n // then we flatmap the result to get list of raw (not composed) gestures\n // this way we don't make the gestures simultaneous with themselves, which is\n // important when the gesture is `ExclusiveGesture` - we don't want to make\n // exclusive gestures simultaneous\n .flatMap((x) => x.toGestureArray())\n );\n\n for (let i = 0; i < this.gestures.length; i++) {\n this.prepareSingleGesture(\n this.gestures[i],\n simultaneousArrays[i],\n this.requireGesturesToFail\n );\n }\n }\n}\n\nexport class ExclusiveGesture extends ComposedGesture {\n prepare() {\n // Transforms the array of gestures into array of grouped raw (not composed) gestures\n // i.e. [gesture1, gesture2, ComposedGesture(gesture3, gesture4)] -> [[gesture1], [gesture2], [gesture3, gesture4]]\n const gestureArrays = this.gestures.map((gesture) =>\n gesture.toGestureArray()\n );\n\n let requireToFail: GestureType[] = [];\n\n for (let i = 0; i < this.gestures.length; i++) {\n this.prepareSingleGesture(\n this.gestures[i],\n this.simultaneousGestures,\n this.requireGesturesToFail.concat(requireToFail)\n );\n\n // Every group gets to wait for all groups before it\n requireToFail = requireToFail.concat(gestureArrays[i]);\n }\n }\n}\n\nexport type ComposedGestureType = InstanceType<typeof ComposedGesture>;\nexport type RaceGestureType = ComposedGestureType;\nexport type SimultaneousGestureType = InstanceType<typeof SimultaneousGesture>;\nexport type ExclusiveGestureType = InstanceType<typeof ExclusiveGesture>;\n"],"mappings":";;;AAAA,SAASA,WAAW,EAAEC,OAAO,QAAiC,WAAW;AAEzE,SAASC,cAAcA,CACrBC,eAAyC,EACzCC,UAAyB,EACzB;EACA,IAAID,eAAe,KAAKE,SAAS,EAAE;IACjC,OAAO,CAAC,GAAGD,UAAU,CAAC;EACxB,CAAC,MAAM;IACL,OAAO,CAAC,GAAGD,eAAe,EAAE,GAAGC,UAAU,CAAC;EAC5C;AACF;AAEA,OAAO,MAAME,eAAe,SAASL,OAAO,CAAC;EAK3CM,WAAWA,CAAC,GAAGC,QAAmB,EAAE;IAClC,KAAK,CAAC,CAAC;IAACC,eAAA,mBALsB,EAAE;IAAAA,eAAA,+BACc,EAAE;IAAAA,eAAA,gCACD,EAAE;IAIjD,IAAI,CAACD,QAAQ,GAAGA,QAAQ;EAC1B;EAEUE,oBAAoBA,CAC5BC,OAAgB,EAChBC,oBAAmC,EACnCC,qBAAoC,EACpC;IACA,IAAIF,OAAO,YAAYX,WAAW,EAAE;MAClC,MAAMc,SAAS,GAAG;QAAE,GAAGH,OAAO,CAACI;MAAO,CAAC;;MAEvC;MACA;MACAD,SAAS,CAACE,gBAAgB,GAAGd,cAAc,CACzCY,SAAS,CAACE,gBAAgB,EAC1BJ,oBACF,CAAC;MACDE,SAAS,CAACG,aAAa,GAAGf,cAAc,CACtCY,SAAS,CAACG,aAAa,EACvBJ,qBACF,CAAC;MAEDF,OAAO,CAACI,MAAM,GAAGD,SAAS;IAC5B,CAAC,MAAM,IAAIH,OAAO,YAAYL,eAAe,EAAE;MA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ASvB,eAAe,CAAC;EACpDY,OAAOA,CAAA,EAAG;IACR;IACA;IACA,MAAMY,aAAa,GAAG,IAAI,CAACtB,QAAQ,CAACgB,GAAG,CAAEb,OAAO,IAC9CA,OAAO,CAACS,cAAc,CAAC,CACzB,CAAC;IAED,IAAIH,aAA4B,GAAG,EAAE;IAErC,KAAK,IAAIU,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,IAAI,CAACnB,QAAQ,CAACoB,MAAM,EAAED,CAAC,EAAE,EAAE;MAC7C,IAAI,CAACjB,oBAAoB,CACvB,IAAI,CAACF,QAAQ,CAACmB,CAAC,CAAC,EAChB,IAAI,CAACf,oBAAoB,EACzB,IAAI,CAACC,qBAAqB,CAACkB,MAAM,CAACd,aAAa,CACjD,CAAC;;MAED;MACAA,aAAa,GAAGA,aAAa,CAACc,MAAM,CAACD,aAAa,CAACH,CAAC,CAAC,CAAC;IACxD;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"sources":["gestureComposition.ts"],"names":["BaseGesture","Gesture","extendRelation","currentRelation","extendWith","undefined","ComposedGesture","constructor","gestures","prepareSingleGesture","gesture","simultaneousGestures","requireGesturesToFail","newConfig","config","simultaneousWith","requireToFail","prepare","initialize","toGestureArray","flatMap","SimultaneousGesture","simultaneousArrays","map","filter","x","i","length","ExclusiveGesture","gestureArrays","concat"],"mappings":";;AAAA,SAASA,WAAT,EAAsBC,OAAtB,QAA8D,WAA9D;;AAEA,SAASC,cAAT,CACEC,eADF,EAEEC,UAFF,EAGE;AACA,MAAID,eAAe,KAAKE,SAAxB,EAAmC;AACjC,WAAO,CAAC,GAAGD,UAAJ,CAAP;AACD,GAFD,MAEO;AACL,WAAO,CAAC,GAAGD,eAAJ,EAAqB,GAAGC,UAAxB,CAAP;AACD;AACF;;AAED,OAAO,MAAME,eAAN,SAA8BL,OAA9B,CAAsC;AAK3CM,EAAAA,WAAW,CAAC,GAAGC,QAAJ,EAAyB;AAClC;;AADkC,sCAJJ,EAII;;AAAA,kDA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,UAAMK,kBAAkB,GAAG,KAAKd,QAAL,CAAce,GAAd,CAAmBb,OAAD,IAC3C;AACA,SAAKF,QAAL,CACE;AADF,KAEGgB,MAFH,CAEWC,CAAD,IAAOA,CAAC,KAAKf,OAFvB,EAGE;AACA;AACA;AACA;AANF,KAOGU,OAPH,CAOYK,CAAD,IAAOA,CAAC,CAACN,cAAF,EAPlB,CAFyB,CAA3B;;AAYA,SAAK,IAAIO,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,KAAKlB,QAAL,CAAcmB,MAAlC,EAA0CD,CAAC,EAA3C,EAA+C;AAC7C,WAAKjB,oBAAL,CACE,KAAKD,QAAL,CAAckB,CAAd,CADF,EAEEJ,kBAAkB,CAACI,CAAD,CAFpB,EAGE,KAAKd,qBAHP;AAKD;AACF;;AAvBsD;AA0BzD,OAAO,MAAMgB,gBAAN,SAA+BtB,eAA/B,CAA+C;AACpDW,EAAAA,OAAO,GAAG;AACR;AACA;AACA,UAAMY,aAAa,GAAG,KAAKrB,QAAL,CAAce,GAAd,CAAmBb,OAAD,IACtCA,OAAO,CAACS,cAAR,EADoB,CAAtB;AAIA,QAAIH,aAA4B,GAAG,EAAnC;;AAEA,SAAK,IAAIU,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,KAAKlB,QAAL,CAAcmB,MAAlC,EAA0CD,CAAC,EAA3C,EAA+C;AAC7C,WAAKjB,oBAAL,CACE,KAAKD,QAAL,CAAckB,CAAd,CADF,EAEE,KAAKf,oBAFP,EAGE,KAAKC,qBAAL,CAA2BkB,MAA3B,CAAkCd,aAAlC,CAHF,EAD6C,CAO7C;;AACAA,MAAAA,aAAa,GAAGA,aAAa,CAACc,MAAd,CAAqBD,aAAa,CAACH,CAAD,CAAlC,CAAhB;AACD;AACF;;AApBmD","sourcesContent":["import { BaseGesture, Gesture, GestureRef, GestureType } from './gesture';\n\nfunction extendRelation(\n currentRelation: GestureRef[] | undefined,\n extendWith: GestureType[]\n) {\n if (currentRelation === undefined) {\n return [...extendWith];\n } else {\n return [...currentRelation, ...extendWith];\n }\n}\n\nexport class ComposedGesture extends Gesture {\n protected gestures: Gesture[] = [];\n protected simultaneousGestures: GestureType[] = [];\n protected requireGesturesToFail: GestureType[] = [];\n\n constructor(...gestures: Gesture[]) {\n super();\n this.gestures = gestures;\n }\n\n protected prepareSingleGesture(\n gesture: Gesture,\n simultaneousGestures: GestureType[],\n requireGesturesToFail: GestureType[]\n ) {\n if (gesture instanceof BaseGesture) {\n const newConfig = { ...gesture.config };\n\n // No need to extend `blocksHandlers` here, because it's not changed in composition.\n // The same effect is achieved by reversing the order of 2 gestures in `Exclusive`\n newConfig.simultaneousWith = extendRelation(\n newConfig.simultaneousWith,\n simultaneousGestures\n );\n newConfig.requireToFail = extendRelation(\n newConfig.requireToFail,\n requireGesturesToFail\n );\n\n gesture.config = newConfig;\n } else if (gesture instanceof ComposedGesture) {\n gesture.simultaneousGestures = simultaneousGestures;\n gesture.requireGesturesToFail = requireGesturesToFail;\n gesture.prepare();\n }\n }\n\n prepare() {\n for (const gesture of this.gestures) {\n this.prepareSingleGesture(\n gesture,\n this.simultaneousGestures,\n this.requireGesturesToFail\n );\n }\n }\n\n initialize() {\n for (const gesture of this.gestures) {\n gesture.initialize();\n }\n }\n\n toGestureArray(): GestureType[] {\n return this.gestures.flatMap((gesture) => gesture.toGestureArray());\n }\n}\n\nexport class SimultaneousGesture extends ComposedGesture {\n prepare() {\n // This piece of magic works something like this:\n // for every gesture in the array\n const simultaneousArrays = this.gestures.map((gesture) =>\n // we take the array it's in\n this.gestures\n // and make a copy without it\n .filter((x) => x !== gesture)\n // then we flatmap the result to get list of raw (not composed) gestures\n // this way we don't make the gestures simultaneous with themselves, which is\n // important when the gesture is `ExclusiveGesture` - we don't want to make\n // exclusive gestures simultaneous\n .flatMap((x) => x.toGestureArray())\n );\n\n for (let i = 0; i < this.gestures.length; i++) {\n this.prepareSingleGesture(\n this.gestures[i],\n simultaneousArrays[i],\n this.requireGesturesToFail\n );\n }\n }\n}\n\nexport class ExclusiveGesture extends ComposedGesture {\n prepare() {\n // Transforms the array of gestures into array of grouped raw (not composed) gestures\n // i.e. [gesture1, gesture2, ComposedGesture(gesture3, gesture4)] -> [[gesture1], [gesture2], [gesture3, gesture4]]\n const gestureArrays = this.gestures.map((gesture) =>\n gesture.toGestureArray()\n );\n\n let requireToFail: GestureType[] = [];\n\n for (let i = 0; i < this.gestures.length; i++) {\n this.prepareSingleGesture(\n this.gestures[i],\n this.simultaneousGestures,\n this.requireGesturesToFail.concat(requireToFail)\n );\n\n // Every group gets to wait for all groups before it\n requireToFail = requireToFail.concat(gestureArrays[i]);\n }\n }\n}\n\nexport type ComposedGestureType = InstanceType<typeof ComposedGesture>;\nexport type RaceGestureType = ComposedGestureType;\nexport type SimultaneousGestureType = InstanceType<typeof SimultaneousGesture>;\nexport type ExclusiveGestureType = InstanceType<typeof ExclusiveGesture>;\n"]}