react-native-gesture-handler 2.22.0 → 2.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (678) hide show
  1. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +14 -0
  2. package/android/src/main/jni/cpp-adapter.cpp +19 -12
  3. package/apple/RNGestureHandler.mm +15 -8
  4. package/apple/RNGestureHandlerModule.mm +17 -5
  5. package/lib/commonjs/ActionType.js +3 -3
  6. package/lib/commonjs/ActionType.js.map +1 -1
  7. package/lib/commonjs/Directions.js +11 -8
  8. package/lib/commonjs/Directions.js.map +1 -1
  9. package/lib/commonjs/EnableNewWebImplementation.js +2 -10
  10. package/lib/commonjs/EnableNewWebImplementation.js.map +1 -1
  11. package/lib/commonjs/GestureHandlerRootViewContext.js +2 -7
  12. package/lib/commonjs/GestureHandlerRootViewContext.js.map +1 -1
  13. package/lib/commonjs/PlatformConstants.js +1 -6
  14. package/lib/commonjs/PlatformConstants.js.map +1 -1
  15. package/lib/commonjs/PlatformConstants.web.js +1 -3
  16. package/lib/commonjs/PlatformConstants.web.js.map +1 -1
  17. package/lib/commonjs/PointerType.js +3 -5
  18. package/lib/commonjs/PointerType.js.map +1 -1
  19. package/lib/commonjs/RNGestureHandlerModule.js +2 -6
  20. package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
  21. package/lib/commonjs/RNGestureHandlerModule.web.js +13 -39
  22. package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
  23. package/lib/commonjs/RNGestureHandlerModule.windows.js +22 -32
  24. package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -1
  25. package/lib/commonjs/RNRenderer.js +1 -3
  26. package/lib/commonjs/RNRenderer.js.map +1 -1
  27. package/lib/commonjs/RNRenderer.web.js +1 -2
  28. package/lib/commonjs/RNRenderer.web.js.map +1 -1
  29. package/lib/commonjs/State.js +4 -3
  30. package/lib/commonjs/State.js.map +1 -1
  31. package/lib/commonjs/TouchEventType.js +3 -3
  32. package/lib/commonjs/TouchEventType.js.map +1 -1
  33. package/lib/commonjs/components/DrawerLayout.js +96 -115
  34. package/lib/commonjs/components/DrawerLayout.js.map +1 -1
  35. package/lib/commonjs/components/GestureButtons.js +36 -80
  36. package/lib/commonjs/components/GestureButtons.js.map +1 -1
  37. package/lib/commonjs/components/GestureButtonsProps.js.map +1 -1
  38. package/lib/commonjs/components/GestureComponents.js +26 -37
  39. package/lib/commonjs/components/GestureComponents.js.map +1 -1
  40. package/lib/commonjs/components/GestureComponents.web.js +13 -27
  41. package/lib/commonjs/components/GestureComponents.web.js.map +1 -1
  42. package/lib/commonjs/components/GestureHandlerButton.js +2 -6
  43. package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
  44. package/lib/commonjs/components/GestureHandlerButton.web.js +4 -12
  45. package/lib/commonjs/components/GestureHandlerButton.web.js.map +1 -1
  46. package/lib/commonjs/components/GestureHandlerRootView.android.js +4 -15
  47. package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -1
  48. package/lib/commonjs/components/GestureHandlerRootView.js +4 -14
  49. package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
  50. package/lib/commonjs/components/GestureHandlerRootView.web.js +4 -13
  51. package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -1
  52. package/lib/commonjs/components/Pressable/Pressable.js +46 -78
  53. package/lib/commonjs/components/Pressable/Pressable.js.map +1 -1
  54. package/lib/commonjs/components/Pressable/PressableProps.js.map +1 -1
  55. package/lib/commonjs/components/Pressable/index.js +1 -3
  56. package/lib/commonjs/components/Pressable/index.js.map +1 -1
  57. package/lib/commonjs/components/Pressable/utils.js +5 -20
  58. package/lib/commonjs/components/Pressable/utils.js.map +1 -1
  59. package/lib/commonjs/components/ReanimatedDrawerLayout.js +38 -76
  60. package/lib/commonjs/components/ReanimatedDrawerLayout.js.map +1 -1
  61. package/lib/commonjs/components/ReanimatedSwipeable.js +133 -98
  62. package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -1
  63. package/lib/commonjs/components/Swipeable.js +34 -75
  64. package/lib/commonjs/components/Swipeable.js.map +1 -1
  65. package/lib/commonjs/components/Text.js +18 -26
  66. package/lib/commonjs/components/Text.js.map +1 -1
  67. package/lib/commonjs/components/gestureHandlerRootHOC.js +5 -14
  68. package/lib/commonjs/components/gestureHandlerRootHOC.js.map +1 -1
  69. package/lib/commonjs/components/touchables/GenericTouchable.js +40 -76
  70. package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
  71. package/lib/commonjs/components/touchables/GenericTouchableProps.js.map +1 -1
  72. package/lib/commonjs/components/touchables/TouchableHighlight.js +20 -33
  73. package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -1
  74. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +17 -31
  75. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
  76. package/lib/commonjs/components/touchables/TouchableNativeFeedback.js +5 -4
  77. package/lib/commonjs/components/touchables/TouchableNativeFeedback.js.map +1 -1
  78. package/lib/commonjs/components/touchables/TouchableNativeFeedbackProps.js.map +1 -1
  79. package/lib/commonjs/components/touchables/TouchableOpacity.js +17 -24
  80. package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -1
  81. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +12 -13
  82. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -1
  83. package/lib/commonjs/components/touchables/index.js +7 -12
  84. package/lib/commonjs/components/touchables/index.js.map +1 -1
  85. package/lib/commonjs/findNodeHandle.js +1 -4
  86. package/lib/commonjs/findNodeHandle.js.map +1 -1
  87. package/lib/commonjs/findNodeHandle.web.js +9 -10
  88. package/lib/commonjs/findNodeHandle.web.js.map +1 -1
  89. package/lib/commonjs/getReactNativeVersion.js +1 -6
  90. package/lib/commonjs/getReactNativeVersion.js.map +1 -1
  91. package/lib/commonjs/getReactNativeVersion.web.js +0 -1
  92. package/lib/commonjs/getReactNativeVersion.web.js.map +1 -1
  93. package/lib/commonjs/getShadowNodeFromRef.js +13 -14
  94. package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
  95. package/lib/commonjs/getShadowNodeFromRef.web.js +0 -1
  96. package/lib/commonjs/getShadowNodeFromRef.web.js.map +1 -1
  97. package/lib/commonjs/ghQueueMicrotask.js +1 -2
  98. package/lib/commonjs/ghQueueMicrotask.js.map +1 -1
  99. package/lib/commonjs/handlers/FlingGestureHandler.js +16 -10
  100. package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -1
  101. package/lib/commonjs/handlers/ForceTouchGestureHandler.js +20 -23
  102. package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -1
  103. package/lib/commonjs/handlers/GestureHandlerEventPayload.js.map +1 -1
  104. package/lib/commonjs/handlers/LongPressGestureHandler.js +16 -10
  105. package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -1
  106. package/lib/commonjs/handlers/NativeViewGestureHandler.js +17 -12
  107. package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -1
  108. package/lib/commonjs/handlers/PanGestureHandler.js +20 -31
  109. package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
  110. package/lib/commonjs/handlers/PinchGestureHandler.js +14 -8
  111. package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -1
  112. package/lib/commonjs/handlers/PressabilityDebugView.js +0 -1
  113. package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -1
  114. package/lib/commonjs/handlers/PressabilityDebugView.web.js +0 -1
  115. package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +1 -1
  116. package/lib/commonjs/handlers/RotationGestureHandler.js +14 -8
  117. package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -1
  118. package/lib/commonjs/handlers/TapGestureHandler.js +16 -10
  119. package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -1
  120. package/lib/commonjs/handlers/createHandler.js +55 -135
  121. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  122. package/lib/commonjs/handlers/createNativeWrapper.js +33 -32
  123. package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -1
  124. package/lib/commonjs/handlers/customDirectEventTypes.js +0 -1
  125. package/lib/commonjs/handlers/customDirectEventTypes.js.map +1 -1
  126. package/lib/commonjs/handlers/customDirectEventTypes.web.js +1 -2
  127. package/lib/commonjs/handlers/customDirectEventTypes.web.js.map +1 -1
  128. package/lib/commonjs/handlers/gestureHandlerCommon.js +9 -10
  129. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
  130. package/lib/commonjs/handlers/gestureHandlerTypesCompat.js.map +1 -1
  131. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js +5 -14
  132. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
  133. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.web.js +10 -20
  134. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.web.js.map +1 -1
  135. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +9 -29
  136. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  137. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +1 -10
  138. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  139. package/lib/commonjs/handlers/gestures/GestureDetector/index.js +12 -37
  140. package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
  141. package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js +0 -3
  142. package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -1
  143. package/lib/commonjs/handlers/gestures/GestureDetector/types.js.map +1 -1
  144. package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js +12 -24
  145. package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
  146. package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js +12 -48
  147. package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -1
  148. package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js +3 -13
  149. package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
  150. package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js +2 -9
  151. package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -1
  152. package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js +8 -16
  153. package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -1
  154. package/lib/commonjs/handlers/gestures/GestureDetector/utils.js +28 -56
  155. package/lib/commonjs/handlers/gestures/GestureDetector/utils.js.map +1 -1
  156. package/lib/commonjs/handlers/gestures/eventReceiver.js +14 -46
  157. package/lib/commonjs/handlers/gestures/eventReceiver.js.map +1 -1
  158. package/lib/commonjs/handlers/gestures/flingGesture.js +5 -12
  159. package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -1
  160. package/lib/commonjs/handlers/gestures/forceTouchGesture.js +8 -19
  161. package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -1
  162. package/lib/commonjs/handlers/gestures/gesture.js +44 -84
  163. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
  164. package/lib/commonjs/handlers/gestures/gestureComposition.js +17 -31
  165. package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -1
  166. package/lib/commonjs/handlers/gestures/gestureObjects.js +1 -27
  167. package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -1
  168. package/lib/commonjs/handlers/gestures/gestureStateManager.js +3 -9
  169. package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -1
  170. package/lib/commonjs/handlers/gestures/gestureStateManager.web.js +2 -7
  171. package/lib/commonjs/handlers/gestures/gestureStateManager.web.js.map +1 -1
  172. package/lib/commonjs/handlers/gestures/hoverGesture.js +11 -25
  173. package/lib/commonjs/handlers/gestures/hoverGesture.js.map +1 -1
  174. package/lib/commonjs/handlers/gestures/longPressGesture.js +6 -14
  175. package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
  176. package/lib/commonjs/handlers/gestures/manualGesture.js +0 -6
  177. package/lib/commonjs/handlers/gestures/manualGesture.js.map +1 -1
  178. package/lib/commonjs/handlers/gestures/nativeGesture.js +5 -12
  179. package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -1
  180. package/lib/commonjs/handlers/gestures/panGesture.js +18 -43
  181. package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -1
  182. package/lib/commonjs/handlers/gestures/pinchGesture.js +2 -9
  183. package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -1
  184. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +1 -8
  185. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -1
  186. package/lib/commonjs/handlers/gestures/rotationGesture.js +2 -9
  187. package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -1
  188. package/lib/commonjs/handlers/gestures/tapGesture.js +10 -22
  189. package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
  190. package/lib/commonjs/handlers/getNextHandlerTag.js +0 -1
  191. package/lib/commonjs/handlers/getNextHandlerTag.js.map +1 -1
  192. package/lib/commonjs/handlers/handlersRegistry.js +11 -21
  193. package/lib/commonjs/handlers/handlersRegistry.js.map +1 -1
  194. package/lib/commonjs/handlers/utils.js +6 -26
  195. package/lib/commonjs/handlers/utils.js.map +1 -1
  196. package/lib/commonjs/index.js +75 -104
  197. package/lib/commonjs/index.js.map +1 -1
  198. package/lib/commonjs/init.js +4 -11
  199. package/lib/commonjs/init.js.map +1 -1
  200. package/lib/commonjs/jestUtils/index.js +4 -5
  201. package/lib/commonjs/jestUtils/index.js.map +1 -1
  202. package/lib/commonjs/jestUtils/jestUtils.js +19 -83
  203. package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
  204. package/lib/commonjs/mocks.js +5 -15
  205. package/lib/commonjs/mocks.js.map +1 -1
  206. package/lib/commonjs/mountRegistry.js +3 -12
  207. package/lib/commonjs/mountRegistry.js.map +1 -1
  208. package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +1 -5
  209. package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -1
  210. package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +2 -7
  211. package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
  212. package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +2 -7
  213. package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -1
  214. package/lib/commonjs/typeUtils.js.map +1 -1
  215. package/lib/commonjs/utils.js +15 -30
  216. package/lib/commonjs/utils.js.map +1 -1
  217. package/lib/commonjs/web/Gestures.js +5 -23
  218. package/lib/commonjs/web/Gestures.js.map +1 -1
  219. package/lib/commonjs/web/constants.js +2 -4
  220. package/lib/commonjs/web/constants.js.map +1 -1
  221. package/lib/commonjs/web/detectors/RotationGestureDetector.js +26 -62
  222. package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -1
  223. package/lib/commonjs/web/detectors/ScaleGestureDetector.js +36 -65
  224. package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
  225. package/lib/commonjs/web/handlers/FlingGestureHandler.js +12 -55
  226. package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
  227. package/lib/commonjs/web/handlers/GestureHandler.js +160 -273
  228. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  229. package/lib/commonjs/web/handlers/HoverGestureHandler.js +8 -21
  230. package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -1
  231. package/lib/commonjs/web/handlers/IGestureHandler.js.map +1 -1
  232. package/lib/commonjs/web/handlers/LongPressGestureHandler.js +12 -53
  233. package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
  234. package/lib/commonjs/web/handlers/ManualGestureHandler.js +1 -11
  235. package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
  236. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +21 -62
  237. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
  238. package/lib/commonjs/web/handlers/PanGestureHandler.js +23 -138
  239. package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
  240. package/lib/commonjs/web/handlers/PinchGestureHandler.js +19 -56
  241. package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
  242. package/lib/commonjs/web/handlers/RotationGestureHandler.js +16 -54
  243. package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
  244. package/lib/commonjs/web/handlers/TapGestureHandler.js +10 -71
  245. package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
  246. package/lib/commonjs/web/interfaces.js +9 -17
  247. package/lib/commonjs/web/interfaces.js.map +1 -1
  248. package/lib/commonjs/web/tools/CircularBuffer.js +17 -29
  249. package/lib/commonjs/web/tools/CircularBuffer.js.map +1 -1
  250. package/lib/commonjs/web/tools/EventManager.js +7 -41
  251. package/lib/commonjs/web/tools/EventManager.js.map +1 -1
  252. package/lib/commonjs/web/tools/GestureHandlerDelegate.js.map +1 -1
  253. package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +51 -118
  254. package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
  255. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +37 -58
  256. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  257. package/lib/commonjs/web/tools/InteractionManager.js +21 -40
  258. package/lib/commonjs/web/tools/InteractionManager.js.map +1 -1
  259. package/lib/commonjs/web/tools/KeyboardEventManager.js +4 -26
  260. package/lib/commonjs/web/tools/KeyboardEventManager.js.map +1 -1
  261. package/lib/commonjs/web/tools/LeastSquareSolver.js +30 -67
  262. package/lib/commonjs/web/tools/LeastSquareSolver.js.map +1 -1
  263. package/lib/commonjs/web/tools/NodeManager.js +9 -16
  264. package/lib/commonjs/web/tools/NodeManager.js.map +1 -1
  265. package/lib/commonjs/web/tools/PointerEventManager.js +10 -45
  266. package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
  267. package/lib/commonjs/web/tools/PointerTracker.js +24 -60
  268. package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
  269. package/lib/commonjs/web/tools/Vector.js +3 -18
  270. package/lib/commonjs/web/tools/Vector.js.map +1 -1
  271. package/lib/commonjs/web/tools/VelocityTracker.js +10 -32
  272. package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -1
  273. package/lib/commonjs/web/tools/WheelEventManager.js +4 -17
  274. package/lib/commonjs/web/tools/WheelEventManager.js.map +1 -1
  275. package/lib/commonjs/web/utils.js +26 -55
  276. package/lib/commonjs/web/utils.js.map +1 -1
  277. package/lib/commonjs/web_hammer/DiscreteGestureHandler.js +7 -19
  278. package/lib/commonjs/web_hammer/DiscreteGestureHandler.js.map +1 -1
  279. package/lib/commonjs/web_hammer/DraggingGestureHandler.js +3 -13
  280. package/lib/commonjs/web_hammer/DraggingGestureHandler.js.map +1 -1
  281. package/lib/commonjs/web_hammer/Errors.js +0 -3
  282. package/lib/commonjs/web_hammer/Errors.js.map +1 -1
  283. package/lib/commonjs/web_hammer/FlingGestureHandler.js +13 -44
  284. package/lib/commonjs/web_hammer/FlingGestureHandler.js.map +1 -1
  285. package/lib/commonjs/web_hammer/GestureHandler.js +55 -142
  286. package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
  287. package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js +2 -11
  288. package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js.map +1 -1
  289. package/lib/commonjs/web_hammer/LongPressGestureHandler.js +5 -19
  290. package/lib/commonjs/web_hammer/LongPressGestureHandler.js.map +1 -1
  291. package/lib/commonjs/web_hammer/NativeViewGestureHandler.js +16 -24
  292. package/lib/commonjs/web_hammer/NativeViewGestureHandler.js.map +1 -1
  293. package/lib/commonjs/web_hammer/NodeManager.js +9 -16
  294. package/lib/commonjs/web_hammer/NodeManager.js.map +1 -1
  295. package/lib/commonjs/web_hammer/PanGestureHandler.js +8 -49
  296. package/lib/commonjs/web_hammer/PanGestureHandler.js.map +1 -1
  297. package/lib/commonjs/web_hammer/PinchGestureHandler.js +2 -11
  298. package/lib/commonjs/web_hammer/PinchGestureHandler.js.map +1 -1
  299. package/lib/commonjs/web_hammer/PressGestureHandler.js +15 -43
  300. package/lib/commonjs/web_hammer/PressGestureHandler.js.map +1 -1
  301. package/lib/commonjs/web_hammer/RotationGestureHandler.js +2 -13
  302. package/lib/commonjs/web_hammer/RotationGestureHandler.js.map +1 -1
  303. package/lib/commonjs/web_hammer/TapGestureHandler.js +33 -52
  304. package/lib/commonjs/web_hammer/TapGestureHandler.js.map +1 -1
  305. package/lib/commonjs/web_hammer/constants.js +13 -26
  306. package/lib/commonjs/web_hammer/constants.js.map +1 -1
  307. package/lib/commonjs/web_hammer/utils.js +4 -14
  308. package/lib/commonjs/web_hammer/utils.js.map +1 -1
  309. package/lib/module/ActionType.js +3 -1
  310. package/lib/module/ActionType.js.map +1 -1
  311. package/lib/module/Directions.js +9 -3
  312. package/lib/module/Directions.js.map +1 -1
  313. package/lib/module/EnableNewWebImplementation.js +2 -5
  314. package/lib/module/EnableNewWebImplementation.js.map +1 -1
  315. package/lib/module/GestureHandlerRootViewContext.js.map +1 -1
  316. package/lib/module/PlatformConstants.js +0 -1
  317. package/lib/module/PlatformConstants.js.map +1 -1
  318. package/lib/module/PlatformConstants.web.js +0 -1
  319. package/lib/module/PlatformConstants.web.js.map +1 -1
  320. package/lib/module/PointerType.js +3 -4
  321. package/lib/module/PointerType.js.map +1 -1
  322. package/lib/module/RNGestureHandlerModule.js +1 -0
  323. package/lib/module/RNGestureHandlerModule.js.map +1 -1
  324. package/lib/module/RNGestureHandlerModule.web.js +12 -22
  325. package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
  326. package/lib/module/RNGestureHandlerModule.windows.js +18 -17
  327. package/lib/module/RNGestureHandlerModule.windows.js.map +1 -1
  328. package/lib/module/RNRenderer.js.map +1 -1
  329. package/lib/module/RNRenderer.web.js.map +1 -1
  330. package/lib/module/State.js +4 -1
  331. package/lib/module/State.js.map +1 -1
  332. package/lib/module/TouchEventType.js +3 -1
  333. package/lib/module/TouchEventType.js.map +1 -1
  334. package/lib/module/components/DrawerLayout.js +87 -99
  335. package/lib/module/components/DrawerLayout.js.map +1 -1
  336. package/lib/module/components/GestureButtons.js +27 -55
  337. package/lib/module/components/GestureButtons.js.map +1 -1
  338. package/lib/module/components/GestureButtonsProps.js.map +1 -1
  339. package/lib/module/components/GestureComponents.js +17 -12
  340. package/lib/module/components/GestureComponents.js.map +1 -1
  341. package/lib/module/components/GestureComponents.web.js +4 -4
  342. package/lib/module/components/GestureComponents.web.js.map +1 -1
  343. package/lib/module/components/GestureHandlerButton.js.map +1 -1
  344. package/lib/module/components/GestureHandlerButton.web.js +1 -2
  345. package/lib/module/components/GestureHandlerButton.web.js.map +1 -1
  346. package/lib/module/components/GestureHandlerRootView.android.js +1 -2
  347. package/lib/module/components/GestureHandlerRootView.android.js.map +1 -1
  348. package/lib/module/components/GestureHandlerRootView.js +1 -2
  349. package/lib/module/components/GestureHandlerRootView.js.map +1 -1
  350. package/lib/module/components/GestureHandlerRootView.web.js +1 -2
  351. package/lib/module/components/GestureHandlerRootView.web.js.map +1 -1
  352. package/lib/module/components/Pressable/Pressable.js +44 -61
  353. package/lib/module/components/Pressable/Pressable.js.map +1 -1
  354. package/lib/module/components/Pressable/PressableProps.js.map +1 -1
  355. package/lib/module/components/Pressable/index.js.map +1 -1
  356. package/lib/module/components/Pressable/utils.js +4 -14
  357. package/lib/module/components/Pressable/utils.js.map +1 -1
  358. package/lib/module/components/ReanimatedDrawerLayout.js +34 -56
  359. package/lib/module/components/ReanimatedDrawerLayout.js.map +1 -1
  360. package/lib/module/components/ReanimatedSwipeable.js +130 -84
  361. package/lib/module/components/ReanimatedSwipeable.js.map +1 -1
  362. package/lib/module/components/Swipeable.js +28 -59
  363. package/lib/module/components/Swipeable.js.map +1 -1
  364. package/lib/module/components/Text.js +14 -13
  365. package/lib/module/components/Text.js.map +1 -1
  366. package/lib/module/components/gestureHandlerRootHOC.js +2 -2
  367. package/lib/module/components/gestureHandlerRootHOC.js.map +1 -1
  368. package/lib/module/components/touchables/GenericTouchable.js +34 -63
  369. package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
  370. package/lib/module/components/touchables/GenericTouchableProps.js.map +1 -1
  371. package/lib/module/components/touchables/TouchableHighlight.js +16 -23
  372. package/lib/module/components/touchables/TouchableHighlight.js.map +1 -1
  373. package/lib/module/components/touchables/TouchableNativeFeedback.android.js +11 -19
  374. package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
  375. package/lib/module/components/touchables/TouchableNativeFeedback.js +6 -1
  376. package/lib/module/components/touchables/TouchableNativeFeedback.js.map +1 -1
  377. package/lib/module/components/touchables/TouchableNativeFeedbackProps.js.map +1 -1
  378. package/lib/module/components/touchables/TouchableOpacity.js +13 -14
  379. package/lib/module/components/touchables/TouchableOpacity.js.map +1 -1
  380. package/lib/module/components/touchables/TouchableWithoutFeedback.js +9 -2
  381. package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +1 -1
  382. package/lib/module/components/touchables/index.js.map +1 -1
  383. package/lib/module/findNodeHandle.js.map +1 -1
  384. package/lib/module/findNodeHandle.web.js +9 -8
  385. package/lib/module/findNodeHandle.web.js.map +1 -1
  386. package/lib/module/getReactNativeVersion.js.map +1 -1
  387. package/lib/module/getReactNativeVersion.web.js.map +1 -1
  388. package/lib/module/getShadowNodeFromRef.js +13 -13
  389. package/lib/module/getShadowNodeFromRef.js.map +1 -1
  390. package/lib/module/getShadowNodeFromRef.web.js.map +1 -1
  391. package/lib/module/ghQueueMicrotask.js.map +1 -1
  392. package/lib/module/handlers/FlingGestureHandler.js +13 -0
  393. package/lib/module/handlers/FlingGestureHandler.js.map +1 -1
  394. package/lib/module/handlers/ForceTouchGestureHandler.js +16 -8
  395. package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -1
  396. package/lib/module/handlers/GestureHandlerEventPayload.js.map +1 -1
  397. package/lib/module/handlers/LongPressGestureHandler.js +13 -0
  398. package/lib/module/handlers/LongPressGestureHandler.js.map +1 -1
  399. package/lib/module/handlers/NativeViewGestureHandler.js +13 -0
  400. package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -1
  401. package/lib/module/handlers/PanGestureHandler.js +15 -19
  402. package/lib/module/handlers/PanGestureHandler.js.map +1 -1
  403. package/lib/module/handlers/PinchGestureHandler.js +13 -0
  404. package/lib/module/handlers/PinchGestureHandler.js.map +1 -1
  405. package/lib/module/handlers/PressabilityDebugView.js.map +1 -1
  406. package/lib/module/handlers/PressabilityDebugView.web.js.map +1 -1
  407. package/lib/module/handlers/RotationGestureHandler.js +13 -0
  408. package/lib/module/handlers/RotationGestureHandler.js.map +1 -1
  409. package/lib/module/handlers/TapGestureHandler.js +13 -0
  410. package/lib/module/handlers/TapGestureHandler.js.map +1 -1
  411. package/lib/module/handlers/createHandler.js +54 -108
  412. package/lib/module/handlers/createHandler.js.map +1 -1
  413. package/lib/module/handlers/createNativeWrapper.js +28 -22
  414. package/lib/module/handlers/createNativeWrapper.js.map +1 -1
  415. package/lib/module/handlers/customDirectEventTypes.js.map +1 -1
  416. package/lib/module/handlers/customDirectEventTypes.web.js.map +1 -1
  417. package/lib/module/handlers/gestureHandlerCommon.js +9 -4
  418. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
  419. package/lib/module/handlers/gestureHandlerTypesCompat.js.map +1 -1
  420. package/lib/module/handlers/gestures/GestureDetector/Wrap.js +3 -4
  421. package/lib/module/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
  422. package/lib/module/handlers/gestures/GestureDetector/Wrap.web.js +5 -6
  423. package/lib/module/handlers/gestures/GestureDetector/Wrap.web.js.map +1 -1
  424. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +8 -16
  425. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  426. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +0 -1
  427. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  428. package/lib/module/handlers/gestures/GestureDetector/index.js +9 -15
  429. package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
  430. package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js +0 -2
  431. package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -1
  432. package/lib/module/handlers/gestures/GestureDetector/types.js.map +1 -1
  433. package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js +11 -14
  434. package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
  435. package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js +12 -39
  436. package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -1
  437. package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js +5 -5
  438. package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
  439. package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js +2 -6
  440. package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -1
  441. package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js +7 -9
  442. package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -1
  443. package/lib/module/handlers/gestures/GestureDetector/utils.js +25 -30
  444. package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -1
  445. package/lib/module/handlers/gestures/eventReceiver.js +14 -38
  446. package/lib/module/handlers/gestures/eventReceiver.js.map +1 -1
  447. package/lib/module/handlers/gestures/flingGesture.js +5 -9
  448. package/lib/module/handlers/gestures/flingGesture.js.map +1 -1
  449. package/lib/module/handlers/gestures/forceTouchGesture.js +8 -17
  450. package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -1
  451. package/lib/module/handlers/gestures/gesture.js +44 -73
  452. package/lib/module/handlers/gestures/gesture.js.map +1 -1
  453. package/lib/module/handlers/gestures/gestureComposition.js +16 -24
  454. package/lib/module/handlers/gestures/gestureComposition.js.map +1 -1
  455. package/lib/module/handlers/gestures/gestureObjects.js +1 -14
  456. package/lib/module/handlers/gestures/gestureObjects.js.map +1 -1
  457. package/lib/module/handlers/gestures/gestureStateManager.js +3 -4
  458. package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
  459. package/lib/module/handlers/gestures/gestureStateManager.web.js +0 -1
  460. package/lib/module/handlers/gestures/gestureStateManager.web.js.map +1 -1
  461. package/lib/module/handlers/gestures/hoverGesture.js +9 -18
  462. package/lib/module/handlers/gestures/hoverGesture.js.map +1 -1
  463. package/lib/module/handlers/gestures/longPressGesture.js +6 -11
  464. package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
  465. package/lib/module/handlers/gestures/manualGesture.js +0 -4
  466. package/lib/module/handlers/gestures/manualGesture.js.map +1 -1
  467. package/lib/module/handlers/gestures/nativeGesture.js +5 -9
  468. package/lib/module/handlers/gestures/nativeGesture.js.map +1 -1
  469. package/lib/module/handlers/gestures/panGesture.js +18 -41
  470. package/lib/module/handlers/gestures/panGesture.js.map +1 -1
  471. package/lib/module/handlers/gestures/pinchGesture.js +2 -7
  472. package/lib/module/handlers/gestures/pinchGesture.js.map +1 -1
  473. package/lib/module/handlers/gestures/reanimatedWrapper.js +0 -5
  474. package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
  475. package/lib/module/handlers/gestures/rotationGesture.js +2 -7
  476. package/lib/module/handlers/gestures/rotationGesture.js.map +1 -1
  477. package/lib/module/handlers/gestures/tapGesture.js +10 -19
  478. package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
  479. package/lib/module/handlers/getNextHandlerTag.js.map +1 -1
  480. package/lib/module/handlers/handlersRegistry.js +6 -8
  481. package/lib/module/handlers/handlersRegistry.js.map +1 -1
  482. package/lib/module/handlers/utils.js +4 -13
  483. package/lib/module/handlers/utils.js.map +1 -1
  484. package/lib/module/index.js.map +1 -1
  485. package/lib/module/init.js +3 -2
  486. package/lib/module/init.js.map +1 -1
  487. package/lib/module/jestUtils/index.js.map +1 -1
  488. package/lib/module/jestUtils/jestUtils.js +20 -66
  489. package/lib/module/jestUtils/jestUtils.js.map +1 -1
  490. package/lib/module/mocks.js +3 -7
  491. package/lib/module/mocks.js.map +1 -1
  492. package/lib/module/mountRegistry.js +3 -10
  493. package/lib/module/mountRegistry.js.map +1 -1
  494. package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -1
  495. package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
  496. package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -1
  497. package/lib/module/typeUtils.js.map +1 -1
  498. package/lib/module/utils.js +8 -13
  499. package/lib/module/utils.js.map +1 -1
  500. package/lib/module/web/Gestures.js +2 -1
  501. package/lib/module/web/Gestures.js.map +1 -1
  502. package/lib/module/web/constants.js.map +1 -1
  503. package/lib/module/web/detectors/RotationGestureDetector.js +26 -59
  504. package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -1
  505. package/lib/module/web/detectors/ScaleGestureDetector.js +36 -61
  506. package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
  507. package/lib/module/web/handlers/FlingGestureHandler.js +11 -45
  508. package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
  509. package/lib/module/web/handlers/GestureHandler.js +159 -259
  510. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  511. package/lib/module/web/handlers/HoverGestureHandler.js +7 -13
  512. package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
  513. package/lib/module/web/handlers/IGestureHandler.js.map +1 -1
  514. package/lib/module/web/handlers/LongPressGestureHandler.js +11 -46
  515. package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
  516. package/lib/module/web/handlers/ManualGestureHandler.js +0 -6
  517. package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
  518. package/lib/module/web/handlers/NativeViewGestureHandler.js +20 -54
  519. package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
  520. package/lib/module/web/handlers/PanGestureHandler.js +22 -129
  521. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
  522. package/lib/module/web/handlers/PinchGestureHandler.js +18 -48
  523. package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
  524. package/lib/module/web/handlers/RotationGestureHandler.js +15 -46
  525. package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
  526. package/lib/module/web/handlers/TapGestureHandler.js +9 -63
  527. package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
  528. package/lib/module/web/interfaces.js +9 -14
  529. package/lib/module/web/interfaces.js.map +1 -1
  530. package/lib/module/web/tools/CircularBuffer.js +17 -27
  531. package/lib/module/web/tools/CircularBuffer.js.map +1 -1
  532. package/lib/module/web/tools/EventManager.js +7 -39
  533. package/lib/module/web/tools/EventManager.js.map +1 -1
  534. package/lib/module/web/tools/GestureHandlerDelegate.js.map +1 -1
  535. package/lib/module/web/tools/GestureHandlerOrchestrator.js +50 -111
  536. package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
  537. package/lib/module/web/tools/GestureHandlerWebDelegate.js +36 -47
  538. package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  539. package/lib/module/web/tools/InteractionManager.js +21 -35
  540. package/lib/module/web/tools/InteractionManager.js.map +1 -1
  541. package/lib/module/web/tools/KeyboardEventManager.js +3 -19
  542. package/lib/module/web/tools/KeyboardEventManager.js.map +1 -1
  543. package/lib/module/web/tools/LeastSquareSolver.js +30 -65
  544. package/lib/module/web/tools/LeastSquareSolver.js.map +1 -1
  545. package/lib/module/web/tools/NodeManager.js +9 -14
  546. package/lib/module/web/tools/NodeManager.js.map +1 -1
  547. package/lib/module/web/tools/PointerEventManager.js +9 -35
  548. package/lib/module/web/tools/PointerEventManager.js.map +1 -1
  549. package/lib/module/web/tools/PointerTracker.js +23 -54
  550. package/lib/module/web/tools/PointerTracker.js.map +1 -1
  551. package/lib/module/web/tools/Vector.js +3 -14
  552. package/lib/module/web/tools/Vector.js.map +1 -1
  553. package/lib/module/web/tools/VelocityTracker.js +9 -26
  554. package/lib/module/web/tools/VelocityTracker.js.map +1 -1
  555. package/lib/module/web/tools/WheelEventManager.js +3 -10
  556. package/lib/module/web/tools/WheelEventManager.js.map +1 -1
  557. package/lib/module/web/utils.js +21 -40
  558. package/lib/module/web/utils.js.map +1 -1
  559. package/lib/module/web_hammer/DiscreteGestureHandler.js +4 -13
  560. package/lib/module/web_hammer/DiscreteGestureHandler.js.map +1 -1
  561. package/lib/module/web_hammer/DraggingGestureHandler.js +0 -5
  562. package/lib/module/web_hammer/DraggingGestureHandler.js.map +1 -1
  563. package/lib/module/web_hammer/Errors.js +0 -1
  564. package/lib/module/web_hammer/Errors.js.map +1 -1
  565. package/lib/module/web_hammer/FlingGestureHandler.js +10 -35
  566. package/lib/module/web_hammer/FlingGestureHandler.js.map +1 -1
  567. package/lib/module/web_hammer/GestureHandler.js +53 -130
  568. package/lib/module/web_hammer/GestureHandler.js.map +1 -1
  569. package/lib/module/web_hammer/IndiscreteGestureHandler.js +1 -6
  570. package/lib/module/web_hammer/IndiscreteGestureHandler.js.map +1 -1
  571. package/lib/module/web_hammer/LongPressGestureHandler.js +2 -11
  572. package/lib/module/web_hammer/LongPressGestureHandler.js.map +1 -1
  573. package/lib/module/web_hammer/NativeViewGestureHandler.js +12 -12
  574. package/lib/module/web_hammer/NativeViewGestureHandler.js.map +1 -1
  575. package/lib/module/web_hammer/NodeManager.js +6 -8
  576. package/lib/module/web_hammer/NodeManager.js.map +1 -1
  577. package/lib/module/web_hammer/PanGestureHandler.js +6 -40
  578. package/lib/module/web_hammer/PanGestureHandler.js.map +1 -1
  579. package/lib/module/web_hammer/PinchGestureHandler.js +0 -5
  580. package/lib/module/web_hammer/PinchGestureHandler.js.map +1 -1
  581. package/lib/module/web_hammer/PressGestureHandler.js +13 -34
  582. package/lib/module/web_hammer/PressGestureHandler.js.map +1 -1
  583. package/lib/module/web_hammer/RotationGestureHandler.js +0 -6
  584. package/lib/module/web_hammer/RotationGestureHandler.js.map +1 -1
  585. package/lib/module/web_hammer/TapGestureHandler.js +31 -45
  586. package/lib/module/web_hammer/TapGestureHandler.js.map +1 -1
  587. package/lib/module/web_hammer/constants.js +2 -1
  588. package/lib/module/web_hammer/constants.js.map +1 -1
  589. package/lib/module/web_hammer/utils.js +2 -2
  590. package/lib/module/web_hammer/utils.js.map +1 -1
  591. package/lib/typescript/components/DrawerLayout.d.ts +27 -0
  592. package/lib/typescript/components/GestureButtonsProps.d.ts +18 -2
  593. package/lib/typescript/components/Pressable/PressableProps.d.ts +3 -10
  594. package/lib/typescript/components/Pressable/index.d.ts +1 -1
  595. package/lib/typescript/components/ReanimatedSwipeable.d.ts +6 -0
  596. package/lib/typescript/components/touchables/TouchableHighlight.d.ts +5 -0
  597. package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +2 -0
  598. package/lib/typescript/components/touchables/TouchableNativeFeedback.d.ts +5 -1
  599. package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.d.ts +3 -0
  600. package/lib/typescript/components/touchables/TouchableOpacity.d.ts +5 -0
  601. package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +6 -0
  602. package/lib/typescript/handlers/FlingGestureHandler.d.ts +9 -0
  603. package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +9 -0
  604. package/lib/typescript/handlers/LongPressGestureHandler.d.ts +9 -0
  605. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +9 -0
  606. package/lib/typescript/handlers/PanGestureHandler.d.ts +9 -0
  607. package/lib/typescript/handlers/PinchGestureHandler.d.ts +9 -0
  608. package/lib/typescript/handlers/RotationGestureHandler.d.ts +9 -0
  609. package/lib/typescript/handlers/TapGestureHandler.d.ts +9 -0
  610. package/lib/typescript/handlers/handlersRegistry.d.ts +1 -0
  611. package/lib/typescript/index.d.ts +1 -1
  612. package/lib/typescript/utils.d.ts +1 -1
  613. package/lib/typescript/web/detectors/RotationGestureDetector.d.ts +7 -7
  614. package/lib/typescript/web/detectors/ScaleGestureDetector.d.ts +8 -8
  615. package/lib/typescript/web/handlers/GestureHandler.d.ts +33 -28
  616. package/lib/typescript/web/handlers/IGestureHandler.d.ts +12 -13
  617. package/lib/typescript/web/tools/CircularBuffer.d.ts +3 -3
  618. package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +1 -1
  619. package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +2 -2
  620. package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +3 -2
  621. package/lib/typescript/web/tools/InteractionManager.d.ts +2 -2
  622. package/lib/typescript/web/tools/NodeManager.d.ts +1 -1
  623. package/lib/typescript/web/tools/PointerTracker.d.ts +4 -4
  624. package/lib/typescript/web/tools/VelocityTracker.d.ts +1 -1
  625. package/package.json +2 -2
  626. package/src/RNGestureHandlerModule.web.ts +2 -2
  627. package/src/components/DrawerLayout.tsx +29 -0
  628. package/src/components/GestureButtons.tsx +13 -2
  629. package/src/components/GestureButtonsProps.ts +31 -2
  630. package/src/components/Pressable/Pressable.tsx +22 -5
  631. package/src/components/Pressable/PressableProps.tsx +4 -11
  632. package/src/components/Pressable/index.ts +4 -1
  633. package/src/components/ReanimatedSwipeable.tsx +194 -113
  634. package/src/components/Text.tsx +13 -4
  635. package/src/components/touchables/TouchableHighlight.tsx +5 -0
  636. package/src/components/touchables/TouchableNativeFeedback.android.tsx +2 -0
  637. package/src/components/touchables/TouchableNativeFeedback.tsx +6 -1
  638. package/src/components/touchables/TouchableNativeFeedbackProps.tsx +3 -0
  639. package/src/components/touchables/TouchableOpacity.tsx +5 -0
  640. package/src/components/touchables/TouchableWithoutFeedback.tsx +6 -0
  641. package/src/findNodeHandle.web.ts +6 -0
  642. package/src/handlers/FlingGestureHandler.ts +10 -0
  643. package/src/handlers/ForceTouchGestureHandler.ts +9 -0
  644. package/src/handlers/LongPressGestureHandler.ts +10 -0
  645. package/src/handlers/NativeViewGestureHandler.ts +10 -0
  646. package/src/handlers/PanGestureHandler.ts +10 -0
  647. package/src/handlers/PinchGestureHandler.ts +10 -0
  648. package/src/handlers/RotationGestureHandler.ts +10 -0
  649. package/src/handlers/TapGestureHandler.ts +10 -0
  650. package/src/handlers/createHandler.tsx +11 -4
  651. package/src/handlers/createNativeWrapper.tsx +10 -4
  652. package/src/handlers/gestures/GestureDetector/index.tsx +2 -2
  653. package/src/handlers/gestures/GestureDetector/useViewRefHandler.ts +3 -3
  654. package/src/handlers/gestures/GestureDetector/utils.ts +2 -2
  655. package/src/handlers/handlersRegistry.ts +7 -3
  656. package/src/index.ts +4 -1
  657. package/src/utils.ts +2 -2
  658. package/src/web/detectors/RotationGestureDetector.ts +22 -22
  659. package/src/web/detectors/ScaleGestureDetector.ts +24 -24
  660. package/src/web/handlers/FlingGestureHandler.ts +6 -7
  661. package/src/web/handlers/GestureHandler.ts +115 -105
  662. package/src/web/handlers/HoverGestureHandler.ts +2 -2
  663. package/src/web/handlers/IGestureHandler.ts +12 -13
  664. package/src/web/handlers/LongPressGestureHandler.ts +7 -7
  665. package/src/web/handlers/NativeViewGestureHandler.ts +14 -19
  666. package/src/web/handlers/PanGestureHandler.ts +17 -17
  667. package/src/web/handlers/PinchGestureHandler.ts +17 -21
  668. package/src/web/handlers/RotationGestureHandler.ts +12 -12
  669. package/src/web/handlers/TapGestureHandler.ts +4 -6
  670. package/src/web/tools/CircularBuffer.ts +15 -15
  671. package/src/web/tools/GestureHandlerDelegate.ts +1 -1
  672. package/src/web/tools/GestureHandlerOrchestrator.ts +42 -42
  673. package/src/web/tools/GestureHandlerWebDelegate.ts +32 -13
  674. package/src/web/tools/InteractionManager.ts +16 -16
  675. package/src/web/tools/NodeManager.ts +2 -2
  676. package/src/web/tools/PointerTracker.ts +20 -20
  677. package/src/web/tools/Vector.ts +1 -1
  678. package/src/web/tools/VelocityTracker.ts +1 -1
@@ -5,49 +5,46 @@ import { ghQueueMicrotask } from '../../../ghQueueMicrotask';
5
5
  import { extractGestureRelations, checkGestureCallbacksForWorklets, ALLOWED_PROPS } from './utils';
6
6
  export function updateHandlers(preparedGesture, gestureConfig, newGestures) {
7
7
  gestureConfig.prepare();
8
-
9
8
  for (let i = 0; i < newGestures.length; i++) {
10
9
  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
10
+ checkGestureCallbacksForWorklets(handler);
13
11
 
12
+ // Only update handlerTag when it's actually different, it may be the same
13
+ // if gesture config object is wrapped with useMemo
14
14
  if (newGestures[i].handlerTag !== handler.handlerTag) {
15
15
  newGestures[i].handlerTag = handler.handlerTag;
16
16
  newGestures[i].handlers.handlerTag = handler.handlerTag;
17
17
  }
18
- } // Use queueMicrotask to extract handlerTags, because when it's ran, all refs should be updated
18
+ }
19
+
20
+ // Use queueMicrotask to extract handlerTags, because when it's ran, all refs should be updated
19
21
  // and handlerTags in BaseGesture references should be updated in the loop above (we need to wait
20
22
  // in case of external relations)
21
-
22
-
23
23
  ghQueueMicrotask(() => {
24
24
  if (!preparedGesture.isMounted) {
25
25
  return;
26
- } // If amount of gesture configs changes, we need to update the callbacks in shared value
27
-
26
+ }
28
27
 
28
+ // If amount of gesture configs changes, we need to update the callbacks in shared value
29
29
  let shouldUpdateSharedValueIfUsed = preparedGesture.attachedGestures.length !== newGestures.length;
30
-
31
30
  for (let i = 0; i < newGestures.length; i++) {
32
- const handler = preparedGesture.attachedGestures[i]; // If the gestureId is different (gesture isn't wrapped with useMemo or its dependencies changed),
33
- // we need to update the shared value, assuming the gesture runs on UI thread or the thread changed
31
+ const handler = preparedGesture.attachedGestures[i];
34
32
 
33
+ // If the gestureId is different (gesture isn't wrapped with useMemo or its dependencies changed),
34
+ // we need to update the shared value, assuming the gesture runs on UI thread or the thread changed
35
35
  if (handler.handlers.gestureId !== newGestures[i].handlers.gestureId && (newGestures[i].shouldUseReanimated || handler.shouldUseReanimated)) {
36
36
  shouldUpdateSharedValueIfUsed = true;
37
37
  }
38
-
39
38
  handler.config = newGestures[i].config;
40
39
  handler.handlers = newGestures[i].handlers;
41
40
  RNGestureHandlerModule.updateGestureHandler(handler.handlerTag, filterConfig(handler.config, ALLOWED_PROPS, extractGestureRelations(handler)));
42
41
  registerHandler(handler.handlerTag, handler, handler.config.testId);
43
42
  }
44
-
45
43
  if (preparedGesture.animatedHandlers && shouldUpdateSharedValueIfUsed) {
46
44
  const newHandlersValue = preparedGesture.attachedGestures.filter(g => g.shouldUseReanimated) // Ignore gestures that shouldn't run on UI
47
45
  .map(g => g.handlers);
48
46
  preparedGesture.animatedHandlers.value = newHandlersValue;
49
47
  }
50
-
51
48
  scheduleFlushOperations();
52
49
  });
53
50
  }
@@ -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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B,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,GAAGlB,eAAe,CAACO,gBAAhB,CACtBY,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,GA/Ce,CAAhB;AAgDD","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 // 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 // If amount of gesture configs changes, we need to update the callbacks in shared value\n let shouldUpdateSharedValueIfUsed =\n preparedGesture.attachedGestures.length !== newGestures.length;\n\n for (let i = 0; i < newGestures.length; i++) {\n const handler = preparedGesture.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 = preparedGesture.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"],"sources":["updateHandlers.ts"],"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 // 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 // If amount of gesture configs changes, we need to update the callbacks in shared value\n let shouldUpdateSharedValueIfUsed =\n preparedGesture.attachedGestures.length !== newGestures.length;\n\n for (let i = 0; i < newGestures.length; i++) {\n const handler = preparedGesture.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 = preparedGesture.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"],"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;EACA;EACAb,gBAAgB,CAAC,MAAM;IACrB,IAAI,CAACK,eAAe,CAACU,SAAS,EAAE;MAC9B;IACF;;IAEA;IACA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","ignoreList":[]}
@@ -4,119 +4,97 @@ import { GestureStateManager } from '../gestureStateManager';
4
4
  import { State } from '../../../State';
5
5
  import { TouchEventType } from '../../../TouchEventType';
6
6
  import { tagMessage } from '../../../utils';
7
-
8
7
  function getHandler(type, gesture) {
9
8
  'worklet';
10
9
 
11
10
  switch (type) {
12
11
  case CALLBACK_TYPE.BEGAN:
13
12
  return gesture.onBegin;
14
-
15
13
  case CALLBACK_TYPE.START:
16
14
  return gesture.onStart;
17
-
18
15
  case CALLBACK_TYPE.UPDATE:
19
16
  return gesture.onUpdate;
20
-
21
17
  case CALLBACK_TYPE.CHANGE:
22
18
  return gesture.onChange;
23
-
24
19
  case CALLBACK_TYPE.END:
25
20
  return gesture.onEnd;
26
-
27
21
  case CALLBACK_TYPE.FINALIZE:
28
22
  return gesture.onFinalize;
29
-
30
23
  case CALLBACK_TYPE.TOUCHES_DOWN:
31
24
  return gesture.onTouchesDown;
32
-
33
25
  case CALLBACK_TYPE.TOUCHES_MOVE:
34
26
  return gesture.onTouchesMove;
35
-
36
27
  case CALLBACK_TYPE.TOUCHES_UP:
37
28
  return gesture.onTouchesUp;
38
-
39
29
  case CALLBACK_TYPE.TOUCHES_CANCELLED:
40
30
  return gesture.onTouchesCancelled;
41
31
  }
42
32
  }
43
-
44
33
  function touchEventTypeToCallbackType(eventType) {
45
34
  'worklet';
46
35
 
47
36
  switch (eventType) {
48
37
  case TouchEventType.TOUCHES_DOWN:
49
38
  return CALLBACK_TYPE.TOUCHES_DOWN;
50
-
51
39
  case TouchEventType.TOUCHES_MOVE:
52
40
  return CALLBACK_TYPE.TOUCHES_MOVE;
53
-
54
41
  case TouchEventType.TOUCHES_UP:
55
42
  return CALLBACK_TYPE.TOUCHES_UP;
56
-
57
43
  case TouchEventType.TOUCHES_CANCELLED:
58
44
  return CALLBACK_TYPE.TOUCHES_CANCELLED;
59
45
  }
60
-
61
46
  return CALLBACK_TYPE.UNDEFINED;
62
47
  }
63
-
64
48
  function runWorklet(type, gesture, event, ...args) {
65
49
  'worklet';
66
50
 
67
51
  const handler = getHandler(type, gesture);
68
-
69
52
  if (gesture.isWorklet[type]) {
70
53
  // @ts-ignore Logic below makes sure the correct event is send to the
71
54
  // correct handler.
72
- handler === null || handler === void 0 ? void 0 : handler(event, ...args);
55
+ handler === null || handler === void 0 || handler(event, ...args);
73
56
  } else if (handler) {
74
57
  console.warn(tagMessage('Animated gesture callback must be a worklet'));
75
58
  }
76
59
  }
77
-
78
60
  function isStateChangeEvent(event) {
79
- 'worklet'; // @ts-ignore Yes, the oldState prop is missing on GestureTouchEvent, that's the point
61
+ 'worklet';
80
62
 
63
+ // @ts-ignore Yes, the oldState prop is missing on GestureTouchEvent, that's the point
81
64
  return event.oldState != null;
82
65
  }
83
-
84
66
  function isTouchEvent(event) {
85
67
  'worklet';
86
68
 
87
69
  return event.eventType != null;
88
70
  }
89
-
90
71
  export function useAnimatedGesture(preparedGesture, needsRebuild) {
91
72
  if (!Reanimated) {
92
73
  return;
93
- } // Hooks are called conditionally, but the condition is whether the
74
+ }
75
+
76
+ // Hooks are called conditionally, but the condition is whether the
94
77
  // react-native-reanimated is installed, which shouldn't change while running
95
78
  // eslint-disable-next-line react-hooks/rules-of-hooks
79
+ const sharedHandlersCallbacks = Reanimated.useSharedValue(null);
96
80
 
81
+ // eslint-disable-next-line react-hooks/rules-of-hooks
82
+ const lastUpdateEvent = Reanimated.useSharedValue([]);
97
83
 
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
-
84
+ // not every gesture needs a state controller, init them lazily
102
85
  const stateControllers = [];
103
-
104
86
  const callback = event => {
105
87
  'worklet';
106
88
 
107
89
  const currentCallback = sharedHandlersCallbacks.value;
108
-
109
90
  if (!currentCallback) {
110
91
  return;
111
92
  }
112
-
113
93
  for (let i = 0; i < currentCallback.length; i++) {
114
94
  const gesture = currentCallback[i];
115
-
116
95
  if (event.handlerTag !== gesture.handlerTag) {
117
96
  continue;
118
97
  }
119
-
120
98
  if (isStateChangeEvent(event)) {
121
99
  if (event.oldState === State.UNDETERMINED && event.state === State.BEGAN) {
122
100
  runWorklet(CALLBACK_TYPE.BEGAN, gesture, event);
@@ -127,37 +105,32 @@ export function useAnimatedGesture(preparedGesture, needsRebuild) {
127
105
  if (event.oldState === State.ACTIVE) {
128
106
  runWorklet(CALLBACK_TYPE.END, gesture, event, true);
129
107
  }
130
-
131
108
  runWorklet(CALLBACK_TYPE.FINALIZE, gesture, event, true);
132
109
  } else if ((event.state === State.FAILED || event.state === State.CANCELLED) && event.state !== event.oldState) {
133
110
  if (event.oldState === State.ACTIVE) {
134
111
  runWorklet(CALLBACK_TYPE.END, gesture, event, false);
135
112
  }
136
-
137
113
  runWorklet(CALLBACK_TYPE.FINALIZE, gesture, event, false);
138
114
  }
139
115
  } else if (isTouchEvent(event)) {
140
116
  if (!stateControllers[i]) {
141
117
  stateControllers[i] = GestureStateManager.create(event.handlerTag);
142
118
  }
143
-
144
119
  if (event.eventType !== TouchEventType.UNDETERMINED) {
145
120
  runWorklet(touchEventTypeToCallbackType(event.eventType), gesture, event, stateControllers[i]);
146
121
  }
147
122
  } else {
148
123
  runWorklet(CALLBACK_TYPE.UPDATE, gesture, event);
149
-
150
124
  if (gesture.onChange && gesture.changeEventCalculator) {
151
125
  var _gesture$changeEventC;
152
-
153
126
  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]));
154
127
  lastUpdateEvent.value[gesture.handlerTag] = event;
155
128
  }
156
129
  }
157
130
  }
158
- }; // eslint-disable-next-line react-hooks/rules-of-hooks
159
-
131
+ };
160
132
 
133
+ // eslint-disable-next-line react-hooks/rules-of-hooks
161
134
  const event = Reanimated.useEvent(callback, ['onGestureHandlerStateChange', 'onGestureHandlerEvent'], needsRebuild);
162
135
  preparedGesture.animatedEventHandler = event;
163
136
  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,SAAKZ,aAAa,CAACa,MAAnB;AACE,aAAOL,OAAO,CAACM,QAAf;;AACF,SAAKd,aAAa,CAACe,MAAnB;AACE,aAAOP,OAAO,CAACQ,QAAf;;AACF,SAAKhB,aAAa,CAACiB,GAAnB;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B;AACxBJ,UAAAA,gBAAgB,CAACI,CAAD,CAAhB,GAAsBlD,mBAAmB,CAAC2D,MAApB,CAA2B5B,KAAK,CAACqB,UAAjC,CAAtB;AACD;;AAED,YAAIrB,KAAK,CAACH,SAAN,KAAoB1B,cAAc,CAACmD,YAAvC,EAAqD;AACnDvB,UAAAA,UAAU,CACRH,4BAA4B,CAACI,KAAK,CAACH,SAAP,CADpB,EAERtB,OAFQ,EAGRyB,KAHQ,EAIRe,gBAAgB,CAACI,CAAD,CAJR,CAAV;AAMD;AACF,OAbM,MAaA;AACLpB,QAAAA,UAAU,CAAChC,aAAa,CAACa,MAAf,EAAuBL,OAAvB,EAAgCyB,KAAhC,CAAV;;AAEA,YAAIzB,OAAO,CAACQ,QAAR,IAAoBR,OAAO,CAACsD,qBAAhC,EAAuD;AAAA;;AACrD9B,UAAAA,UAAU,CACRhC,aAAa,CAACe,MADN,EAERP,OAFQ,2BAGRA,OAAO,CAACsD,qBAHA,0DAGR,2BAAAtD,OAAO,EACLyB,KADK,EAELc,eAAe,CAACI,KAAhB,CAAsB3C,OAAO,CAAC8C,UAA9B,CAFK,CAHC,CAAV;AASAP,UAAAA,eAAe,CAACI,KAAhB,CAAsB3C,OAAO,CAAC8C,UAA9B,IAA4CrB,KAA5C;AACD;AACF;AACF;AACF,GA7ED,CApBA,CAmGA;;;AACA,QAAMA,KAAK,GAAGhC,UAAU,CAAC8D,QAAX,CACZd,QADY,EAEZ,CAAC,6BAAD,EAAgC,uBAAhC,CAFY,EAGZL,YAHY,CAAd;AAMAD,EAAAA,eAAe,CAACqB,oBAAhB,GAAuC/B,KAAvC;AACAU,EAAAA,eAAe,CAACsB,gBAAhB,GAAmCpB,uBAAnC;AACD","sourcesContent":["import { HandlerCallbacks, 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","_gesture$changeEventC","call","useEvent","animatedEventHandler","animatedHandlers"],"sources":["useAnimatedGesture.ts"],"sourcesContent":["import { HandlerCallbacks, 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 = sharedH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AC1C,CACF,CAAC;UAEDP,eAAe,CAACI,KAAK,CAAC3C,OAAO,CAAC8C,UAAU,CAAC,GAAGrB,KAAK;QACnD;MACF;IACF;EACF,CAAC;;EAED;EACA,MAAMA,KAAK,GAAGhC,UAAU,CAACgE,QAAQ,CAC/BhB,QAAQ,EACR,CAAC,6BAA6B,EAAE,uBAAuB,CAAC,EACxDL,YACF,CAAC;EAEDD,eAAe,CAACuB,oBAAoB,GAAGjC,KAAK;EAC5CU,eAAe,CAACwB,gBAAgB,GAAGtB,uBAAuB;AAC5D","ignoreList":[]}
@@ -4,18 +4,19 @@ import { updateHandlers } from './updateHandlers';
4
4
  import { needsToReattach } from './needsToReattach';
5
5
  import { dropHandlers } from './dropHandlers';
6
6
  import { useForceRender, validateDetectorChildren } from './utils';
7
- import findNodeHandle from '../../../findNodeHandle'; // Returns a function that's responsible for updating the attached gestures
7
+ import findNodeHandle from '../../../findNodeHandle';
8
+
9
+ // Returns a function that's responsible for updating the attached gestures
8
10
  // If the view has changed, it will reattach the handlers to the new view
9
11
  // If the view remains the same, it will update the handlers with the new config
10
-
11
12
  export function useDetectorUpdater(state, preparedGesture, gesturesToAttach, gestureConfig, webEventHandlersRef) {
12
13
  const forceRender = useForceRender();
13
- const updateAttachedGestures = useCallback( // skipConfigUpdate is used to prevent unnecessary updates when only checking if the view has changed
14
+ const updateAttachedGestures = useCallback(
15
+ // skipConfigUpdate is used to prevent unnecessary updates when only checking if the view has changed
14
16
  skipConfigUpdate => {
15
17
  // If the underlying view has changed we need to reattach handlers to the new view
16
18
  const viewTag = findNodeHandle(state.viewRef);
17
19
  const didUnderlyingViewChange = viewTag !== state.previousViewTag;
18
-
19
20
  if (didUnderlyingViewChange || needsToReattach(preparedGesture, gesturesToAttach)) {
20
21
  validateDetectorChildren(state.viewRef);
21
22
  dropHandlers(preparedGesture);
@@ -26,7 +27,6 @@ export function useDetectorUpdater(state, preparedGesture, gesturesToAttach, ges
26
27
  webEventHandlersRef,
27
28
  viewTag
28
29
  });
29
-
30
30
  if (didUnderlyingViewChange) {
31
31
  state.previousViewTag = viewTag;
32
32
  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"],"sources":["useDetectorUpdater.ts"],"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"],"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,17 @@
1
1
  import { transformIntoHandlerTags } from '../../utils';
2
2
  import { MountRegistry } from '../../../mountRegistry';
3
3
  import { useEffect } from 'react';
4
-
5
4
  function shouldUpdateDetector(relation, gesture) {
6
5
  if (relation === undefined) {
7
6
  return false;
8
7
  }
9
-
10
8
  for (const tag of transformIntoHandlerTags(relation)) {
11
9
  if (tag === gesture.handlerTag) {
12
10
  return true;
13
11
  }
14
12
  }
15
-
16
13
  return false;
17
14
  }
18
-
19
15
  export function useMountReactions(updateDetector, state) {
20
16
  useEffect(() => {
21
17
  return MountRegistry.addMountListener(gesture => {
@@ -26,10 +22,10 @@ export function useMountReactions(updateDetector, state) {
26
22
  const blocksHandlers = attachedGesture.config.blocksHandlers;
27
23
  const requireToFail = attachedGesture.config.requireToFail;
28
24
  const simultaneousWith = attachedGesture.config.simultaneousWith;
29
-
30
25
  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
26
+ updateDetector();
32
27
 
28
+ // We can safely return here, if any other gestures should be updated, they will be by the above call
33
29
  return;
34
30
  }
35
31
  }
@@ -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"],"sources":["useMountReactions.ts"],"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"],"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":[]}
@@ -10,23 +10,21 @@ export function useViewRefHandler(state, updateAttachedGestures) {
10
10
  if (ref === null) {
11
11
  return;
12
12
  }
13
+ state.viewRef = ref;
13
14
 
14
- state.viewRef = ref; // if it's the first render, also set the previousViewTag to prevent reattaching gestures when not needed
15
-
15
+ // if it's the first render, also set the previousViewTag to prevent reattaching gestures when not needed
16
16
  if (state.previousViewTag === -1) {
17
17
  state.previousViewTag = findNodeHandle(state.viewRef);
18
- } // Pass true as `skipConfigUpdate`. Here we only want to trigger the eventual reattaching of handlers
19
- // in case the view has changed. If the view doesn't change, the update will be handled by detector.
20
-
18
+ }
21
19
 
20
+ // Pass true as `skipConfigUpdate`. Here we only want to trigger the eventual reattaching of handlers
21
+ // in case the view has changed. If the view doesn't change, the update will be handled by detector.
22
22
  if (!state.firstRender) {
23
23
  updateAttachedGestures(true);
24
24
  }
25
-
26
- if (__DEV__ && isFabric() && global.isFormsStackingContext) {
25
+ if (__DEV__ && isFabric() && global.isViewFlatteningDisabled) {
27
26
  const node = getShadowNodeFromRef(ref);
28
-
29
- if (global.isFormsStackingContext(node) === false) {
27
+ if (global.isViewFlatteningDisabled(node) === false) {
30
28
  console.error(tagMessage('GestureDetector has received a child that may get view-flattened. ' + '\nTo prevent it from misbehaving you need to wrap the child with a `<View collapsable={false}>`.'));
31
29
  }
32
30
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useViewRefHandler.ts"],"names":["isFabric","tagMessage","getShadowNodeFromRef","useCallback","findNodeHandle","useViewRefHandler","state","updateAttachedGestures","refHandler","ref","viewRef","previousViewTag","firstRender","__DEV__","global","isFormsStackingContext","node","console","error"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,UAAnB,QAAqC,gBAArC;AACA,SAASC,oBAAT,QAAqC,+BAArC;AAGA,SAAgBC,WAAhB,QAAmC,OAAnC;AACA,OAAOC,cAAP,MAA2B,yBAA3B;AAMA;AACA;AACA;AACA,OAAO,SAASC,iBAAT,CACLC,KADK,EAELC,sBAFK,EAGL;AACA,QAAMC,UAAU,GAAGL,WAAW,CAC3BM,GAAD,IAAiC;AAC/B,QAAIA,GAAG,KAAK,IAAZ,EAAkB;AAChB;AACD;;AAEDH,IAAAA,KAAK,CAACI,OAAN,GAAgBD,GAAhB,CAL+B,CAO/B;;AACA,QAAIH,KAAK,CAACK,eAAN,KAA0B,CAAC,CAA/B,EAAkC;AAChCL,MAAAA,KAAK,CAACK,eAAN,GAAwBP,cAAc,CAACE,KAAK,CAACI,OAAP,CAAtC;AACD,KAV8B,CAY/B;AACA;;;AACA,QAAI,CAACJ,KAAK,CAACM,WAAX,EAAwB;AACtBL,MAAAA,sBAAsB,CAAC,IAAD,CAAtB;AACD;;AAED,QAAIM,OAAO,IAAIb,QAAQ,EAAnB,IAAyBc,MAAM,CAACC,sBAApC,EAA4D;AAC1D,YAAMC,IAAI,GAAGd,oBAAoB,CAACO,GAAD,CAAjC;;AACA,UAAIK,MAAM,CAACC,sBAAP,CAA8BC,IAA9B,MAAwC,KAA5C,EAAmD;AACjDC,QAAAA,OAAO,CAACC,KAAR,CACEjB,UAAU,CACR,uEACE,kGAFM,CADZ;AAMD;AACF;AACF,GA9B2B,EA+B5B,CAACK,KAAD,EAAQC,sBAAR,CA/B4B,CAA9B;AAkCA,SAAOC,UAAP;AACD","sourcesContent":["import { isFabric, tagMessage } from '../../../utils';\nimport { getShadowNodeFromRef } from '../../../getShadowNodeFromRef';\n\nimport { GestureDetectorState } from './types';\nimport React, { useCallback } from 'react';\nimport findNodeHandle from '../../../findNodeHandle';\n\ndeclare const global: {\n isFormsStackingContext: (node: unknown) => boolean | null; // JSI function\n};\n\n// Ref handler for the Wrap component attached under the GestureDetector.\n// It's responsible for setting the viewRef on the state and triggering the reattaching of handlers\n// if the view has changed.\nexport function useViewRefHandler(\n state: GestureDetectorState,\n updateAttachedGestures: (skipConfigUpdate?: boolean) => void\n) {\n const refHandler = useCallback(\n (ref: React.Component | null) => {\n if (ref === null) {\n return;\n }\n\n state.viewRef = ref;\n\n // if it's the first render, also set the previousViewTag to prevent reattaching gestures when not needed\n if (state.previousViewTag === -1) {\n state.previousViewTag = findNodeHandle(state.viewRef) as number;\n }\n\n // Pass true as `skipConfigUpdate`. Here we only want to trigger the eventual reattaching of handlers\n // in case the view has changed. If the view doesn't change, the update will be handled by detector.\n if (!state.firstRender) {\n updateAttachedGestures(true);\n }\n\n if (__DEV__ && isFabric() && global.isFormsStackingContext) {\n const node = getShadowNodeFromRef(ref);\n if (global.isFormsStackingContext(node) === false) {\n console.error(\n tagMessage(\n 'GestureDetector has received a child that may get view-flattened. ' +\n '\\nTo prevent it from misbehaving you need to wrap the child with a `<View collapsable={false}>`.'\n )\n );\n }\n }\n },\n [state, updateAttachedGestures]\n );\n\n return refHandler;\n}\n"]}
1
+ {"version":3,"names":["isFabric","tagMessage","getShadowNodeFromRef","useCallback","findNodeHandle","useViewRefHandler","state","updateAttachedGestures","refHandler","ref","viewRef","previousViewTag","firstRender","__DEV__","global","isViewFlatteningDisabled","node","console","error"],"sources":["useViewRefHandler.ts"],"sourcesContent":["import { isFabric, tagMessage } from '../../../utils';\nimport { getShadowNodeFromRef } from '../../../getShadowNodeFromRef';\n\nimport { GestureDetectorState } from './types';\nimport React, { useCallback } from 'react';\nimport findNodeHandle from '../../../findNodeHandle';\n\ndeclare const global: {\n isViewFlatteningDisabled: (node: unknown) => boolean | null; // JSI function\n};\n\n// Ref handler for the Wrap component attached under the GestureDetector.\n// It's responsible for setting the viewRef on the state and triggering the reattaching of handlers\n// if the view has changed.\nexport function useViewRefHandler(\n state: GestureDetectorState,\n updateAttachedGestures: (skipConfigUpdate?: boolean) => void\n) {\n const refHandler = useCallback(\n (ref: React.Component | null) => {\n if (ref === null) {\n return;\n }\n\n state.viewRef = ref;\n\n // if it's the first render, also set the previousViewTag to prevent reattaching gestures when not needed\n if (state.previousViewTag === -1) {\n state.previousViewTag = findNodeHandle(state.viewRef) as number;\n }\n\n // Pass true as `skipConfigUpdate`. Here we only want to trigger the eventual reattaching of handlers\n // in case the view has changed. If the view doesn't change, the update will be handled by detector.\n if (!state.firstRender) {\n updateAttachedGestures(true);\n }\n\n if (__DEV__ && isFabric() && global.isViewFlatteningDisabled) {\n const node = getShadowNodeFromRef(ref);\n if (global.isViewFlatteningDisabled(node) === false) {\n console.error(\n tagMessage(\n 'GestureDetector has received a child that may get view-flattened. ' +\n '\\nTo prevent it from misbehaving you need to wrap the child with a `<View collapsable={false}>`.'\n )\n );\n }\n }\n },\n [state, updateAttachedGestures]\n );\n\n return refHandler;\n}\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,UAAU,QAAQ,gBAAgB;AACrD,SAASC,oBAAoB,QAAQ,+BAA+B;AAGpE,SAAgBC,WAAW,QAAQ,OAAO;AAC1C,OAAOC,cAAc,MAAM,yBAAyB;AAMpD;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAC/BC,KAA2B,EAC3BC,sBAA4D,EAC5D;EACA,MAAMC,UAAU,GAAGL,WAAW,CAC3BM,GAA2B,IAAK;IAC/B,IAAIA,GAAG,KAAK,IAAI,EAAE;MAChB;IACF;IAEAH,KAAK,CAACI,OAAO,GAAGD,GAAG;;IAEnB;IACA,IAAIH,KAAK,CAACK,eAAe,KAAK,CAAC,CAAC,EAAE;MAChCL,KAAK,CAACK,eAAe,GAAGP,cAAc,CAACE,KAAK,CAACI,OAAO,CAAW;IACjE;;IAEA;IACA;IACA,IAAI,CAACJ,KAAK,CAACM,WAAW,EAAE;MACtBL,sBAAsB,CAAC,IAAI,CAAC;IAC9B;IAEA,IAAIM,OAAO,IAAIb,QAAQ,CAAC,CAAC,IAAIc,MAAM,CAACC,wBAAwB,EAAE;MAC5D,MAAMC,IAAI,GAAGd,oBAAoB,CAACO,GAAG,CAAC;MACtC,IAAIK,MAAM,CAACC,wBAAwB,CAACC,IAAI,CAAC,KAAK,KAAK,EAAE;QACnDC,OAAO,CAACC,KAAK,CACXjB,UAAU,CACR,oEAAoE,GAClE,kGACJ,CACF,CAAC;MACH;IACF;EACF,CAAC,EACD,CAACK,KAAK,EAAEC,sBAAsB,CAChC,CAAC;EAED,OAAOC,UAAU;AACnB","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import { Platform } from 'react-native';
2
- import { isJestEnv, tagMessage } from '../../../utils';
2
+ import { isTestEnv, tagMessage } from '../../../utils';
3
3
  import { BaseGesture } from '../gesture';
4
4
  import { flingGestureHandlerProps } from '../../FlingGestureHandler';
5
5
  import { forceTouchGestureHandlerProps } from '../../ForceTouchGestureHandler';
@@ -16,7 +16,6 @@ import { useCallback, useRef, useState } from 'react';
16
16
  import { Reanimated } from '../reanimatedWrapper';
17
17
  import { onGestureHandlerEvent } from '../eventReceiver';
18
18
  export const ALLOWED_PROPS = [...baseGestureHandlerWithDetectorProps, ...tapGestureHandlerProps, ...panGestureHandlerProps, ...panGestureHandlerCustomNativeProps, ...longPressGestureHandlerProps, ...forceTouchGestureHandlerProps, ...flingGestureHandlerProps, ...hoverGestureHandlerProps, ...nativeViewGestureHandlerProps];
19
-
20
19
  function convertToHandlerTag(ref) {
21
20
  if (typeof ref === 'number') {
22
21
  return ref;
@@ -24,19 +23,15 @@ function convertToHandlerTag(ref) {
24
23
  return ref.handlerTag;
25
24
  } else {
26
25
  var _ref$current$handlerT, _ref$current;
27
-
28
26
  // @ts-ignore in this case it should be a ref either to gesture object or
29
27
  // a gesture handler component, in both cases handlerTag property exists
30
28
  return (_ref$current$handlerT = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.handlerTag) !== null && _ref$current$handlerT !== void 0 ? _ref$current$handlerT : -1;
31
29
  }
32
30
  }
33
-
34
31
  function extractValidHandlerTags(interactionGroup) {
35
32
  var _interactionGroup$map, _interactionGroup$map2;
36
-
37
- return (_interactionGroup$map = interactionGroup === null || interactionGroup === void 0 ? void 0 : (_interactionGroup$map2 = interactionGroup.map(convertToHandlerTag)) === null || _interactionGroup$map2 === void 0 ? void 0 : _interactionGroup$map2.filter(tag => tag > 0)) !== null && _interactionGroup$map !== void 0 ? _interactionGroup$map : [];
33
+ return (_interactionGroup$map = interactionGroup === null || interactionGroup === void 0 || (_interactionGroup$map2 = interactionGroup.map(convertToHandlerTag)) === null || _interactionGroup$map2 === void 0 ? void 0 : _interactionGroup$map2.filter(tag => tag > 0)) !== null && _interactionGroup$map !== void 0 ? _interactionGroup$map : [];
38
34
  }
39
-
40
35
  export function extractGestureRelations(gesture) {
41
36
  const requireToFail = extractValidHandlerTags(gesture.config.requireToFail);
42
37
  const simultaneousWith = extractValidHandlerTags(gesture.config.simultaneousWith);
@@ -50,35 +45,33 @@ export function extractGestureRelations(gesture) {
50
45
  export function checkGestureCallbacksForWorklets(gesture) {
51
46
  if (!__DEV__) {
52
47
  return;
53
- } // If a gesture is explicitly marked to run on the JS thread there is no need to check
48
+ }
49
+ // If a gesture is explicitly marked to run on the JS thread there is no need to check
54
50
  // if callbacks are worklets as the user is aware they will be ran on the JS thread
55
-
56
-
57
51
  if (gesture.config.runOnJS) {
58
52
  return;
59
53
  }
60
-
61
54
  const areSomeNotWorklets = gesture.handlers.isWorklet.includes(false);
62
- const areSomeWorklets = gesture.handlers.isWorklet.includes(true); // If some of the callbacks are worklets and some are not, and the gesture is not
63
- // explicitly marked with `.runOnJS(true)` show an error
55
+ const areSomeWorklets = gesture.handlers.isWorklet.includes(true);
64
56
 
57
+ // If some of the callbacks are worklets and some are not, and the gesture is not
58
+ // explicitly marked with `.runOnJS(true)` show an error
65
59
  if (areSomeNotWorklets && areSomeWorklets) {
66
60
  console.error(tagMessage(`Some of the callbacks in the gesture are worklets and some are not. Either make sure that all calbacks are marked as 'worklet' if you wish to run them on the UI thread or use '.runOnJS(true)' modifier on the gesture explicitly to run all callbacks on the JS thread.`));
67
61
  }
68
-
69
62
  if (Reanimated === undefined) {
70
63
  // If Reanimated is not available, we can't run worklets, so we shouldn't show the warning
71
64
  return;
72
65
  }
73
-
74
- const areAllNotWorklets = !areSomeWorklets && areSomeNotWorklets; // If none of the callbacks are worklets and the gesture is not explicitly marked with
66
+ const areAllNotWorklets = !areSomeWorklets && areSomeNotWorklets;
67
+ // If none of the callbacks are worklets and the gesture is not explicitly marked with
75
68
  // `.runOnJS(true)` show a warning
76
-
77
- if (areAllNotWorklets && !isJestEnv()) {
69
+ if (areAllNotWorklets && !isTestEnv()) {
78
70
  console.warn(tagMessage(`None of the callbacks in the gesture are worklets. If you wish to run them on the JS thread use '.runOnJS(true)' modifier on the gesture to make this explicit. Otherwise, mark the callbacks as 'worklet' to run them on the UI thread.`));
79
71
  }
80
- } // eslint-disable-next-line @typescript-eslint/no-explicit-any
72
+ }
81
73
 
74
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
82
75
  export function validateDetectorChildren(ref) {
83
76
  // Finds the first native view under the Wrap component and traverses the fiber tree upwards
84
77
  // to check whether there is more than one native view as a pseudo-direct child of GestureDetector
@@ -102,22 +95,24 @@ export function validateDetectorChildren(ref) {
102
95
  // / \
103
96
  // NativeView NativeView
104
97
  if (__DEV__ && Platform.OS !== 'web') {
105
- const REACT_NATIVE_VERSION = getReactNativeVersion(); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
106
-
107
- const wrapType = REACT_NATIVE_VERSION.minor > 63 || REACT_NATIVE_VERSION.major > 0 ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
108
- ref._reactInternals.elementType : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
109
- ref._reactInternalFiber.elementType; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
110
-
111
- let instance = RNRenderer.findHostInstance_DEPRECATED(ref)._internalFiberInstanceHandleDEV; // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
112
-
113
-
98
+ const REACT_NATIVE_VERSION = getReactNativeVersion();
99
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
100
+ const wrapType = REACT_NATIVE_VERSION.minor > 63 || REACT_NATIVE_VERSION.major > 0 ?
101
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
102
+ ref._reactInternals.elementType :
103
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
104
+ ref._reactInternalFiber.elementType;
105
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
106
+ let instance = RNRenderer.findHostInstance_DEPRECATED(ref)._internalFiberInstanceHandleDEV;
107
+
108
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
114
109
  while (instance && instance.elementType !== wrapType) {
115
110
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
116
111
  if (instance.sibling) {
117
112
  throw new Error('GestureDetector has more than one native view as its children. This can happen if you are using a custom component that renders multiple views, like React.Fragment. You should wrap content of GestureDetector with a <View> or <Animated.View>.');
118
- } // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
119
-
113
+ }
120
114
 
115
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
121
116
  instance = instance.return;
122
117
  }
123
118
  }