react-native-gesture-handler 2.25.0 → 2.26.0

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 (1028) hide show
  1. package/RNGestureHandler.podspec +1 -0
  2. package/android/build.gradle +41 -42
  3. package/android/fabric/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +1 -1
  4. package/android/gradle.properties +1 -1
  5. package/android/noreanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt +2 -2
  6. package/android/paper/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +4 -1
  7. package/android/reanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt +1 -1
  8. package/android/{package77/src → src}/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +14 -19
  9. package/android/src/main/java/com/swmansion/gesturehandler/core/FlingGestureHandler.kt +29 -5
  10. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +229 -114
  11. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerInteractionController.kt +4 -4
  12. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +91 -49
  13. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerRegistry.kt +1 -1
  14. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureUtils.kt +13 -4
  15. package/android/src/main/java/com/swmansion/gesturehandler/core/HoverGestureHandler.kt +20 -6
  16. package/android/src/main/java/com/swmansion/gesturehandler/core/LongPressGestureHandler.kt +52 -21
  17. package/android/src/main/java/com/swmansion/gesturehandler/core/ManualGestureHandler.kt +12 -1
  18. package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +65 -35
  19. package/android/src/main/java/com/swmansion/gesturehandler/core/OnTouchEventListener.kt +3 -3
  20. package/android/src/main/java/com/swmansion/gesturehandler/core/PanGestureHandler.kt +187 -92
  21. package/android/src/main/java/com/swmansion/gesturehandler/core/PinchGestureHandler.kt +12 -5
  22. package/android/src/main/java/com/swmansion/gesturehandler/core/PointerEventsConfig.kt +1 -1
  23. package/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureDetector.kt +3 -1
  24. package/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureHandler.kt +12 -5
  25. package/android/src/main/java/com/swmansion/gesturehandler/core/StylusData.kt +1 -1
  26. package/android/src/main/java/com/swmansion/gesturehandler/core/TapGestureHandler.kt +55 -33
  27. package/android/src/main/java/com/swmansion/gesturehandler/core/Vector.kt +13 -18
  28. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +27 -21
  29. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.kt +7 -2
  30. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +13 -12
  31. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDispatcher.kt +189 -0
  32. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerFactoryUtil.kt +34 -0
  33. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +7 -11
  34. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +29 -590
  35. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.kt +8 -14
  36. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +26 -16
  37. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +15 -12
  38. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.kt +2 -4
  39. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +17 -16
  40. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +6 -4
  41. package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt +7 -5
  42. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/FlingGestureHandlerEventDataBuilder.kt +2 -1
  43. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/GestureHandlerEventDataBuilder.kt +1 -1
  44. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/HoverGestureHandlerEventDataBuilder.kt +2 -1
  45. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/LongPressGestureHandlerEventDataBuilder.kt +2 -1
  46. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/ManualGestureHandlerEventDataBuilder.kt +2 -1
  47. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/NativeGestureHandlerEventDataBuilder.kt +2 -1
  48. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/PanGestureHandlerEventDataBuilder.kt +2 -1
  49. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/PinchGestureHandlerEventDataBuilder.kt +2 -1
  50. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/RotationGestureHandlerEventDataBuilder.kt +2 -1
  51. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/TapGestureHandlerEventDataBuilder.kt +2 -1
  52. package/android/src/main/jni/CMakeLists.txt +10 -1
  53. package/android/svg/src/main/java/com/swmansion/gesturehandler/RNSVGHitTester.kt +1 -3
  54. package/apple/RNGestureHandlerButton.mm +6 -2
  55. package/lib/commonjs/ActionType.js +3 -3
  56. package/lib/commonjs/ActionType.js.map +1 -1
  57. package/lib/commonjs/Directions.js +11 -8
  58. package/lib/commonjs/Directions.js.map +1 -1
  59. package/lib/commonjs/EnableNewWebImplementation.js +2 -10
  60. package/lib/commonjs/EnableNewWebImplementation.js.map +1 -1
  61. package/lib/commonjs/GestureHandlerRootViewContext.js +2 -7
  62. package/lib/commonjs/GestureHandlerRootViewContext.js.map +1 -1
  63. package/lib/commonjs/PlatformConstants.js +1 -7
  64. package/lib/commonjs/PlatformConstants.js.map +1 -1
  65. package/lib/commonjs/PlatformConstants.web.js +1 -3
  66. package/lib/commonjs/PlatformConstants.web.js.map +1 -1
  67. package/lib/commonjs/PointerType.js +3 -5
  68. package/lib/commonjs/PointerType.js.map +1 -1
  69. package/lib/commonjs/RNGestureHandlerModule.js +2 -6
  70. package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
  71. package/lib/commonjs/RNGestureHandlerModule.web.js +10 -37
  72. package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
  73. package/lib/commonjs/RNGestureHandlerModule.windows.js +22 -32
  74. package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -1
  75. package/lib/commonjs/RNRenderer.js +1 -3
  76. package/lib/commonjs/RNRenderer.js.map +1 -1
  77. package/lib/commonjs/RNRenderer.web.js +1 -2
  78. package/lib/commonjs/RNRenderer.web.js.map +1 -1
  79. package/lib/commonjs/State.js +4 -3
  80. package/lib/commonjs/State.js.map +1 -1
  81. package/lib/commonjs/TouchEventType.js +3 -3
  82. package/lib/commonjs/TouchEventType.js.map +1 -1
  83. package/lib/commonjs/components/DrawerLayout.js +436 -462
  84. package/lib/commonjs/components/DrawerLayout.js.map +1 -1
  85. package/lib/commonjs/components/GestureButtons.js +123 -181
  86. package/lib/commonjs/components/GestureButtons.js.map +1 -1
  87. package/lib/commonjs/components/GestureButtonsProps.js.map +1 -1
  88. package/lib/commonjs/components/GestureComponents.js +36 -45
  89. package/lib/commonjs/components/GestureComponents.js.map +1 -1
  90. package/lib/commonjs/components/GestureComponents.web.js +19 -32
  91. package/lib/commonjs/components/GestureComponents.web.js.map +1 -1
  92. package/lib/commonjs/components/GestureHandlerButton.js +2 -6
  93. package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
  94. package/lib/commonjs/components/GestureHandlerButton.web.js +6 -14
  95. package/lib/commonjs/components/GestureHandlerButton.web.js.map +1 -1
  96. package/lib/commonjs/components/GestureHandlerRootView.android.js +10 -20
  97. package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -1
  98. package/lib/commonjs/components/GestureHandlerRootView.js +10 -19
  99. package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
  100. package/lib/commonjs/components/GestureHandlerRootView.web.js +10 -18
  101. package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -1
  102. package/lib/commonjs/components/Pressable/Pressable.js +72 -118
  103. package/lib/commonjs/components/Pressable/Pressable.js.map +1 -1
  104. package/lib/commonjs/components/Pressable/PressableProps.js.map +1 -1
  105. package/lib/commonjs/components/Pressable/index.js +1 -3
  106. package/lib/commonjs/components/Pressable/index.js.map +1 -1
  107. package/lib/commonjs/components/Pressable/utils.js +16 -38
  108. package/lib/commonjs/components/Pressable/utils.js.map +1 -1
  109. package/lib/commonjs/components/ReanimatedDrawerLayout.js +72 -108
  110. package/lib/commonjs/components/ReanimatedDrawerLayout.js.map +1 -1
  111. package/lib/commonjs/components/ReanimatedSwipeable.js +81 -102
  112. package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -1
  113. package/lib/commonjs/components/Swipeable.js +290 -335
  114. package/lib/commonjs/components/Swipeable.js.map +1 -1
  115. package/lib/commonjs/components/Text.js +23 -34
  116. package/lib/commonjs/components/Text.js.map +1 -1
  117. package/lib/commonjs/components/gestureHandlerRootHOC.js +11 -17
  118. package/lib/commonjs/components/gestureHandlerRootHOC.js.map +1 -1
  119. package/lib/commonjs/components/touchables/ExtraButtonProps.js.map +1 -1
  120. package/lib/commonjs/components/touchables/GenericTouchable.js +95 -140
  121. package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
  122. package/lib/commonjs/components/touchables/GenericTouchableProps.js.map +1 -1
  123. package/lib/commonjs/components/touchables/TouchableHighlight.js +51 -69
  124. package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -1
  125. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +38 -56
  126. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
  127. package/lib/commonjs/components/touchables/TouchableNativeFeedback.js +1 -4
  128. package/lib/commonjs/components/touchables/TouchableNativeFeedback.js.map +1 -1
  129. package/lib/commonjs/components/touchables/TouchableNativeFeedbackProps.js.map +1 -1
  130. package/lib/commonjs/components/touchables/TouchableOpacity.js +39 -53
  131. package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -1
  132. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +11 -15
  133. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -1
  134. package/lib/commonjs/components/touchables/index.js +7 -12
  135. package/lib/commonjs/components/touchables/index.js.map +1 -1
  136. package/lib/commonjs/components/utils.js +17 -0
  137. package/lib/commonjs/components/utils.js.map +1 -0
  138. package/lib/commonjs/findNodeHandle.js +1 -4
  139. package/lib/commonjs/findNodeHandle.js.map +1 -1
  140. package/lib/commonjs/findNodeHandle.web.js +7 -16
  141. package/lib/commonjs/findNodeHandle.web.js.map +1 -1
  142. package/lib/commonjs/getShadowNodeFromRef.js +19 -20
  143. package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
  144. package/lib/commonjs/getShadowNodeFromRef.web.js +0 -1
  145. package/lib/commonjs/getShadowNodeFromRef.web.js.map +1 -1
  146. package/lib/commonjs/ghQueueMicrotask.js +1 -2
  147. package/lib/commonjs/ghQueueMicrotask.js.map +1 -1
  148. package/lib/commonjs/handlers/FlingGestureHandler.js +9 -11
  149. package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -1
  150. package/lib/commonjs/handlers/ForceTouchGestureHandler.js +16 -23
  151. package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -1
  152. package/lib/commonjs/handlers/GestureHandlerEventPayload.js.map +1 -1
  153. package/lib/commonjs/handlers/LongPressGestureHandler.js +9 -11
  154. package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -1
  155. package/lib/commonjs/handlers/NativeViewGestureHandler.ts +59 -0
  156. package/lib/commonjs/handlers/PanGestureHandler.js +13 -32
  157. package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
  158. package/lib/commonjs/handlers/PinchGestureHandler.js +7 -9
  159. package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -1
  160. package/lib/commonjs/handlers/PressabilityDebugView.js +0 -1
  161. package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -1
  162. package/lib/commonjs/handlers/PressabilityDebugView.web.js +0 -1
  163. package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +1 -1
  164. package/lib/commonjs/handlers/RotationGestureHandler.js +7 -9
  165. package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -1
  166. package/lib/commonjs/handlers/TapGestureHandler.js +9 -11
  167. package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -1
  168. package/lib/commonjs/handlers/createHandler.js +128 -229
  169. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  170. package/lib/commonjs/handlers/createNativeWrapper.js +26 -35
  171. package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -1
  172. package/lib/commonjs/handlers/customDirectEventTypes.js +0 -1
  173. package/lib/commonjs/handlers/customDirectEventTypes.js.map +1 -1
  174. package/lib/commonjs/handlers/customDirectEventTypes.web.js +1 -2
  175. package/lib/commonjs/handlers/customDirectEventTypes.web.js.map +1 -1
  176. package/lib/commonjs/handlers/gestureHandlerCommon.js +9 -10
  177. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
  178. package/lib/commonjs/handlers/gestureHandlerTypesCompat.js.map +1 -1
  179. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js +5 -15
  180. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
  181. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.web.js +14 -22
  182. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.web.js.map +1 -1
  183. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +9 -29
  184. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  185. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +1 -10
  186. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  187. package/lib/commonjs/handlers/gestures/GestureDetector/index.js +19 -42
  188. package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
  189. package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js +0 -3
  190. package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -1
  191. package/lib/commonjs/handlers/gestures/GestureDetector/types.js.map +1 -1
  192. package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js +15 -26
  193. package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
  194. package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js +13 -50
  195. package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -1
  196. package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js +3 -13
  197. package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
  198. package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js +2 -9
  199. package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -1
  200. package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js +6 -14
  201. package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -1
  202. package/lib/commonjs/handlers/gestures/GestureDetector/utils.js +23 -52
  203. package/lib/commonjs/handlers/gestures/GestureDetector/utils.js.map +1 -1
  204. package/lib/commonjs/handlers/gestures/eventReceiver.js +14 -55
  205. package/lib/commonjs/handlers/gestures/eventReceiver.js.map +1 -1
  206. package/lib/commonjs/handlers/gestures/flingGesture.js +3 -13
  207. package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -1
  208. package/lib/commonjs/handlers/gestures/forceTouchGesture.js +6 -20
  209. package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -1
  210. package/lib/commonjs/handlers/gestures/gesture.js +50 -93
  211. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
  212. package/lib/commonjs/handlers/gestures/gestureComposition.js +17 -34
  213. package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -1
  214. package/lib/commonjs/handlers/gestures/gestureObjects.js +1 -27
  215. package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -1
  216. package/lib/commonjs/handlers/gestures/gestureStateManager.js +5 -11
  217. package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -1
  218. package/lib/commonjs/handlers/gestures/gestureStateManager.web.js +2 -7
  219. package/lib/commonjs/handlers/gestures/gestureStateManager.web.js.map +1 -1
  220. package/lib/commonjs/handlers/gestures/hoverGesture.js +9 -26
  221. package/lib/commonjs/handlers/gestures/hoverGesture.js.map +1 -1
  222. package/lib/commonjs/handlers/gestures/longPressGesture.js +4 -15
  223. package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
  224. package/lib/commonjs/handlers/gestures/manualGesture.js +0 -6
  225. package/lib/commonjs/handlers/gestures/manualGesture.js.map +1 -1
  226. package/lib/{module/handlers/gestures/nativeGesture.js → commonjs/handlers/gestures/nativeGesture.ts} +12 -13
  227. package/lib/commonjs/handlers/gestures/panGesture.js +16 -44
  228. package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -1
  229. package/lib/commonjs/handlers/gestures/pinchGesture.js +2 -9
  230. package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -1
  231. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +2 -10
  232. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -1
  233. package/lib/commonjs/handlers/gestures/rotationGesture.js +2 -9
  234. package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -1
  235. package/lib/commonjs/handlers/gestures/tapGesture.js +8 -23
  236. package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
  237. package/lib/commonjs/handlers/getNextHandlerTag.js +0 -1
  238. package/lib/commonjs/handlers/getNextHandlerTag.js.map +1 -1
  239. package/lib/commonjs/handlers/handlersRegistry.js +7 -23
  240. package/lib/commonjs/handlers/handlersRegistry.js.map +1 -1
  241. package/lib/commonjs/handlers/utils.js +8 -31
  242. package/lib/commonjs/handlers/utils.js.map +1 -1
  243. package/lib/commonjs/index.js +75 -104
  244. package/lib/commonjs/index.js.map +1 -1
  245. package/lib/commonjs/init.js +4 -11
  246. package/lib/commonjs/init.js.map +1 -1
  247. package/lib/commonjs/jestUtils/index.js +4 -5
  248. package/lib/commonjs/jestUtils/index.js.map +1 -1
  249. package/lib/commonjs/jestUtils/jestUtils.js +24 -91
  250. package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
  251. package/lib/commonjs/mocks.js +10 -18
  252. package/lib/commonjs/mocks.js.map +1 -1
  253. package/lib/commonjs/mountRegistry.js +2 -14
  254. package/lib/commonjs/mountRegistry.js.map +1 -1
  255. package/lib/commonjs/package.json +1 -0
  256. package/lib/commonjs/specs/NativeRNGestureHandlerModule.ts +26 -0
  257. package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.ts +22 -0
  258. package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.ts +6 -0
  259. package/lib/commonjs/typeUtils.js.map +1 -1
  260. package/lib/commonjs/utils.js +14 -35
  261. package/lib/commonjs/utils.js.map +1 -1
  262. package/lib/commonjs/web/Gestures.js +5 -23
  263. package/lib/commonjs/web/Gestures.js.map +1 -1
  264. package/lib/commonjs/web/constants.js +2 -4
  265. package/lib/commonjs/web/constants.js.map +1 -1
  266. package/lib/commonjs/web/detectors/RotationGestureDetector.js +10 -52
  267. package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -1
  268. package/lib/commonjs/web/detectors/ScaleGestureDetector.js +11 -55
  269. package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
  270. package/lib/commonjs/web/handlers/FlingGestureHandler.js +9 -59
  271. package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
  272. package/lib/commonjs/web/handlers/GestureHandler.js +91 -226
  273. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  274. package/lib/commonjs/web/handlers/HoverGestureHandler.js +3 -23
  275. package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -1
  276. package/lib/commonjs/web/handlers/IGestureHandler.js.map +1 -1
  277. package/lib/commonjs/web/handlers/LongPressGestureHandler.js +11 -59
  278. package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
  279. package/lib/commonjs/web/handlers/ManualGestureHandler.js +1 -11
  280. package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
  281. package/lib/{module/web/handlers/NativeViewGestureHandler.js → commonjs/web/handlers/NativeViewGestureHandler.ts} +49 -48
  282. package/lib/commonjs/web/handlers/PanGestureHandler.js +33 -155
  283. package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
  284. package/lib/commonjs/web/handlers/PinchGestureHandler.js +25 -68
  285. package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
  286. package/lib/commonjs/web/handlers/RotationGestureHandler.js +23 -67
  287. package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
  288. package/lib/commonjs/web/handlers/TapGestureHandler.js +18 -87
  289. package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
  290. package/lib/commonjs/web/interfaces.js +9 -17
  291. package/lib/commonjs/web/interfaces.js.map +1 -1
  292. package/lib/commonjs/web/tools/CircularBuffer.js +0 -19
  293. package/lib/commonjs/web/tools/CircularBuffer.js.map +1 -1
  294. package/lib/commonjs/web/tools/EventManager.js +5 -44
  295. package/lib/commonjs/web/tools/EventManager.js.map +1 -1
  296. package/lib/commonjs/web/tools/GestureHandlerDelegate.js.map +1 -1
  297. package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +13 -86
  298. package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
  299. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +14 -61
  300. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  301. package/lib/commonjs/web/tools/InteractionManager.js +12 -35
  302. package/lib/commonjs/web/tools/InteractionManager.js.map +1 -1
  303. package/lib/commonjs/web/tools/KeyboardEventManager.js +24 -52
  304. package/lib/commonjs/web/tools/KeyboardEventManager.js.map +1 -1
  305. package/lib/commonjs/web/tools/LeastSquareSolver.js +24 -69
  306. package/lib/commonjs/web/tools/LeastSquareSolver.js.map +1 -1
  307. package/lib/commonjs/web/tools/NodeManager.js +5 -15
  308. package/lib/commonjs/web/tools/NodeManager.js.map +1 -1
  309. package/lib/commonjs/web/tools/PointerEventManager.js +119 -159
  310. package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
  311. package/lib/commonjs/web/tools/PointerTracker.js +20 -63
  312. package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
  313. package/lib/commonjs/web/tools/Vector.js +1 -25
  314. package/lib/commonjs/web/tools/Vector.js.map +1 -1
  315. package/lib/commonjs/web/tools/VelocityTracker.js +10 -36
  316. package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -1
  317. package/lib/commonjs/web/tools/WheelEventManager.js +15 -34
  318. package/lib/commonjs/web/tools/WheelEventManager.js.map +1 -1
  319. package/lib/commonjs/web/utils.js +32 -67
  320. package/lib/commonjs/web/utils.js.map +1 -1
  321. package/lib/commonjs/web_hammer/DiscreteGestureHandler.js +8 -20
  322. package/lib/commonjs/web_hammer/DiscreteGestureHandler.js.map +1 -1
  323. package/lib/commonjs/web_hammer/DraggingGestureHandler.js +4 -14
  324. package/lib/commonjs/web_hammer/DraggingGestureHandler.js.map +1 -1
  325. package/lib/commonjs/web_hammer/Errors.js +0 -3
  326. package/lib/commonjs/web_hammer/Errors.js.map +1 -1
  327. package/lib/commonjs/web_hammer/FlingGestureHandler.js +14 -45
  328. package/lib/commonjs/web_hammer/FlingGestureHandler.js.map +1 -1
  329. package/lib/commonjs/web_hammer/GestureHandler.js +149 -244
  330. package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
  331. package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js +2 -11
  332. package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js.map +1 -1
  333. package/lib/commonjs/web_hammer/LongPressGestureHandler.js +6 -20
  334. package/lib/commonjs/web_hammer/LongPressGestureHandler.js.map +1 -1
  335. package/lib/commonjs/web_hammer/NativeViewGestureHandler.ts +47 -0
  336. package/lib/commonjs/web_hammer/NodeManager.js +9 -16
  337. package/lib/commonjs/web_hammer/NodeManager.js.map +1 -1
  338. package/lib/commonjs/web_hammer/PanGestureHandler.js +8 -49
  339. package/lib/commonjs/web_hammer/PanGestureHandler.js.map +1 -1
  340. package/lib/commonjs/web_hammer/PinchGestureHandler.js +2 -11
  341. package/lib/commonjs/web_hammer/PinchGestureHandler.js.map +1 -1
  342. package/lib/commonjs/web_hammer/PressGestureHandler.js +14 -49
  343. package/lib/commonjs/web_hammer/PressGestureHandler.js.map +1 -1
  344. package/lib/commonjs/web_hammer/RotationGestureHandler.js +3 -15
  345. package/lib/commonjs/web_hammer/RotationGestureHandler.js.map +1 -1
  346. package/lib/commonjs/web_hammer/TapGestureHandler.js +43 -70
  347. package/lib/commonjs/web_hammer/TapGestureHandler.js.map +1 -1
  348. package/lib/commonjs/web_hammer/constants.js +13 -26
  349. package/lib/commonjs/web_hammer/constants.js.map +1 -1
  350. package/lib/commonjs/web_hammer/utils.js +4 -14
  351. package/lib/commonjs/web_hammer/utils.js.map +1 -1
  352. package/lib/module/ActionType.js +5 -1
  353. package/lib/module/ActionType.js.map +1 -1
  354. package/lib/module/Directions.js +11 -3
  355. package/lib/module/Directions.js.map +1 -1
  356. package/lib/module/EnableNewWebImplementation.js +4 -5
  357. package/lib/module/EnableNewWebImplementation.js.map +1 -1
  358. package/lib/module/GestureHandlerRootViewContext.js +2 -0
  359. package/lib/module/GestureHandlerRootViewContext.js.map +1 -1
  360. package/lib/module/PlatformConstants.js +2 -2
  361. package/lib/module/PlatformConstants.js.map +1 -1
  362. package/lib/module/PlatformConstants.web.js +2 -1
  363. package/lib/module/PlatformConstants.web.js.map +1 -1
  364. package/lib/module/PointerType.js +4 -3
  365. package/lib/module/PointerType.js.map +1 -1
  366. package/lib/module/RNGestureHandlerModule.js +3 -0
  367. package/lib/module/RNGestureHandlerModule.js.map +1 -1
  368. package/lib/module/RNGestureHandlerModule.web.js +12 -20
  369. package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
  370. package/lib/module/RNGestureHandlerModule.windows.js +20 -17
  371. package/lib/module/RNGestureHandlerModule.windows.js.map +1 -1
  372. package/lib/module/RNRenderer.js +2 -0
  373. package/lib/module/RNRenderer.js.map +1 -1
  374. package/lib/module/RNRenderer.web.js +2 -0
  375. package/lib/module/RNRenderer.web.js.map +1 -1
  376. package/lib/module/State.js +6 -1
  377. package/lib/module/State.js.map +1 -1
  378. package/lib/module/TouchEventType.js +5 -1
  379. package/lib/module/TouchEventType.js.map +1 -1
  380. package/lib/module/components/DrawerLayout.js +427 -446
  381. package/lib/module/components/DrawerLayout.js.map +1 -1
  382. package/lib/module/components/GestureButtons.js +119 -157
  383. package/lib/module/components/GestureButtons.js.map +1 -1
  384. package/lib/module/components/GestureButtonsProps.js +2 -0
  385. package/lib/module/components/GestureButtonsProps.js.map +1 -1
  386. package/lib/module/components/GestureComponents.js +29 -19
  387. package/lib/module/components/GestureComponents.js.map +1 -1
  388. package/lib/module/components/GestureComponents.web.js +13 -9
  389. package/lib/module/components/GestureComponents.web.js.map +1 -1
  390. package/lib/module/components/GestureHandlerButton.js +2 -0
  391. package/lib/module/components/GestureHandlerButton.js.map +1 -1
  392. package/lib/module/components/GestureHandlerButton.web.js +6 -4
  393. package/lib/module/components/GestureHandlerButton.web.js.map +1 -1
  394. package/lib/module/components/GestureHandlerRootView.android.js +9 -6
  395. package/lib/module/components/GestureHandlerRootView.android.js.map +1 -1
  396. package/lib/module/components/GestureHandlerRootView.js +9 -6
  397. package/lib/module/components/GestureHandlerRootView.js.map +1 -1
  398. package/lib/module/components/GestureHandlerRootView.web.js +9 -6
  399. package/lib/module/components/GestureHandlerRootView.web.js.map +1 -1
  400. package/lib/module/components/Pressable/Pressable.js +70 -98
  401. package/lib/module/components/Pressable/Pressable.js.map +1 -1
  402. package/lib/module/components/Pressable/PressableProps.js +2 -0
  403. package/lib/module/components/Pressable/PressableProps.js.map +1 -1
  404. package/lib/module/components/Pressable/index.js +2 -0
  405. package/lib/module/components/Pressable/index.js.map +1 -1
  406. package/lib/module/components/Pressable/utils.js +17 -32
  407. package/lib/module/components/Pressable/utils.js.map +1 -1
  408. package/lib/module/components/ReanimatedDrawerLayout.js +71 -88
  409. package/lib/module/components/ReanimatedDrawerLayout.js.map +1 -1
  410. package/lib/module/components/ReanimatedSwipeable.js +78 -87
  411. package/lib/module/components/ReanimatedSwipeable.js.map +1 -1
  412. package/lib/module/components/Swipeable.js +286 -320
  413. package/lib/module/components/Swipeable.js.map +1 -1
  414. package/lib/module/components/Text.js +22 -20
  415. package/lib/module/components/Text.js.map +1 -1
  416. package/lib/module/components/gestureHandlerRootHOC.js +11 -5
  417. package/lib/module/components/gestureHandlerRootHOC.js.map +1 -1
  418. package/lib/module/components/touchables/ExtraButtonProps.js +1 -1
  419. package/lib/module/components/touchables/ExtraButtonProps.js.map +1 -1
  420. package/lib/module/components/touchables/GenericTouchable.js +92 -127
  421. package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
  422. package/lib/module/components/touchables/GenericTouchableProps.js +2 -0
  423. package/lib/module/components/touchables/GenericTouchableProps.js.map +1 -1
  424. package/lib/module/components/touchables/TouchableHighlight.js +48 -58
  425. package/lib/module/components/touchables/TouchableHighlight.js.map +1 -1
  426. package/lib/module/components/touchables/TouchableNativeFeedback.android.js +34 -43
  427. package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
  428. package/lib/module/components/touchables/TouchableNativeFeedback.js +3 -1
  429. package/lib/module/components/touchables/TouchableNativeFeedback.js.map +1 -1
  430. package/lib/module/components/touchables/TouchableNativeFeedbackProps.js +2 -0
  431. package/lib/module/components/touchables/TouchableNativeFeedbackProps.js.map +1 -1
  432. package/lib/module/components/touchables/TouchableOpacity.js +34 -43
  433. package/lib/module/components/touchables/TouchableOpacity.js.map +1 -1
  434. package/lib/module/components/touchables/TouchableWithoutFeedback.js +9 -4
  435. package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +1 -1
  436. package/lib/module/components/touchables/index.js +2 -0
  437. package/lib/module/components/touchables/index.js.map +1 -1
  438. package/lib/module/components/utils.js +13 -0
  439. package/lib/module/components/utils.js.map +1 -0
  440. package/lib/module/findNodeHandle.js +2 -0
  441. package/lib/module/findNodeHandle.js.map +1 -1
  442. package/lib/module/findNodeHandle.web.js +9 -13
  443. package/lib/module/findNodeHandle.web.js.map +1 -1
  444. package/lib/module/getShadowNodeFromRef.js +21 -19
  445. package/lib/module/getShadowNodeFromRef.js.map +1 -1
  446. package/lib/module/getShadowNodeFromRef.web.js +2 -0
  447. package/lib/module/getShadowNodeFromRef.web.js.map +1 -1
  448. package/lib/module/ghQueueMicrotask.js +2 -0
  449. package/lib/module/ghQueueMicrotask.js.map +1 -1
  450. package/lib/module/handlers/FlingGestureHandler.js +8 -0
  451. package/lib/module/handlers/FlingGestureHandler.js.map +1 -1
  452. package/lib/module/handlers/ForceTouchGestureHandler.js +14 -8
  453. package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -1
  454. package/lib/module/handlers/GestureHandlerEventPayload.js +2 -0
  455. package/lib/module/handlers/GestureHandlerEventPayload.js.map +1 -1
  456. package/lib/module/handlers/LongPressGestureHandler.js +8 -0
  457. package/lib/module/handlers/LongPressGestureHandler.js.map +1 -1
  458. package/lib/module/handlers/NativeViewGestureHandler.ts +59 -0
  459. package/lib/module/handlers/PanGestureHandler.js +10 -19
  460. package/lib/module/handlers/PanGestureHandler.js.map +1 -1
  461. package/lib/module/handlers/PinchGestureHandler.js +4 -0
  462. package/lib/module/handlers/PinchGestureHandler.js.map +1 -1
  463. package/lib/module/handlers/PressabilityDebugView.js +2 -0
  464. package/lib/module/handlers/PressabilityDebugView.js.map +1 -1
  465. package/lib/module/handlers/PressabilityDebugView.web.js +2 -0
  466. package/lib/module/handlers/PressabilityDebugView.web.js.map +1 -1
  467. package/lib/module/handlers/RotationGestureHandler.js +4 -0
  468. package/lib/module/handlers/RotationGestureHandler.js.map +1 -1
  469. package/lib/module/handlers/TapGestureHandler.js +8 -0
  470. package/lib/module/handlers/TapGestureHandler.js.map +1 -1
  471. package/lib/module/handlers/createHandler.js +127 -200
  472. package/lib/module/handlers/createHandler.js.map +1 -1
  473. package/lib/module/handlers/createNativeWrapper.js +22 -22
  474. package/lib/module/handlers/createNativeWrapper.js.map +1 -1
  475. package/lib/module/handlers/customDirectEventTypes.js +2 -0
  476. package/lib/module/handlers/customDirectEventTypes.js.map +1 -1
  477. package/lib/module/handlers/customDirectEventTypes.web.js +2 -0
  478. package/lib/module/handlers/customDirectEventTypes.web.js.map +1 -1
  479. package/lib/module/handlers/gestureHandlerCommon.js +11 -4
  480. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
  481. package/lib/module/handlers/gestureHandlerTypesCompat.js +2 -0
  482. package/lib/module/handlers/gestureHandlerTypesCompat.js.map +1 -1
  483. package/lib/module/handlers/gestures/GestureDetector/Wrap.js +4 -4
  484. package/lib/module/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
  485. package/lib/module/handlers/gestures/GestureDetector/Wrap.web.js +12 -8
  486. package/lib/module/handlers/gestures/GestureDetector/Wrap.web.js.map +1 -1
  487. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +10 -16
  488. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  489. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +2 -1
  490. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  491. package/lib/module/handlers/gestures/GestureDetector/index.js +18 -19
  492. package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
  493. package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js +2 -2
  494. package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -1
  495. package/lib/module/handlers/gestures/GestureDetector/types.js +2 -0
  496. package/lib/module/handlers/gestures/GestureDetector/types.js.map +1 -1
  497. package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js +16 -16
  498. package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
  499. package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js +15 -41
  500. package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -1
  501. package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js +7 -5
  502. package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
  503. package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js +4 -6
  504. package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -1
  505. package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js +7 -7
  506. package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -1
  507. package/lib/module/handlers/gestures/GestureDetector/utils.js +21 -26
  508. package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -1
  509. package/lib/module/handlers/gestures/eventReceiver.js +16 -47
  510. package/lib/module/handlers/gestures/eventReceiver.js.map +1 -1
  511. package/lib/module/handlers/gestures/flingGesture.js +4 -9
  512. package/lib/module/handlers/gestures/flingGesture.js.map +1 -1
  513. package/lib/module/handlers/gestures/forceTouchGesture.js +7 -17
  514. package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -1
  515. package/lib/module/handlers/gestures/gesture.js +51 -81
  516. package/lib/module/handlers/gestures/gesture.js.map +1 -1
  517. package/lib/module/handlers/gestures/gestureComposition.js +17 -26
  518. package/lib/module/handlers/gestures/gestureComposition.js.map +1 -1
  519. package/lib/module/handlers/gestures/gestureObjects.js +3 -14
  520. package/lib/module/handlers/gestures/gestureObjects.js.map +1 -1
  521. package/lib/module/handlers/gestures/gestureStateManager.js +7 -6
  522. package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
  523. package/lib/module/handlers/gestures/gestureStateManager.web.js +2 -1
  524. package/lib/module/handlers/gestures/gestureStateManager.web.js.map +1 -1
  525. package/lib/module/handlers/gestures/hoverGesture.js +8 -18
  526. package/lib/module/handlers/gestures/hoverGesture.js.map +1 -1
  527. package/lib/module/handlers/gestures/longPressGesture.js +5 -11
  528. package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
  529. package/lib/module/handlers/gestures/manualGesture.js +2 -4
  530. package/lib/module/handlers/gestures/manualGesture.js.map +1 -1
  531. package/lib/module/handlers/gestures/nativeGesture.ts +33 -0
  532. package/lib/module/handlers/gestures/panGesture.js +17 -41
  533. package/lib/module/handlers/gestures/panGesture.js.map +1 -1
  534. package/lib/module/handlers/gestures/pinchGesture.js +4 -7
  535. package/lib/module/handlers/gestures/pinchGesture.js.map +1 -1
  536. package/lib/module/handlers/gestures/reanimatedWrapper.js +2 -6
  537. package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
  538. package/lib/module/handlers/gestures/rotationGesture.js +4 -7
  539. package/lib/module/handlers/gestures/rotationGesture.js.map +1 -1
  540. package/lib/module/handlers/gestures/tapGesture.js +9 -19
  541. package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
  542. package/lib/module/handlers/getNextHandlerTag.js +2 -0
  543. package/lib/module/handlers/getNextHandlerTag.js.map +1 -1
  544. package/lib/module/handlers/handlersRegistry.js +3 -7
  545. package/lib/module/handlers/handlersRegistry.js.map +1 -1
  546. package/lib/module/handlers/utils.js +8 -18
  547. package/lib/module/handlers/utils.js.map +1 -1
  548. package/lib/module/index.js +2 -0
  549. package/lib/module/index.js.map +1 -1
  550. package/lib/module/init.js +5 -2
  551. package/lib/module/init.js.map +1 -1
  552. package/lib/module/jestUtils/index.js +2 -0
  553. package/lib/module/jestUtils/index.js.map +1 -1
  554. package/lib/module/jestUtils/jestUtils.js +27 -74
  555. package/lib/module/jestUtils/jestUtils.js.map +1 -1
  556. package/lib/module/mocks.js +9 -9
  557. package/lib/module/mocks.js.map +1 -1
  558. package/lib/module/mountRegistry.js +3 -11
  559. package/lib/module/mountRegistry.js.map +1 -1
  560. package/lib/module/specs/NativeRNGestureHandlerModule.ts +26 -0
  561. package/lib/module/specs/RNGestureHandlerButtonNativeComponent.ts +22 -0
  562. package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.ts +6 -0
  563. package/lib/module/typeUtils.js +1 -1
  564. package/lib/module/typeUtils.js.map +1 -1
  565. package/lib/module/utils.js +8 -14
  566. package/lib/module/utils.js.map +1 -1
  567. package/lib/module/web/Gestures.js +4 -1
  568. package/lib/module/web/Gestures.js.map +1 -1
  569. package/lib/module/web/constants.js +2 -0
  570. package/lib/module/web/constants.js.map +1 -1
  571. package/lib/module/web/detectors/RotationGestureDetector.js +11 -48
  572. package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -1
  573. package/lib/module/web/detectors/ScaleGestureDetector.js +12 -50
  574. package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
  575. package/lib/module/web/handlers/FlingGestureHandler.js +9 -48
  576. package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
  577. package/lib/module/web/handlers/GestureHandler.js +90 -212
  578. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  579. package/lib/module/web/handlers/HoverGestureHandler.js +3 -14
  580. package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
  581. package/lib/module/web/handlers/IGestureHandler.js +1 -1
  582. package/lib/module/web/handlers/IGestureHandler.js.map +1 -1
  583. package/lib/module/web/handlers/LongPressGestureHandler.js +11 -51
  584. package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
  585. package/lib/module/web/handlers/ManualGestureHandler.js +2 -6
  586. package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
  587. package/lib/module/web/handlers/NativeViewGestureHandler.ts +175 -0
  588. package/lib/module/web/handlers/PanGestureHandler.js +33 -145
  589. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
  590. package/lib/module/web/handlers/PinchGestureHandler.js +25 -59
  591. package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
  592. package/lib/module/web/handlers/RotationGestureHandler.js +23 -58
  593. package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
  594. package/lib/module/web/handlers/TapGestureHandler.js +18 -78
  595. package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
  596. package/lib/module/web/interfaces.js +10 -13
  597. package/lib/module/web/interfaces.js.map +1 -1
  598. package/lib/module/web/tools/CircularBuffer.js +1 -16
  599. package/lib/module/web/tools/CircularBuffer.js.map +1 -1
  600. package/lib/module/web/tools/EventManager.js +6 -41
  601. package/lib/module/web/tools/EventManager.js.map +1 -1
  602. package/lib/module/web/tools/GestureHandlerDelegate.js +2 -0
  603. package/lib/module/web/tools/GestureHandlerDelegate.js.map +1 -1
  604. package/lib/module/web/tools/GestureHandlerOrchestrator.js +13 -78
  605. package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
  606. package/lib/module/web/tools/GestureHandlerWebDelegate.js +14 -49
  607. package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  608. package/lib/module/web/tools/InteractionManager.js +13 -32
  609. package/lib/module/web/tools/InteractionManager.js.map +1 -1
  610. package/lib/module/web/tools/KeyboardEventManager.js +24 -44
  611. package/lib/module/web/tools/KeyboardEventManager.js.map +1 -1
  612. package/lib/module/web/tools/LeastSquareSolver.js +25 -66
  613. package/lib/module/web/tools/LeastSquareSolver.js.map +1 -1
  614. package/lib/module/web/tools/NodeManager.js +6 -12
  615. package/lib/module/web/tools/NodeManager.js.map +1 -1
  616. package/lib/module/web/tools/PointerEventManager.js +119 -148
  617. package/lib/module/web/tools/PointerEventManager.js.map +1 -1
  618. package/lib/module/web/tools/PointerTracker.js +20 -56
  619. package/lib/module/web/tools/PointerTracker.js.map +1 -1
  620. package/lib/module/web/tools/Vector.js +2 -20
  621. package/lib/module/web/tools/Vector.js.map +1 -1
  622. package/lib/module/web/tools/VelocityTracker.js +10 -29
  623. package/lib/module/web/tools/VelocityTracker.js.map +1 -1
  624. package/lib/module/web/tools/WheelEventManager.js +15 -26
  625. package/lib/module/web/tools/WheelEventManager.js.map +1 -1
  626. package/lib/module/web/utils.js +29 -49
  627. package/lib/module/web/utils.js.map +1 -1
  628. package/lib/module/web_hammer/DiscreteGestureHandler.js +6 -13
  629. package/lib/module/web_hammer/DiscreteGestureHandler.js.map +1 -1
  630. package/lib/module/web_hammer/DraggingGestureHandler.js +2 -5
  631. package/lib/module/web_hammer/DraggingGestureHandler.js.map +1 -1
  632. package/lib/module/web_hammer/Errors.js +2 -1
  633. package/lib/module/web_hammer/Errors.js.map +1 -1
  634. package/lib/module/web_hammer/FlingGestureHandler.js +12 -35
  635. package/lib/module/web_hammer/FlingGestureHandler.js.map +1 -1
  636. package/lib/module/web_hammer/GestureHandler.js +148 -233
  637. package/lib/module/web_hammer/GestureHandler.js.map +1 -1
  638. package/lib/module/web_hammer/IndiscreteGestureHandler.js +3 -6
  639. package/lib/module/web_hammer/IndiscreteGestureHandler.js.map +1 -1
  640. package/lib/module/web_hammer/LongPressGestureHandler.js +4 -11
  641. package/lib/module/web_hammer/LongPressGestureHandler.js.map +1 -1
  642. package/lib/module/web_hammer/NativeViewGestureHandler.ts +47 -0
  643. package/lib/module/web_hammer/NodeManager.js +8 -8
  644. package/lib/module/web_hammer/NodeManager.js.map +1 -1
  645. package/lib/module/web_hammer/PanGestureHandler.js +8 -40
  646. package/lib/module/web_hammer/PanGestureHandler.js.map +1 -1
  647. package/lib/module/web_hammer/PinchGestureHandler.js +2 -5
  648. package/lib/module/web_hammer/PinchGestureHandler.js.map +1 -1
  649. package/lib/module/web_hammer/PressGestureHandler.js +13 -39
  650. package/lib/module/web_hammer/PressGestureHandler.js.map +1 -1
  651. package/lib/module/web_hammer/RotationGestureHandler.js +3 -8
  652. package/lib/module/web_hammer/RotationGestureHandler.js.map +1 -1
  653. package/lib/module/web_hammer/TapGestureHandler.js +42 -62
  654. package/lib/module/web_hammer/TapGestureHandler.js.map +1 -1
  655. package/lib/module/web_hammer/constants.js +4 -1
  656. package/lib/module/web_hammer/constants.js.map +1 -1
  657. package/lib/module/web_hammer/utils.js +4 -2
  658. package/lib/module/web_hammer/utils.js.map +1 -1
  659. package/lib/typescript/ActionType.d.ts +1 -0
  660. package/lib/typescript/ActionType.d.ts.map +1 -0
  661. package/lib/typescript/Directions.d.ts +1 -0
  662. package/lib/typescript/Directions.d.ts.map +1 -0
  663. package/lib/typescript/EnableNewWebImplementation.d.ts +1 -0
  664. package/lib/typescript/EnableNewWebImplementation.d.ts.map +1 -0
  665. package/lib/typescript/GestureHandlerRootViewContext.d.ts +1 -0
  666. package/lib/typescript/GestureHandlerRootViewContext.d.ts.map +1 -0
  667. package/lib/typescript/PlatformConstants.d.ts +1 -0
  668. package/lib/typescript/PlatformConstants.d.ts.map +1 -0
  669. package/lib/typescript/PlatformConstants.web.d.ts +1 -0
  670. package/lib/typescript/PlatformConstants.web.d.ts.map +1 -0
  671. package/lib/typescript/PointerType.d.ts +1 -0
  672. package/lib/typescript/PointerType.d.ts.map +1 -0
  673. package/lib/typescript/RNGestureHandlerModule.d.ts +1 -0
  674. package/lib/typescript/RNGestureHandlerModule.d.ts.map +1 -0
  675. package/lib/typescript/RNGestureHandlerModule.web.d.ts +1 -0
  676. package/lib/typescript/RNGestureHandlerModule.web.d.ts.map +1 -0
  677. package/lib/typescript/RNGestureHandlerModule.windows.d.ts +1 -0
  678. package/lib/typescript/RNGestureHandlerModule.windows.d.ts.map +1 -0
  679. package/lib/typescript/RNRenderer.d.ts +1 -0
  680. package/lib/typescript/RNRenderer.d.ts.map +1 -0
  681. package/lib/typescript/RNRenderer.web.d.ts +1 -0
  682. package/lib/typescript/RNRenderer.web.d.ts.map +1 -0
  683. package/lib/typescript/State.d.ts +1 -0
  684. package/lib/typescript/State.d.ts.map +1 -0
  685. package/lib/typescript/TouchEventType.d.ts +1 -0
  686. package/lib/typescript/TouchEventType.d.ts.map +1 -0
  687. package/lib/typescript/components/DrawerLayout.d.ts +1 -0
  688. package/lib/typescript/components/DrawerLayout.d.ts.map +1 -0
  689. package/lib/typescript/components/GestureButtons.d.ts +1 -0
  690. package/lib/typescript/components/GestureButtons.d.ts.map +1 -0
  691. package/lib/typescript/components/GestureButtonsProps.d.ts +1 -0
  692. package/lib/typescript/components/GestureButtonsProps.d.ts.map +1 -0
  693. package/lib/typescript/components/GestureComponents.d.ts +4 -3
  694. package/lib/typescript/components/GestureComponents.d.ts.map +1 -0
  695. package/lib/typescript/components/GestureComponents.web.d.ts +1 -0
  696. package/lib/typescript/components/GestureComponents.web.d.ts.map +1 -0
  697. package/lib/typescript/components/GestureHandlerButton.d.ts +1 -0
  698. package/lib/typescript/components/GestureHandlerButton.d.ts.map +1 -0
  699. package/lib/typescript/components/GestureHandlerButton.web.d.ts +1 -0
  700. package/lib/typescript/components/GestureHandlerButton.web.d.ts.map +1 -0
  701. package/lib/typescript/components/GestureHandlerRootView.android.d.ts +1 -0
  702. package/lib/typescript/components/GestureHandlerRootView.android.d.ts.map +1 -0
  703. package/lib/typescript/components/GestureHandlerRootView.d.ts +1 -0
  704. package/lib/typescript/components/GestureHandlerRootView.d.ts.map +1 -0
  705. package/lib/typescript/components/GestureHandlerRootView.web.d.ts +1 -0
  706. package/lib/typescript/components/GestureHandlerRootView.web.d.ts.map +1 -0
  707. package/lib/typescript/components/Pressable/Pressable.d.ts +1 -0
  708. package/lib/typescript/components/Pressable/Pressable.d.ts.map +1 -0
  709. package/lib/typescript/components/Pressable/PressableProps.d.ts +17 -1
  710. package/lib/typescript/components/Pressable/PressableProps.d.ts.map +1 -0
  711. package/lib/typescript/components/Pressable/index.d.ts +1 -0
  712. package/lib/typescript/components/Pressable/index.d.ts.map +1 -0
  713. package/lib/typescript/components/Pressable/utils.d.ts +1 -0
  714. package/lib/typescript/components/Pressable/utils.d.ts.map +1 -0
  715. package/lib/typescript/components/ReanimatedDrawerLayout.d.ts +1 -0
  716. package/lib/typescript/components/ReanimatedDrawerLayout.d.ts.map +1 -0
  717. package/lib/typescript/components/ReanimatedSwipeable.d.ts +13 -2
  718. package/lib/typescript/components/ReanimatedSwipeable.d.ts.map +1 -0
  719. package/lib/typescript/components/Swipeable.d.ts +1 -0
  720. package/lib/typescript/components/Swipeable.d.ts.map +1 -0
  721. package/lib/typescript/components/Text.d.ts +1 -0
  722. package/lib/typescript/components/Text.d.ts.map +1 -0
  723. package/lib/typescript/components/gestureHandlerRootHOC.d.ts +1 -0
  724. package/lib/typescript/components/gestureHandlerRootHOC.d.ts.map +1 -0
  725. package/lib/typescript/components/touchables/ExtraButtonProps.d.ts +1 -0
  726. package/lib/typescript/components/touchables/ExtraButtonProps.d.ts.map +1 -0
  727. package/lib/typescript/components/touchables/GenericTouchable.d.ts +1 -0
  728. package/lib/typescript/components/touchables/GenericTouchable.d.ts.map +1 -0
  729. package/lib/typescript/components/touchables/GenericTouchableProps.d.ts +1 -0
  730. package/lib/typescript/components/touchables/GenericTouchableProps.d.ts.map +1 -0
  731. package/lib/typescript/components/touchables/TouchableHighlight.d.ts +1 -0
  732. package/lib/typescript/components/touchables/TouchableHighlight.d.ts.map +1 -0
  733. package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +1 -0
  734. package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts.map +1 -0
  735. package/lib/typescript/components/touchables/TouchableNativeFeedback.d.ts +1 -0
  736. package/lib/typescript/components/touchables/TouchableNativeFeedback.d.ts.map +1 -0
  737. package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.d.ts +1 -0
  738. package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.d.ts.map +1 -0
  739. package/lib/typescript/components/touchables/TouchableOpacity.d.ts +1 -0
  740. package/lib/typescript/components/touchables/TouchableOpacity.d.ts.map +1 -0
  741. package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +2 -1
  742. package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts.map +1 -0
  743. package/lib/typescript/components/touchables/index.d.ts +1 -0
  744. package/lib/typescript/components/touchables/index.d.ts.map +1 -0
  745. package/lib/typescript/components/utils.d.ts +5 -0
  746. package/lib/typescript/components/utils.d.ts.map +1 -0
  747. package/lib/typescript/findNodeHandle.d.ts +1 -0
  748. package/lib/typescript/findNodeHandle.d.ts.map +1 -0
  749. package/lib/typescript/findNodeHandle.web.d.ts +1 -0
  750. package/lib/typescript/findNodeHandle.web.d.ts.map +1 -0
  751. package/lib/typescript/getShadowNodeFromRef.d.ts +1 -0
  752. package/lib/typescript/getShadowNodeFromRef.d.ts.map +1 -0
  753. package/lib/typescript/getShadowNodeFromRef.web.d.ts +1 -0
  754. package/lib/typescript/getShadowNodeFromRef.web.d.ts.map +1 -0
  755. package/lib/typescript/ghQueueMicrotask.d.ts +1 -0
  756. package/lib/typescript/ghQueueMicrotask.d.ts.map +1 -0
  757. package/lib/typescript/handlers/FlingGestureHandler.d.ts +1 -1
  758. package/lib/typescript/handlers/FlingGestureHandler.d.ts.map +1 -0
  759. package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +1 -0
  760. package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts.map +1 -0
  761. package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +1 -0
  762. package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts.map +1 -0
  763. package/lib/typescript/handlers/LongPressGestureHandler.d.ts +1 -1
  764. package/lib/typescript/handlers/LongPressGestureHandler.d.ts.map +1 -0
  765. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +1 -1
  766. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts.map +1 -0
  767. package/lib/typescript/handlers/PanGestureHandler.d.ts +1 -1
  768. package/lib/typescript/handlers/PanGestureHandler.d.ts.map +1 -0
  769. package/lib/typescript/handlers/PinchGestureHandler.d.ts +1 -1
  770. package/lib/typescript/handlers/PinchGestureHandler.d.ts.map +1 -0
  771. package/lib/typescript/handlers/PressabilityDebugView.d.ts +1 -0
  772. package/lib/typescript/handlers/PressabilityDebugView.d.ts.map +1 -0
  773. package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +1 -0
  774. package/lib/typescript/handlers/PressabilityDebugView.web.d.ts.map +1 -0
  775. package/lib/typescript/handlers/RotationGestureHandler.d.ts +1 -1
  776. package/lib/typescript/handlers/RotationGestureHandler.d.ts.map +1 -0
  777. package/lib/typescript/handlers/TapGestureHandler.d.ts +1 -1
  778. package/lib/typescript/handlers/TapGestureHandler.d.ts.map +1 -0
  779. package/lib/typescript/handlers/createHandler.d.ts +1 -0
  780. package/lib/typescript/handlers/createHandler.d.ts.map +1 -0
  781. package/lib/typescript/handlers/createNativeWrapper.d.ts +1 -0
  782. package/lib/typescript/handlers/createNativeWrapper.d.ts.map +1 -0
  783. package/lib/typescript/handlers/customDirectEventTypes.d.ts +1 -0
  784. package/lib/typescript/handlers/customDirectEventTypes.d.ts.map +1 -0
  785. package/lib/typescript/handlers/customDirectEventTypes.web.d.ts +1 -0
  786. package/lib/typescript/handlers/customDirectEventTypes.web.d.ts.map +1 -0
  787. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +1 -0
  788. package/lib/typescript/handlers/gestureHandlerCommon.d.ts.map +1 -0
  789. package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts +1 -0
  790. package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts.map +1 -0
  791. package/lib/typescript/handlers/gestures/GestureDetector/Wrap.d.ts +1 -0
  792. package/lib/typescript/handlers/gestures/GestureDetector/Wrap.d.ts.map +1 -0
  793. package/lib/typescript/handlers/gestures/GestureDetector/Wrap.web.d.ts +3 -2
  794. package/lib/typescript/handlers/gestures/GestureDetector/Wrap.web.d.ts.map +1 -0
  795. package/lib/typescript/handlers/gestures/GestureDetector/attachHandlers.d.ts +1 -0
  796. package/lib/typescript/handlers/gestures/GestureDetector/attachHandlers.d.ts.map +1 -0
  797. package/lib/typescript/handlers/gestures/GestureDetector/dropHandlers.d.ts +1 -0
  798. package/lib/typescript/handlers/gestures/GestureDetector/dropHandlers.d.ts.map +1 -0
  799. package/lib/typescript/handlers/gestures/GestureDetector/index.d.ts +1 -0
  800. package/lib/typescript/handlers/gestures/GestureDetector/index.d.ts.map +1 -0
  801. package/lib/typescript/handlers/gestures/GestureDetector/needsToReattach.d.ts +1 -0
  802. package/lib/typescript/handlers/gestures/GestureDetector/needsToReattach.d.ts.map +1 -0
  803. package/lib/typescript/handlers/gestures/GestureDetector/types.d.ts +1 -1
  804. package/lib/typescript/handlers/gestures/GestureDetector/types.d.ts.map +1 -0
  805. package/lib/typescript/handlers/gestures/GestureDetector/updateHandlers.d.ts +1 -0
  806. package/lib/typescript/handlers/gestures/GestureDetector/updateHandlers.d.ts.map +1 -0
  807. package/lib/typescript/handlers/gestures/GestureDetector/useAnimatedGesture.d.ts +1 -0
  808. package/lib/typescript/handlers/gestures/GestureDetector/useAnimatedGesture.d.ts.map +1 -0
  809. package/lib/typescript/handlers/gestures/GestureDetector/useDetectorUpdater.d.ts +1 -0
  810. package/lib/typescript/handlers/gestures/GestureDetector/useDetectorUpdater.d.ts.map +1 -0
  811. package/lib/typescript/handlers/gestures/GestureDetector/useMountReactions.d.ts +1 -0
  812. package/lib/typescript/handlers/gestures/GestureDetector/useMountReactions.d.ts.map +1 -0
  813. package/lib/typescript/handlers/gestures/GestureDetector/useViewRefHandler.d.ts +1 -0
  814. package/lib/typescript/handlers/gestures/GestureDetector/useViewRefHandler.d.ts.map +1 -0
  815. package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts +1 -1
  816. package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts.map +1 -0
  817. package/lib/typescript/handlers/gestures/eventReceiver.d.ts +1 -0
  818. package/lib/typescript/handlers/gestures/eventReceiver.d.ts.map +1 -0
  819. package/lib/typescript/handlers/gestures/flingGesture.d.ts +1 -0
  820. package/lib/typescript/handlers/gestures/flingGesture.d.ts.map +1 -0
  821. package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +1 -0
  822. package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts.map +1 -0
  823. package/lib/typescript/handlers/gestures/gesture.d.ts +1 -1
  824. package/lib/typescript/handlers/gestures/gesture.d.ts.map +1 -0
  825. package/lib/typescript/handlers/gestures/gestureComposition.d.ts +1 -0
  826. package/lib/typescript/handlers/gestures/gestureComposition.d.ts.map +1 -0
  827. package/lib/typescript/handlers/gestures/gestureObjects.d.ts +1 -0
  828. package/lib/typescript/handlers/gestures/gestureObjects.d.ts.map +1 -0
  829. package/lib/typescript/handlers/gestures/gestureStateManager.d.ts +1 -0
  830. package/lib/typescript/handlers/gestures/gestureStateManager.d.ts.map +1 -0
  831. package/lib/typescript/handlers/gestures/gestureStateManager.web.d.ts +1 -0
  832. package/lib/typescript/handlers/gestures/gestureStateManager.web.d.ts.map +1 -0
  833. package/lib/typescript/handlers/gestures/hoverGesture.d.ts +1 -0
  834. package/lib/typescript/handlers/gestures/hoverGesture.d.ts.map +1 -0
  835. package/lib/typescript/handlers/gestures/longPressGesture.d.ts +1 -0
  836. package/lib/typescript/handlers/gestures/longPressGesture.d.ts.map +1 -0
  837. package/lib/typescript/handlers/gestures/manualGesture.d.ts +1 -0
  838. package/lib/typescript/handlers/gestures/manualGesture.d.ts.map +1 -0
  839. package/lib/typescript/handlers/gestures/nativeGesture.d.ts +1 -0
  840. package/lib/typescript/handlers/gestures/nativeGesture.d.ts.map +1 -0
  841. package/lib/typescript/handlers/gestures/panGesture.d.ts +1 -0
  842. package/lib/typescript/handlers/gestures/panGesture.d.ts.map +1 -0
  843. package/lib/typescript/handlers/gestures/pinchGesture.d.ts +1 -0
  844. package/lib/typescript/handlers/gestures/pinchGesture.d.ts.map +1 -0
  845. package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +1 -0
  846. package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts.map +1 -0
  847. package/lib/typescript/handlers/gestures/rotationGesture.d.ts +1 -0
  848. package/lib/typescript/handlers/gestures/rotationGesture.d.ts.map +1 -0
  849. package/lib/typescript/handlers/gestures/tapGesture.d.ts +1 -0
  850. package/lib/typescript/handlers/gestures/tapGesture.d.ts.map +1 -0
  851. package/lib/typescript/handlers/getNextHandlerTag.d.ts +1 -0
  852. package/lib/typescript/handlers/getNextHandlerTag.d.ts.map +1 -0
  853. package/lib/typescript/handlers/handlersRegistry.d.ts +1 -0
  854. package/lib/typescript/handlers/handlersRegistry.d.ts.map +1 -0
  855. package/lib/typescript/handlers/utils.d.ts +1 -0
  856. package/lib/typescript/handlers/utils.d.ts.map +1 -0
  857. package/lib/typescript/index.d.ts +1 -0
  858. package/lib/typescript/index.d.ts.map +1 -0
  859. package/lib/typescript/init.d.ts +1 -0
  860. package/lib/typescript/init.d.ts.map +1 -0
  861. package/lib/typescript/jestUtils/index.d.ts +1 -0
  862. package/lib/typescript/jestUtils/index.d.ts.map +1 -0
  863. package/lib/typescript/jestUtils/jestUtils.d.ts +1 -1
  864. package/lib/typescript/jestUtils/jestUtils.d.ts.map +1 -0
  865. package/lib/typescript/mocks.d.ts +1 -0
  866. package/lib/typescript/mocks.d.ts.map +1 -0
  867. package/lib/typescript/mountRegistry.d.ts +1 -1
  868. package/lib/typescript/mountRegistry.d.ts.map +1 -0
  869. package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +1 -0
  870. package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts.map +1 -0
  871. package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +1 -1
  872. package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts.map +1 -0
  873. package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts +1 -1
  874. package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts.map +1 -0
  875. package/lib/typescript/typeUtils.d.ts +1 -0
  876. package/lib/typescript/typeUtils.d.ts.map +1 -0
  877. package/lib/typescript/utils.d.ts +1 -0
  878. package/lib/typescript/utils.d.ts.map +1 -0
  879. package/lib/typescript/web/Gestures.d.ts +1 -0
  880. package/lib/typescript/web/Gestures.d.ts.map +1 -0
  881. package/lib/typescript/web/constants.d.ts +1 -0
  882. package/lib/typescript/web/constants.d.ts.map +1 -0
  883. package/lib/typescript/web/detectors/RotationGestureDetector.d.ts +1 -0
  884. package/lib/typescript/web/detectors/RotationGestureDetector.d.ts.map +1 -0
  885. package/lib/typescript/web/detectors/ScaleGestureDetector.d.ts +1 -0
  886. package/lib/typescript/web/detectors/ScaleGestureDetector.d.ts.map +1 -0
  887. package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +1 -0
  888. package/lib/typescript/web/handlers/FlingGestureHandler.d.ts.map +1 -0
  889. package/lib/typescript/web/handlers/GestureHandler.d.ts +1 -1
  890. package/lib/typescript/web/handlers/GestureHandler.d.ts.map +1 -0
  891. package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +1 -0
  892. package/lib/typescript/web/handlers/HoverGestureHandler.d.ts.map +1 -0
  893. package/lib/typescript/web/handlers/IGestureHandler.d.ts +1 -0
  894. package/lib/typescript/web/handlers/IGestureHandler.d.ts.map +1 -0
  895. package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +1 -1
  896. package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts.map +1 -0
  897. package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +1 -0
  898. package/lib/typescript/web/handlers/ManualGestureHandler.d.ts.map +1 -0
  899. package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +1 -1
  900. package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts.map +1 -0
  901. package/lib/typescript/web/handlers/PanGestureHandler.d.ts +1 -0
  902. package/lib/typescript/web/handlers/PanGestureHandler.d.ts.map +1 -0
  903. package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +1 -1
  904. package/lib/typescript/web/handlers/PinchGestureHandler.d.ts.map +1 -0
  905. package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +1 -1
  906. package/lib/typescript/web/handlers/RotationGestureHandler.d.ts.map +1 -0
  907. package/lib/typescript/web/handlers/TapGestureHandler.d.ts +1 -0
  908. package/lib/typescript/web/handlers/TapGestureHandler.d.ts.map +1 -0
  909. package/lib/typescript/web/interfaces.d.ts +1 -0
  910. package/lib/typescript/web/interfaces.d.ts.map +1 -0
  911. package/lib/typescript/web/tools/CircularBuffer.d.ts +1 -0
  912. package/lib/typescript/web/tools/CircularBuffer.d.ts.map +1 -0
  913. package/lib/typescript/web/tools/EventManager.d.ts +1 -0
  914. package/lib/typescript/web/tools/EventManager.d.ts.map +1 -0
  915. package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +1 -0
  916. package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts.map +1 -0
  917. package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +1 -0
  918. package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts.map +1 -0
  919. package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +1 -0
  920. package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts.map +1 -0
  921. package/lib/typescript/web/tools/InteractionManager.d.ts +1 -0
  922. package/lib/typescript/web/tools/InteractionManager.d.ts.map +1 -0
  923. package/lib/typescript/web/tools/KeyboardEventManager.d.ts +1 -0
  924. package/lib/typescript/web/tools/KeyboardEventManager.d.ts.map +1 -0
  925. package/lib/typescript/web/tools/LeastSquareSolver.d.ts +1 -0
  926. package/lib/typescript/web/tools/LeastSquareSolver.d.ts.map +1 -0
  927. package/lib/typescript/web/tools/NodeManager.d.ts +1 -0
  928. package/lib/typescript/web/tools/NodeManager.d.ts.map +1 -0
  929. package/lib/typescript/web/tools/PointerEventManager.d.ts +1 -0
  930. package/lib/typescript/web/tools/PointerEventManager.d.ts.map +1 -0
  931. package/lib/typescript/web/tools/PointerTracker.d.ts +1 -0
  932. package/lib/typescript/web/tools/PointerTracker.d.ts.map +1 -0
  933. package/lib/typescript/web/tools/Vector.d.ts +1 -0
  934. package/lib/typescript/web/tools/Vector.d.ts.map +1 -0
  935. package/lib/typescript/web/tools/VelocityTracker.d.ts +1 -0
  936. package/lib/typescript/web/tools/VelocityTracker.d.ts.map +1 -0
  937. package/lib/typescript/web/tools/WheelEventManager.d.ts +1 -0
  938. package/lib/typescript/web/tools/WheelEventManager.d.ts.map +1 -0
  939. package/lib/typescript/web/utils.d.ts +1 -0
  940. package/lib/typescript/web/utils.d.ts.map +1 -0
  941. package/lib/typescript/web_hammer/DiscreteGestureHandler.d.ts +1 -0
  942. package/lib/typescript/web_hammer/DiscreteGestureHandler.d.ts.map +1 -0
  943. package/lib/typescript/web_hammer/DraggingGestureHandler.d.ts +1 -0
  944. package/lib/typescript/web_hammer/DraggingGestureHandler.d.ts.map +1 -0
  945. package/lib/typescript/web_hammer/Errors.d.ts +1 -0
  946. package/lib/typescript/web_hammer/Errors.d.ts.map +1 -0
  947. package/lib/typescript/web_hammer/FlingGestureHandler.d.ts +1 -0
  948. package/lib/typescript/web_hammer/FlingGestureHandler.d.ts.map +1 -0
  949. package/lib/typescript/web_hammer/GestureHandler.d.ts +1 -0
  950. package/lib/typescript/web_hammer/GestureHandler.d.ts.map +1 -0
  951. package/lib/typescript/web_hammer/IndiscreteGestureHandler.d.ts +1 -0
  952. package/lib/typescript/web_hammer/IndiscreteGestureHandler.d.ts.map +1 -0
  953. package/lib/typescript/web_hammer/LongPressGestureHandler.d.ts +1 -0
  954. package/lib/typescript/web_hammer/LongPressGestureHandler.d.ts.map +1 -0
  955. package/lib/typescript/web_hammer/NativeViewGestureHandler.d.ts +1 -0
  956. package/lib/typescript/web_hammer/NativeViewGestureHandler.d.ts.map +1 -0
  957. package/lib/typescript/web_hammer/NodeManager.d.ts +1 -0
  958. package/lib/typescript/web_hammer/NodeManager.d.ts.map +1 -0
  959. package/lib/typescript/web_hammer/PanGestureHandler.d.ts +1 -0
  960. package/lib/typescript/web_hammer/PanGestureHandler.d.ts.map +1 -0
  961. package/lib/typescript/web_hammer/PinchGestureHandler.d.ts +1 -0
  962. package/lib/typescript/web_hammer/PinchGestureHandler.d.ts.map +1 -0
  963. package/lib/typescript/web_hammer/PressGestureHandler.d.ts +1 -0
  964. package/lib/typescript/web_hammer/PressGestureHandler.d.ts.map +1 -0
  965. package/lib/typescript/web_hammer/RotationGestureHandler.d.ts +1 -0
  966. package/lib/typescript/web_hammer/RotationGestureHandler.d.ts.map +1 -0
  967. package/lib/typescript/web_hammer/TapGestureHandler.d.ts +1 -0
  968. package/lib/typescript/web_hammer/TapGestureHandler.d.ts.map +1 -0
  969. package/lib/typescript/web_hammer/constants.d.ts +1 -0
  970. package/lib/typescript/web_hammer/constants.d.ts.map +1 -0
  971. package/lib/typescript/web_hammer/utils.d.ts +1 -0
  972. package/lib/typescript/web_hammer/utils.d.ts.map +1 -0
  973. package/package.json +27 -47
  974. package/src/components/DrawerLayout.tsx +5 -2
  975. package/src/components/GestureButtons.tsx +2 -2
  976. package/src/components/GestureComponents.web.tsx +1 -1
  977. package/src/components/GestureHandlerButton.web.tsx +3 -3
  978. package/src/components/Pressable/Pressable.tsx +34 -9
  979. package/src/components/Pressable/PressableProps.tsx +19 -0
  980. package/src/components/ReanimatedSwipeable.tsx +55 -33
  981. package/src/components/Swipeable.tsx +3 -0
  982. package/src/components/Text.tsx +5 -2
  983. package/src/components/utils.ts +26 -0
  984. package/src/getShadowNodeFromRef.ts +2 -2
  985. package/src/handlers/createHandler.tsx +1 -0
  986. package/src/handlers/gestures/reanimatedWrapper.ts +0 -1
  987. package/src/handlers/utils.ts +1 -1
  988. package/src/utils.ts +0 -1
  989. package/src/web_hammer/DiscreteGestureHandler.ts +1 -1
  990. package/src/web_hammer/DraggingGestureHandler.ts +1 -1
  991. package/src/web_hammer/FlingGestureHandler.ts +1 -1
  992. package/src/web_hammer/GestureHandler.ts +2 -1
  993. package/src/web_hammer/LongPressGestureHandler.ts +1 -1
  994. package/README.md +0 -71
  995. package/android/packageDeprecated/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +0 -85
  996. package/android/paper77/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +0 -60
  997. package/android/paper77/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerInterface.java +0 -26
  998. package/android/paper77/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerDelegate.java +0 -26
  999. package/android/paper77/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerInterface.java +0 -16
  1000. package/android/paper77/src/main/java/com/swmansion/gesturehandler/NativeRNGestureHandlerModuleSpec.java +0 -67
  1001. package/android/paper77/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +0 -13
  1002. package/lib/commonjs/handlers/NativeViewGestureHandler.js +0 -35
  1003. package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +0 -1
  1004. package/lib/commonjs/handlers/gestures/nativeGesture.js +0 -44
  1005. package/lib/commonjs/handlers/gestures/nativeGesture.js.map +0 -1
  1006. package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +0 -13
  1007. package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +0 -1
  1008. package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +0 -15
  1009. package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +0 -1
  1010. package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +0 -15
  1011. package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js.map +0 -1
  1012. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +0 -189
  1013. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +0 -1
  1014. package/lib/commonjs/web_hammer/NativeViewGestureHandler.js +0 -66
  1015. package/lib/commonjs/web_hammer/NativeViewGestureHandler.js.map +0 -1
  1016. package/lib/module/handlers/NativeViewGestureHandler.js +0 -19
  1017. package/lib/module/handlers/NativeViewGestureHandler.js.map +0 -1
  1018. package/lib/module/handlers/gestures/nativeGesture.js.map +0 -1
  1019. package/lib/module/specs/NativeRNGestureHandlerModule.js +0 -3
  1020. package/lib/module/specs/NativeRNGestureHandlerModule.js.map +0 -1
  1021. package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js +0 -3
  1022. package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +0 -1
  1023. package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js +0 -3
  1024. package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js.map +0 -1
  1025. package/lib/module/web/handlers/NativeViewGestureHandler.js.map +0 -1
  1026. package/lib/module/web_hammer/NativeViewGestureHandler.js +0 -49
  1027. package/lib/module/web_hammer/NativeViewGestureHandler.js.map +0 -1
  1028. /package/android/{common → noreanimated}/src/main/java/com/swmansion/common/GestureHandlerStateManager.kt +0 -0
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  /* eslint-disable react/no-unused-prop-types */
2
4
  import React, { useContext, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
3
5
  import { Platform } from 'react-native';
@@ -13,24 +15,20 @@ import { Wrap, AnimatedWrap } from './Wrap';
13
15
  import { useDetectorUpdater } from './useDetectorUpdater';
14
16
  import { useViewRefHandler } from './useViewRefHandler';
15
17
  import { useMountReactions } from './useMountReactions';
16
-
18
+ import { jsx as _jsx } from "react/jsx-runtime";
17
19
  function propagateDetectorConfig(props, gesture) {
18
20
  const keysToPropagate = ['userSelect', 'enableContextMenu', 'touchAction'];
19
-
20
21
  for (const key of keysToPropagate) {
21
22
  const value = props[key];
22
-
23
23
  if (value === undefined) {
24
24
  continue;
25
25
  }
26
-
27
26
  for (const g of gesture.toGestureArray()) {
28
27
  const config = g.config;
29
28
  config[key] = value;
30
29
  }
31
30
  }
32
31
  }
33
-
34
32
  /**
35
33
  * `GestureDetector` is responsible for creating and updating native gesture handlers based on the config of provided gesture.
36
34
  *
@@ -48,18 +46,17 @@ function propagateDetectorConfig(props, gesture) {
48
46
  */
49
47
  export const GestureDetector = props => {
50
48
  const rootViewContext = useContext(GestureHandlerRootViewContext);
51
-
52
49
  if (__DEV__ && !rootViewContext && !isTestEnv() && Platform.OS !== 'web') {
53
50
  throw new Error('GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.');
54
- } // Gesture config should be wrapped with useMemo to prevent unnecessary re-renders
55
-
51
+ }
56
52
 
53
+ // Gesture config should be wrapped with useMemo to prevent unnecessary re-renders
57
54
  const gestureConfig = props.gesture;
58
55
  propagateDetectorConfig(props, gestureConfig);
59
56
  const gesturesToAttach = useMemo(() => gestureConfig.toGestureArray(), [gestureConfig]);
60
57
  const shouldUseReanimated = gesturesToAttach.some(g => g.shouldUseReanimated);
61
- const webEventHandlersRef = useWebEventHandlers(); // Store state in ref to prevent unnecessary renders
62
-
58
+ const webEventHandlersRef = useWebEventHandlers();
59
+ // Store state in ref to prevent unnecessary renders
63
60
  const state = useRef({
64
61
  firstRender: true,
65
62
  viewRef: null,
@@ -74,9 +71,10 @@ export const GestureDetector = props => {
74
71
  isMounted: false
75
72
  }).current;
76
73
  const updateAttachedGestures = useDetectorUpdater(state, preparedGesture, gesturesToAttach, gestureConfig, webEventHandlersRef);
77
- const refHandler = useViewRefHandler(state, updateAttachedGestures); // Reanimated event should be rebuilt only when gestures are reattached, otherwise
78
- // config update will be enough as all necessary items are stored in shared values anyway
74
+ const refHandler = useViewRefHandler(state, updateAttachedGestures);
79
75
 
76
+ // Reanimated event should be rebuilt only when gestures are reattached, otherwise
77
+ // config update will be enough as all necessary items are stored in shared values anyway
80
78
  const needsToRebuildReanimatedEvent = state.firstRender || state.forceRebuildReanimatedEvent || needsToReattach(preparedGesture, gesturesToAttach);
81
79
  state.forceRebuildReanimatedEvent = false;
82
80
  useAnimatedGesture(preparedGesture, needsToRebuildReanimatedEvent);
@@ -103,16 +101,17 @@ export const GestureDetector = props => {
103
101
  }
104
102
  }, [props]);
105
103
  useMountReactions(updateAttachedGestures, preparedGesture);
106
-
107
104
  if (shouldUseReanimated) {
108
- return /*#__PURE__*/React.createElement(AnimatedWrap, {
105
+ return /*#__PURE__*/_jsx(AnimatedWrap, {
109
106
  ref: refHandler,
110
- onGestureHandlerEvent: preparedGesture.animatedEventHandler
111
- }, props.children);
107
+ onGestureHandlerEvent: preparedGesture.animatedEventHandler,
108
+ children: props.children
109
+ });
112
110
  } else {
113
- return /*#__PURE__*/React.createElement(Wrap, {
114
- ref: refHandler
115
- }, props.children);
111
+ return /*#__PURE__*/_jsx(Wrap, {
112
+ ref: refHandler,
113
+ children: props.children
114
+ });
116
115
  }
117
116
  };
118
117
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","useContext","useEffect","useLayoutEffect","useMemo","useRef","Platform","findNodeHandle","isTestEnv","GestureHandlerRootViewContext","useAnimatedGesture","attachHandlers","needsToReattach","dropHandlers","useWebEventHandlers","Wrap","AnimatedWrap","useDetectorUpdater","useViewRefHandler","useMountReactions","propagateDetectorConfig","props","gesture","keysToPropagate","key","value","undefined","g","toGestureArray","config","GestureDetector","rootViewContext","__DEV__","OS","Error","gestureConfig","gesturesToAttach","shouldUseReanimated","some","webEventHandlersRef","state","firstRender","viewRef","previousViewTag","forceRebuildReanimatedEvent","current","preparedGesture","attachedGestures","animatedEventHandler","animatedHandlers","isMounted","updateAttachedGestures","refHandler","needsToRebuildReanimatedEvent","viewTag","children"],"mappings":"AAAA;AACA,OAAOA,KAAP,IACEC,UADF,EAEEC,SAFF,EAGEC,eAHF,EAIEC,OAJF,EAKEC,MALF,QAMO,OANP;AAOA,SAASC,QAAT,QAAyB,cAAzB;AACA,OAAOC,cAAP,MAA2B,yBAA3B;AAIA,SAASC,SAAT,QAA0B,gBAA1B;AAEA,OAAOC,6BAAP,MAA0C,wCAA1C;AAEA,SAASC,kBAAT,QAAmC,sB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AAK,CAACE,OAAP,CAA9B;AACAI,IAAAA,eAAe,CAACI,SAAhB,GAA4B,IAA5B;AAEAvC,IAAAA,cAAc,CAAC;AACbmC,MAAAA,eADa;AAEbX,MAAAA,aAFa;AAGbC,MAAAA,gBAHa;AAIbG,MAAAA,mBAJa;AAKbe,MAAAA;AALa,KAAD,CAAd;AAQA,WAAO,MAAM;AACXR,MAAAA,eAAe,CAACI,SAAhB,GAA4B,KAA5B;AACArC,MAAAA,YAAY,CAACiC,eAAD,CAAZ;AACD,KAHD;AAID,GAhBc,EAgBZ,EAhBY,CAAf;AAkBA5C,EAAAA,SAAS,CAAC,MAAM;AACd,QAAIsC,KAAK,CAACC,WAAV,EAAuB;AACrBD,MAAAA,KAAK,CAACC,WAAN,GAAoB,KAApB;AACD,KAFD,MAEO;AACLU,MAAAA,sBAAsB;AACvB;AACF,GANQ,EAMN,CAAC9B,KAAD,CANM,CAAT;AAQAF,EAAAA,iBAAiB,CAACgC,sBAAD,EAAyBL,eAAzB,CAAjB;;AAEA,MAAIT,mBAAJ,EAAyB;AACvB,wBACE,oBAAC,YAAD;AACE,MAAA,GAAG,EAAEe,UADP;AAEE,MAAA,qBAAqB,EAAEN,eAAe,CAACE;AAFzC,OAGG3B,KAAK,CAACkC,QAHT,CADF;AAOD,GARD,MAQO;AACL,wBAAO,oBAAC,IAAD;AAAM,MAAA,GAAG,EAAEH;AAAX,OAAwB/B,KAAK,CAACkC,QAA9B,CAAP;AACD;AACF,CAhGM","sourcesContent":["/* eslint-disable react/no-unused-prop-types */\nimport React, {\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n} from 'react';\nimport { Platform } from 'react-native';\nimport findNodeHandle from '../../../findNodeHandle';\nimport { GestureType } from '../gesture';\nimport { UserSelect, TouchAction } from '../../gestureHandlerCommon';\nimport { ComposedGesture } from '../gestureComposition';\nimport { isTestEnv } from '../../../utils';\n\nimport GestureHandlerRootViewContext from '../../../GestureHandlerRootViewContext';\nimport { AttachedGestureState, GestureDetectorState } from './types';\nimport { useAnimatedGesture } from './useAnimatedGesture';\nimport { attachHandlers } from './attachHandlers';\nimport { needsToReattach } from './needsToReattach';\nimport { dropHandlers } from './dropHandlers';\nimport { useWebEventHandlers } from './utils';\nimport { Wrap, AnimatedWrap } from './Wrap';\nimport { useDetectorUpdater } from './useDetectorUpdater';\nimport { useViewRefHandler } from './useViewRefHandler';\nimport { useMountReactions } from './useMountReactions';\n\nfunction propagateDetectorConfig(\n props: GestureDetectorProps,\n gesture: ComposedGesture | GestureType\n) {\n const keysToPropagate: (keyof GestureDetectorProps)[] = [\n 'userSelect',\n 'enableContextMenu',\n 'touchAction',\n ];\n\n for (const key of keysToPropagate) {\n const value = props[key];\n if (value === undefined) {\n continue;\n }\n\n for (const g of gesture.toGestureArray()) {\n const config = g.config as { [key: string]: unknown };\n config[key] = value;\n }\n }\n}\n\ninterface GestureDetectorProps {\n children?: React.ReactNode;\n /**\n * A gesture object containing the configuration and callbacks.\n * Can be any of:\n * - base gestures (`Tap`, `Pan`, ...)\n * - `ComposedGesture` (`Race`, `Simultaneous`, `Exclusive`)\n */\n gesture: ComposedGesture | GestureType;\n /**\n * #### Web only\n * This parameter allows to specify which `userSelect` property should be applied to underlying view.\n * Possible values are `\"none\" | \"auto\" | \"text\"`. Default value is set to `\"none\"`.\n */\n userSelect?: UserSelect;\n /**\n * #### Web only\n * Specifies whether context menu should be enabled after clicking on underlying view with right mouse button.\n * Default value is set to `false`.\n */\n enableContextMenu?: boolean;\n /**\n * #### Web only\n * This parameter allows to specify which `touchAction` property should be applied to underlying view.\n * Supports all CSS touch-action values (e.g. `\"none\"`, `\"pan-y\"`). Default value is set to `\"none\"`.\n */\n touchAction?: TouchAction;\n}\n\n/**\n * `GestureDetector` is responsible for creating and updating native gesture handlers based on the config of provided gesture.\n *\n * ### Props\n * - `gesture`\n * - `userSelect` (**Web only**)\n * - `enableContextMenu` (**Web only**)\n * - `touchAction` (**Web only**)\n *\n * ### Remarks\n * - Gesture Detector will use first native view in its subtree to recognize gestures, however if this view is used only to group its children it may get automatically collapsed.\n * - Using the same instance of a gesture across multiple Gesture Detectors is not possible.\n *\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/gesture-detector\n */\nexport const GestureDetector = (props: GestureDetectorProps) => {\n const rootViewContext = useContext(GestureHandlerRootViewContext);\n if (__DEV__ && !rootViewContext && !isTestEnv() && Platform.OS !== 'web') {\n throw new Error(\n 'GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.'\n );\n }\n\n // Gesture config should be wrapped with useMemo to prevent unnecessary re-renders\n const gestureConfig = props.gesture;\n propagateDetectorConfig(props, gestureConfig);\n\n const gesturesToAttach = useMemo(\n () => gestureConfig.toGestureArray(),\n [gestureConfig]\n );\n const shouldUseReanimated = gesturesToAttach.some(\n (g) => g.shouldUseReanimated\n );\n\n const webEventHandlersRef = useWebEventHandlers();\n // Store state in ref to prevent unnecessary renders\n const state = useRef<GestureDetectorState>({\n firstRender: true,\n viewRef: null,\n previousViewTag: -1,\n forceRebuildReanimatedEvent: false,\n }).current;\n\n const preparedGesture = React.useRef<AttachedGestureState>({\n attachedGestures: [],\n animatedEventHandler: null,\n animatedHandlers: null,\n shouldUseReanimated: shouldUseReanimated,\n isMounted: false,\n }).current;\n\n const updateAttachedGestures = useDetectorUpdater(\n state,\n preparedGesture,\n gesturesToAttach,\n gestureConfig,\n webEventHandlersRef\n );\n\n const refHandler = useViewRefHandler(state, updateAttachedGestures);\n\n // Reanimated event should be rebuilt only when gestures are reattached, otherwise\n // config update will be enough as all necessary items are stored in shared values anyway\n const needsToRebuildReanimatedEvent =\n state.firstRender ||\n state.forceRebuildReanimatedEvent ||\n needsToReattach(preparedGesture, gesturesToAttach);\n state.forceRebuildReanimatedEvent = false;\n\n useAnimatedGesture(preparedGesture, needsToRebuildReanimatedEvent);\n\n useLayoutEffect(() => {\n const viewTag = findNodeHandle(state.viewRef) as number;\n preparedGesture.isMounted = true;\n\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesturesToAttach,\n webEventHandlersRef,\n viewTag,\n });\n\n return () => {\n preparedGesture.isMounted = false;\n dropHandlers(preparedGesture);\n };\n }, []);\n\n useEffect(() => {\n if (state.firstRender) {\n state.firstRender = false;\n } else {\n updateAttachedGestures();\n }\n }, [props]);\n\n useMountReactions(updateAttachedGestures, preparedGesture);\n\n if (shouldUseReanimated) {\n return (\n <AnimatedWrap\n ref={refHandler}\n onGestureHandlerEvent={preparedGesture.animatedEventHandler}>\n {props.children}\n </AnimatedWrap>\n );\n } else {\n return <Wrap ref={refHandler}>{props.children}</Wrap>;\n }\n};\n"]}
1
+ {"version":3,"names":["React","useContext","useEffect","useLayoutEffect","useMemo","useRef","Platform","findNodeHandle","isTestEnv","GestureHandlerRootViewContext","useAnimatedGesture","attachHandlers","needsToReattach","dropHandlers","useWebEventHandlers","Wrap","AnimatedWrap","useDetectorUpdater","useViewRefHandler","useMountReactions","jsx","_jsx","propagateDetectorConfig","props","gesture","keysToPropagate","key","value","undefined","g","toGestureArray","config","GestureDetector","rootViewContext","__DEV__","OS","Error","gestureConfig","gesturesToAttach","shouldUseReanimated","some","webEventHandlersRef","state","firstRender","viewRef","previousViewTag","forceRebuildReanimatedEvent","current","preparedGesture","attachedGestures","animatedEventHandler","animatedHandlers","isMounted","updateAttachedGestures","refHandler","needsToRebuildReanimatedEvent","viewTag","ref","onGestureHandlerEvent","children"],"sourceRoot":"../../../../../src","sources":["handlers/gestures/GestureDetector/index.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,IACVC,UAAU,EACVC,SAAS,EACTC,eAAe,EACfC,OAAO,EACPC,MAAM,QACD,OAAO;AACd,SAASC,QAAQ,QAAQ,cAAc;AACvC,OAAOC,cAAc,MAAM,yBAAyB;AAIpD,SAASC,SAAS,QAAQ,gBAAgB;AAE1C,OAAOC,6BAA6B,MAAM,wCAAwC;AAElF,SAASC,kBAA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MACbC,gBAAgB;MAChBG,mBAAmB;MACnBe;IACF,CAAC,CAAC;IAEF,OAAO,MAAM;MACXR,eAAe,CAACI,SAAS,GAAG,KAAK;MACjCvC,YAAY,CAACmC,eAAe,CAAC;IAC/B,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN9C,SAAS,CAAC,MAAM;IACd,IAAIwC,KAAK,CAACC,WAAW,EAAE;MACrBD,KAAK,CAACC,WAAW,GAAG,KAAK;IAC3B,CAAC,MAAM;MACLU,sBAAsB,CAAC,CAAC;IAC1B;EACF,CAAC,EAAE,CAAC9B,KAAK,CAAC,CAAC;EAEXJ,iBAAiB,CAACkC,sBAAsB,EAAEL,eAAe,CAAC;EAE1D,IAAIT,mBAAmB,EAAE;IACvB,oBACElB,IAAA,CAACL,YAAY;MACXyC,GAAG,EAAEH,UAAW;MAChBI,qBAAqB,EAAEV,eAAe,CAACE,oBAAqB;MAAAS,QAAA,EAC3DpC,KAAK,CAACoC;IAAQ,CACH,CAAC;EAEnB,CAAC,MAAM;IACL,oBAAOtC,IAAA,CAACN,IAAI;MAAC0C,GAAG,EAAEH,UAAW;MAAAK,QAAA,EAAEpC,KAAK,CAACoC;IAAQ,CAAO,CAAC;EACvD;AACF,CAAC","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  // Checks whether the gesture should be reattached to the view, this will happen when:
2
4
  // - The number of gestures in the preparedGesture is different than the number of gestures in the gesture
3
5
  // - The handlerName is different in any of the gestures
@@ -6,13 +8,11 @@ export function needsToReattach(preparedGesture, newGestures) {
6
8
  if (newGestures.length !== preparedGesture.attachedGestures.length) {
7
9
  return true;
8
10
  }
9
-
10
11
  for (let i = 0; i < newGestures.length; i++) {
11
12
  if (newGestures[i].handlerName !== preparedGesture.attachedGestures[i].handlerName || newGestures[i].shouldUseReanimated !== preparedGesture.attachedGestures[i].shouldUseReanimated) {
12
13
  return true;
13
14
  }
14
15
  }
15
-
16
16
  return false;
17
17
  }
18
18
  //# sourceMappingURL=needsToReattach.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["needsToReattach.ts"],"names":["needsToReattach","preparedGesture","newGestures","length","attachedGestures","i","handlerName","shouldUseReanimated"],"mappings":"AAGA;AACA;AACA;AACA;AACA,OAAO,SAASA,eAAT,CACLC,eADK,EAELC,WAFK,EAGL;AACA,MAAIA,WAAW,CAACC,MAAZ,KAAuBF,eAAe,CAACG,gBAAhB,CAAiCD,MAA5D,EAAoE;AAClE,WAAO,IAAP;AACD;;AACD,OAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,WAAW,CAACC,MAAhC,EAAwCE,CAAC,EAAzC,EAA6C;AAC3C,QACEH,WAAW,CAACG,CAAD,CAAX,CAAeC,WAAf,KACEL,eAAe,CAACG,gBAAhB,CAAiCC,CAAjC,EAAoCC,WADtC,IAEAJ,WAAW,CAACG,CAAD,CAAX,CAAeE,mBAAf,KACEN,eAAe,CAACG,gBAAhB,CAAiCC,CAAjC,EAAoCE,mBAJxC,EAKE;AACA,aAAO,IAAP;AACD;AACF;;AAED,SAAO,KAAP;AACD","sourcesContent":["import { GestureType } from '../gesture';\nimport { AttachedGestureState } from './types';\n\n// Checks whether the gesture should be reattached to the view, this will happen when:\n// - The number of gestures in the preparedGesture is different than the number of gestures in the gesture\n// - The handlerName is different in any of the gestures\n// - At least one of the gestures changed the thread it runs on\nexport function needsToReattach(\n preparedGesture: AttachedGestureState,\n newGestures: GestureType[]\n) {\n if (newGestures.length !== preparedGesture.attachedGestures.length) {\n return true;\n }\n for (let i = 0; i < newGestures.length; i++) {\n if (\n newGestures[i].handlerName !==\n preparedGesture.attachedGestures[i].handlerName ||\n newGestures[i].shouldUseReanimated !==\n preparedGesture.attachedGestures[i].shouldUseReanimated\n ) {\n return true;\n }\n }\n\n return false;\n}\n"]}
1
+ {"version":3,"names":["needsToReattach","preparedGesture","newGestures","length","attachedGestures","i","handlerName","shouldUseReanimated"],"sourceRoot":"../../../../../src","sources":["handlers/gestures/GestureDetector/needsToReattach.ts"],"mappings":";;AAGA;AACA;AACA;AACA;AACA,OAAO,SAASA,eAAeA,CAC7BC,eAAqC,EACrCC,WAA0B,EAC1B;EACA,IAAIA,WAAW,CAACC,MAAM,KAAKF,eAAe,CAACG,gBAAgB,CAACD,MAAM,EAAE;IAClE,OAAO,IAAI;EACb;EACA,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,WAAW,CAACC,MAAM,EAAEE,CAAC,EAAE,EAAE;IAC3C,IACEH,WAAW,CAACG,CAAC,CAAC,CAACC,WAAW,KACxBL,eAAe,CAACG,gBAAgB,CAACC,CAAC,CAAC,CAACC,WAAW,IACjDJ,WAAW,CAACG,CAAC,CAAC,CAACE,mBAAmB,KAChCN,eAAe,CAACG,gBAAgB,CAACC,CAAC,CAAC,CAACE,mBAAmB,EACzD;MACA,OAAO,IAAI;IACb;EACF;EAEA,OAAO,KAAK;AACd","ignoreList":[]}
@@ -1,2 +1,4 @@
1
+ "use strict";
2
+
1
3
  export {};
2
4
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
1
+ {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["handlers/gestures/GestureDetector/types.ts"],"mappings":"","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  import { registerHandler } from '../../handlersRegistry';
2
4
  import RNGestureHandlerModule from '../../../RNGestureHandlerModule';
3
5
  import { filterConfig, scheduleFlushOperations } from '../../utils';
@@ -5,56 +7,54 @@ import { ghQueueMicrotask } from '../../../ghQueueMicrotask';
5
7
  import { extractGestureRelations, checkGestureCallbacksForWorklets, ALLOWED_PROPS } from './utils';
6
8
  export function updateHandlers(preparedGesture, gestureConfig, newGestures) {
7
9
  gestureConfig.prepare();
8
-
9
10
  for (let i = 0; i < newGestures.length; i++) {
10
11
  const handler = preparedGesture.attachedGestures[i];
11
- checkGestureCallbacksForWorklets(handler); // Only update handlerTag when it's actually different, it may be the same
12
- // if gesture config object is wrapped with useMemo
12
+ checkGestureCallbacksForWorklets(handler);
13
13
 
14
+ // Only update handlerTag when it's actually different, it may be the same
15
+ // if gesture config object is wrapped with useMemo
14
16
  if (newGestures[i].handlerTag !== handler.handlerTag) {
15
17
  newGestures[i].handlerTag = handler.handlerTag;
16
18
  newGestures[i].handlers.handlerTag = handler.handlerTag;
17
19
  }
18
- } // Store attached gestures to avoid crash when gestures changed after queueing micro task
20
+ }
19
21
 
22
+ // Store attached gestures to avoid crash when gestures changed after queueing micro task
23
+ const attachedGestures = preparedGesture.attachedGestures;
20
24
 
21
- const attachedGestures = preparedGesture.attachedGestures; // Use queueMicrotask to extract handlerTags, because when it's ran, all refs should be updated
25
+ // Use queueMicrotask to extract handlerTags, because when it's ran, all refs should be updated
22
26
  // and handlerTags in BaseGesture references should be updated in the loop above (we need to wait
23
27
  // in case of external relations)
24
-
25
28
  ghQueueMicrotask(() => {
26
29
  if (!preparedGesture.isMounted) {
27
30
  return;
28
- } // Stop if attached gestures changed after queueing micro task
29
-
31
+ }
30
32
 
33
+ // Stop if attached gestures changed after queueing micro task
31
34
  if (attachedGestures !== preparedGesture.attachedGestures) {
32
35
  return;
33
- } // If amount of gesture configs changes, we need to update the callbacks in shared value
34
-
36
+ }
35
37
 
38
+ // If amount of gesture configs changes, we need to update the callbacks in shared value
36
39
  let shouldUpdateSharedValueIfUsed = attachedGestures.length !== newGestures.length;
37
-
38
40
  for (let i = 0; i < newGestures.length; i++) {
39
- const handler = attachedGestures[i]; // If the gestureId is different (gesture isn't wrapped with useMemo or its dependencies changed),
40
- // we need to update the shared value, assuming the gesture runs on UI thread or the thread changed
41
+ const handler = attachedGestures[i];
41
42
 
43
+ // If the gestureId is different (gesture isn't wrapped with useMemo or its dependencies changed),
44
+ // we need to update the shared value, assuming the gesture runs on UI thread or the thread changed
42
45
  if (handler.handlers.gestureId !== newGestures[i].handlers.gestureId && (newGestures[i].shouldUseReanimated || handler.shouldUseReanimated)) {
43
46
  shouldUpdateSharedValueIfUsed = true;
44
47
  }
45
-
46
48
  handler.config = newGestures[i].config;
47
49
  handler.handlers = newGestures[i].handlers;
48
50
  RNGestureHandlerModule.updateGestureHandler(handler.handlerTag, filterConfig(handler.config, ALLOWED_PROPS, extractGestureRelations(handler)));
49
51
  registerHandler(handler.handlerTag, handler, handler.config.testId);
50
52
  }
51
-
52
53
  if (preparedGesture.animatedHandlers && shouldUpdateSharedValueIfUsed) {
53
54
  const newHandlersValue = attachedGestures.filter(g => g.shouldUseReanimated) // Ignore gestures that shouldn't run on UI
54
55
  .map(g => g.handlers);
55
56
  preparedGesture.animatedHandlers.value = newHandlersValue;
56
57
  }
57
-
58
58
  scheduleFlushOperations();
59
59
  });
60
60
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["updateHandlers.ts"],"names":["registerHandler","RNGestureHandlerModule","filterConfig","scheduleFlushOperations","ghQueueMicrotask","extractGestureRelations","checkGestureCallbacksForWorklets","ALLOWED_PROPS","updateHandlers","preparedGesture","gestureConfig","newGestures","prepare","i","length","handler","attachedGestures","handlerTag","handlers","isMounted","shouldUpdateSharedValueIfUsed","gestureId","shouldUseReanimated","config","updateGestureHandler","testId","animatedHandlers","newHandlersValue","filter","g","map","value"],"mappings":"AACA,SAASA,eAAT,QAAgC,wBAAhC;AACA,OAAOC,sBAAP,MAAmC,iCAAnC;AACA,SAASC,YAAT,EAAuBC,uBAAvB,QAAsD,aAAtD;AAEA,SAASC,gBAAT,QAAiC,2BAAjC;AAEA,SACEC,uBADF,EAEEC,gCAFF,EAGEC,aAHF,QAIO,SAJP;AAMA,OAAO,SAASC,cAAT,CACLC,eADK,EAELC,aAFK,EAGLC,WAHK,EAIL;AACAD,EAAAA,aAAa,CAACE,OAAd;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,WAAW,CAACG,MAAhC,EAAwCD,CAAC,EAAzC,EAA6C;AAC3C,UAAME,O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;AACAR,MAAAA,OAAO,CAACG,QAAR,GAAmBP,WAAW,CAACE,CAAD,CAAX,CAAeK,QAAlC;AAEAjB,MAAAA,sBAAsB,CAACuB,oBAAvB,CACET,OAAO,CAACE,UADV,EAEEf,YAAY,CACVa,OAAO,CAACQ,MADE,EAEVhB,aAFU,EAGVF,uBAAuB,CAACU,OAAD,CAHb,CAFd;AASAf,MAAAA,eAAe,CAACe,OAAO,CAACE,UAAT,EAAqBF,OAArB,EAA8BA,OAAO,CAACQ,MAAR,CAAeE,MAA7C,CAAf;AACD;;AAED,QAAIhB,eAAe,CAACiB,gBAAhB,IAAoCN,6BAAxC,EAAuE;AACrE,YAAMO,gBAAgB,GAAGX,gBAAgB,CACtCY,MADsB,CACdC,CAAD,IAAOA,CAAC,CAACP,mBADM,EACe;AADf,OAEtBQ,GAFsB,CAEjBD,CAAD,IAAOA,CAAC,CAACX,QAFS,CAAzB;AAMAT,MAAAA,eAAe,CAACiB,gBAAhB,CAAiCK,KAAjC,GAAyCJ,gBAAzC;AACD;;AAEDxB,IAAAA,uBAAuB;AACxB,GApDe,CAAhB;AAqDD","sourcesContent":["import { GestureType, HandlerCallbacks } from '../gesture';\nimport { registerHandler } from '../../handlersRegistry';\nimport RNGestureHandlerModule from '../../../RNGestureHandlerModule';\nimport { filterConfig, scheduleFlushOperations } from '../../utils';\nimport { ComposedGesture } from '../gestureComposition';\nimport { ghQueueMicrotask } from '../../../ghQueueMicrotask';\nimport { AttachedGestureState } from './types';\nimport {\n extractGestureRelations,\n checkGestureCallbacksForWorklets,\n ALLOWED_PROPS,\n} from './utils';\n\nexport function updateHandlers(\n preparedGesture: AttachedGestureState,\n gestureConfig: ComposedGesture | GestureType,\n newGestures: GestureType[]\n) {\n gestureConfig.prepare();\n\n for (let i = 0; i < newGestures.length; i++) {\n const handler = preparedGesture.attachedGestures[i];\n checkGestureCallbacksForWorklets(handler);\n\n // Only update handlerTag when it's actually different, it may be the same\n // if gesture config object is wrapped with useMemo\n if (newGestures[i].handlerTag !== handler.handlerTag) {\n newGestures[i].handlerTag = handler.handlerTag;\n newGestures[i].handlers.handlerTag = handler.handlerTag;\n }\n }\n\n // Store attached gestures to avoid crash when gestures changed after queueing micro task\n const attachedGestures = preparedGesture.attachedGestures;\n\n // Use queueMicrotask to extract handlerTags, because when it's ran, all refs should be updated\n // and handlerTags in BaseGesture references should be updated in the loop above (we need to wait\n // in case of external relations)\n ghQueueMicrotask(() => {\n if (!preparedGesture.isMounted) {\n return;\n }\n\n // Stop if attached gestures changed after queueing micro task\n if (attachedGestures !== preparedGesture.attachedGestures) {\n return;\n }\n\n // If amount of gesture configs changes, we need to update the callbacks in shared value\n let shouldUpdateSharedValueIfUsed =\n attachedGestures.length !== newGestures.length;\n\n for (let i = 0; i < newGestures.length; i++) {\n const handler = attachedGestures[i];\n\n // If the gestureId is different (gesture isn't wrapped with useMemo or its dependencies changed),\n // we need to update the shared value, assuming the gesture runs on UI thread or the thread changed\n if (\n handler.handlers.gestureId !== newGestures[i].handlers.gestureId &&\n (newGestures[i].shouldUseReanimated || handler.shouldUseReanimated)\n ) {\n shouldUpdateSharedValueIfUsed = true;\n }\n\n handler.config = newGestures[i].config;\n handler.handlers = newGestures[i].handlers;\n\n RNGestureHandlerModule.updateGestureHandler(\n handler.handlerTag,\n filterConfig(\n handler.config,\n ALLOWED_PROPS,\n extractGestureRelations(handler)\n )\n );\n\n registerHandler(handler.handlerTag, handler, handler.config.testId);\n }\n\n if (preparedGesture.animatedHandlers && shouldUpdateSharedValueIfUsed) {\n const newHandlersValue = attachedGestures\n .filter((g) => g.shouldUseReanimated) // Ignore gestures that shouldn't run on UI\n .map((g) => g.handlers) as unknown as HandlerCallbacks<\n Record<string, unknown>\n >[];\n\n preparedGesture.animatedHandlers.value = newHandlersValue;\n }\n\n scheduleFlushOperations();\n });\n}\n"]}
1
+ {"version":3,"names":["registerHandler","RNGestureHandlerModule","filterConfig","scheduleFlushOperations","ghQueueMicrotask","extractGestureRelations","checkGestureCallbacksForWorklets","ALLOWED_PROPS","updateHandlers","preparedGesture","gestureConfig","newGestures","prepare","i","length","handler","attachedGestures","handlerTag","handlers","isMounted","shouldUpdateSharedValueIfUsed","gestureId","shouldUseReanimated","config","updateGestureHandler","testId","animatedHandlers","newHandlersValue","filter","g","map","value"],"sourceRoot":"../../../../../src","sources":["handlers/gestures/GestureDetector/updateHandlers.ts"],"mappings":";;AACA,SAASA,eAAe,QAAQ,wBAAwB;AACxD,OAAOC,sBAAsB,MAAM,iCAAiC;AACpE,SAASC,YAAY,EAAEC,uBAAuB,QAAQ,aAAa;AAEnE,SAASC,gBAAgB,QAAQ,2BAA2B;AAE5D,SACEC,uBAAuB,EACvBC,gCAAgC,EAChCC,aAAa,QACR,SAAS;AAEhB,OAAO,SAASC,cAAcA,CAC5BC,eAAqC,EACrCC,aAA4C,EAC5CC,WAA0B,EAC1B;EACAD,aAAa,CAACE,OAAO,CAAC,CAAC;EAEvB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,WAAW,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IAC3C,MAAME,OAAO,GAAGN,eAAe,CAACO,gBAAgB,CAACH,CAAC,CAAC;IACnDP,gCAAgC,CAACS,OAAO,CAAC;;IAEzC;IACA;IACA,IAAIJ,WAAW,CAACE,CAAC,CAAC,CAACI,UAAU,KAAKF,OAAO,CAACE,UAAU,EAAE;MACpDN,WAAW,CAACE,CAAC,CAAC,CAACI,UAAU,GAAGF,OAAO,CAACE,UAAU;MAC9CN,WAAW,CAACE,CAAC,CAAC,CAACK,QAAQ,CAACD,UAAU,GAAGF,OAAO,CAACE,UAAU;IACzD;EACF;;EAEA;EACA,MAAMD,gBAAgB,GAAGP,eAAe,CAACO,gBAAgB;;EAEzD;EACA;EACA;EACAZ,gBAAgB,CAAC,MAAM;IACrB,IAAI,CAACK,eAAe,CAACU,SAAS,EAAE;MAC9B;IACF;;IAEA;IACA,IAAIH,gBAAgB,KAAKP,eAAe,CAACO,g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ignoreList":[]}
@@ -1,122 +1,102 @@
1
+ "use strict";
2
+
1
3
  import { CALLBACK_TYPE } from '../gesture';
2
4
  import { Reanimated } from '../reanimatedWrapper';
3
5
  import { GestureStateManager } from '../gestureStateManager';
4
6
  import { State } from '../../../State';
5
7
  import { TouchEventType } from '../../../TouchEventType';
6
8
  import { tagMessage } from '../../../utils';
7
-
8
9
  function getHandler(type, gesture) {
9
10
  'worklet';
10
11
 
11
12
  switch (type) {
12
13
  case CALLBACK_TYPE.BEGAN:
13
14
  return gesture.onBegin;
14
-
15
15
  case CALLBACK_TYPE.START:
16
16
  return gesture.onStart;
17
-
18
17
  case CALLBACK_TYPE.UPDATE:
19
18
  return gesture.onUpdate;
20
-
21
19
  case CALLBACK_TYPE.CHANGE:
22
20
  return gesture.onChange;
23
-
24
21
  case CALLBACK_TYPE.END:
25
22
  return gesture.onEnd;
26
-
27
23
  case CALLBACK_TYPE.FINALIZE:
28
24
  return gesture.onFinalize;
29
-
30
25
  case CALLBACK_TYPE.TOUCHES_DOWN:
31
26
  return gesture.onTouchesDown;
32
-
33
27
  case CALLBACK_TYPE.TOUCHES_MOVE:
34
28
  return gesture.onTouchesMove;
35
-
36
29
  case CALLBACK_TYPE.TOUCHES_UP:
37
30
  return gesture.onTouchesUp;
38
-
39
31
  case CALLBACK_TYPE.TOUCHES_CANCELLED:
40
32
  return gesture.onTouchesCancelled;
41
33
  }
42
34
  }
43
-
44
35
  function touchEventTypeToCallbackType(eventType) {
45
36
  'worklet';
46
37
 
47
38
  switch (eventType) {
48
39
  case TouchEventType.TOUCHES_DOWN:
49
40
  return CALLBACK_TYPE.TOUCHES_DOWN;
50
-
51
41
  case TouchEventType.TOUCHES_MOVE:
52
42
  return CALLBACK_TYPE.TOUCHES_MOVE;
53
-
54
43
  case TouchEventType.TOUCHES_UP:
55
44
  return CALLBACK_TYPE.TOUCHES_UP;
56
-
57
45
  case TouchEventType.TOUCHES_CANCELLED:
58
46
  return CALLBACK_TYPE.TOUCHES_CANCELLED;
59
47
  }
60
-
61
48
  return CALLBACK_TYPE.UNDEFINED;
62
49
  }
63
-
64
50
  function runWorklet(type, gesture, event, ...args) {
65
51
  'worklet';
66
52
 
67
53
  const handler = getHandler(type, gesture);
68
-
69
54
  if (gesture.isWorklet[type]) {
70
55
  // @ts-ignore Logic below makes sure the correct event is send to the
71
56
  // correct handler.
72
- handler === null || handler === void 0 ? void 0 : handler(event, ...args);
57
+ handler?.(event, ...args);
73
58
  } else if (handler) {
74
59
  console.warn(tagMessage('Animated gesture callback must be a worklet'));
75
60
  }
76
61
  }
77
-
78
62
  function isStateChangeEvent(event) {
79
- 'worklet'; // @ts-ignore Yes, the oldState prop is missing on GestureTouchEvent, that's the point
63
+ 'worklet';
80
64
 
65
+ // @ts-ignore Yes, the oldState prop is missing on GestureTouchEvent, that's the point
81
66
  return event.oldState != null;
82
67
  }
83
-
84
68
  function isTouchEvent(event) {
85
69
  'worklet';
86
70
 
87
71
  return event.eventType != null;
88
72
  }
89
-
90
73
  export function useAnimatedGesture(preparedGesture, needsRebuild) {
91
74
  if (!Reanimated) {
92
75
  return;
93
- } // Hooks are called conditionally, but the condition is whether the
76
+ }
77
+
78
+ // Hooks are called conditionally, but the condition is whether the
94
79
  // react-native-reanimated is installed, which shouldn't change while running
95
80
  // eslint-disable-next-line react-hooks/rules-of-hooks
81
+ const sharedHandlersCallbacks = Reanimated.useSharedValue(null);
96
82
 
83
+ // eslint-disable-next-line react-hooks/rules-of-hooks
84
+ const lastUpdateEvent = Reanimated.useSharedValue([]);
97
85
 
98
- const sharedHandlersCallbacks = Reanimated.useSharedValue(null); // eslint-disable-next-line react-hooks/rules-of-hooks
99
-
100
- const lastUpdateEvent = Reanimated.useSharedValue([]); // not every gesture needs a state controller, init them lazily
101
-
86
+ // not every gesture needs a state controller, init them lazily
102
87
  const stateControllers = [];
103
-
104
88
  const callback = event => {
105
89
  'worklet';
106
90
 
107
91
  const currentCallback = sharedHandlersCallbacks.value;
108
-
109
92
  if (!currentCallback) {
110
93
  return;
111
94
  }
112
-
113
95
  for (let i = 0; i < currentCallback.length; i++) {
114
96
  const gesture = currentCallback[i];
115
-
116
97
  if (event.handlerTag !== gesture.handlerTag) {
117
98
  continue;
118
99
  }
119
-
120
100
  if (isStateChangeEvent(event)) {
121
101
  if (event.oldState === State.UNDETERMINED && event.state === State.BEGAN) {
122
102
  runWorklet(CALLBACK_TYPE.BEGAN, gesture, event);
@@ -127,37 +107,31 @@ export function useAnimatedGesture(preparedGesture, needsRebuild) {
127
107
  if (event.oldState === State.ACTIVE) {
128
108
  runWorklet(CALLBACK_TYPE.END, gesture, event, true);
129
109
  }
130
-
131
110
  runWorklet(CALLBACK_TYPE.FINALIZE, gesture, event, true);
132
111
  } else if ((event.state === State.FAILED || event.state === State.CANCELLED) && event.state !== event.oldState) {
133
112
  if (event.oldState === State.ACTIVE) {
134
113
  runWorklet(CALLBACK_TYPE.END, gesture, event, false);
135
114
  }
136
-
137
115
  runWorklet(CALLBACK_TYPE.FINALIZE, gesture, event, false);
138
116
  }
139
117
  } else if (isTouchEvent(event)) {
140
118
  if (!stateControllers[i]) {
141
119
  stateControllers[i] = GestureStateManager.create(event.handlerTag);
142
120
  }
143
-
144
121
  if (event.eventType !== TouchEventType.UNDETERMINED) {
145
122
  runWorklet(touchEventTypeToCallbackType(event.eventType), gesture, event, stateControllers[i]);
146
123
  }
147
124
  } else {
148
125
  runWorklet(CALLBACK_TYPE.UPDATE, gesture, event);
149
-
150
126
  if (gesture.onChange && gesture.changeEventCalculator) {
151
- var _gesture$changeEventC;
152
-
153
- runWorklet(CALLBACK_TYPE.CHANGE, gesture, (_gesture$changeEventC = gesture.changeEventCalculator) === null || _gesture$changeEventC === void 0 ? void 0 : _gesture$changeEventC.call(gesture, event, lastUpdateEvent.value[gesture.handlerTag]));
127
+ runWorklet(CALLBACK_TYPE.CHANGE, gesture, gesture.changeEventCalculator?.(event, lastUpdateEvent.value[gesture.handlerTag]));
154
128
  lastUpdateEvent.value[gesture.handlerTag] = event;
155
129
  }
156
130
  }
157
131
  }
158
- }; // eslint-disable-next-line react-hooks/rules-of-hooks
159
-
132
+ };
160
133
 
134
+ // eslint-disable-next-line react-hooks/rules-of-hooks
161
135
  const event = Reanimated.useEvent(callback, ['onGestureHandlerStateChange', 'onGestureHandlerEvent'], needsRebuild);
162
136
  preparedGesture.animatedEventHandler = event;
163
137
  preparedGesture.animatedHandlers = sharedHandlersCallbacks;
@@ -1 +1 @@
1
- {"version":3,"sources":["useAnimatedGesture.ts"],"names":["CALLBACK_TYPE","Reanimated","GestureStateManager","State","TouchEventType","tagMessage","getHandler","type","gesture","BEGAN","onBegin","START","onStart","UPDATE","onUpdate","CHANGE","onChange","END","onEnd","FINALIZE","onFinalize","TOUCHES_DOWN","onTouchesDown","TOUCHES_MOVE","onTouchesMove","TOUCHES_UP","onTouchesUp","TOUCHES_CANCELLED","onTouchesCancelled","touchEventTypeToCallbackType","eventType","UNDEFINED","runWorklet","event","args","handler","isWorklet","console","warn","isStateChangeEvent","oldState","isTouchEvent","useAnimatedGesture","preparedGesture","needsRebuild","sharedHandlersCallbacks","useSharedValue","lastUpdateEvent","stateControllers","callback","currentCallback","value","i","length","handlerTag","UNDETERMINED","state","ACTIVE","undefined","FAILED","CANCELLED","create","changeEventCalculator","useEvent","animatedEventHandler","animatedHandlers"],"mappings":"AAAA,SAA2BA,aAA3B,QAAgD,YAAhD;AACA,SAASC,UAAT,QAA2B,sBAA3B;AAMA,SACEC,mBADF,QAGO,wBAHP;AAIA,SAASC,KAAT,QAAsB,gBAAtB;AACA,SAASC,cAAT,QAA+B,yBAA/B;AACA,SAASC,UAAT,QAA2B,gBAA3B;;AAGA,SAASC,UAAT,CACEC,IADF,EAEEC,OAFF,EAGE;AACA;;AACA,UAAQD,IAAR;AACE,SAAKP,aAAa,CAACS,KAAnB;AACE,aAAOD,OAAO,CAACE,OAAf;;AACF,SAAKV,aAAa,CAACW,KAAnB;AACE,aAAOH,OAAO,CAACI,OAAf;;AACF,S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lerCallbacks, CALLBACK_TYPE } from '../gesture';\nimport { Reanimated } from '../reanimatedWrapper';\nimport {\n GestureTouchEvent,\n GestureUpdateEvent,\n GestureStateChangeEvent,\n} from '../../gestureHandlerCommon';\nimport {\n GestureStateManager,\n GestureStateManagerType,\n} from '../gestureStateManager';\nimport { State } from '../../../State';\nimport { TouchEventType } from '../../../TouchEventType';\nimport { tagMessage } from '../../../utils';\nimport { AttachedGestureState } from './types';\n\nfunction getHandler(\n type: CALLBACK_TYPE,\n gesture: HandlerCallbacks<Record<string, unknown>>\n) {\n 'worklet';\n switch (type) {\n case CALLBACK_TYPE.BEGAN:\n return gesture.onBegin;\n case CALLBACK_TYPE.START:\n return gesture.onStart;\n case CALLBACK_TYPE.UPDATE:\n return gesture.onUpdate;\n case CALLBACK_TYPE.CHANGE:\n return gesture.onChange;\n case CALLBACK_TYPE.END:\n return gesture.onEnd;\n case CALLBACK_TYPE.FINALIZE:\n return gesture.onFinalize;\n case CALLBACK_TYPE.TOUCHES_DOWN:\n return gesture.onTouchesDown;\n case CALLBACK_TYPE.TOUCHES_MOVE:\n return gesture.onTouchesMove;\n case CALLBACK_TYPE.TOUCHES_UP:\n return gesture.onTouchesUp;\n case CALLBACK_TYPE.TOUCHES_CANCELLED:\n return gesture.onTouchesCancelled;\n }\n}\n\nfunction touchEventTypeToCallbackType(\n eventType: TouchEventType\n): CALLBACK_TYPE {\n 'worklet';\n switch (eventType) {\n case TouchEventType.TOUCHES_DOWN:\n return CALLBACK_TYPE.TOUCHES_DOWN;\n case TouchEventType.TOUCHES_MOVE:\n return CALLBACK_TYPE.TOUCHES_MOVE;\n case TouchEventType.TOUCHES_UP:\n return CALLBACK_TYPE.TOUCHES_UP;\n case TouchEventType.TOUCHES_CANCELLED:\n return CALLBACK_TYPE.TOUCHES_CANCELLED;\n }\n return CALLBACK_TYPE.UNDEFINED;\n}\n\nfunction runWorklet(\n type: CALLBACK_TYPE,\n gesture: HandlerCallbacks<Record<string, unknown>>,\n event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent,\n ...args: unknown[]\n) {\n 'worklet';\n const handler = getHandler(type, gesture);\n if (gesture.isWorklet[type]) {\n // @ts-ignore Logic below makes sure the correct event is send to the\n // correct handler.\n handler?.(event, ...args);\n } else if (handler) {\n console.warn(tagMessage('Animated gesture callback must be a worklet'));\n }\n}\n\nfunction isStateChangeEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n): event is GestureStateChangeEvent {\n 'worklet';\n // @ts-ignore Yes, the oldState prop is missing on GestureTouchEvent, that's the point\n return event.oldState != null;\n}\n\nfunction isTouchEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n): event is GestureTouchEvent {\n 'worklet';\n return event.eventType != null;\n}\n\nexport function useAnimatedGesture(\n preparedGesture: AttachedGestureState,\n needsRebuild: boolean\n) {\n if (!Reanimated) {\n return;\n }\n\n // Hooks are called conditionally, but the condition is whether the\n // react-native-reanimated is installed, which shouldn't change while running\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const sharedHandlersCallbacks = Reanimated.useSharedValue<\n HandlerCallbacks<Record<string, unknown>>[] | null\n >(null);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const lastUpdateEvent = Reanimated.useSharedValue<\n (GestureUpdateEvent | undefined)[]\n >([]);\n\n // not every gesture needs a state controller, init them lazily\n const stateControllers: GestureStateManagerType[] = [];\n\n const callback = (\n event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent\n ) => {\n 'worklet';\n\n const currentCallback = sharedHandlersCallbacks.value;\n if (!currentCallback) {\n return;\n }\n\n for (let i = 0; i < currentCallback.length; i++) {\n const gesture = currentCallback[i];\n\n if (event.handlerTag !== gesture.handlerTag) {\n continue;\n }\n\n if (isStateChangeEvent(event)) {\n if (\n event.oldState === State.UNDETERMINED &&\n event.state === State.BEGAN\n ) {\n runWorklet(CALLBACK_TYPE.BEGAN, gesture, event);\n } else if (\n (event.oldState === State.BEGAN ||\n event.oldState === State.UNDETERMINED) &&\n event.state === State.ACTIVE\n ) {\n runWorklet(CALLBACK_TYPE.START, gesture, event);\n lastUpdateEvent.value[gesture.handlerTag] = undefined;\n } else if (\n event.oldState !== event.state &&\n event.state === State.END\n ) {\n if (event.oldState === State.ACTIVE) {\n runWorklet(CALLBACK_TYPE.END, gesture, event, true);\n }\n runWorklet(CALLBACK_TYPE.FINALIZE, gesture, event, true);\n } else if (\n (event.state === State.FAILED || event.state === State.CANCELLED) &&\n event.state !== event.oldState\n ) {\n if (event.oldState === State.ACTIVE) {\n runWorklet(CALLBACK_TYPE.END, gesture, event, false);\n }\n runWorklet(CALLBACK_TYPE.FINALIZE, gesture, event, false);\n }\n } else if (isTouchEvent(event)) {\n if (!stateControllers[i]) {\n stateControllers[i] = GestureStateManager.create(event.handlerTag);\n }\n\n if (event.eventType !== TouchEventType.UNDETERMINED) {\n runWorklet(\n touchEventTypeToCallbackType(event.eventType),\n gesture,\n event,\n stateControllers[i]\n );\n }\n } else {\n runWorklet(CALLBACK_TYPE.UPDATE, gesture, event);\n\n if (gesture.onChange && gesture.changeEventCalculator) {\n runWorklet(\n CALLBACK_TYPE.CHANGE,\n gesture,\n gesture.changeEventCalculator?.(\n event,\n lastUpdateEvent.value[gesture.handlerTag]\n )\n );\n\n lastUpdateEvent.value[gesture.handlerTag] = event;\n }\n }\n }\n };\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const event = Reanimated.useEvent(\n callback,\n ['onGestureHandlerStateChange', 'onGestureHandlerEvent'],\n needsRebuild\n );\n\n preparedGesture.animatedEventHandler = event;\n preparedGesture.animatedHandlers = sharedHandlersCallbacks;\n}\n"]}
1
+ {"version":3,"names":["CALLBACK_TYPE","Reanimated","GestureStateManager","State","TouchEventType","tagMessage","getHandler","type","gesture","BEGAN","onBegin","START","onStart","UPDATE","onUpdate","CHANGE","onChange","END","onEnd","FINALIZE","onFinalize","TOUCHES_DOWN","onTouchesDown","TOUCHES_MOVE","onTouchesMove","TOUCHES_UP","onTouchesUp","TOUCHES_CANCELLED","onTouchesCancelled","touchEventTypeToCallbackType","eventType","UNDEFINED","runWorklet","event","args","handler","isWorklet","console","warn","isStateChangeEvent","oldState","isTouchEvent","useAnimatedGesture","preparedGesture","needsRebuild","sharedHandlersCallbacks","useSharedValue","lastUpdateEvent","stateControllers","callback","currentCallback","value","i","length","handlerTag","UNDETERMINED","state","ACTIVE","undefined","FAILED","CANCELLED","create","changeEventCalculator","useEvent","animatedEventHandler","animatedHandlers"],"sourceRoot":"../../../../../src","sources":["handlers/gestures/GestureDetector/useAnimatedGesture.ts"],"mappings":";;AAAA,SAA2BA,aAAa,QAAQ,YAAY;AAC5D,SAASC,UAAU,QAAQ,sBAAsB;AAMjD,SACEC,mBAAmB,QAEd,wBAAwB;AAC/B,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,UAAU,QAAQ,gBAAgB;AAG3C,SAASC,UAAUA,CACjBC,IAAmB,EACnBC,OAAkD,EAClD;EACA,SAAS;;EACT,QAAQD,IAAI;IACV,KAAKP,aAAa,CAACS,KAAK;MACtB,OAAOD,OAAO,CAACE,OAAO;IACxB,KAAKV,aAAa,CAACW,KAAK;MACtB,OAAOH,OAAO,CAACI,OAAO;IACxB,KAAKZ,aAAa,CAACa,MAAM;MACvB,OAAOL,OAAO,CAACM,QAAQ;IACzB,KAAKd,aAAa,CAACe,MAAM;MACvB,OAAOP,OAAO,CAACQ,QAAQ;IACzB,KAAKhB,aAAa,CAACiB,GAAG;MACpB,OAAOT,OAAO,CAACU,KAAK;IACtB,KAAKlB,aAAa,CAACmB,QAAQ;MACzB,OAAOX,OAAO,CAACY,UAAU;IAC3B,KAAKpB,aAAa,CAACqB,YAAY;MAC7B,OAAOb,OAAO,CAACc,aAAa;IAC9B,KAAKtB,aAAa,CAACuB,YAAY;MAC7B,OAAOf,OAAO,CAACgB,aAAa;IAC9B,KAAKxB,aAAa,CAACyB,UAA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AEyB,KAAK,CAAC;QAEhD,IAAIzB,OAAO,CAACQ,QAAQ,IAAIR,OAAO,CAACsD,qBAAqB,EAAE;UACrD9B,UAAU,CACRhC,aAAa,CAACe,MAAM,EACpBP,OAAO,EACPA,OAAO,CAACsD,qBAAqB,GAC3B7B,KAAK,EACLc,eAAe,CAACI,KAAK,CAAC3C,OAAO,CAAC8C,UAAU,CAC1C,CACF,CAAC;UAEDP,eAAe,CAACI,KAAK,CAAC3C,OAAO,CAAC8C,UAAU,CAAC,GAAGrB,KAAK;QACnD;MACF;IACF;EACF,CAAC;;EAED;EACA,MAAMA,KAAK,GAAGhC,UAAU,CAAC8D,QAAQ,CAC/Bd,QAAQ,EACR,CAAC,6BAA6B,EAAE,uBAAuB,CAAC,EACxDL,YACF,CAAC;EAEDD,eAAe,CAACqB,oBAAoB,GAAG/B,KAAK;EAC5CU,eAAe,CAACsB,gBAAgB,GAAGpB,uBAAuB;AAC5D","ignoreList":[]}
@@ -1,21 +1,24 @@
1
+ "use strict";
2
+
1
3
  import { useCallback } from 'react';
2
4
  import { attachHandlers } from './attachHandlers';
3
5
  import { updateHandlers } from './updateHandlers';
4
6
  import { needsToReattach } from './needsToReattach';
5
7
  import { dropHandlers } from './dropHandlers';
6
8
  import { useForceRender, validateDetectorChildren } from './utils';
7
- import findNodeHandle from '../../../findNodeHandle'; // Returns a function that's responsible for updating the attached gestures
9
+ import findNodeHandle from '../../../findNodeHandle';
10
+
11
+ // Returns a function that's responsible for updating the attached gestures
8
12
  // If the view has changed, it will reattach the handlers to the new view
9
13
  // If the view remains the same, it will update the handlers with the new config
10
-
11
14
  export function useDetectorUpdater(state, preparedGesture, gesturesToAttach, gestureConfig, webEventHandlersRef) {
12
15
  const forceRender = useForceRender();
13
- const updateAttachedGestures = useCallback( // skipConfigUpdate is used to prevent unnecessary updates when only checking if the view has changed
16
+ const updateAttachedGestures = useCallback(
17
+ // skipConfigUpdate is used to prevent unnecessary updates when only checking if the view has changed
14
18
  skipConfigUpdate => {
15
19
  // If the underlying view has changed we need to reattach handlers to the new view
16
20
  const viewTag = findNodeHandle(state.viewRef);
17
21
  const didUnderlyingViewChange = viewTag !== state.previousViewTag;
18
-
19
22
  if (didUnderlyingViewChange || needsToReattach(preparedGesture, gesturesToAttach)) {
20
23
  validateDetectorChildren(state.viewRef);
21
24
  dropHandlers(preparedGesture);
@@ -26,7 +29,6 @@ export function useDetectorUpdater(state, preparedGesture, gesturesToAttach, ges
26
29
  webEventHandlersRef,
27
30
  viewTag
28
31
  });
29
-
30
32
  if (didUnderlyingViewChange) {
31
33
  state.previousViewTag = viewTag;
32
34
  state.forceRebuildReanimatedEvent = true;
@@ -1 +1 @@
1
- {"version":3,"sources":["useDetectorUpdater.ts"],"names":["useCallback","attachHandlers","updateHandlers","needsToReattach","dropHandlers","useForceRender","validateDetectorChildren","findNodeHandle","useDetectorUpdater","state","preparedGesture","gesturesToAttach","gestureConfig","webEventHandlersRef","forceRender","updateAttachedGestures","skipConfigUpdate","viewTag","viewRef","didUnderlyingViewChange","previousViewTag","forceRebuildReanimatedEvent"],"mappings":"AAAA,SAAgBA,WAAhB,QAAmC,OAAnC;AASA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,cAAT,EAAyBC,wBAAzB,QAAyD,SAAzD;AACA,OAAOC,cAAP,MAA2B,yBAA3B,C,CAEA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CACLC,KADK,EAELC,eAFK,EAGLC,gBAHK,EAILC,aAJK,EAKLC,mBALK,EAML;AACA,QAAMC,WAAW,GAAGT,cAAc,EAAlC;AACA,QAAMU,sBAAsB,GAAGf,WAAW,EACxC;AACCgB,EAAAA,gBAAD,IAAgC;AAC9B;AACA,UAAMC,OAAO,GAAGV,cAAc,CAACE,KAAK,CAACS,OAAP,CAA9B;AACA,UAAMC,uBAAuB,GAAGF,OAAO,KAAKR,KAAK,CAACW,eAAlD;;AAEA,QACED,uBAAuB,IACvBhB,eAAe,CAACO,eAAD,EAAkBC,gBAAlB,CAFjB,EAGE;AACAL,MAAAA,wBAAwB,CAACG,KAAK,CAACS,OAAP,CAAxB;AACAd,MAAAA,YAAY,CAACM,eAAD,CAAZ;AACAT,MAAAA,cAAc,CAAC;AACbS,QAAAA,eADa;AAEbE,QAAAA,aAFa;AAGbD,QAAAA,gBAHa;AAIbE,QAAAA,mBAJa;AAKbI,QAAAA;AALa,OAAD,CAAd;;AAQA,UAAIE,uBAAJ,EAA6B;AAC3BV,QAAAA,KAAK,CAACW,eAAN,GAAwBH,OAAxB;AACAR,QAAAA,KAAK,CAACY,2BAAN,GAAoC,IAApC;AACAP,QAAAA,WAAW;AACZ;AACF,KAnBD,MAmBO,IAAI,CAACE,gBAAL,EAAuB;AAC5Bd,MAAAA,cAAc,CAACQ,eAAD,EAAkBE,aAAlB,EAAiCD,gBAAjC,CAAd;AACD;AACF,GA7BuC,EA8BxC,CACEG,WADF,EAEEF,aAFF,EAGED,gBAHF,EAIED,eAJF,EAKED,KALF,EAMEI,mBANF,CA9BwC,CAA1C;AAwCA,SAAOE,sBAAP;AACD","sourcesContent":["import React, { useCallback } from 'react';\nimport { GestureType } from '../gesture';\nimport { ComposedGesture } from '../gestureComposition';\n\nimport {\n AttachedGestureState,\n GestureDetectorState,\n WebEventHandler,\n} from './types';\nimport { attachHandlers } from './attachHandlers';\nimport { updateHandlers } from './updateHandlers';\nimport { needsToReattach } from './needsToReattach';\nimport { dropHandlers } from './dropHandlers';\nimport { useForceRender, validateDetectorChildren } from './utils';\nimport findNodeHandle from '../../../findNodeHandle';\n\n// Returns a function that's responsible for updating the attached gestures\n// If the view has changed, it will reattach the handlers to the new view\n// If the view remains the same, it will update the handlers with the new config\nexport function useDetectorUpdater(\n state: GestureDetectorState,\n preparedGesture: AttachedGestureState,\n gesturesToAttach: GestureType[],\n gestureConfig: ComposedGesture | GestureType,\n webEventHandlersRef: React.RefObject<WebEventHandler>\n) {\n const forceRender = useForceRender();\n const updateAttachedGestures = useCallback(\n // skipConfigUpdate is used to prevent unnecessary updates when only checking if the view has changed\n (skipConfigUpdate?: boolean) => {\n // If the underlying view has changed we need to reattach handlers to the new view\n const viewTag = findNodeHandle(state.viewRef) as number;\n const didUnderlyingViewChange = viewTag !== state.previousViewTag;\n\n if (\n didUnderlyingViewChange ||\n needsToReattach(preparedGesture, gesturesToAttach)\n ) {\n validateDetectorChildren(state.viewRef);\n dropHandlers(preparedGesture);\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesturesToAttach,\n webEventHandlersRef,\n viewTag,\n });\n\n if (didUnderlyingViewChange) {\n state.previousViewTag = viewTag;\n state.forceRebuildReanimatedEvent = true;\n forceRender();\n }\n } else if (!skipConfigUpdate) {\n updateHandlers(preparedGesture, gestureConfig, gesturesToAttach);\n }\n },\n [\n forceRender,\n gestureConfig,\n gesturesToAttach,\n preparedGesture,\n state,\n webEventHandlersRef,\n ]\n );\n\n return updateAttachedGestures;\n}\n"]}
1
+ {"version":3,"names":["useCallback","attachHandlers","updateHandlers","needsToReattach","dropHandlers","useForceRender","validateDetectorChildren","findNodeHandle","useDetectorUpdater","state","preparedGesture","gesturesToAttach","gestureConfig","webEventHandlersRef","forceRender","updateAttachedGestures","skipConfigUpdate","viewTag","viewRef","didUnderlyingViewChange","previousViewTag","forceRebuildReanimatedEvent"],"sourceRoot":"../../../../../src","sources":["handlers/gestures/GestureDetector/useDetectorUpdater.ts"],"mappings":";;AAAA,SAAgBA,WAAW,QAAQ,OAAO;AAS1C,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,cAAc,EAAEC,wBAAwB,QAAQ,SAAS;AAClE,OAAOC,cAAc,MAAM,yBAAyB;;AAEpD;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAChCC,KAA2B,EAC3BC,eAAqC,EACrCC,gBAA+B,EAC/BC,aAA4C,EAC5CC,mBAAqD,EACrD;EACA,MAAMC,WAAW,GAAGT,cAAc,CAAC,CAAC;EACpC,MAAMU,sBAAsB,GAAGf,WAAW;EACxC;EACCgB,gBAA0B,IAAK;IAC9B;IACA,MAAMC,OAAO,GAAGV,cAAc,CAACE,KAAK,CAACS,OAAO,CAAW;IACvD,MAAMC,uBAAuB,GAAGF,OAAO,KAAKR,KAAK,CAACW,eAAe;IAEjE,IACED,uBAAuB,IACvBhB,eAAe,CAACO,eAAe,EAAEC,gBAAgB,CAAC,EAClD;MACAL,wBAAwB,CAACG,KAAK,CAACS,OAAO,CAAC;MACvCd,YAAY,CAACM,eAAe,CAAC;MAC7BT,cAAc,CAAC;QACbS,eAAe;QACfE,aAAa;QACbD,gBAAgB;QAChBE,mBAAmB;QACnBI;MACF,CAAC,CAAC;MAEF,IAAIE,uBAAuB,EAAE;QAC3BV,KAAK,CAACW,eAAe,GAAGH,OAAO;QAC/BR,KAAK,CAACY,2BAA2B,GAAG,IAAI;QACxCP,WAAW,CAAC,CAAC;MACf;IACF,CAAC,MAAM,IAAI,CAACE,gBAAgB,EAAE;MAC5Bd,cAAc,CAACQ,eAAe,EAAEE,aAAa,EAAED,gBAAgB,CAAC;IAClE;EACF,CAAC,EACD,CACEG,WAAW,EACXF,aAAa,EACbD,gBAAgB,EAChBD,eAAe,EACfD,KAAK,EACLI,mBAAmB,CAEvB,CAAC;EAED,OAAOE,sBAAsB;AAC/B","ignoreList":[]}
@@ -1,21 +1,19 @@
1
+ "use strict";
2
+
1
3
  import { transformIntoHandlerTags } from '../../utils';
2
4
  import { MountRegistry } from '../../../mountRegistry';
3
5
  import { useEffect } from 'react';
4
-
5
6
  function shouldUpdateDetector(relation, gesture) {
6
7
  if (relation === undefined) {
7
8
  return false;
8
9
  }
9
-
10
10
  for (const tag of transformIntoHandlerTags(relation)) {
11
11
  if (tag === gesture.handlerTag) {
12
12
  return true;
13
13
  }
14
14
  }
15
-
16
15
  return false;
17
16
  }
18
-
19
17
  export function useMountReactions(updateDetector, state) {
20
18
  useEffect(() => {
21
19
  return MountRegistry.addMountListener(gesture => {
@@ -26,10 +24,10 @@ export function useMountReactions(updateDetector, state) {
26
24
  const blocksHandlers = attachedGesture.config.blocksHandlers;
27
25
  const requireToFail = attachedGesture.config.requireToFail;
28
26
  const simultaneousWith = attachedGesture.config.simultaneousWith;
29
-
30
27
  if (shouldUpdateDetector(blocksHandlers, gesture) || shouldUpdateDetector(requireToFail, gesture) || shouldUpdateDetector(simultaneousWith, gesture)) {
31
- updateDetector(); // We can safely return here, if any other gestures should be updated, they will be by the above call
28
+ updateDetector();
32
29
 
30
+ // We can safely return here, if any other gestures should be updated, they will be by the above call
33
31
  return;
34
32
  }
35
33
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useMountReactions.ts"],"names":["transformIntoHandlerTags","MountRegistry","useEffect","shouldUpdateDetector","relation","gesture","undefined","tag","handlerTag","useMountReactions","updateDetector","state","addMountListener","attachedGesture","attachedGestures","blocksHandlers","config","requireToFail","simultaneousWith"],"mappings":"AAAA,SAASA,wBAAT,QAAyC,aAAzC;AACA,SAASC,aAAT,QAA8B,wBAA9B;AAEA,SAASC,SAAT,QAA0B,OAA1B;;AAGA,SAASC,oBAAT,CACEC,QADF,EAEEC,OAFF,EAGE;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1B,WAAO,KAAP;AACD;;AAED,OAAK,MAAMC,GAAX,IAAkBP,wBAAwB,CAACI,QAAD,CAA1C,EAAsD;AACpD,QAAIG,GAAG,KAAKF,OAAO,CAACG,UAApB,EAAgC;AAC9B,aAAO,IAAP;AACD;AACF;;AAED,SAAO,KAAP;AACD;;AAED,OAAO,SAASC,iBAAT,CACLC,cADK,EAELC,KAFK,EAGL;AACAT,EAAAA,SAAS,CAAC,MAAM;AACd,WAAOD,aAAa,CAACW,gBAAd,CAAgCP,OAAD,IAAa;AACjD;AACA;AACA;AACA,WAAK,MAAMQ,eAAX,IAA8BF,KAAK,CAACG,gBAApC,EAAsD;AACpD,cAAMC,cAAc,GAAGF,eAAe,CAACG,MAAhB,CAAuBD,cAA9C;AACA,cAAME,aAAa,GAAGJ,eAAe,CAACG,MAAhB,CAAuBC,aAA7C;AACA,cAAMC,gBAAgB,GAAGL,eAAe,CAACG,MAAhB,CAAuBE,gBAAhD;;AAEA,YACEf,oBAAoB,CAACY,cAAD,EAAiBV,OAAjB,CAApB,IACAF,oBAAoB,CAACc,aAAD,EAAgBZ,OAAhB,CADpB,IAEAF,oBAAoB,CAACe,gBAAD,EAAmBb,OAAnB,CAHtB,EAIE;AACAK,UAAAA,cAAc,GADd,CAGA;;AACA;AACD;AACF;AACF,KApBM,CAAP;AAqBD,GAtBQ,EAsBN,CAACA,cAAD,EAAiBC,KAAjB,CAtBM,CAAT;AAuBD","sourcesContent":["import { transformIntoHandlerTags } from '../../utils';\nimport { MountRegistry } from '../../../mountRegistry';\nimport { AttachedGestureState } from './types';\nimport { useEffect } from 'react';\nimport { GestureRef } from '../gesture';\n\nfunction shouldUpdateDetector(\n relation: GestureRef[] | undefined,\n gesture: { handlerTag: number }\n) {\n if (relation === undefined) {\n return false;\n }\n\n for (const tag of transformIntoHandlerTags(relation)) {\n if (tag === gesture.handlerTag) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function useMountReactions(\n updateDetector: () => void,\n state: AttachedGestureState\n) {\n useEffect(() => {\n return MountRegistry.addMountListener((gesture) => {\n // At this point the ref in the gesture config should be updated, so we can check if one of the gestures\n // set in a relation with the gesture got mounted. If so, we need to update the detector to propagate\n // the changes to the native side.\n for (const attachedGesture of state.attachedGestures) {\n const blocksHandlers = attachedGesture.config.blocksHandlers;\n const requireToFail = attachedGesture.config.requireToFail;\n const simultaneousWith = attachedGesture.config.simultaneousWith;\n\n if (\n shouldUpdateDetector(blocksHandlers, gesture) ||\n shouldUpdateDetector(requireToFail, gesture) ||\n shouldUpdateDetector(simultaneousWith, gesture)\n ) {\n updateDetector();\n\n // We can safely return here, if any other gestures should be updated, they will be by the above call\n return;\n }\n }\n });\n }, [updateDetector, state]);\n}\n"]}
1
+ {"version":3,"names":["transformIntoHandlerTags","MountRegistry","useEffect","shouldUpdateDetector","relation","gesture","undefined","tag","handlerTag","useMountReactions","updateDetector","state","addMountListener","attachedGesture","attachedGestures","blocksHandlers","config","requireToFail","simultaneousWith"],"sourceRoot":"../../../../../src","sources":["handlers/gestures/GestureDetector/useMountReactions.ts"],"mappings":";;AAAA,SAASA,wBAAwB,QAAQ,aAAa;AACtD,SAASC,aAAa,QAAQ,wBAAwB;AAEtD,SAASC,SAAS,QAAQ,OAAO;AAGjC,SAASC,oBAAoBA,CAC3BC,QAAkC,EAClCC,OAA+B,EAC/B;EACA,IAAID,QAAQ,KAAKE,SAAS,EAAE;IAC1B,OAAO,KAAK;EACd;EAEA,KAAK,MAAMC,GAAG,IAAIP,wBAAwB,CAACI,QAAQ,CAAC,EAAE;IACpD,IAAIG,GAAG,KAAKF,OAAO,CAACG,UAAU,EAAE;MAC9B,OAAO,IAAI;IACb;EACF;EAEA,OAAO,KAAK;AACd;AAEA,OAAO,SAASC,iBAAiBA,CAC/BC,cAA0B,EAC1BC,KAA2B,EAC3B;EACAT,SAAS,CAAC,MAAM;IACd,OAAOD,aAAa,CAACW,gBAAgB,CAAEP,OAAO,IAAK;MACjD;MACA;MACA;MACA,KAAK,MAAMQ,eAAe,IAAIF,KAAK,CAACG,gBAAgB,EAAE;QACpD,MAAMC,cAAc,GAAGF,eAAe,CAACG,MAAM,CAACD,cAAc;QAC5D,MAAME,aAAa,GAAGJ,eAAe,CAACG,MAAM,CAACC,aAAa;QAC1D,MAAMC,gBAAgB,GAAGL,eAAe,CAACG,MAAM,CAACE,gBAAgB;QAEhE,IACEf,oBAAoB,CAACY,cAAc,EAAEV,OAAO,CAAC,IAC7CF,oBAAoB,CAACc,aAAa,EAAEZ,OAAO,CAAC,IAC5CF,oBAAoB,CAACe,gBAAgB,EAAEb,OAAO,CAAC,EAC/C;UACAK,cAAc,CAAC,CAAC;;UAEhB;UACA;QACF;MACF;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,CAACA,cAAc,EAAEC,KAAK,CAAC,CAAC;AAC7B","ignoreList":[]}