react-native-gesture-handler 2.17.1 → 2.18.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (429) hide show
  1. package/ReanimatedSwipeable/package.json +6 -0
  2. package/android/build.gradle +0 -103
  3. package/android/gradle.properties +0 -7
  4. package/android/paper/src/main/java/com/swmansion/gesturehandler/NativeRNGestureHandlerModuleSpec.java +22 -10
  5. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +1 -1
  6. package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +16 -0
  7. package/android/src/main/java/com/swmansion/gesturehandler/core/PinchGestureHandler.kt +7 -8
  8. package/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureDetector.kt +14 -4
  9. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +3 -1
  10. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +3 -1
  11. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +2 -1
  12. package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt +8 -7
  13. package/android/src/main/jni/cpp-adapter.cpp +2 -2
  14. package/apple/Handlers/RNFlingHandler.m +1 -0
  15. package/apple/Handlers/RNForceTouchHandler.m +2 -0
  16. package/apple/Handlers/RNLongPressHandler.m +2 -1
  17. package/apple/Handlers/RNManualHandler.m +1 -0
  18. package/apple/Handlers/RNNativeViewHandler.mm +31 -27
  19. package/apple/Handlers/RNPanHandler.m +1 -0
  20. package/apple/Handlers/RNPinchHandler.m +1 -0
  21. package/apple/Handlers/RNRotationHandler.m +1 -0
  22. package/apple/Handlers/RNTapHandler.m +1 -0
  23. package/apple/RNGestureHandlerModule.mm +1 -2
  24. package/apple/RNRootViewGestureRecognizer.m +5 -0
  25. package/lib/commonjs/Directions.js +2 -2
  26. package/lib/commonjs/Directions.js.map +1 -1
  27. package/lib/commonjs/RNGestureHandlerModule.web.js +2 -2
  28. package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
  29. package/lib/commonjs/components/DrawerLayout.js +2 -2
  30. package/lib/commonjs/components/DrawerLayout.js.map +1 -1
  31. package/lib/commonjs/components/GestureButtons.js +3 -3
  32. package/lib/commonjs/components/GestureButtons.js.map +1 -1
  33. package/lib/commonjs/components/GestureButtonsProps.js +6 -0
  34. package/lib/commonjs/components/GestureButtonsProps.js.map +1 -0
  35. package/lib/commonjs/components/GestureComponents.js +1 -1
  36. package/lib/commonjs/components/GestureComponents.js.map +1 -1
  37. package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
  38. package/lib/commonjs/components/GestureHandlerRootView.android.js +1 -1
  39. package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -1
  40. package/lib/commonjs/components/GestureHandlerRootView.js +1 -1
  41. package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
  42. package/lib/commonjs/components/Pressable/Pressable.js +334 -0
  43. package/lib/commonjs/components/Pressable/Pressable.js.map +1 -0
  44. package/lib/commonjs/components/Pressable/PressableProps.js +6 -0
  45. package/lib/commonjs/components/Pressable/PressableProps.js.map +1 -0
  46. package/lib/commonjs/components/Pressable/index.js +24 -0
  47. package/lib/commonjs/components/Pressable/index.js.map +1 -0
  48. package/lib/commonjs/components/Pressable/utils.js +136 -0
  49. package/lib/commonjs/components/Pressable/utils.js.map +1 -0
  50. package/lib/commonjs/components/ReanimatedSwipeable.js +317 -0
  51. package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -0
  52. package/lib/commonjs/components/Swipeable.js +8 -3
  53. package/lib/commonjs/components/Swipeable.js.map +1 -1
  54. package/lib/commonjs/components/touchables/GenericTouchable.js +4 -4
  55. package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
  56. package/lib/commonjs/components/touchables/GenericTouchableProps.js +6 -0
  57. package/lib/commonjs/components/touchables/GenericTouchableProps.js.map +1 -0
  58. package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -1
  59. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +1 -1
  60. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
  61. package/lib/commonjs/components/touchables/TouchableNativeFeedbackProps.js +6 -0
  62. package/lib/commonjs/components/touchables/TouchableNativeFeedbackProps.js.map +1 -0
  63. package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -1
  64. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -1
  65. package/lib/commonjs/getShadowNodeFromRef.js +2 -2
  66. package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
  67. package/lib/commonjs/ghQueueMicrotask.js +3 -4
  68. package/lib/commonjs/ghQueueMicrotask.js.map +1 -1
  69. package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -1
  70. package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -1
  71. package/lib/commonjs/handlers/GestureHandlerEventPayload.js +2 -0
  72. package/lib/commonjs/handlers/GestureHandlerEventPayload.js.map +1 -0
  73. package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -1
  74. package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -1
  75. package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
  76. package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -1
  77. package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -1
  78. package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -1
  79. package/lib/commonjs/handlers/createHandler.js +21 -19
  80. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  81. package/lib/commonjs/handlers/createNativeWrapper.js +3 -3
  82. package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -1
  83. package/lib/commonjs/handlers/gestureHandlerCommon.js +0 -86
  84. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
  85. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
  86. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +9 -9
  87. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  88. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +2 -2
  89. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  90. package/lib/commonjs/handlers/gestures/GestureDetector/index.js +1 -1
  91. package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
  92. package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js +21 -31
  93. package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
  94. package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js +1 -1
  95. package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
  96. package/lib/commonjs/handlers/gestures/GestureDetector/utils.js +5 -5
  97. package/lib/commonjs/handlers/gestures/GestureDetector/utils.js.map +1 -1
  98. package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -1
  99. package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -1
  100. package/lib/commonjs/handlers/gestures/gesture.js +7 -7
  101. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
  102. package/lib/commonjs/handlers/gestures/gestureComposition.js +5 -5
  103. package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -1
  104. package/lib/commonjs/handlers/gestures/gestureStateManager.js +1 -1
  105. package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -1
  106. package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
  107. package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -1
  108. package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -1
  109. package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -1
  110. package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -1
  111. package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
  112. package/lib/commonjs/handlers/getNextHandlerTag.js +12 -0
  113. package/lib/commonjs/handlers/getNextHandlerTag.js.map +1 -0
  114. package/lib/commonjs/handlers/handlersRegistry.js +0 -6
  115. package/lib/commonjs/handlers/handlersRegistry.js.map +1 -1
  116. package/lib/commonjs/handlers/utils.js +91 -0
  117. package/lib/commonjs/handlers/utils.js.map +1 -0
  118. package/lib/commonjs/index.js +8 -0
  119. package/lib/commonjs/index.js.map +1 -1
  120. package/lib/commonjs/init.js +1 -1
  121. package/lib/commonjs/init.js.map +1 -1
  122. package/lib/commonjs/jestUtils/jestUtils.js +2 -2
  123. package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
  124. package/lib/commonjs/mocks.js +2 -2
  125. package/lib/commonjs/mocks.js.map +1 -1
  126. package/lib/commonjs/utils.js +1 -1
  127. package/lib/commonjs/utils.js.map +1 -1
  128. package/lib/commonjs/web/Gestures.js +1 -1
  129. package/lib/commonjs/web/Gestures.js.map +1 -1
  130. package/lib/commonjs/web/detectors/RotationGestureDetector.js +1 -1
  131. package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -1
  132. package/lib/commonjs/web/detectors/ScaleGestureDetector.js +4 -4
  133. package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
  134. package/lib/commonjs/web/handlers/FlingGestureHandler.js +1 -1
  135. package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
  136. package/lib/commonjs/web/handlers/GestureHandler.js +6 -11
  137. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  138. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +1 -1
  139. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
  140. package/lib/commonjs/web/handlers/PanGestureHandler.js +1 -1
  141. package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
  142. package/lib/commonjs/web/handlers/TapGestureHandler.js +1 -1
  143. package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
  144. package/lib/commonjs/web/tools/EventManager.js +2 -2
  145. package/lib/commonjs/web/tools/EventManager.js.map +1 -1
  146. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +4 -11
  147. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  148. package/lib/commonjs/web/tools/LeastSquareSolver.js +18 -18
  149. package/lib/commonjs/web/tools/LeastSquareSolver.js.map +1 -1
  150. package/lib/commonjs/web/tools/PointerEventManager.js +2 -2
  151. package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
  152. package/lib/commonjs/web/tools/PointerTracker.js +1 -1
  153. package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
  154. package/lib/commonjs/web/tools/TouchEventManager.js +4 -4
  155. package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -1
  156. package/lib/commonjs/web/tools/VelocityTracker.js +6 -6
  157. package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -1
  158. package/lib/commonjs/web_hammer/NodeManager.js +2 -0
  159. package/lib/commonjs/web_hammer/NodeManager.js.map +1 -1
  160. package/lib/module/Directions.js +2 -2
  161. package/lib/module/Directions.js.map +1 -1
  162. package/lib/module/RNGestureHandlerModule.web.js +2 -2
  163. package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
  164. package/lib/module/components/DrawerLayout.js +2 -2
  165. package/lib/module/components/DrawerLayout.js.map +1 -1
  166. package/lib/module/components/GestureButtons.js +3 -3
  167. package/lib/module/components/GestureButtons.js.map +1 -1
  168. package/lib/module/components/GestureButtonsProps.js +2 -0
  169. package/lib/module/components/GestureButtonsProps.js.map +1 -0
  170. package/lib/module/components/GestureComponents.js +1 -1
  171. package/lib/module/components/GestureComponents.js.map +1 -1
  172. package/lib/module/components/GestureHandlerButton.js.map +1 -1
  173. package/lib/module/components/GestureHandlerRootView.android.js +1 -1
  174. package/lib/module/components/GestureHandlerRootView.android.js.map +1 -1
  175. package/lib/module/components/GestureHandlerRootView.js +1 -1
  176. package/lib/module/components/GestureHandlerRootView.js.map +1 -1
  177. package/lib/module/components/Pressable/Pressable.js +309 -0
  178. package/lib/module/components/Pressable/Pressable.js.map +1 -0
  179. package/lib/module/components/Pressable/PressableProps.js +2 -0
  180. package/lib/module/components/Pressable/PressableProps.js.map +1 -0
  181. package/lib/module/components/Pressable/index.js +3 -0
  182. package/lib/module/components/Pressable/index.js.map +1 -0
  183. package/lib/module/components/Pressable/utils.js +120 -0
  184. package/lib/module/components/Pressable/utils.js.map +1 -0
  185. package/lib/module/components/ReanimatedSwipeable.js +293 -0
  186. package/lib/module/components/ReanimatedSwipeable.js.map +1 -0
  187. package/lib/module/components/Swipeable.js +9 -3
  188. package/lib/module/components/Swipeable.js.map +1 -1
  189. package/lib/module/components/touchables/GenericTouchable.js +4 -4
  190. package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
  191. package/lib/module/components/touchables/GenericTouchableProps.js +2 -0
  192. package/lib/module/components/touchables/GenericTouchableProps.js.map +1 -0
  193. package/lib/module/components/touchables/TouchableHighlight.js.map +1 -1
  194. package/lib/module/components/touchables/TouchableNativeFeedback.android.js +1 -1
  195. package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
  196. package/lib/module/components/touchables/TouchableNativeFeedbackProps.js +2 -0
  197. package/lib/module/components/touchables/TouchableNativeFeedbackProps.js.map +1 -0
  198. package/lib/module/components/touchables/TouchableOpacity.js.map +1 -1
  199. package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +1 -1
  200. package/lib/module/getShadowNodeFromRef.js +2 -2
  201. package/lib/module/getShadowNodeFromRef.js.map +1 -1
  202. package/lib/module/ghQueueMicrotask.js +3 -4
  203. package/lib/module/ghQueueMicrotask.js.map +1 -1
  204. package/lib/module/handlers/FlingGestureHandler.js.map +1 -1
  205. package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -1
  206. package/lib/module/handlers/GestureHandlerEventPayload.js +2 -0
  207. package/lib/module/handlers/GestureHandlerEventPayload.js.map +1 -0
  208. package/lib/module/handlers/LongPressGestureHandler.js.map +1 -1
  209. package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -1
  210. package/lib/module/handlers/PanGestureHandler.js.map +1 -1
  211. package/lib/module/handlers/PinchGestureHandler.js.map +1 -1
  212. package/lib/module/handlers/RotationGestureHandler.js.map +1 -1
  213. package/lib/module/handlers/TapGestureHandler.js.map +1 -1
  214. package/lib/module/handlers/createHandler.js +6 -5
  215. package/lib/module/handlers/createHandler.js.map +1 -1
  216. package/lib/module/handlers/createNativeWrapper.js +3 -3
  217. package/lib/module/handlers/createNativeWrapper.js.map +1 -1
  218. package/lib/module/handlers/gestureHandlerCommon.js +0 -72
  219. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
  220. package/lib/module/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
  221. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +4 -4
  222. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  223. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +1 -1
  224. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  225. package/lib/module/handlers/gestures/GestureDetector/index.js +1 -1
  226. package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
  227. package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js +18 -28
  228. package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
  229. package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js +1 -1
  230. package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
  231. package/lib/module/handlers/gestures/GestureDetector/utils.js +5 -5
  232. package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -1
  233. package/lib/module/handlers/gestures/flingGesture.js.map +1 -1
  234. package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -1
  235. package/lib/module/handlers/gestures/gesture.js +6 -6
  236. package/lib/module/handlers/gestures/gesture.js.map +1 -1
  237. package/lib/module/handlers/gestures/gestureComposition.js +5 -5
  238. package/lib/module/handlers/gestures/gestureComposition.js.map +1 -1
  239. package/lib/module/handlers/gestures/gestureStateManager.js +1 -1
  240. package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
  241. package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
  242. package/lib/module/handlers/gestures/nativeGesture.js.map +1 -1
  243. package/lib/module/handlers/gestures/panGesture.js.map +1 -1
  244. package/lib/module/handlers/gestures/pinchGesture.js.map +1 -1
  245. package/lib/module/handlers/gestures/rotationGesture.js.map +1 -1
  246. package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
  247. package/lib/module/handlers/getNextHandlerTag.js +5 -0
  248. package/lib/module/handlers/getNextHandlerTag.js.map +1 -0
  249. package/lib/module/handlers/handlersRegistry.js +0 -4
  250. package/lib/module/handlers/handlersRegistry.js.map +1 -1
  251. package/lib/module/handlers/utils.js +73 -0
  252. package/lib/module/handlers/utils.js.map +1 -0
  253. package/lib/module/index.js +1 -0
  254. package/lib/module/index.js.map +1 -1
  255. package/lib/module/init.js +1 -1
  256. package/lib/module/init.js.map +1 -1
  257. package/lib/module/jestUtils/jestUtils.js +2 -2
  258. package/lib/module/jestUtils/jestUtils.js.map +1 -1
  259. package/lib/module/mocks.js +2 -2
  260. package/lib/module/mocks.js.map +1 -1
  261. package/lib/module/utils.js +1 -1
  262. package/lib/module/utils.js.map +1 -1
  263. package/lib/module/web/Gestures.js +1 -1
  264. package/lib/module/web/Gestures.js.map +1 -1
  265. package/lib/module/web/detectors/RotationGestureDetector.js +1 -1
  266. package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -1
  267. package/lib/module/web/detectors/ScaleGestureDetector.js +4 -4
  268. package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
  269. package/lib/module/web/handlers/FlingGestureHandler.js +1 -1
  270. package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
  271. package/lib/module/web/handlers/GestureHandler.js +6 -11
  272. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  273. package/lib/module/web/handlers/NativeViewGestureHandler.js +1 -1
  274. package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
  275. package/lib/module/web/handlers/PanGestureHandler.js +1 -1
  276. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
  277. package/lib/module/web/handlers/TapGestureHandler.js +1 -1
  278. package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
  279. package/lib/module/web/tools/EventManager.js +2 -2
  280. package/lib/module/web/tools/EventManager.js.map +1 -1
  281. package/lib/module/web/tools/GestureHandlerWebDelegate.js +4 -11
  282. package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  283. package/lib/module/web/tools/LeastSquareSolver.js +18 -18
  284. package/lib/module/web/tools/LeastSquareSolver.js.map +1 -1
  285. package/lib/module/web/tools/PointerEventManager.js +2 -2
  286. package/lib/module/web/tools/PointerEventManager.js.map +1 -1
  287. package/lib/module/web/tools/PointerTracker.js +1 -1
  288. package/lib/module/web/tools/PointerTracker.js.map +1 -1
  289. package/lib/module/web/tools/TouchEventManager.js +4 -4
  290. package/lib/module/web/tools/TouchEventManager.js.map +1 -1
  291. package/lib/module/web/tools/VelocityTracker.js +6 -6
  292. package/lib/module/web/tools/VelocityTracker.js.map +1 -1
  293. package/lib/module/web_hammer/NodeManager.js +1 -1
  294. package/lib/module/web_hammer/NodeManager.js.map +1 -1
  295. package/lib/typescript/RNGestureHandlerModule.web.d.ts +1 -1
  296. package/lib/typescript/components/GestureButtons.d.ts +2 -85
  297. package/lib/typescript/components/GestureButtonsProps.d.ts +99 -0
  298. package/lib/typescript/components/GestureHandlerButton.d.ts +1 -1
  299. package/lib/typescript/components/Pressable/Pressable.d.ts +3 -0
  300. package/lib/typescript/components/Pressable/PressableProps.d.ts +116 -0
  301. package/lib/typescript/components/Pressable/index.d.ts +2 -0
  302. package/lib/typescript/components/Pressable/utils.d.ts +15 -0
  303. package/lib/typescript/components/ReanimatedSwipeable.d.ts +125 -0
  304. package/lib/typescript/components/Swipeable.d.ts +5 -0
  305. package/lib/typescript/components/touchables/GenericTouchable.d.ts +4 -16
  306. package/lib/typescript/components/touchables/GenericTouchableProps.d.ts +14 -0
  307. package/lib/typescript/components/touchables/TouchableHighlight.d.ts +1 -1
  308. package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +2 -9
  309. package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.d.ts +9 -0
  310. package/lib/typescript/components/touchables/TouchableOpacity.d.ts +1 -1
  311. package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +2 -1
  312. package/lib/typescript/handlers/FlingGestureHandler.d.ts +2 -6
  313. package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +1 -10
  314. package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +159 -0
  315. package/lib/typescript/handlers/LongPressGestureHandler.d.ts +2 -35
  316. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +2 -6
  317. package/lib/typescript/handlers/PanGestureHandler.d.ts +3 -51
  318. package/lib/typescript/handlers/PinchGestureHandler.d.ts +2 -23
  319. package/lib/typescript/handlers/RotationGestureHandler.d.ts +2 -23
  320. package/lib/typescript/handlers/TapGestureHandler.d.ts +2 -6
  321. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +0 -5
  322. package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts +10 -9
  323. package/lib/typescript/handlers/gestures/GestureDetector/types.d.ts +1 -0
  324. package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts +1 -0
  325. package/lib/typescript/handlers/gestures/flingGesture.d.ts +2 -1
  326. package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +2 -1
  327. package/lib/typescript/handlers/gestures/gesture.d.ts +2 -8
  328. package/lib/typescript/handlers/gestures/longPressGesture.d.ts +2 -1
  329. package/lib/typescript/handlers/gestures/nativeGesture.d.ts +2 -1
  330. package/lib/typescript/handlers/gestures/panGesture.d.ts +2 -1
  331. package/lib/typescript/handlers/gestures/pinchGesture.d.ts +1 -1
  332. package/lib/typescript/handlers/gestures/rotationGesture.d.ts +1 -1
  333. package/lib/typescript/handlers/gestures/tapGesture.d.ts +2 -1
  334. package/lib/typescript/handlers/getNextHandlerTag.d.ts +1 -0
  335. package/lib/typescript/handlers/handlersRegistry.d.ts +1 -2
  336. package/lib/typescript/handlers/utils.d.ts +6 -0
  337. package/lib/typescript/index.d.ts +12 -9
  338. package/lib/typescript/jestUtils/jestUtils.d.ts +9 -7
  339. package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +1 -0
  340. package/lib/typescript/web/handlers/GestureHandler.d.ts +1 -0
  341. package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +1 -0
  342. package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +1 -0
  343. package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +1 -0
  344. package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +1 -0
  345. package/lib/typescript/web/handlers/PanGestureHandler.d.ts +1 -0
  346. package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +1 -0
  347. package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +1 -0
  348. package/lib/typescript/web/handlers/TapGestureHandler.d.ts +1 -0
  349. package/lib/typescript/web_hammer/NodeManager.d.ts +4 -5
  350. package/package.json +14 -16
  351. package/src/Directions.ts +2 -2
  352. package/src/RNGestureHandlerModule.web.ts +2 -2
  353. package/src/components/DrawerLayout.tsx +7 -9
  354. package/src/components/GestureButtons.tsx +13 -123
  355. package/src/components/GestureButtonsProps.ts +115 -0
  356. package/src/components/GestureComponents.tsx +1 -1
  357. package/src/components/GestureHandlerButton.tsx +1 -1
  358. package/src/components/GestureHandlerRootView.android.tsx +1 -1
  359. package/src/components/GestureHandlerRootView.tsx +1 -1
  360. package/src/components/Pressable/Pressable.tsx +398 -0
  361. package/src/components/Pressable/PressableProps.tsx +149 -0
  362. package/src/components/Pressable/index.ts +2 -0
  363. package/src/components/Pressable/utils.ts +180 -0
  364. package/src/components/ReanimatedSwipeable.tsx +629 -0
  365. package/src/components/Swipeable.tsx +12 -6
  366. package/src/components/touchables/GenericTouchable.tsx +9 -36
  367. package/src/components/touchables/GenericTouchableProps.ts +26 -0
  368. package/src/components/touchables/TouchableHighlight.tsx +2 -4
  369. package/src/components/touchables/TouchableNativeFeedback.android.tsx +7 -17
  370. package/src/components/touchables/TouchableNativeFeedbackProps.tsx +12 -0
  371. package/src/components/touchables/TouchableOpacity.tsx +3 -5
  372. package/src/components/touchables/TouchableWithoutFeedback.tsx +2 -1
  373. package/src/getShadowNodeFromRef.ts +2 -2
  374. package/src/ghQueueMicrotask.ts +7 -4
  375. package/src/handlers/FlingGestureHandler.ts +1 -6
  376. package/src/handlers/ForceTouchGestureHandler.ts +1 -12
  377. package/src/handlers/GestureHandlerEventPayload.ts +184 -0
  378. package/src/handlers/LongPressGestureHandler.ts +1 -40
  379. package/src/handlers/NativeViewGestureHandler.ts +1 -7
  380. package/src/handlers/PanGestureHandler.ts +1 -58
  381. package/src/handlers/PinchGestureHandler.ts +1 -27
  382. package/src/handlers/RotationGestureHandler.ts +1 -27
  383. package/src/handlers/TapGestureHandler.ts +1 -6
  384. package/src/handlers/createHandler.tsx +6 -11
  385. package/src/handlers/createNativeWrapper.tsx +3 -3
  386. package/src/handlers/gestureHandlerCommon.ts +3 -79
  387. package/src/handlers/gestureHandlerTypesCompat.ts +16 -30
  388. package/src/handlers/gestures/GestureDetector/Wrap.tsx +1 -1
  389. package/src/handlers/gestures/GestureDetector/attachHandlers.ts +4 -7
  390. package/src/handlers/gestures/GestureDetector/dropHandlers.ts +1 -1
  391. package/src/handlers/gestures/GestureDetector/index.tsx +1 -1
  392. package/src/handlers/gestures/GestureDetector/updateHandlers.ts +20 -30
  393. package/src/handlers/gestures/GestureDetector/useDetectorUpdater.ts +1 -1
  394. package/src/handlers/gestures/GestureDetector/utils.ts +5 -5
  395. package/src/handlers/gestures/flingGesture.ts +2 -4
  396. package/src/handlers/gestures/forceTouchGesture.ts +2 -4
  397. package/src/handlers/gestures/gesture.ts +17 -15
  398. package/src/handlers/gestures/gestureComposition.ts +5 -5
  399. package/src/handlers/gestures/gestureStateManager.ts +1 -1
  400. package/src/handlers/gestures/longPressGesture.ts +2 -4
  401. package/src/handlers/gestures/nativeGesture.ts +2 -4
  402. package/src/handlers/gestures/panGesture.ts +2 -4
  403. package/src/handlers/gestures/pinchGesture.ts +1 -1
  404. package/src/handlers/gestures/rotationGesture.ts +1 -1
  405. package/src/handlers/gestures/tapGesture.ts +2 -4
  406. package/src/handlers/getNextHandlerTag.ts +5 -0
  407. package/src/handlers/handlersRegistry.ts +0 -6
  408. package/src/handlers/utils.ts +75 -0
  409. package/src/index.ts +25 -36
  410. package/src/init.ts +1 -1
  411. package/src/jestUtils/jestUtils.ts +12 -10
  412. package/src/mocks.ts +2 -2
  413. package/src/utils.ts +1 -1
  414. package/src/web/Gestures.ts +1 -1
  415. package/src/web/detectors/RotationGestureDetector.ts +1 -1
  416. package/src/web/detectors/ScaleGestureDetector.ts +4 -4
  417. package/src/web/handlers/FlingGestureHandler.ts +1 -1
  418. package/src/web/handlers/GestureHandler.ts +8 -14
  419. package/src/web/handlers/NativeViewGestureHandler.ts +3 -3
  420. package/src/web/handlers/PanGestureHandler.ts +1 -1
  421. package/src/web/handlers/TapGestureHandler.ts +1 -1
  422. package/src/web/tools/EventManager.ts +2 -2
  423. package/src/web/tools/GestureHandlerWebDelegate.ts +3 -8
  424. package/src/web/tools/LeastSquareSolver.ts +18 -18
  425. package/src/web/tools/PointerEventManager.ts +2 -2
  426. package/src/web/tools/PointerTracker.ts +2 -1
  427. package/src/web/tools/TouchEventManager.ts +4 -4
  428. package/src/web/tools/VelocityTracker.ts +6 -6
  429. package/src/web_hammer/NodeManager.ts +2 -11
@@ -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","config","updateGestureHandler","testId","animatedHandlers","previousHandlersValue","value","newHandlersValue","filter","g","shouldUseReanimated","map","shouldUpdateSharedValue","gestureId"],"mappings":"AACA,SAASA,eAAT,QAAgC,wBAAhC;AACA,OAAOC,sBAAP,MAAmC,iCAAnC;AACA,SACEC,YADF,EAEEC,uBAFF,QAGO,4BAHP;AAKA,SAASC,gBAAT,QAAiC,2BAAjC;AAEA,SACEC,uBADF,EAEEC,gCAFF,EAGEC,aAHF,QAIO,SAJP;AAMA,OAAO,SAASC,cAAT,CACLC,eADK,EAELC,aAFK,EAGLC,WAHK,EAIL;AACAD,EAAAA,aAAa,CAACE,OAAd;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,WAAW,CAACG,MAAhC,EAAwCD,CAAC,EAAzC,EAA6C;AAC3C,UAAME,OAAO,GAAGN,eAAe,CAACO,gBAAhB,CAAiCH,CAAjC,CAAhB;AACAP,IAAAA,gCAAgC,CAACS,OAAD,CAAhC,CAF2C,CAI3C;AACA;;AACA,QAAIJ,WAAW,CAACE,CAAD,CAAX,CAAeI,UAAf,KAA8BF,OAAO,CAACE,UAA1C,EAAsD;AACpDN,MAAAA,WAAW,CAACE,CAAD,CAAX,CAAeI,UAAf,GAA4BF,OAAO,CAACE,UAApC;AACAN,MAAAA,WAAW,CAACE,CAAD,CAAX,CAAeK,QAAf,CAAwBD,UAAxB,GAAqCF,OAAO,CAACE,UAA7C;AACD;AACF,GAbD,CAeA;AACA;AACA;;;AACAb,EAAAA,gBAAgB,CAAC,MAAM;AACrB,QAAI,CAACK,eAAe,CAACU,SAArB,EAAgC;AAC9B;AACD;;AACD,SAAK,IAAIN,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,WAAW,CAACG,MAAhC,EAAwCD,CAAC,EAAzC,EAA6C;AAC3C,YAAME,OAAO,GAAGN,eAAe,CAACO,gBAAhB,CAAiCH,CAAjC,CAAhB;AAEAE,MAAAA,OAAO,CAACK,MA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AAAA,uBAAuB;AACxB,GAtDe,CAAhB;AAuDD","sourcesContent":["import { GestureType, HandlerCallbacks } from '../gesture';\nimport { registerHandler } from '../../handlersRegistry';\nimport RNGestureHandlerModule from '../../../RNGestureHandlerModule';\nimport {\n filterConfig,\n scheduleFlushOperations,\n} from '../../gestureHandlerCommon';\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 for (let i = 0; i < newGestures.length; i++) {\n const handler = preparedGesture.attachedGestures[i];\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) {\n const previousHandlersValue =\n preparedGesture.animatedHandlers.value ?? [];\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 // if amount of gesture configs changes, we need to update the callbacks in shared value\n let shouldUpdateSharedValue =\n previousHandlersValue.length !== newHandlersValue.length;\n\n if (!shouldUpdateSharedValue) {\n // if the amount is the same, we need to check if any of the configs inside has changed\n for (let i = 0; i < newHandlersValue.length; i++) {\n if (\n // we can use the `gestureId` prop as it's unique for every config instance\n newHandlersValue[i].gestureId !== previousHandlersValue[i].gestureId\n ) {\n shouldUpdateSharedValue = true;\n break;\n }\n }\n }\n\n if (shouldUpdateSharedValue) {\n preparedGesture.animatedHandlers.value = newHandlersValue;\n }\n }\n\n scheduleFlushOperations();\n });\n}\n"]}
1
+ {"version":3,"sources":["updateHandlers.ts"],"names":["registerHandler","RNGestureHandlerModule","filterConfig","scheduleFlushOperations","ghQueueMicrotask","extractGestureRelations","checkGestureCallbacksForWorklets","ALLOWED_PROPS","updateHandlers","preparedGesture","gestureConfig","newGestures","prepare","i","length","handler","attachedGestures","handlerTag","handlers","isMounted","shouldUpdateSharedValueIfUsed","gestureId","shouldUseReanimated","config","updateGestureHandler","testId","animatedHandlers","newHandlersValue","filter","g","map","value"],"mappings":"AACA,SAASA,eAAT,QAAgC,wBAAhC;AACA,OAAOC,sBAAP,MAAmC,iCAAnC;AACA,SAASC,YAAT,EAAuBC,uBAAvB,QAAsD,aAAtD;AAEA,SAASC,gBAAT,QAAiC,2BAAjC;AAEA,SACEC,uBADF,EAEEC,gCAFF,EAGEC,aAHF,QAIO,SAJP;AAMA,OAAO,SAASC,cAAT,CACLC,eADK,EAELC,aAFK,EAGLC,WAHK,EAIL;AACAD,EAAAA,aAAa,CAACE,OAAd;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,WAAW,CAACG,MAAhC,EAAwCD,CAAC,EAAzC,EAA6C;AAC3C,UAAME,OAAO,GAAGN,eAAe,CAACO,gBAAhB,CAAiCH,CAAjC,CAAhB;AACAP,IAAAA,gCAA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U,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"]}
@@ -12,7 +12,7 @@ export function useDetectorUpdater(state, preparedGesture, gesturesToAttach, ges
12
12
  const forceRender = useForceRender();
13
13
  const updateAttachedGestures = useCallback( // skipConfigUpdate is used to prevent unnecessary updates when only checking if the view has changed
14
14
  skipConfigUpdate => {
15
- // if the underlying view has changed we need to reattach handlers to the new view
15
+ // If the underlying view has changed we need to reattach handlers to the new view
16
16
  const viewTag = findNodeHandle(state.viewRef);
17
17
  const didUnderlyingViewChange = viewTag !== state.previousViewTag;
18
18
 
@@ -1 +1 @@
1
- {"version":3,"sources":["useDetectorUpdater.ts"],"names":["useCallback","findNodeHandle","attachHandlers","updateHandlers","needsToReattach","dropHandlers","useForceRender","validateDetectorChildren","useDetectorUpdater","state","preparedGesture","gesturesToAttach","gestureConfig","webEventHandlersRef","forceRender","updateAttachedGestures","skipConfigUpdate","viewTag","viewRef","didUnderlyingViewChange","previousViewTag","forceRebuildReanimatedEvent"],"mappings":"AAAA,SAAgBA,WAAhB,QAAmC,OAAnC;AACA,SAASC,cAAT,QAA+B,cAA/B;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,C,CAEA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CACLC,KADK,EAELC,eAFK,EAGLC,gBAHK,EAILC,aAJK,EAKLC,mBALK,EAML;AACA,QAAMC,WAAW,GAAGR,cAAc,EAAlC;AACA,QAAMS,sBAAsB,GAAGf,WAAW,EACxC;AACCgB,EAAAA,gBAAD,IAAgC;AAC9B;AACA,UAAMC,OAAO,GAAGhB,cAAc,CAACQ,KAAK,CAACS,OAAP,CAA9B;AACA,UAAMC,uBAAuB,GAAGF,OAAO,KAAKR,KAAK,CAACW,eAAlD;;AAEA,QACED,uBAAuB,IACvBf,eAAe,CAACM,eAAD,EAAkBC,gBAAlB,CAFjB,EAGE;AACAJ,MAAAA,wBAAwB,CAACE,KAAK,CAACS,OAAP,CAAxB;AACAb,MAAAA,YAAY,CAACK,eAAD,CAAZ;AACAR,MAAAA,cAAc,CAAC;AACbQ,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;AAC5Bb,MAAAA,cAAc,CAACO,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 { findNodeHandle } from 'react-native';\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';\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,"sources":["useDetectorUpdater.ts"],"names":["useCallback","findNodeHandle","attachHandlers","updateHandlers","needsToReattach","dropHandlers","useForceRender","validateDetectorChildren","useDetectorUpdater","state","preparedGesture","gesturesToAttach","gestureConfig","webEventHandlersRef","forceRender","updateAttachedGestures","skipConfigUpdate","viewTag","viewRef","didUnderlyingViewChange","previousViewTag","forceRebuildReanimatedEvent"],"mappings":"AAAA,SAAgBA,WAAhB,QAAmC,OAAnC;AACA,SAASC,cAAT,QAA+B,cAA/B;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,C,CAEA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CACLC,KADK,EAELC,eAFK,EAGLC,gBAHK,EAILC,aAJK,EAKLC,mBALK,EAML;AACA,QAAMC,WAAW,GAAGR,cAAc,EAAlC;AACA,QAAMS,sBAAsB,GAAGf,WAAW,EACxC;AACCgB,EAAAA,gBAAD,IAAgC;AAC9B;AACA,UAAMC,OAAO,GAAGhB,cAAc,CAACQ,KAAK,CAACS,OAAP,CAA9B;AACA,UAAMC,uBAAuB,GAAGF,OAAO,KAAKR,KAAK,CAACW,eAAlD;;AAEA,QACED,uBAAuB,IACvBf,eAAe,CAACM,eAAD,EAAkBC,gBAAlB,CAFjB,EAGE;AACAJ,MAAAA,wBAAwB,CAACE,KAAK,CAACS,OAAP,CAAxB;AACAb,MAAAA,YAAY,CAACK,eAAD,CAAZ;AACAR,MAAAA,cAAc,CAAC;AACbQ,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;AAC5Bb,MAAAA,cAAc,CAACO,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 { findNodeHandle } from 'react-native';\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';\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"]}
@@ -50,7 +50,7 @@ export function extractGestureRelations(gesture) {
50
50
  export function checkGestureCallbacksForWorklets(gesture) {
51
51
  if (!__DEV__) {
52
52
  return;
53
- } // if a gesture is explicitly marked to run on the JS thread there is no need to check
53
+ } // If a gesture is explicitly marked to run on the JS thread there is no need to check
54
54
  // if callbacks are worklets as the user is aware they will be ran on the JS thread
55
55
 
56
56
 
@@ -59,7 +59,7 @@ export function checkGestureCallbacksForWorklets(gesture) {
59
59
  }
60
60
 
61
61
  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
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
63
  // explicitly marked with `.runOnJS(true)` show an error
64
64
 
65
65
  if (areSomeNotWorklets && areSomeWorklets) {
@@ -67,11 +67,11 @@ export function checkGestureCallbacksForWorklets(gesture) {
67
67
  }
68
68
 
69
69
  if (Reanimated === undefined) {
70
- // if Reanimated is not available, we can't run worklets, so we shouldn't show the warning
70
+ // If Reanimated is not available, we can't run worklets, so we shouldn't show the warning
71
71
  return;
72
72
  }
73
73
 
74
- const areAllNotWorklets = !areSomeWorklets && areSomeNotWorklets; // if none of the callbacks are worklets and the gesture is not explicitly marked with
74
+ const areAllNotWorklets = !areSomeWorklets && areSomeNotWorklets; // If none of the callbacks are worklets and the gesture is not explicitly marked with
75
75
  // `.runOnJS(true)` show a warning
76
76
 
77
77
  if (areAllNotWorklets) {
@@ -80,7 +80,7 @@ export function checkGestureCallbacksForWorklets(gesture) {
80
80
  } // eslint-disable-next-line @typescript-eslint/no-explicit-any
81
81
 
82
82
  export function validateDetectorChildren(ref) {
83
- // finds the first native view under the Wrap component and traverses the fiber tree upwards
83
+ // Finds the first native view under the Wrap component and traverses the fiber tree upwards
84
84
  // to check whether there is more than one native view as a pseudo-direct child of GestureDetector
85
85
  // i.e. this is not ok:
86
86
  // Wrap
@@ -1 +1 @@
1
- {"version":3,"sources":["utils.ts"],"names":["Platform","tagMessage","BaseGesture","flingGestureHandlerProps","forceTouchGestureHandlerProps","longPressGestureHandlerProps","panGestureHandlerProps","panGestureHandlerCustomNativeProps","tapGestureHandlerProps","hoverGestureHandlerProps","nativeViewGestureHandlerProps","baseGestureHandlerWithDetectorProps","isNewWebImplementationEnabled","getReactNativeVersion","RNRenderer","useCallback","useRef","useState","Reanimated","onGestureHandlerEvent","ALLOWED_PROPS","convertToHandlerTag","ref","handlerTag","current","extractValidHandlerTags","interactionGroup","map","filter","tag","extractGestureRelations","gesture","requireToFail","config","simultaneousWith","blocksHandlers","waitFor","simultaneousHandlers","checkGestureCallbacksForWorklets","__DEV__","runOnJS","areSomeNotWorklets","handlers","isWorklet","includes","areSomeWorklets","console","error","undefined","areAllNotWorklets","warn","validateDetectorChildren","OS","REACT_NATIVE_VERSION","wrapType","minor","major","_reactInternals","elementType","_reactInternalFiber","instance","findHostInstance_DEPRECATED","_internalFiberInstanceHandleDEV","sibling","Error","return","useForceRender","renderState","setRenderState","forceRender","useWebEventHandlers","e","nativeEvent","onGestureHandlerStateChange"],"mappings":"AAAA,SAASA,QAAT,QAAyB,cAAzB;AAEA,SAASC,UAAT,QAA2B,gBAA3B;AACA,SAA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AGoD,CAAD,IAAyC;AAC9DpD,MAAAA,qBAAqB,CAACoD,CAAC,CAACC,WAAH,CAArB;AACD,KAH4B;AAI7BC,IAAAA,2BAA2B,EAAE7D,6BAA6B,KACrD2D,CAAD,IAAyC;AACvCpD,MAAAA,qBAAqB,CAACoD,CAAC,CAACC,WAAH,CAArB;AACD,KAHqD,GAItDxB;AARyB,GAAlB,CAAb;AAUD","sourcesContent":["import { Platform } from 'react-native';\n\nimport { tagMessage } from '../../../utils';\nimport { GestureRef, BaseGesture, GestureType } from '../gesture';\n\nimport { flingGestureHandlerProps } from '../../FlingGestureHandler';\nimport { forceTouchGestureHandlerProps } from '../../ForceTouchGestureHandler';\nimport { longPressGestureHandlerProps } from '../../LongPressGestureHandler';\nimport {\n panGestureHandlerProps,\n panGestureHandlerCustomNativeProps,\n} from '../../PanGestureHandler';\nimport { tapGestureHandlerProps } from '../../TapGestureHandler';\nimport { hoverGestureHandlerProps } from '../hoverGesture';\nimport { nativeViewGestureHandlerProps } from '../../NativeViewGestureHandler';\nimport {\n HandlerStateChangeEvent,\n baseGestureHandlerWithDetectorProps,\n} from '../../gestureHandlerCommon';\nimport { isNewWebImplementationEnabled } from '../../../EnableNewWebImplementation';\nimport { getReactNativeVersion } from '../../../getReactNativeVersion';\nimport { RNRenderer } from '../../../RNRenderer';\nimport { useCallback, useRef, useState } from 'react';\nimport { Reanimated } from '../reanimatedWrapper';\nimport { onGestureHandlerEvent } from '../eventReceiver';\nimport { WebEventHandler } from './types';\n\nexport const ALLOWED_PROPS = [\n ...baseGestureHandlerWithDetectorProps,\n ...tapGestureHandlerProps,\n ...panGestureHandlerProps,\n ...panGestureHandlerCustomNativeProps,\n ...longPressGestureHandlerProps,\n ...forceTouchGestureHandlerProps,\n ...flingGestureHandlerProps,\n ...hoverGestureHandlerProps,\n ...nativeViewGestureHandlerProps,\n];\n\nfunction convertToHandlerTag(ref: GestureRef): number {\n if (typeof ref === 'number') {\n return ref;\n } else if (ref instanceof BaseGesture) {\n return ref.handlerTag;\n } else {\n // @ts-ignore in this case it should be a ref either to gesture object or\n // a gesture handler component, in both cases handlerTag property exists\n return ref.current?.handlerTag ?? -1;\n }\n}\n\nfunction extractValidHandlerTags(interactionGroup: GestureRef[] | undefined) {\n return (\n interactionGroup?.map(convertToHandlerTag)?.filter((tag) => tag > 0) ?? []\n );\n}\n\nexport function extractGestureRelations(gesture: GestureType) {\n const requireToFail = extractValidHandlerTags(gesture.config.requireToFail);\n const simultaneousWith = extractValidHandlerTags(\n gesture.config.simultaneousWith\n );\n const blocksHandlers = extractValidHandlerTags(gesture.config.blocksHandlers);\n\n return {\n waitFor: requireToFail,\n simultaneousHandlers: simultaneousWith,\n blocksHandlers: blocksHandlers,\n };\n}\n\nexport function checkGestureCallbacksForWorklets(gesture: GestureType) {\n if (!__DEV__) {\n return;\n }\n // if a gesture is explicitly marked to run on the JS thread there is no need to check\n // if callbacks are worklets as the user is aware they will be ran on the JS thread\n if (gesture.config.runOnJS) {\n return;\n }\n\n const areSomeNotWorklets = gesture.handlers.isWorklet.includes(false);\n const areSomeWorklets = gesture.handlers.isWorklet.includes(true);\n\n // if some of the callbacks are worklets and some are not, and the gesture is not\n // explicitly marked with `.runOnJS(true)` show an error\n if (areSomeNotWorklets && areSomeWorklets) {\n console.error(\n tagMessage(\n `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.`\n )\n );\n }\n\n if (Reanimated === undefined) {\n // if Reanimated is not available, we can't run worklets, so we shouldn't show the warning\n return;\n }\n\n const areAllNotWorklets = !areSomeWorklets && areSomeNotWorklets;\n // if none of the callbacks are worklets and the gesture is not explicitly marked with\n // `.runOnJS(true)` show a warning\n if (areAllNotWorklets) {\n console.warn(\n tagMessage(\n `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.`\n )\n );\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function validateDetectorChildren(ref: any) {\n // finds the first native view under the Wrap component and traverses the fiber tree upwards\n // to check whether there is more than one native view as a pseudo-direct child of GestureDetector\n // i.e. this is not ok:\n // Wrap\n // |\n // / \\\n // / \\\n // / \\\n // / \\\n // NativeView NativeView\n //\n // but this is fine:\n // Wrap\n // |\n // NativeView\n // |\n // / \\\n // / \\\n // / \\\n // / \\\n // NativeView NativeView\n if (__DEV__ && Platform.OS !== 'web') {\n const REACT_NATIVE_VERSION = getReactNativeVersion();\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const wrapType =\n REACT_NATIVE_VERSION.minor > 63 || REACT_NATIVE_VERSION.major > 0\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ref._reactInternals.elementType\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ref._reactInternalFiber.elementType;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let instance =\n RNRenderer.findHostInstance_DEPRECATED(\n ref\n )._internalFiberInstanceHandleDEV;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n while (instance && instance.elementType !== wrapType) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (instance.sibling) {\n throw new Error(\n '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>.'\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n instance = instance.return;\n }\n }\n}\n\nexport function useForceRender() {\n const [renderState, setRenderState] = useState(false);\n const forceRender = useCallback(() => {\n setRenderState(!renderState);\n }, [renderState, setRenderState]);\n\n return forceRender;\n}\n\nexport function useWebEventHandlers() {\n return useRef<WebEventHandler>({\n onGestureHandlerEvent: (e: HandlerStateChangeEvent<unknown>) => {\n onGestureHandlerEvent(e.nativeEvent);\n },\n onGestureHandlerStateChange: isNewWebImplementationEnabled()\n ? (e: HandlerStateChangeEvent<unknown>) => {\n onGestureHandlerEvent(e.nativeEvent);\n }\n : undefined,\n });\n}\n"]}
1
+ {"version":3,"sources":["utils.ts"],"names":["Platform","tagMessage","BaseGesture","flingGestureHandlerProps","forceTouchGestureHandlerProps","longPressGestureHandlerProps","panGestureHandlerProps","panGestureHandlerCustomNativeProps","tapGestureHandlerProps","hoverGestureHandlerProps","nativeViewGestureHandlerProps","baseGestureHandlerWithDetectorProps","isNewWebImplementationEnabled","getReactNativeVersion","RNRenderer","useCallback","useRef","useState","Reanimated","onGestureHandlerEvent","ALLOWED_PROPS","convertToHandlerTag","ref","handlerTag","current","extractValidHandlerTags","interactionGroup","map","filter","tag","extractGestureRelations","gesture","requireToFail","config","simultaneousWith","blocksHandlers","waitFor","simultaneousHandlers","checkGestureCallbacksForWorklets","__DEV__","runOnJS","areSomeNotWorklets","handlers","isWorklet","includes","areSomeWorklets","console","error","undefined","areAllNotWorklets","warn","validateDetectorChildren","OS","REACT_NATIVE_VERSION","wrapType","minor","major","_reactInternals","elementType","_reactInternalFiber","instance","findHostInstance_DEPRECATED","_internalFiberInstanceHandleDEV","sibling","Error","return","useForceRender","renderState","setRenderState","forceRender","useWebEventHandlers","e","nativeEvent","onGestureHandlerStateChange"],"mappings":"AAAA,SAASA,QAAT,QAAyB,cAAzB;AAEA,SAASC,UAAT,QAA2B,gBAA3B;AACA,SAAqBC,WAArB,QAAqD,YAArD;AAEA,SAASC,wBAAT,QAAyC,2BAAzC;AACA,SAASC,6BAAT,QAA8C,gCAA9C;AACA,SAASC,4BAAT,QAA6C,+BAA7C;AACA,SACEC,sBADF,EAEEC,kCAFF,QAGO,yBAHP;AAIA,SAASC,sBAAT,QAAuC,yBAAvC;AACA,SAASC,wBAAT,QAAyC,iBAAzC;AACA,SAASC,6BAAT,QAA8C,gCAA9C;AACA,SAEEC,mCAFF,QAGO,4BAHP;AAIA,SAASC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AQ,GACZD,oBAAoB,CAACE,KAArB,GAA6B,EAA7B,IAAmCF,oBAAoB,CAACG,KAArB,GAA6B,CAAhE,GACI;AACAlC,IAAAA,GAAG,CAACmC,eAAJ,CAAoBC,WAFxB,GAGI;AACApC,IAAAA,GAAG,CAACqC,mBAAJ,CAAwBD,WAL9B,CAHoC,CASpC;;AACA,QAAIE,QAAQ,GACV9C,UAAU,CAAC+C,2BAAX,CACEvC,GADF,EAEEwC,+BAHJ,CAVoC,CAepC;;;AACA,WAAOF,QAAQ,IAAIA,QAAQ,CAACF,WAAT,KAAyBJ,QAA5C,EAAsD;AACpD;AACA,UAAIM,QAAQ,CAACG,OAAb,EAAsB;AACpB,cAAM,IAAIC,KAAJ,CACJ,mPADI,CAAN;AAGD,OANmD,CAQpD;;;AACAJ,MAAAA,QAAQ,GAAGA,QAAQ,CAACK,MAApB;AACD;AACF;AACF;AAED,OAAO,SAASC,cAAT,GAA0B;AAC/B,QAAM,CAACC,WAAD,EAAcC,cAAd,IAAgCnD,QAAQ,CAAC,KAAD,CAA9C;AACA,QAAMoD,WAAW,GAAGtD,WAAW,CAAC,MAAM;AACpCqD,IAAAA,cAAc,CAAC,CAACD,WAAF,CAAd;AACD,GAF8B,EAE5B,CAACA,WAAD,EAAcC,cAAd,CAF4B,CAA/B;AAIA,SAAOC,WAAP;AACD;AAED,OAAO,SAASC,mBAAT,GAA+B;AACpC,SAAOtD,MAAM,CAAkB;AAC7BG,IAAAA,qBAAqB,EAAGoD,CAAD,IAAyC;AAC9DpD,MAAAA,qBAAqB,CAACoD,CAAC,CAACC,WAAH,CAArB;AACD,KAH4B;AAI7BC,IAAAA,2BAA2B,EAAE7D,6BAA6B,KACrD2D,CAAD,IAAyC;AACvCpD,MAAAA,qBAAqB,CAACoD,CAAC,CAACC,WAAH,CAArB;AACD,KAHqD,GAItDxB;AARyB,GAAlB,CAAb;AAUD","sourcesContent":["import { Platform } from 'react-native';\n\nimport { tagMessage } from '../../../utils';\nimport { GestureRef, BaseGesture, GestureType } from '../gesture';\n\nimport { flingGestureHandlerProps } from '../../FlingGestureHandler';\nimport { forceTouchGestureHandlerProps } from '../../ForceTouchGestureHandler';\nimport { longPressGestureHandlerProps } from '../../LongPressGestureHandler';\nimport {\n panGestureHandlerProps,\n panGestureHandlerCustomNativeProps,\n} from '../../PanGestureHandler';\nimport { tapGestureHandlerProps } from '../../TapGestureHandler';\nimport { hoverGestureHandlerProps } from '../hoverGesture';\nimport { nativeViewGestureHandlerProps } from '../../NativeViewGestureHandler';\nimport {\n HandlerStateChangeEvent,\n baseGestureHandlerWithDetectorProps,\n} from '../../gestureHandlerCommon';\nimport { isNewWebImplementationEnabled } from '../../../EnableNewWebImplementation';\nimport { getReactNativeVersion } from '../../../getReactNativeVersion';\nimport { RNRenderer } from '../../../RNRenderer';\nimport { useCallback, useRef, useState } from 'react';\nimport { Reanimated } from '../reanimatedWrapper';\nimport { onGestureHandlerEvent } from '../eventReceiver';\nimport { WebEventHandler } from './types';\n\nexport const ALLOWED_PROPS = [\n ...baseGestureHandlerWithDetectorProps,\n ...tapGestureHandlerProps,\n ...panGestureHandlerProps,\n ...panGestureHandlerCustomNativeProps,\n ...longPressGestureHandlerProps,\n ...forceTouchGestureHandlerProps,\n ...flingGestureHandlerProps,\n ...hoverGestureHandlerProps,\n ...nativeViewGestureHandlerProps,\n];\n\nfunction convertToHandlerTag(ref: GestureRef): number {\n if (typeof ref === 'number') {\n return ref;\n } else if (ref instanceof BaseGesture) {\n return ref.handlerTag;\n } else {\n // @ts-ignore in this case it should be a ref either to gesture object or\n // a gesture handler component, in both cases handlerTag property exists\n return ref.current?.handlerTag ?? -1;\n }\n}\n\nfunction extractValidHandlerTags(interactionGroup: GestureRef[] | undefined) {\n return (\n interactionGroup?.map(convertToHandlerTag)?.filter((tag) => tag > 0) ?? []\n );\n}\n\nexport function extractGestureRelations(gesture: GestureType) {\n const requireToFail = extractValidHandlerTags(gesture.config.requireToFail);\n const simultaneousWith = extractValidHandlerTags(\n gesture.config.simultaneousWith\n );\n const blocksHandlers = extractValidHandlerTags(gesture.config.blocksHandlers);\n\n return {\n waitFor: requireToFail,\n simultaneousHandlers: simultaneousWith,\n blocksHandlers: blocksHandlers,\n };\n}\n\nexport function checkGestureCallbacksForWorklets(gesture: GestureType) {\n if (!__DEV__) {\n return;\n }\n // If a gesture is explicitly marked to run on the JS thread there is no need to check\n // if callbacks are worklets as the user is aware they will be ran on the JS thread\n if (gesture.config.runOnJS) {\n return;\n }\n\n const areSomeNotWorklets = gesture.handlers.isWorklet.includes(false);\n const areSomeWorklets = gesture.handlers.isWorklet.includes(true);\n\n // If some of the callbacks are worklets and some are not, and the gesture is not\n // explicitly marked with `.runOnJS(true)` show an error\n if (areSomeNotWorklets && areSomeWorklets) {\n console.error(\n tagMessage(\n `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.`\n )\n );\n }\n\n if (Reanimated === undefined) {\n // If Reanimated is not available, we can't run worklets, so we shouldn't show the warning\n return;\n }\n\n const areAllNotWorklets = !areSomeWorklets && areSomeNotWorklets;\n // If none of the callbacks are worklets and the gesture is not explicitly marked with\n // `.runOnJS(true)` show a warning\n if (areAllNotWorklets) {\n console.warn(\n tagMessage(\n `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.`\n )\n );\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function validateDetectorChildren(ref: any) {\n // Finds the first native view under the Wrap component and traverses the fiber tree upwards\n // to check whether there is more than one native view as a pseudo-direct child of GestureDetector\n // i.e. this is not ok:\n // Wrap\n // |\n // / \\\n // / \\\n // / \\\n // / \\\n // NativeView NativeView\n //\n // but this is fine:\n // Wrap\n // |\n // NativeView\n // |\n // / \\\n // / \\\n // / \\\n // / \\\n // NativeView NativeView\n if (__DEV__ && Platform.OS !== 'web') {\n const REACT_NATIVE_VERSION = getReactNativeVersion();\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const wrapType =\n REACT_NATIVE_VERSION.minor > 63 || REACT_NATIVE_VERSION.major > 0\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ref._reactInternals.elementType\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ref._reactInternalFiber.elementType;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let instance =\n RNRenderer.findHostInstance_DEPRECATED(\n ref\n )._internalFiberInstanceHandleDEV;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n while (instance && instance.elementType !== wrapType) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (instance.sibling) {\n throw new Error(\n '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>.'\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n instance = instance.return;\n }\n }\n}\n\nexport function useForceRender() {\n const [renderState, setRenderState] = useState(false);\n const forceRender = useCallback(() => {\n setRenderState(!renderState);\n }, [renderState, setRenderState]);\n\n return forceRender;\n}\n\nexport function useWebEventHandlers() {\n return useRef<WebEventHandler>({\n onGestureHandlerEvent: (e: HandlerStateChangeEvent<unknown>) => {\n onGestureHandlerEvent(e.nativeEvent);\n },\n onGestureHandlerStateChange: isNewWebImplementationEnabled()\n ? (e: HandlerStateChangeEvent<unknown>) => {\n onGestureHandlerEvent(e.nativeEvent);\n }\n : undefined,\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["flingGesture.ts"],"names":["BaseGesture","FlingGesture","constructor","handlerName","numberOfPointers","pointers","config","direction"],"mappings":";;AAAA,SAASA,WAAT,QAA+C,WAA/C;AAMA,OAAO,MAAMC,YAAN,SAA2BD,WAA3B,CAAwE;AAG7EE,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF0C,EAE1C;;AAGZ,SAAKC,WAAL,GAAmB,qBAAnB;AACD;AAED;AACF;AACA;AACA;;;AACEC,EAAAA,gBAAgB,CAACC,QAAD,EAAmB;AACjC,SAAKC,MAAL,CAAYF,gBAAZ,GAA+BC,QAA/B;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;;;AACEE,EAAAA,SAAS,CAACA,SAAD,EAAoB;AAC3B,SAAKD,MAAL,CAAYC,SAAZ,GAAwBA,SAAxB;AACA,WAAO,IAAP;AACD;;AA5B4E","sourcesContent":["import { BaseGesture, BaseGestureConfig } from './gesture';\nimport {\n FlingGestureConfig,\n FlingGestureHandlerEventPayload,\n} from '../FlingGestureHandler';\n\nexport class FlingGesture extends BaseGesture<FlingGestureHandlerEventPayload> {\n public config: BaseGestureConfig & FlingGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'FlingGestureHandler';\n }\n\n /**\n * Determine exact number of points required to handle the fling gesture.\n * @param pointers\n */\n numberOfPointers(pointers: number) {\n this.config.numberOfPointers = pointers;\n return this;\n }\n\n /**\n * Expressed allowed direction of movement.\n * Expected values are exported as constants in the Directions object.\n * Arguments can be combined using `|` operator. Default value is set to `MouseButton.LEFT`.\n * @param direction\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/fling-gesture/#directionvalue-directions\n */\n direction(direction: number) {\n this.config.direction = direction;\n return this;\n }\n}\n\nexport type FlingGestureType = InstanceType<typeof FlingGesture>;\n"]}
1
+ {"version":3,"sources":["flingGesture.ts"],"names":["BaseGesture","FlingGesture","constructor","handlerName","numberOfPointers","pointers","config","direction"],"mappings":";;AAAA,SAASA,WAAT,QAA+C,WAA/C;AAIA,OAAO,MAAMC,YAAN,SAA2BD,WAA3B,CAAwE;AAG7EE,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF0C,EAE1C;;AAGZ,SAAKC,WAAL,GAAmB,qBAAnB;AACD;AAED;AACF;AACA;AACA;;;AACEC,EAAAA,gBAAgB,CAACC,QAAD,EAAmB;AACjC,SAAKC,MAAL,CAAYF,gBAAZ,GAA+BC,QAA/B;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;;;AACEE,EAAAA,SAAS,CAACA,SAAD,EAAoB;AAC3B,SAAKD,MAAL,CAAYC,SAAZ,GAAwBA,SAAxB;AACA,WAAO,IAAP;AACD;;AA5B4E","sourcesContent":["import { BaseGesture, BaseGestureConfig } from './gesture';\nimport { FlingGestureConfig } from '../FlingGestureHandler';\nimport type { FlingGestureHandlerEventPayload } from '../GestureHandlerEventPayload';\n\nexport class FlingGesture extends BaseGesture<FlingGestureHandlerEventPayload> {\n public config: BaseGestureConfig & FlingGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'FlingGestureHandler';\n }\n\n /**\n * Determine exact number of points required to handle the fling gesture.\n * @param pointers\n */\n numberOfPointers(pointers: number) {\n this.config.numberOfPointers = pointers;\n return this;\n }\n\n /**\n * Expressed allowed direction of movement.\n * Expected values are exported as constants in the Directions object.\n * Arguments can be combined using `|` operator. Default value is set to `MouseButton.LEFT`.\n * @param direction\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/fling-gesture/#directionvalue-directions\n */\n direction(direction: number) {\n this.config.direction = direction;\n return this;\n }\n}\n\nexport type FlingGestureType = InstanceType<typeof FlingGesture>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["forceTouchGesture.ts"],"names":["ContinousBaseGesture","changeEventCalculator","current","previous","changePayload","undefined","forceChange","force","ForceTouchGesture","constructor","handlerName","minForce","config","maxForce","feedbackOnActivation","value","onChange","callback","handlers"],"mappings":";;AAAA,SAA4BA,oBAA5B,QAAwD,WAAxD;;AAWA,SAASC,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;AACA;;AACA,MAAIC,aAAJ;;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1BD,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK;AADP,KAAhB;AAGD,GAJD,MAIO;AACLH,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK,KAAR,GAAgBJ,QAAQ,CAACI;AADxB,KAAhB;AAGD;;AAED,SAAO,EAAE,GAAGL,OAAL;AAAc,OAAGE;AAAjB,GAAP;AACD;;AAED,OAAO,MAAMI,iBAAN,SAAgCR,oBAAhC,CAGL;AAGAS,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF+C,EAE/C;;AAGZ,SAAKC,WAAL,GAAmB,0BAAnB;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEC,EAAAA,QAAQ,CAACJ,KAAD,EAAgB;AACtB,SAAKK,MAAL,CAAYD,QAAZ,GAAuBJ,KAAvB;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEM,EAAAA,QAAQ,CAACN,KAAD,EAAgB;AACtB,SAAKK,MAAL,CAAYC,QAAZ,GAAuBN,KAAvB;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;;;AACEO,EAAAA,oBAAoB,CAACC,KAAD,EAAiB;AACnC,SAAKH,MAAL,CAAYE,oBAAZ,GAAmCC,KAAnC;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,QAAQ,CACNC,QADM,EASN;AACA;AACA,SAAKC,QAAL,CAAcjB,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAMe,QAAN,CAAeC,QAAf,CAAP;AACD;;AAnDD","sourcesContent":["import { BaseGestureConfig, ContinousBaseGesture } from './gesture';\nimport {\n ForceTouchGestureConfig,\n ForceTouchGestureHandlerEventPayload,\n} from '../ForceTouchGestureHandler';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\n\nexport type ForceTouchGestureChangeEventPayload = {\n forceChange: number;\n};\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent<ForceTouchGestureHandlerEventPayload>,\n previous?: GestureUpdateEvent<ForceTouchGestureHandlerEventPayload>\n) {\n 'worklet';\n let changePayload: ForceTouchGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n forceChange: current.force,\n };\n } else {\n changePayload = {\n forceChange: current.force - previous.force,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class ForceTouchGesture extends ContinousBaseGesture<\n ForceTouchGestureHandlerEventPayload,\n ForceTouchGestureChangeEventPayload\n> {\n public config: BaseGestureConfig & ForceTouchGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'ForceTouchGestureHandler';\n }\n\n /**\n * A minimal pressure that is required before gesture can activate.\n * Should be a value from range [0.0, 1.0]. Default is 0.2.\n * @param force\n */\n minForce(force: number) {\n this.config.minForce = force;\n return this;\n }\n\n /**\n * A maximal pressure that could be applied for gesture.\n * If the pressure is greater, gesture fails. Should be a value from range [0.0, 1.0].\n * @param force\n */\n maxForce(force: number) {\n this.config.maxForce = force;\n return this;\n }\n\n /**\n * Value defining if haptic feedback has to be performed on activation.\n * @param value\n */\n feedbackOnActivation(value: boolean) {\n this.config.feedbackOnActivation = value;\n return this;\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n GestureUpdateEvent<\n ForceTouchGestureHandlerEventPayload &\n ForceTouchGestureChangeEventPayload\n >\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, ForceTouchGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type ForceTouchGestureType = InstanceType<typeof ForceTouchGesture>;\n"]}
1
+ {"version":3,"sources":["forceTouchGesture.ts"],"names":["ContinousBaseGesture","changeEventCalculator","current","previous","changePayload","undefined","forceChange","force","ForceTouchGesture","constructor","handlerName","minForce","config","maxForce","feedbackOnActivation","value","onChange","callback","handlers"],"mappings":";;AAAA,SAA4BA,oBAA5B,QAAwD,WAAxD;;AASA,SAASC,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;AACA;;AACA,MAAIC,aAAJ;;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1BD,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK;AADP,KAAhB;AAGD,GAJD,MAIO;AACLH,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK,KAAR,GAAgBJ,QAAQ,CAACI;AADxB,KAAhB;AAGD;;AAED,SAAO,EAAE,GAAGL,OAAL;AAAc,OAAGE;AAAjB,GAAP;AACD;;AAED,OAAO,MAAMI,iBAAN,SAAgCR,oBAAhC,CAGL;AAGAS,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF+C,EAE/C;;AAGZ,SAAKC,WAAL,GAAmB,0BAAnB;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEC,EAAAA,QAAQ,CAACJ,KAAD,EAAgB;AACtB,SAAKK,MAAL,CAAYD,QAAZ,GAAuBJ,KAAvB;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEM,EAAAA,QAAQ,CAACN,KAAD,EAAgB;AACtB,SAAKK,MAAL,CAAYC,QAAZ,GAAuBN,KAAvB;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;;;AACEO,EAAAA,oBAAoB,CAACC,KAAD,EAAiB;AACnC,SAAKH,MAAL,CAAYE,oBAAZ,GAAmCC,KAAnC;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,QAAQ,CACNC,QADM,EASN;AACA;AACA,SAAKC,QAAL,CAAcjB,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAMe,QAAN,CAAeC,QAAf,CAAP;AACD;;AAnDD","sourcesContent":["import { BaseGestureConfig, ContinousBaseGesture } from './gesture';\nimport { ForceTouchGestureConfig } from '../ForceTouchGestureHandler';\nimport type { ForceTouchGestureHandlerEventPayload } from '../GestureHandlerEventPayload';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\n\nexport type ForceTouchGestureChangeEventPayload = {\n forceChange: number;\n};\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent<ForceTouchGestureHandlerEventPayload>,\n previous?: GestureUpdateEvent<ForceTouchGestureHandlerEventPayload>\n) {\n 'worklet';\n let changePayload: ForceTouchGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n forceChange: current.force,\n };\n } else {\n changePayload = {\n forceChange: current.force - previous.force,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class ForceTouchGesture extends ContinousBaseGesture<\n ForceTouchGestureHandlerEventPayload,\n ForceTouchGestureChangeEventPayload\n> {\n public config: BaseGestureConfig & ForceTouchGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'ForceTouchGestureHandler';\n }\n\n /**\n * A minimal pressure that is required before gesture can activate.\n * Should be a value from range [0.0, 1.0]. Default is 0.2.\n * @param force\n */\n minForce(force: number) {\n this.config.minForce = force;\n return this;\n }\n\n /**\n * A maximal pressure that could be applied for gesture.\n * If the pressure is greater, gesture fails. Should be a value from range [0.0, 1.0].\n * @param force\n */\n maxForce(force: number) {\n this.config.maxForce = force;\n return this;\n }\n\n /**\n * Value defining if haptic feedback has to be performed on activation.\n * @param value\n */\n feedbackOnActivation(value: boolean) {\n this.config.feedbackOnActivation = value;\n return this;\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n GestureUpdateEvent<\n ForceTouchGestureHandlerEventPayload &\n ForceTouchGestureChangeEventPayload\n >\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, ForceTouchGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type ForceTouchGestureType = InstanceType<typeof ForceTouchGesture>;\n"]}
@@ -1,6 +1,6 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
2
 
3
- import { getNextHandlerTag } from '../handlersRegistry';
3
+ import { getNextHandlerTag } from '../getNextHandlerTag';
4
4
  import { isRemoteDebuggingEnabled } from '../../utils';
5
5
  export const CALLBACK_TYPE = {
6
6
  UNDEFINED: 0,
@@ -62,7 +62,7 @@ export class BaseGesture extends Gesture {
62
62
 
63
63
 
64
64
  isWorklet(callback) {
65
- //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
65
+ // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
66
66
  return callback.__workletHash !== undefined;
67
67
  }
68
68
  /**
@@ -96,7 +96,7 @@ export class BaseGesture extends Gesture {
96
96
 
97
97
 
98
98
  onEnd(callback) {
99
- this.handlers.onEnd = callback; //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
99
+ this.handlers.onEnd = callback; // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
100
100
 
101
101
  this.handlers.isWorklet[CALLBACK_TYPE.END] = this.isWorklet(callback);
102
102
  return this;
@@ -108,7 +108,7 @@ export class BaseGesture extends Gesture {
108
108
 
109
109
 
110
110
  onFinalize(callback) {
111
- this.handlers.onFinalize = callback; //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
111
+ this.handlers.onFinalize = callback; // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
112
112
 
113
113
  this.handlers.isWorklet[CALLBACK_TYPE.FINALIZE] = this.isWorklet(callback);
114
114
  return this;
@@ -317,8 +317,8 @@ export class BaseGesture extends Gesture {
317
317
  prepare() {}
318
318
 
319
319
  get shouldUseReanimated() {
320
- // use Reanimated when runOnJS isn't set explicitly,
321
- // and all defined callbacks are worklets,
320
+ // Use Reanimated when runOnJS isn't set explicitly,
321
+ // all defined callbacks are worklets
322
322
  // and remote debugging is disabled
323
323
  return this.config.runOnJS !== true && !this.handlers.isWorklet.includes(false) && !isRemoteDebuggingEnabled();
324
324
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["gesture.ts"],"names":["getNextHandlerTag","isRemoteDebuggingEnabled","CALLBACK_TYPE","UNDEFINED","BEGAN","START","UPDATE","CHANGE","END","FINALIZE","TOUCHES_DOWN","TOUCHES_MOVE","TOUCHES_UP","TOUCHES_CANCELLED","Gesture","nextGestureId","BaseGesture","constructor","gestureId","handlerTag","isWorklet","handlers","addDependency","key","gesture","value","config","Array","concat","withRef","ref","callback","__workletHash","undefined","onBegin","onStart","onEnd","onFinalize","onTouchesDown","needsPointerData","onTouchesMove","onTouchesUp","onTouchesCancelled","enabled","shouldCancelWhenOutside","hitSlop","activeCursor","mouseButton","runOnJS","simultaneousWithExternalGesture","gestures","requireExternalGestureToFail","blocksExternalGesture","withTestId","id","testId","cancelsTouchesInView","initialize","current","toGestureArray","prepare","shouldUseReanimated","includes","ContinousBaseGesture","onUpdate","onChange","manualActivation"],"mappings":";;AAWA,SAASA,iBAAT,QAAkC,qBAAlC;AAQA,SAASC,wBAAT,QAAyC,aAAzC;AAgEA,OAAO,MAAMC,aAAa,GAAG;AAC3BC,EAAAA,SAAS,EAAE,CADgB;AAE3BC,EAAAA,KAAK,EAAE,CAFoB;AAG3BC,EAAAA,KAAK,EAAE,CAHoB;AAI3BC,EAAAA,MAAM,EAAE,CAJmB;AAK3BC,EAAAA,MAAM,EAAE,CALmB;AAM3BC,EAAAA,GAAG,EAAE,CANsB;AAO3BC,EAAAA,QAAQ,EAAE,CAPiB;AAQ3BC,EAAAA,YAAY,EAAE,CARa;AAS3BC,EAAAA,YAAY,EAAE,CATa;AAU3BC,EAAAA,UAAU,EAAE,CAVe;AAW3BC,EAAAA,iBAAiB,EAAE;AAXQ,CAAtB,C,CAcP;AACA;;AAGA,OAAO,MAAeC,OAAf,CAAuB;AAoB9B,IAAIC,aAAa,GAAG,CAApB;AACA,OAAO,MAAeC,WAAf,SAEGF,OAFH,CAEW;AAWhBG,EAAAA,WAAW,GAAG;AACZ,YADY,CAGZ;AACA;AACA;AACA;AACA;;AAPY,uCAVM,CAAC,CAUP;;AAAA,wCATM,CAAC,CASP;;AAAA,yCARO,EAQP;;A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AkB;AAC9B,WAAO,CAAC,IAAD,CAAP;AACD,GAhSe,CAkShB;;;AACAC,EAAAA,OAAO,GAAG,CAAE;;AAEW,MAAnBC,mBAAmB,GAAY;AACjC;AACA;AACA;AACA,WACE,KAAKnC,MAAL,CAAYsB,OAAZ,KAAwB,IAAxB,IACA,CAAC,KAAK3B,QAAL,CAAcD,SAAd,CAAwB0C,QAAxB,CAAiC,KAAjC,CADD,IAEA,CAAC7D,wBAAwB,EAH3B;AAKD;;AA9Se;AAiTlB,OAAO,MAAe8D,oBAAf,SAGG/C,WAHH,CAG8B;AACnC;AACF;AACA;AACA;AACEgD,EAAAA,QAAQ,CAACjC,QAAD,EAA+D;AACrE,SAAKV,QAAL,CAAc2C,QAAd,GAAyBjC,QAAzB;AACA,SAAKV,QAAL,CAAcD,SAAd,CAAwBlB,aAAa,CAACI,MAAtC,IAAgD,KAAKc,SAAL,CAAeW,QAAf,CAAhD;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEkC,EAAAA,QAAQ,CACNlC,QADM,EAIN;AACA,SAAKV,QAAL,CAAc4C,QAAd,GAAyBlC,QAAzB;AACA,SAAKV,QAAL,CAAcD,SAAd,CAAwBlB,aAAa,CAACK,MAAtC,IAAgD,KAAKa,SAAL,CAAeW,QAAf,CAAhD;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEmC,EAAAA,gBAAgB,CAACA,gBAAD,EAA4B;AAC1C,SAAKxC,MAAL,CAAYwC,gBAAZ,GAA+BA,gBAA/B;AACA,WAAO,IAAP;AACD;;AAlCkC","sourcesContent":["import { FlingGestureHandlerEventPayload } from '../FlingGestureHandler';\nimport { ForceTouchGestureHandlerEventPayload } from '../ForceTouchGestureHandler';\nimport {\n HitSlop,\n CommonGestureConfig,\n GestureTouchEvent,\n GestureStateChangeEvent,\n GestureUpdateEvent,\n ActiveCursor,\n MouseButton,\n} from '../gestureHandlerCommon';\nimport { getNextHandlerTag } from '../handlersRegistry';\nimport { GestureStateManagerType } from './gestureStateManager';\nimport { LongPressGestureHandlerEventPayload } from '../LongPressGestureHandler';\nimport { PanGestureHandlerEventPayload } from '../PanGestureHandler';\nimport { PinchGestureHandlerEventPayload } from '../PinchGestureHandler';\nimport { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';\nimport { TapGestureHandlerEventPayload } from '../TapGestureHandler';\nimport { NativeViewGestureHandlerPayload } from '../NativeViewGestureHandler';\nimport { isRemoteDebuggingEnabled } from '../../utils';\n\nexport type GestureType =\n | BaseGesture<Record<string, unknown>>\n | BaseGesture<Record<string, never>>\n | BaseGesture<TapGestureHandlerEventPayload>\n | BaseGesture<PanGestureHandlerEventPayload>\n | BaseGesture<LongPressGestureHandlerEventPayload>\n | BaseGesture<RotationGestureHandlerEventPayload>\n | BaseGesture<PinchGestureHandlerEventPayload>\n | BaseGesture<FlingGestureHandlerEventPayload>\n | BaseGesture<ForceTouchGestureHandlerEventPayload>\n | BaseGesture<NativeViewGestureHandlerPayload>;\n\nexport type GestureRef =\n | number\n | GestureType\n | React.RefObject<GestureType | undefined>\n | React.RefObject<React.ComponentType | undefined>; // allow adding a ref to a gesture handler\nexport interface BaseGestureConfig\n extends CommonGestureConfig,\n Record<string, unknown> {\n ref?: React.MutableRefObject<GestureType | undefined>;\n requireToFail?: GestureRef[];\n simultaneousWith?: GestureRef[];\n blocksHandlers?: GestureRef[];\n needsPointerData?: boolean;\n manualActivation?: boolean;\n runOnJS?: boolean;\n testId?: string;\n cancelsTouchesInView?: boolean;\n}\n\ntype TouchEventHandlerType = (\n event: GestureTouchEvent,\n stateManager: GestureStateManagerType\n) => void;\n\nexport type HandlerCallbacks<EventPayloadT extends Record<string, unknown>> = {\n gestureId: number;\n handlerTag: number;\n onBegin?: (event: GestureStateChangeEvent<EventPayloadT>) => void;\n onStart?: (event: GestureStateChangeEvent<EventPayloadT>) => void;\n onEnd?: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void;\n onFinalize?: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void;\n onUpdate?: (event: GestureUpdateEvent<EventPayloadT>) => void;\n onChange?: (event: any) => void;\n onTouchesDown?: TouchEventHandlerType;\n onTouchesMove?: TouchEventHandlerType;\n onTouchesUp?: TouchEventHandlerType;\n onTouchesCancelled?: TouchEventHandlerType;\n changeEventCalculator?: (\n current: GestureUpdateEvent<Record<string, unknown>>,\n previous?: GestureUpdateEvent<Record<string, unknown>>\n ) => GestureUpdateEvent<Record<string, unknown>>;\n isWorklet: boolean[];\n};\n\nexport const CALLBACK_TYPE = {\n UNDEFINED: 0,\n BEGAN: 1,\n START: 2,\n UPDATE: 3,\n CHANGE: 4,\n END: 5,\n FINALIZE: 6,\n TOUCHES_DOWN: 7,\n TOUCHES_MOVE: 8,\n TOUCHES_UP: 9,\n TOUCHES_CANCELLED: 10,\n} as const;\n\n// Allow using CALLBACK_TYPE as object and type\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type CALLBACK_TYPE = typeof CALLBACK_TYPE[keyof typeof CALLBACK_TYPE];\n\nexport abstract class Gesture {\n /**\n * Return array of gestures, providing the same interface for creating and updating\n * handlers, no matter which object was used to create gesture instance.\n */\n abstract toGestureArray(): GestureType[];\n\n /**\n * Assign handlerTag to the gesture instance and set ref.current (if a ref is set)\n */\n abstract initialize(): void;\n\n /**\n * Make sure that values of properties defining relations are arrays. Do any necessary\n * preprocessing required to configure relations between handlers. Called just before\n * updating the handler on the native side.\n */\n abstract prepare(): void;\n}\n\nlet nextGestureId = 0;\nexport abstract class BaseGesture<\n EventPayloadT extends Record<string, unknown>\n> extends Gesture {\n private gestureId = -1;\n public handlerTag = -1;\n public handlerName = '';\n public config: BaseGestureConfig = {};\n public handlers: HandlerCallbacks<EventPayloadT> = {\n gestureId: -1,\n handlerTag: -1,\n isWorklet: [],\n };\n\n constructor() {\n super();\n\n // Used to check whether the gesture config has been updated when wrapping it\n // with `useMemo`. Since every config will have a unique id, when the dependencies\n // don't change, the config won't be recreated and the id will stay the same.\n // If the id is different, it means that the config has changed and the gesture\n // needs to be updated.\n this.gestureId = nextGestureId++;\n this.handlers.gestureId = this.gestureId;\n }\n\n private addDependency(\n key: 'simultaneousWith' | 'requireToFail' | 'blocksHandlers',\n gesture: Exclude<GestureRef, number>\n ) {\n const value = this.config[key];\n this.config[key] = value\n ? Array<GestureRef>().concat(value, gesture)\n : [gesture];\n }\n\n /**\n * Sets a `ref` to the gesture object, allowing for interoperability with the old API.\n * @param ref\n */\n withRef(ref: React.MutableRefObject<GestureType | undefined>) {\n this.config.ref = ref;\n return this;\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n protected isWorklet(callback: Function) {\n //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\n return callback.__workletHash !== undefined;\n }\n\n /**\n * Set the callback that is being called when given gesture handler starts receiving touches.\n * At the moment of this callback the handler is in `BEGAN` state and we don't know yet if it will recognize the gesture at all.\n * @param callback\n */\n onBegin(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void) {\n this.handlers.onBegin = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.BEGAN] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called when the gesture is recognized by the handler and it transitions to the `ACTIVE` state.\n * @param callback\n */\n onStart(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void) {\n this.handlers.onStart = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.START] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called when the gesture that was recognized by the handler finishes and handler reaches `END` state.\n * It will be called only if the handler was previously in the `ACTIVE` state.\n * @param callback\n */\n onEnd(\n callback: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void\n ) {\n this.handlers.onEnd = callback;\n //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\n this.handlers.isWorklet[CALLBACK_TYPE.END] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called when the handler finalizes handling gesture - the gesture was recognized and has finished or it failed to recognize.\n * @param callback\n */\n onFinalize(\n callback: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void\n ) {\n this.handlers.onFinalize = callback;\n //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\n this.handlers.isWorklet[CALLBACK_TYPE.FINALIZE] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the `onTouchesDown` callback which is called every time a pointer is placed on the screen.\n * @param callback\n */\n onTouchesDown(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesDown = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_DOWN] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Set the `onTouchesMove` callback which is called every time a pointer is moved on the screen.\n * @param callback\n */\n onTouchesMove(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesMove = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_MOVE] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Set the `onTouchesUp` callback which is called every time a pointer is lifted from the screen.\n * @param callback\n */\n onTouchesUp(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesUp = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_UP] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Set the `onTouchesCancelled` callback which is called every time a pointer stops being tracked, for example when the gesture finishes.\n * @param callback\n */\n onTouchesCancelled(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesCancelled = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_CANCELLED] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Indicates whether the given handler should be analyzing stream of touch events or not.\n * @param enabled\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#enabledvalue-boolean\n */\n enabled(enabled: boolean) {\n this.config.enabled = enabled;\n return this;\n }\n\n /**\n * When true the handler will cancel or fail recognition (depending on its current state) whenever the finger leaves the area of the connected view.\n * @param value\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#shouldcancelwhenoutsidevalue-boolean\n */\n shouldCancelWhenOutside(value: boolean) {\n this.config.shouldCancelWhenOutside = value;\n return this;\n }\n\n /**\n * This parameter enables control over what part of the connected view area can be used to begin recognizing the gesture.\n * When a negative number is provided the bounds of the view will reduce the area by the given number of points in each of the sides evenly.\n * @param hitSlop\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#hitslopsettings\n */\n hitSlop(hitSlop: HitSlop) {\n this.config.hitSlop = hitSlop;\n return this;\n }\n\n /**\n * #### Web only\n * This parameter allows to specify which `cursor` should be used when gesture activates.\n * Supports all CSS cursor values (e.g. `\"grab\"`, `\"zoom-in\"`). Default value is set to `\"auto\"`.\n * @param activeCursor\n */\n activeCursor(activeCursor: ActiveCursor) {\n this.config.activeCursor = activeCursor;\n return this;\n }\n\n /**\n * #### Web & Android only\n * Allows users to choose which mouse button should handler respond to.\n * Arguments can be combined using `|` operator, e.g. `mouseButton(MouseButton.LEFT | MouseButton.RIGHT)`.\n * Default value is set to `MouseButton.LEFT`.\n * @param mouseButton\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#mousebuttonvalue-mousebutton-web--android-only\n */\n mouseButton(mouseButton: MouseButton) {\n this.config.mouseButton = mouseButton;\n return this;\n }\n\n /**\n * When `react-native-reanimated` is installed, the callbacks passed to the gestures are automatically workletized and run on the UI thread when called.\n * This option allows for changing this behavior: when `true`, all the callbacks will be run on the JS thread instead of the UI thread, regardless of whether they are worklets or not.\n * Defaults to `false`.\n * @param runOnJS\n */\n runOnJS(runOnJS: boolean) {\n this.config.runOnJS = runOnJS;\n return this;\n }\n\n /**\n * Allows gestures across different components to be recognized simultaneously.\n * @param gestures\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#simultaneouswithexternalgesture\n */\n simultaneousWithExternalGesture(...gestures: Exclude<GestureRef, number>[]) {\n for (const gesture of gestures) {\n this.addDependency('simultaneousWith', gesture);\n }\n return this;\n }\n\n /**\n * Allows to delay activation of the handler until all handlers passed as arguments to this method fail (or don't begin at all).\n * @param gestures\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#requireexternalgesturetofail\n */\n requireExternalGestureToFail(...gestures: Exclude<GestureRef, number>[]) {\n for (const gesture of gestures) {\n this.addDependency('requireToFail', gesture);\n }\n return this;\n }\n\n /**\n * Works similarily to `requireExternalGestureToFail` but the direction of the relation is reversed - instead of being one-to-many relation, it's many-to-one.\n * @param gestures\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#blocksexternalgesture\n */\n blocksExternalGesture(...gestures: Exclude<GestureRef, number>[]) {\n for (const gesture of gestures) {\n this.addDependency('blocksHandlers', gesture);\n }\n return this;\n }\n\n /**\n * Sets a `testID` property for gesture object, allowing for querying for it in tests.\n * @param id\n */\n withTestId(id: string) {\n this.config.testId = id;\n return this;\n }\n\n /**\n * #### iOS only\n * When `true`, the handler will cancel touches for native UI components (`UIButton`, `UISwitch`, etc) it's attached to when it becomes `ACTIVE`.\n * Default value is `true`.\n * @param value\n */\n cancelsTouchesInView(value: boolean) {\n this.config.cancelsTouchesInView = value;\n return this;\n }\n\n initialize() {\n this.handlerTag = getNextHandlerTag();\n\n this.handlers = { ...this.handlers, handlerTag: this.handlerTag };\n\n if (this.config.ref) {\n this.config.ref.current = this as GestureType;\n }\n }\n\n toGestureArray(): GestureType[] {\n return [this as GestureType];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n prepare() {}\n\n get shouldUseReanimated(): boolean {\n // use Reanimated when runOnJS isn't set explicitly,\n // and all defined callbacks are worklets,\n // and remote debugging is disabled\n return (\n this.config.runOnJS !== true &&\n !this.handlers.isWorklet.includes(false) &&\n !isRemoteDebuggingEnabled()\n );\n }\n}\n\nexport abstract class ContinousBaseGesture<\n EventPayloadT extends Record<string, unknown>,\n EventChangePayloadT extends Record<string, unknown>\n> extends BaseGesture<EventPayloadT> {\n /**\n * Set the callback that is being called every time the gesture receives an update while it's active.\n * @param callback\n */\n onUpdate(callback: (event: GestureUpdateEvent<EventPayloadT>) => void) {\n this.handlers.onUpdate = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.UPDATE] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called every time the gesture receives an update while it's active.\n * This callback will receive information about change in value in relation to the last received event.\n * @param callback\n */\n onChange(\n callback: (\n event: GestureUpdateEvent<EventPayloadT & EventChangePayloadT>\n ) => void\n ) {\n this.handlers.onChange = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.CHANGE] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * When `true` the handler will not activate by itself even if its activation criteria are met.\n * Instead you can manipulate its state using state manager.\n * @param manualActivation\n */\n manualActivation(manualActivation: boolean) {\n this.config.manualActivation = manualActivation;\n return this;\n }\n}\n"]}
1
+ {"version":3,"sources":["gesture.ts"],"names":["getNextHandlerTag","isRemoteDebuggingEnabled","CALLBACK_TYPE","UNDEFINED","BEGAN","START","UPDATE","CHANGE","END","FINALIZE","TOUCHES_DOWN","TOUCHES_MOVE","TOUCHES_UP","TOUCHES_CANCELLED","Gesture","nextGestureId","BaseGesture","constructor","gestureId","handlerTag","isWorklet","handlers","addDependency","key","gesture","value","config","Array","concat","withRef","ref","callback","__workletHash","undefined","onBegin","onStart","onEnd","onFinalize","onTouchesDown","needsPointerData","onTouchesMove","onTouchesUp","onTouchesCancelled","enabled","shouldCancelWhenOutside","hitSlop","activeCursor","mouseButton","runOnJS","simultaneousWithExternalGesture","gestures","requireExternalGestureToFail","blocksExternalGesture","withTestId","id","testId","cancelsTouchesInView","initialize","current","toGestureArray","prepare","shouldUseReanimated","includes","ContinousBaseGesture","onUpdate","onChange","manualActivation"],"mappings":";;AASA,SA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AAcD,SAAd,CAAwBlB,aAAa,CAACI,MAAtC,IAAgD,KAAKc,SAAL,CAAeW,QAAf,CAAhD;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEkC,EAAAA,QAAQ,CACNlC,QADM,EAIN;AACA,SAAKV,QAAL,CAAc4C,QAAd,GAAyBlC,QAAzB;AACA,SAAKV,QAAL,CAAcD,SAAd,CAAwBlB,aAAa,CAACK,MAAtC,IAAgD,KAAKa,SAAL,CAAeW,QAAf,CAAhD;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEmC,EAAAA,gBAAgB,CAACA,gBAAD,EAA4B;AAC1C,SAAKxC,MAAL,CAAYwC,gBAAZ,GAA+BA,gBAA/B;AACA,WAAO,IAAP;AACD;;AAlCkC","sourcesContent":["import {\n HitSlop,\n CommonGestureConfig,\n GestureTouchEvent,\n GestureStateChangeEvent,\n GestureUpdateEvent,\n ActiveCursor,\n MouseButton,\n} from '../gestureHandlerCommon';\nimport { getNextHandlerTag } from '../getNextHandlerTag';\nimport { GestureStateManagerType } from './gestureStateManager';\nimport type {\n FlingGestureHandlerEventPayload,\n ForceTouchGestureHandlerEventPayload,\n LongPressGestureHandlerEventPayload,\n PanGestureHandlerEventPayload,\n PinchGestureHandlerEventPayload,\n RotationGestureHandlerEventPayload,\n TapGestureHandlerEventPayload,\n NativeViewGestureHandlerPayload,\n} from '../GestureHandlerEventPayload';\nimport { isRemoteDebuggingEnabled } from '../../utils';\n\nexport type GestureType =\n | BaseGesture<Record<string, unknown>>\n | BaseGesture<Record<string, never>>\n | BaseGesture<TapGestureHandlerEventPayload>\n | BaseGesture<PanGestureHandlerEventPayload>\n | BaseGesture<LongPressGestureHandlerEventPayload>\n | BaseGesture<RotationGestureHandlerEventPayload>\n | BaseGesture<PinchGestureHandlerEventPayload>\n | BaseGesture<FlingGestureHandlerEventPayload>\n | BaseGesture<ForceTouchGestureHandlerEventPayload>\n | BaseGesture<NativeViewGestureHandlerPayload>;\n\nexport type GestureRef =\n | number\n | GestureType\n | React.RefObject<GestureType | undefined>\n | React.RefObject<React.ComponentType | undefined>; // Allow adding a ref to a gesture handler\nexport interface BaseGestureConfig\n extends CommonGestureConfig,\n Record<string, unknown> {\n ref?: React.MutableRefObject<GestureType | undefined>;\n requireToFail?: GestureRef[];\n simultaneousWith?: GestureRef[];\n blocksHandlers?: GestureRef[];\n needsPointerData?: boolean;\n manualActivation?: boolean;\n runOnJS?: boolean;\n testId?: string;\n cancelsTouchesInView?: boolean;\n}\n\ntype TouchEventHandlerType = (\n event: GestureTouchEvent,\n stateManager: GestureStateManagerType\n) => void;\n\nexport type HandlerCallbacks<EventPayloadT extends Record<string, unknown>> = {\n gestureId: number;\n handlerTag: number;\n onBegin?: (event: GestureStateChangeEvent<EventPayloadT>) => void;\n onStart?: (event: GestureStateChangeEvent<EventPayloadT>) => void;\n onEnd?: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void;\n onFinalize?: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void;\n onUpdate?: (event: GestureUpdateEvent<EventPayloadT>) => void;\n onChange?: (event: any) => void;\n onTouchesDown?: TouchEventHandlerType;\n onTouchesMove?: TouchEventHandlerType;\n onTouchesUp?: TouchEventHandlerType;\n onTouchesCancelled?: TouchEventHandlerType;\n changeEventCalculator?: (\n current: GestureUpdateEvent<Record<string, unknown>>,\n previous?: GestureUpdateEvent<Record<string, unknown>>\n ) => GestureUpdateEvent<Record<string, unknown>>;\n isWorklet: boolean[];\n};\n\nexport const CALLBACK_TYPE = {\n UNDEFINED: 0,\n BEGAN: 1,\n START: 2,\n UPDATE: 3,\n CHANGE: 4,\n END: 5,\n FINALIZE: 6,\n TOUCHES_DOWN: 7,\n TOUCHES_MOVE: 8,\n TOUCHES_UP: 9,\n TOUCHES_CANCELLED: 10,\n} as const;\n\n// Allow using CALLBACK_TYPE as object and type\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type CALLBACK_TYPE = typeof CALLBACK_TYPE[keyof typeof CALLBACK_TYPE];\n\nexport abstract class Gesture {\n /**\n * Return array of gestures, providing the same interface for creating and updating\n * handlers, no matter which object was used to create gesture instance.\n */\n abstract toGestureArray(): GestureType[];\n\n /**\n * Assign handlerTag to the gesture instance and set ref.current (if a ref is set)\n */\n abstract initialize(): void;\n\n /**\n * Make sure that values of properties defining relations are arrays. Do any necessary\n * preprocessing required to configure relations between handlers. Called just before\n * updating the handler on the native side.\n */\n abstract prepare(): void;\n}\n\nlet nextGestureId = 0;\nexport abstract class BaseGesture<\n EventPayloadT extends Record<string, unknown>\n> extends Gesture {\n private gestureId = -1;\n public handlerTag = -1;\n public handlerName = '';\n public config: BaseGestureConfig = {};\n public handlers: HandlerCallbacks<EventPayloadT> = {\n gestureId: -1,\n handlerTag: -1,\n isWorklet: [],\n };\n\n constructor() {\n super();\n\n // Used to check whether the gesture config has been updated when wrapping it\n // with `useMemo`. Since every config will have a unique id, when the dependencies\n // don't change, the config won't be recreated and the id will stay the same.\n // If the id is different, it means that the config has changed and the gesture\n // needs to be updated.\n this.gestureId = nextGestureId++;\n this.handlers.gestureId = this.gestureId;\n }\n\n private addDependency(\n key: 'simultaneousWith' | 'requireToFail' | 'blocksHandlers',\n gesture: Exclude<GestureRef, number>\n ) {\n const value = this.config[key];\n this.config[key] = value\n ? Array<GestureRef>().concat(value, gesture)\n : [gesture];\n }\n\n /**\n * Sets a `ref` to the gesture object, allowing for interoperability with the old API.\n * @param ref\n */\n withRef(ref: React.MutableRefObject<GestureType | undefined>) {\n this.config.ref = ref;\n return this;\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n protected isWorklet(callback: Function) {\n // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\n return callback.__workletHash !== undefined;\n }\n\n /**\n * Set the callback that is being called when given gesture handler starts receiving touches.\n * At the moment of this callback the handler is in `BEGAN` state and we don't know yet if it will recognize the gesture at all.\n * @param callback\n */\n onBegin(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void) {\n this.handlers.onBegin = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.BEGAN] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called when the gesture is recognized by the handler and it transitions to the `ACTIVE` state.\n * @param callback\n */\n onStart(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void) {\n this.handlers.onStart = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.START] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called when the gesture that was recognized by the handler finishes and handler reaches `END` state.\n * It will be called only if the handler was previously in the `ACTIVE` state.\n * @param callback\n */\n onEnd(\n callback: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void\n ) {\n this.handlers.onEnd = callback;\n // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\n this.handlers.isWorklet[CALLBACK_TYPE.END] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called when the handler finalizes handling gesture - the gesture was recognized and has finished or it failed to recognize.\n * @param callback\n */\n onFinalize(\n callback: (\n event: GestureStateChangeEvent<EventPayloadT>,\n success: boolean\n ) => void\n ) {\n this.handlers.onFinalize = callback;\n // @ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\n this.handlers.isWorklet[CALLBACK_TYPE.FINALIZE] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the `onTouchesDown` callback which is called every time a pointer is placed on the screen.\n * @param callback\n */\n onTouchesDown(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesDown = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_DOWN] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Set the `onTouchesMove` callback which is called every time a pointer is moved on the screen.\n * @param callback\n */\n onTouchesMove(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesMove = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_MOVE] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Set the `onTouchesUp` callback which is called every time a pointer is lifted from the screen.\n * @param callback\n */\n onTouchesUp(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesUp = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_UP] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Set the `onTouchesCancelled` callback which is called every time a pointer stops being tracked, for example when the gesture finishes.\n * @param callback\n */\n onTouchesCancelled(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesCancelled = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_CANCELLED] =\n this.isWorklet(callback);\n\n return this;\n }\n\n /**\n * Indicates whether the given handler should be analyzing stream of touch events or not.\n * @param enabled\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#enabledvalue-boolean\n */\n enabled(enabled: boolean) {\n this.config.enabled = enabled;\n return this;\n }\n\n /**\n * When true the handler will cancel or fail recognition (depending on its current state) whenever the finger leaves the area of the connected view.\n * @param value\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#shouldcancelwhenoutsidevalue-boolean\n */\n shouldCancelWhenOutside(value: boolean) {\n this.config.shouldCancelWhenOutside = value;\n return this;\n }\n\n /**\n * This parameter enables control over what part of the connected view area can be used to begin recognizing the gesture.\n * When a negative number is provided the bounds of the view will reduce the area by the given number of points in each of the sides evenly.\n * @param hitSlop\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#hitslopsettings\n */\n hitSlop(hitSlop: HitSlop) {\n this.config.hitSlop = hitSlop;\n return this;\n }\n\n /**\n * #### Web only\n * This parameter allows to specify which `cursor` should be used when gesture activates.\n * Supports all CSS cursor values (e.g. `\"grab\"`, `\"zoom-in\"`). Default value is set to `\"auto\"`.\n * @param activeCursor\n */\n activeCursor(activeCursor: ActiveCursor) {\n this.config.activeCursor = activeCursor;\n return this;\n }\n\n /**\n * #### Web & Android only\n * Allows users to choose which mouse button should handler respond to.\n * Arguments can be combined using `|` operator, e.g. `mouseButton(MouseButton.LEFT | MouseButton.RIGHT)`.\n * Default value is set to `MouseButton.LEFT`.\n * @param mouseButton\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#mousebuttonvalue-mousebutton-web--android-only\n */\n mouseButton(mouseButton: MouseButton) {\n this.config.mouseButton = mouseButton;\n return this;\n }\n\n /**\n * When `react-native-reanimated` is installed, the callbacks passed to the gestures are automatically workletized and run on the UI thread when called.\n * This option allows for changing this behavior: when `true`, all the callbacks will be run on the JS thread instead of the UI thread, regardless of whether they are worklets or not.\n * Defaults to `false`.\n * @param runOnJS\n */\n runOnJS(runOnJS: boolean) {\n this.config.runOnJS = runOnJS;\n return this;\n }\n\n /**\n * Allows gestures across different components to be recognized simultaneously.\n * @param gestures\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#simultaneouswithexternalgesture\n */\n simultaneousWithExternalGesture(...gestures: Exclude<GestureRef, number>[]) {\n for (const gesture of gestures) {\n this.addDependency('simultaneousWith', gesture);\n }\n return this;\n }\n\n /**\n * Allows to delay activation of the handler until all handlers passed as arguments to this method fail (or don't begin at all).\n * @param gestures\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#requireexternalgesturetofail\n */\n requireExternalGestureToFail(...gestures: Exclude<GestureRef, number>[]) {\n for (const gesture of gestures) {\n this.addDependency('requireToFail', gesture);\n }\n return this;\n }\n\n /**\n * Works similarily to `requireExternalGestureToFail` but the direction of the relation is reversed - instead of being one-to-many relation, it's many-to-one.\n * @param gestures\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#blocksexternalgesture\n */\n blocksExternalGesture(...gestures: Exclude<GestureRef, number>[]) {\n for (const gesture of gestures) {\n this.addDependency('blocksHandlers', gesture);\n }\n return this;\n }\n\n /**\n * Sets a `testID` property for gesture object, allowing for querying for it in tests.\n * @param id\n */\n withTestId(id: string) {\n this.config.testId = id;\n return this;\n }\n\n /**\n * #### iOS only\n * When `true`, the handler will cancel touches for native UI components (`UIButton`, `UISwitch`, etc) it's attached to when it becomes `ACTIVE`.\n * Default value is `true`.\n * @param value\n */\n cancelsTouchesInView(value: boolean) {\n this.config.cancelsTouchesInView = value;\n return this;\n }\n\n initialize() {\n this.handlerTag = getNextHandlerTag();\n\n this.handlers = { ...this.handlers, handlerTag: this.handlerTag };\n\n if (this.config.ref) {\n this.config.ref.current = this as GestureType;\n }\n }\n\n toGestureArray(): GestureType[] {\n return [this as GestureType];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n prepare() {}\n\n get shouldUseReanimated(): boolean {\n // Use Reanimated when runOnJS isn't set explicitly,\n // all defined callbacks are worklets\n // and remote debugging is disabled\n return (\n this.config.runOnJS !== true &&\n !this.handlers.isWorklet.includes(false) &&\n !isRemoteDebuggingEnabled()\n );\n }\n}\n\nexport abstract class ContinousBaseGesture<\n EventPayloadT extends Record<string, unknown>,\n EventChangePayloadT extends Record<string, unknown>\n> extends BaseGesture<EventPayloadT> {\n /**\n * Set the callback that is being called every time the gesture receives an update while it's active.\n * @param callback\n */\n onUpdate(callback: (event: GestureUpdateEvent<EventPayloadT>) => void) {\n this.handlers.onUpdate = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.UPDATE] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * Set the callback that is being called every time the gesture receives an update while it's active.\n * This callback will receive information about change in value in relation to the last received event.\n * @param callback\n */\n onChange(\n callback: (\n event: GestureUpdateEvent<EventPayloadT & EventChangePayloadT>\n ) => void\n ) {\n this.handlers.onChange = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.CHANGE] = this.isWorklet(callback);\n return this;\n }\n\n /**\n * When `true` the handler will not activate by itself even if its activation criteria are met.\n * Instead you can manipulate its state using state manager.\n * @param manualActivation\n */\n manualActivation(manualActivation: boolean) {\n this.config.manualActivation = manualActivation;\n return this;\n }\n}\n"]}
@@ -26,8 +26,8 @@ export class ComposedGesture extends Gesture {
26
26
  prepareSingleGesture(gesture, simultaneousGestures, requireGesturesToFail) {
27
27
  if (gesture instanceof BaseGesture) {
28
28
  const newConfig = { ...gesture.config
29
- }; // no need to extend `blocksHandlers` here, because it's not changed in composition
30
- // the same effect is achieved by reversing the order of 2 gestures in `Exclusive`
29
+ }; // No need to extend `blocksHandlers` here, because it's not changed in composition.
30
+ // The same effect is achieved by reversing the order of 2 gestures in `Exclusive`
31
31
 
32
32
  newConfig.simultaneousWith = extendRelation(newConfig.simultaneousWith, simultaneousGestures);
33
33
  newConfig.requireToFail = extendRelation(newConfig.requireToFail, requireGesturesToFail);
@@ -58,7 +58,7 @@ export class ComposedGesture extends Gesture {
58
58
  }
59
59
  export class SimultaneousGesture extends ComposedGesture {
60
60
  prepare() {
61
- // this piece of magic works something like this:
61
+ // This piece of magic works something like this:
62
62
  // for every gesture in the array
63
63
  const simultaneousArrays = this.gestures.map(gesture => // we take the array it's in
64
64
  this.gestures // and make a copy without it
@@ -76,13 +76,13 @@ export class SimultaneousGesture extends ComposedGesture {
76
76
  }
77
77
  export class ExclusiveGesture extends ComposedGesture {
78
78
  prepare() {
79
- // transforms the array of gestures into array of grouped raw (not composed) gestures
79
+ // Transforms the array of gestures into array of grouped raw (not composed) gestures
80
80
  // i.e. [gesture1, gesture2, ComposedGesture(gesture3, gesture4)] -> [[gesture1], [gesture2], [gesture3, gesture4]]
81
81
  const gestureArrays = this.gestures.map(gesture => gesture.toGestureArray());
82
82
  let requireToFail = [];
83
83
 
84
84
  for (let i = 0; i < this.gestures.length; i++) {
85
- this.prepareSingleGesture(this.gestures[i], this.simultaneousGestures, this.requireGesturesToFail.concat(requireToFail)); // every group gets to wait for all groups before it
85
+ this.prepareSingleGesture(this.gestures[i], this.simultaneousGestures, this.requireGesturesToFail.concat(requireToFail)); // Every group gets to wait for all groups before it
86
86
 
87
87
  requireToFail = requireToFail.concat(gestureArrays[i]);
88
88
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["gestureComposition.ts"],"names":["BaseGesture","Gesture","extendRelation","currentRelation","extendWith","undefined","ComposedGesture","constructor","gestures","prepareSingleGesture","gesture","simultaneousGestures","requireGesturesToFail","newConfig","config","simultaneousWith","requireToFail","prepare","initialize","toGestureArray","flatMap","SimultaneousGesture","simultaneousArrays","map","filter","x","i","length","ExclusiveGesture","gestureArrays","concat"],"mappings":";;AAAA,SAASA,WAAT,EAAsBC,OAAtB,QAA8D,WAA9D;;AAEA,SAASC,cAAT,CACEC,eADF,EAEEC,UAFF,EAGE;AACA,MAAID,eAAe,KAAKE,SAAxB,EAAmC;AACjC,WAAO,CAAC,GAAGD,UAAJ,CAAP;AACD,GAFD,MAEO;AACL,WAAO,CAAC,GAAGD,eAAJ,EAAqB,GAAGC,UAAxB,CAAP;AACD;AACF;;AAED,OAAO,MAAME,eAAN,SAA8BL,OAA9B,CAAsC;AAK3CM,EAAAA,WAAW,CAAC,GAAGC,QAAJ,EAAyB;AAClC;;AADkC,sCAJJ,EAII;;AAAA,kDAHY,EAGZ;;AAAA,mDAFa,EAEb;;AAElC,SAAKA,QAAL,GAAgBA,QAAhB;AACD;;AAESC,EAAAA,oBAAoB,CAC5BC,OAD4B,EAE5BC,oBAF4B,EAG5BC,qBAH4B,EAI5B;AACA,QAAIF,OAAO,YAAYV,WAAvB,EAAoC;AAClC,YAAMa,SAAS,GAAG,EAAE,GAAGH,OAAO,CAACI;AAAb,OAAlB,CADkC,CAGlC;AACA;;AACAD,MAAAA,SAAS,CAACE,gBAAV,GAA6Bb,cAAc,CACzCW,SAAS,CAACE,gBAD+B,EAEzCJ,oBAFyC,CAA3C;AAIAE,MAAAA,SAAS,CAACG,aAAV,GAA0Bd,cAAc,CACtCW,SAAS,CAACG,aAD4B,EAEtCJ,qBAFsC,CAAxC;AAKAF,MAAAA,OAAO,CAACI,MAAR,GAAiBD,SAAjB;AACD,KA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AAN,SAA+BtB,eAA/B,CAA+C;AACpDW,EAAAA,OAAO,GAAG;AACR;AACA;AACA,UAAMY,aAAa,GAAG,KAAKrB,QAAL,CAAce,GAAd,CAAmBb,OAAD,IACtCA,OAAO,CAACS,cAAR,EADoB,CAAtB;AAIA,QAAIH,aAA4B,GAAG,EAAnC;;AAEA,SAAK,IAAIU,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,KAAKlB,QAAL,CAAcmB,MAAlC,EAA0CD,CAAC,EAA3C,EAA+C;AAC7C,WAAKjB,oBAAL,CACE,KAAKD,QAAL,CAAckB,CAAd,CADF,EAEE,KAAKf,oBAFP,EAGE,KAAKC,qBAAL,CAA2BkB,MAA3B,CAAkCd,aAAlC,CAHF,EAD6C,CAO7C;;AACAA,MAAAA,aAAa,GAAGA,aAAa,CAACc,MAAd,CAAqBD,aAAa,CAACH,CAAD,CAAlC,CAAhB;AACD;AACF;;AApBmD","sourcesContent":["import { BaseGesture, Gesture, GestureRef, GestureType } from './gesture';\n\nfunction extendRelation(\n currentRelation: GestureRef[] | undefined,\n extendWith: GestureType[]\n) {\n if (currentRelation === undefined) {\n return [...extendWith];\n } else {\n return [...currentRelation, ...extendWith];\n }\n}\n\nexport class ComposedGesture extends Gesture {\n protected gestures: Gesture[] = [];\n protected simultaneousGestures: GestureType[] = [];\n protected requireGesturesToFail: GestureType[] = [];\n\n constructor(...gestures: Gesture[]) {\n super();\n this.gestures = gestures;\n }\n\n protected prepareSingleGesture(\n gesture: Gesture,\n simultaneousGestures: GestureType[],\n requireGesturesToFail: GestureType[]\n ) {\n if (gesture instanceof BaseGesture) {\n const newConfig = { ...gesture.config };\n\n // no need to extend `blocksHandlers` here, because it's not changed in composition\n // the same effect is achieved by reversing the order of 2 gestures in `Exclusive`\n newConfig.simultaneousWith = extendRelation(\n newConfig.simultaneousWith,\n simultaneousGestures\n );\n newConfig.requireToFail = extendRelation(\n newConfig.requireToFail,\n requireGesturesToFail\n );\n\n gesture.config = newConfig;\n } else if (gesture instanceof ComposedGesture) {\n gesture.simultaneousGestures = simultaneousGestures;\n gesture.requireGesturesToFail = requireGesturesToFail;\n gesture.prepare();\n }\n }\n\n prepare() {\n for (const gesture of this.gestures) {\n this.prepareSingleGesture(\n gesture,\n this.simultaneousGestures,\n this.requireGesturesToFail\n );\n }\n }\n\n initialize() {\n for (const gesture of this.gestures) {\n gesture.initialize();\n }\n }\n\n toGestureArray(): GestureType[] {\n return this.gestures.flatMap((gesture) => gesture.toGestureArray());\n }\n}\n\nexport class SimultaneousGesture extends ComposedGesture {\n prepare() {\n // this piece of magic works something like this:\n // for every gesture in the array\n const simultaneousArrays = this.gestures.map((gesture) =>\n // we take the array it's in\n this.gestures\n // and make a copy without it\n .filter((x) => x !== gesture)\n // then we flatmap the result to get list of raw (not composed) gestures\n // this way we don't make the gestures simultaneous with themselves, which is\n // important when the gesture is `ExclusiveGesture` - we don't want to make\n // exclusive gestures simultaneous\n .flatMap((x) => x.toGestureArray())\n );\n\n for (let i = 0; i < this.gestures.length; i++) {\n this.prepareSingleGesture(\n this.gestures[i],\n simultaneousArrays[i],\n this.requireGesturesToFail\n );\n }\n }\n}\n\nexport class ExclusiveGesture extends ComposedGesture {\n prepare() {\n // transforms the array of gestures into array of grouped raw (not composed) gestures\n // i.e. [gesture1, gesture2, ComposedGesture(gesture3, gesture4)] -> [[gesture1], [gesture2], [gesture3, gesture4]]\n const gestureArrays = this.gestures.map((gesture) =>\n gesture.toGestureArray()\n );\n\n let requireToFail: GestureType[] = [];\n\n for (let i = 0; i < this.gestures.length; i++) {\n this.prepareSingleGesture(\n this.gestures[i],\n this.simultaneousGestures,\n this.requireGesturesToFail.concat(requireToFail)\n );\n\n // every group gets to wait for all groups before it\n requireToFail = requireToFail.concat(gestureArrays[i]);\n }\n }\n}\n\nexport type ComposedGestureType = InstanceType<typeof ComposedGesture>;\nexport type RaceGestureType = ComposedGestureType;\nexport type SimultaneousGestureType = InstanceType<typeof SimultaneousGesture>;\nexport type ExclusiveGestureType = InstanceType<typeof ExclusiveGesture>;\n"]}
1
+ {"version":3,"sources":["gestureComposition.ts"],"names":["BaseGesture","Gesture","extendRelation","currentRelation","extendWith","undefined","ComposedGesture","constructor","gestures","prepareSingleGesture","gesture","simultaneousGestures","requireGesturesToFail","newConfig","config","simultaneousWith","requireToFail","prepare","initialize","toGestureArray","flatMap","SimultaneousGesture","simultaneousArrays","map","filter","x","i","length","ExclusiveGesture","gestureArrays","concat"],"mappings":";;AAAA,SAASA,WAAT,EAAsBC,OAAtB,QAA8D,WAA9D;;AAEA,SAASC,cAAT,CACEC,eADF,EAEEC,UAFF,EAGE;AACA,MAAID,eAAe,KAAKE,SAAxB,EAAmC;AACjC,WAAO,CAAC,GAAGD,UAAJ,CAAP;AACD,GAFD,MAEO;AACL,WAAO,CAAC,GAAGD,eAAJ,EAAqB,GAAGC,UAAxB,CAAP;AACD;AACF;;AAED,OAAO,MAAME,eAAN,SAA8BL,OAA9B,CAAsC;AAK3CM,EAAAA,WAAW,CAAC,GAAGC,QAAJ,EAAyB;AAClC;;AADkC,sCAJJ,EAII;;AAAA,kDAHY,EAGZ;;AAAA,mDAFa,EAEb;;AAElC,SAAKA,QAAL,GAAgBA,QAAhB;AACD;;AAESC,EAAAA,oBAAoB,CAC5BC,OAD4B,EAE5BC,oBAF4B,EAG5BC,qBAH4B,EAI5B;AACA,QAAIF,OAAO,YAAYV,WAAvB,EAAoC;AAClC,YAAMa,SAAS,GAAG,EAAE,GAAGH,OAAO,CAACI;AAAb,OAAlB,CADkC,CAGlC;AACA;;AACAD,MAAAA,SAAS,CAACE,gBAAV,GAA6Bb,cAAc,CACzCW,SAAS,CAACE,gBAD+B,EAEzCJ,oBAFyC,CAA3C;AAIAE,MAAAA,SAAS,CAACG,aAAV,GAA0Bd,cAAc,CACtCW,SAAS,CAACG,aAD4B,EAEtCJ,qBAFsC,CAAxC;AAKAF,MAAAA,OAAO,CAACI,MAAR,GAAiBD,SAAjB;AACD,KAfD,MAeO,IAAIH,O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/B,CAA+C;AACpDW,EAAAA,OAAO,GAAG;AACR;AACA;AACA,UAAMY,aAAa,GAAG,KAAKrB,QAAL,CAAce,GAAd,CAAmBb,OAAD,IACtCA,OAAO,CAACS,cAAR,EADoB,CAAtB;AAIA,QAAIH,aAA4B,GAAG,EAAnC;;AAEA,SAAK,IAAIU,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,KAAKlB,QAAL,CAAcmB,MAAlC,EAA0CD,CAAC,EAA3C,EAA+C;AAC7C,WAAKjB,oBAAL,CACE,KAAKD,QAAL,CAAckB,CAAd,CADF,EAEE,KAAKf,oBAFP,EAGE,KAAKC,qBAAL,CAA2BkB,MAA3B,CAAkCd,aAAlC,CAHF,EAD6C,CAO7C;;AACAA,MAAAA,aAAa,GAAGA,aAAa,CAACc,MAAd,CAAqBD,aAAa,CAACH,CAAD,CAAlC,CAAhB;AACD;AACF;;AApBmD","sourcesContent":["import { BaseGesture, Gesture, GestureRef, GestureType } from './gesture';\n\nfunction extendRelation(\n currentRelation: GestureRef[] | undefined,\n extendWith: GestureType[]\n) {\n if (currentRelation === undefined) {\n return [...extendWith];\n } else {\n return [...currentRelation, ...extendWith];\n }\n}\n\nexport class ComposedGesture extends Gesture {\n protected gestures: Gesture[] = [];\n protected simultaneousGestures: GestureType[] = [];\n protected requireGesturesToFail: GestureType[] = [];\n\n constructor(...gestures: Gesture[]) {\n super();\n this.gestures = gestures;\n }\n\n protected prepareSingleGesture(\n gesture: Gesture,\n simultaneousGestures: GestureType[],\n requireGesturesToFail: GestureType[]\n ) {\n if (gesture instanceof BaseGesture) {\n const newConfig = { ...gesture.config };\n\n // No need to extend `blocksHandlers` here, because it's not changed in composition.\n // The same effect is achieved by reversing the order of 2 gestures in `Exclusive`\n newConfig.simultaneousWith = extendRelation(\n newConfig.simultaneousWith,\n simultaneousGestures\n );\n newConfig.requireToFail = extendRelation(\n newConfig.requireToFail,\n requireGesturesToFail\n );\n\n gesture.config = newConfig;\n } else if (gesture instanceof ComposedGesture) {\n gesture.simultaneousGestures = simultaneousGestures;\n gesture.requireGesturesToFail = requireGesturesToFail;\n gesture.prepare();\n }\n }\n\n prepare() {\n for (const gesture of this.gestures) {\n this.prepareSingleGesture(\n gesture,\n this.simultaneousGestures,\n this.requireGesturesToFail\n );\n }\n }\n\n initialize() {\n for (const gesture of this.gestures) {\n gesture.initialize();\n }\n }\n\n toGestureArray(): GestureType[] {\n return this.gestures.flatMap((gesture) => gesture.toGestureArray());\n }\n}\n\nexport class SimultaneousGesture extends ComposedGesture {\n prepare() {\n // This piece of magic works something like this:\n // for every gesture in the array\n const simultaneousArrays = this.gestures.map((gesture) =>\n // we take the array it's in\n this.gestures\n // and make a copy without it\n .filter((x) => x !== gesture)\n // then we flatmap the result to get list of raw (not composed) gestures\n // this way we don't make the gestures simultaneous with themselves, which is\n // important when the gesture is `ExclusiveGesture` - we don't want to make\n // exclusive gestures simultaneous\n .flatMap((x) => x.toGestureArray())\n );\n\n for (let i = 0; i < this.gestures.length; i++) {\n this.prepareSingleGesture(\n this.gestures[i],\n simultaneousArrays[i],\n this.requireGesturesToFail\n );\n }\n }\n}\n\nexport class ExclusiveGesture extends ComposedGesture {\n prepare() {\n // Transforms the array of gestures into array of grouped raw (not composed) gestures\n // i.e. [gesture1, gesture2, ComposedGesture(gesture3, gesture4)] -> [[gesture1], [gesture2], [gesture3, gesture4]]\n const gestureArrays = this.gestures.map((gesture) =>\n gesture.toGestureArray()\n );\n\n let requireToFail: GestureType[] = [];\n\n for (let i = 0; i < this.gestures.length; i++) {\n this.prepareSingleGesture(\n this.gestures[i],\n this.simultaneousGestures,\n this.requireGesturesToFail.concat(requireToFail)\n );\n\n // Every group gets to wait for all groups before it\n requireToFail = requireToFail.concat(gestureArrays[i]);\n }\n }\n}\n\nexport type ComposedGestureType = InstanceType<typeof ComposedGesture>;\nexport type RaceGestureType = ComposedGestureType;\nexport type SimultaneousGestureType = InstanceType<typeof SimultaneousGesture>;\nexport type ExclusiveGestureType = InstanceType<typeof ExclusiveGesture>;\n"]}
@@ -1,7 +1,7 @@
1
1
  import { Reanimated } from './reanimatedWrapper';
2
2
  import { State } from '../../State';
3
3
  import { tagMessage } from '../../utils';
4
- const warningMessage = tagMessage('react-native-reanimated is required in order to use synchronous state management'); // check if reanimated module is available, but look for useSharedValue as conditional
4
+ const warningMessage = tagMessage('react-native-reanimated is required in order to use synchronous state management'); // Check if reanimated module is available, but look for useSharedValue as conditional
5
5
  // require of reanimated can sometimes return content of `utils.ts` file (?)
6
6
 
7
7
  const REANIMATED_AVAILABLE = (Reanimated === null || Reanimated === void 0 ? void 0 : Reanimated.useSharedValue) !== undefined;
@@ -1 +1 @@
1
- {"version":3,"sources":["gestureStateManager.ts"],"names":["Reanimated","State","tagMessage","warningMessage","REANIMATED_AVAILABLE","useSharedValue","undefined","setGestureState","create","handlerTag","begin","BEGAN","console","warn","activate","ACTIVE","fail","FAILED","end","END","GestureStateManager"],"mappings":"AAAA,SAASA,UAAT,QAA2B,qBAA3B;AACA,SAASC,KAAT,QAAsB,aAAtB;AACA,SAASC,UAAT,QAA2B,aAA3B;AASA,MAAMC,cAAc,GAAGD,UAAU,CAC/B,kFAD+B,CAAjC,C,CAIA;AACA;;AACA,MAAME,oBAAoB,GAAG,CAAAJ,UAAU,SAAV,IAAAA,UAAU,WAAV,YAAAA,UAAU,CAAEK,cAAZ,MAA+BC,SAA5D;AACA,MAAMC,eAAe,GAAGP,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAEO,eAApC;;AAEA,SAASC,MAAT,CAAgBC,UAAhB,EAA6D;AAC3D;;AACA,SAAO;AACLC,IAAAA,KAAK,EAAE,MAAM;AACX;;AACA,UAAIN,oBAAJ,EAA0B;AACxB;AACA;AACAG,QAAAA,eAAe,CAAEE,UAAF,EAAcR,KAAK,CAACU,KAApB,CAAf;AACD,OAJD,MAIO;AACLC,QAAAA,OAAO,CAACC,IAAR,CAAaV,cAAb;AACD;AACF,KAVI;AAYLW,IAAAA,QAAQ,EAAE,MAAM;AACd;;AACA,UAAIV,oBAAJ,EAA0B;AACxB;AACA;AACAG,QAAAA,eAAe,CAAEE,UAAF,EAAcR,KAAK,CAACc,MAApB,CAAf;AACD,OAJD,MAIO;AACLH,QAAAA,OAAO,CAACC,IAAR,CAAaV,cAAb;AACD;AACF,KArBI;AAuBLa,IAAAA,IAAI,EAAE,MAAM;AACV;;AACA,UAAIZ,oBAAJ,EAA0B;AACxB;AACA;AACAG,QAAAA,eAAe,CAAEE,UAAF,EAAcR,KAAK,CAACgB,MAApB,CAAf;AACD,OAJD,MAIO;AACLL,QAAAA,OAAO,CAACC,IAAR,CAAaV,cAAb;AACD;AACF,KAhCI;AAkCLe,IAAAA,GAAG,EAAE,MAAM;AACT;;AACA,UAAId,oBAAJ,EAA0B;AACxB;AACA;AACAG,QAAAA,eAAe,CAAEE,UAAF,EAAcR,KAAK,CAACkB,GAApB,CAAf;AACD,OAJD,MAIO;AACLP,QAAAA,OAAO,CAACC,IAAR,CAAaV,cAAb;AACD;AACF;AA3CI,GAAP;AA6CD;;AAED,OAAO,MAAMiB,mBAAmB,GAAG;AACjCZ,EAAAA;AADiC,CAA5B","sourcesContent":["import { Reanimated } from './reanimatedWrapper';\nimport { State } from '../../State';\nimport { tagMessage } from '../../utils';\n\nexport interface GestureStateManagerType {\n begin: () => void;\n activate: () => void;\n fail: () => void;\n end: () => void;\n}\n\nconst warningMessage = tagMessage(\n 'react-native-reanimated is required in order to use synchronous state management'\n);\n\n// check if reanimated module is available, but look for useSharedValue as conditional\n// require of reanimated can sometimes return content of `utils.ts` file (?)\nconst REANIMATED_AVAILABLE = Reanimated?.useSharedValue !== undefined;\nconst setGestureState = Reanimated?.setGestureState;\n\nfunction create(handlerTag: number): GestureStateManagerType {\n 'worklet';\n return {\n begin: () => {\n 'worklet';\n if (REANIMATED_AVAILABLE) {\n // When Reanimated is available, setGestureState should be defined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n setGestureState!(handlerTag, State.BEGAN);\n } else {\n console.warn(warningMessage);\n }\n },\n\n activate: () => {\n 'worklet';\n if (REANIMATED_AVAILABLE) {\n // When Reanimated is available, setGestureState should be defined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n setGestureState!(handlerTag, State.ACTIVE);\n } else {\n console.warn(warningMessage);\n }\n },\n\n fail: () => {\n 'worklet';\n if (REANIMATED_AVAILABLE) {\n // When Reanimated is available, setGestureState should be defined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n setGestureState!(handlerTag, State.FAILED);\n } else {\n console.warn(warningMessage);\n }\n },\n\n end: () => {\n 'worklet';\n if (REANIMATED_AVAILABLE) {\n // When Reanimated is available, setGestureState should be defined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n setGestureState!(handlerTag, State.END);\n } else {\n console.warn(warningMessage);\n }\n },\n };\n}\n\nexport const GestureStateManager = {\n create,\n};\n"]}
1
+ {"version":3,"sources":["gestureStateManager.ts"],"names":["Reanimated","State","tagMessage","warningMessage","REANIMATED_AVAILABLE","useSharedValue","undefined","setGestureState","create","handlerTag","begin","BEGAN","console","warn","activate","ACTIVE","fail","FAILED","end","END","GestureStateManager"],"mappings":"AAAA,SAASA,UAAT,QAA2B,qBAA3B;AACA,SAASC,KAAT,QAAsB,aAAtB;AACA,SAASC,UAAT,QAA2B,aAA3B;AASA,MAAMC,cAAc,GAAGD,UAAU,CAC/B,kFAD+B,CAAjC,C,CAIA;AACA;;AACA,MAAME,oBAAoB,GAAG,CAAAJ,UAAU,SAAV,IAAAA,UAAU,WAAV,YAAAA,UAAU,CAAEK,cAAZ,MAA+BC,SAA5D;AACA,MAAMC,eAAe,GAAGP,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAEO,eAApC;;AAEA,SAASC,MAAT,CAAgBC,UAAhB,EAA6D;AAC3D;;AACA,SAAO;AACLC,IAAAA,KAAK,EAAE,MAAM;AACX;;AACA,UAAIN,oBAAJ,EAA0B;AACxB;AACA;AACAG,QAAAA,eAAe,CAAEE,UAAF,EAAcR,KAAK,CAACU,KAApB,CAAf;AACD,OAJD,MAIO;AACLC,QAAAA,OAAO,CAACC,IAAR,CAAaV,cAAb;AACD;AACF,KAVI;AAYLW,IAAAA,QAAQ,EAAE,MAAM;AACd;;AACA,UAAIV,oBAAJ,EAA0B;AACxB;AACA;AACAG,QAAAA,eAAe,CAAEE,UAAF,EAAcR,KAAK,CAACc,MAApB,CAAf;AACD,OAJD,MAIO;AACLH,QAAAA,OAAO,CAACC,IAAR,CAAaV,cAAb;AACD;AACF,KArBI;AAuBLa,IAAAA,IAAI,EAAE,MAAM;AACV;;AACA,UAAIZ,oBAAJ,EAA0B;AACxB;AACA;AACAG,QAAAA,eAAe,CAAEE,UAAF,EAAcR,KAAK,CAACgB,MAApB,CAAf;AACD,OAJD,MAIO;AACLL,QAAAA,OAAO,CAACC,IAAR,CAAaV,cAAb;AACD;AACF,KAhCI;AAkCLe,IAAAA,GAAG,EAAE,MAAM;AACT;;AACA,UAAId,oBAAJ,EAA0B;AACxB;AACA;AACAG,QAAAA,eAAe,CAAEE,UAAF,EAAcR,KAAK,CAACkB,GAApB,CAAf;AACD,OAJD,MAIO;AACLP,QAAAA,OAAO,CAACC,IAAR,CAAaV,cAAb;AACD;AACF;AA3CI,GAAP;AA6CD;;AAED,OAAO,MAAMiB,mBAAmB,GAAG;AACjCZ,EAAAA;AADiC,CAA5B","sourcesContent":["import { Reanimated } from './reanimatedWrapper';\nimport { State } from '../../State';\nimport { tagMessage } from '../../utils';\n\nexport interface GestureStateManagerType {\n begin: () => void;\n activate: () => void;\n fail: () => void;\n end: () => void;\n}\n\nconst warningMessage = tagMessage(\n 'react-native-reanimated is required in order to use synchronous state management'\n);\n\n// Check if reanimated module is available, but look for useSharedValue as conditional\n// require of reanimated can sometimes return content of `utils.ts` file (?)\nconst REANIMATED_AVAILABLE = Reanimated?.useSharedValue !== undefined;\nconst setGestureState = Reanimated?.setGestureState;\n\nfunction create(handlerTag: number): GestureStateManagerType {\n 'worklet';\n return {\n begin: () => {\n 'worklet';\n if (REANIMATED_AVAILABLE) {\n // When Reanimated is available, setGestureState should be defined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n setGestureState!(handlerTag, State.BEGAN);\n } else {\n console.warn(warningMessage);\n }\n },\n\n activate: () => {\n 'worklet';\n if (REANIMATED_AVAILABLE) {\n // When Reanimated is available, setGestureState should be defined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n setGestureState!(handlerTag, State.ACTIVE);\n } else {\n console.warn(warningMessage);\n }\n },\n\n fail: () => {\n 'worklet';\n if (REANIMATED_AVAILABLE) {\n // When Reanimated is available, setGestureState should be defined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n setGestureState!(handlerTag, State.FAILED);\n } else {\n console.warn(warningMessage);\n }\n },\n\n end: () => {\n 'worklet';\n if (REANIMATED_AVAILABLE) {\n // When Reanimated is available, setGestureState should be defined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n setGestureState!(handlerTag, State.END);\n } else {\n console.warn(warningMessage);\n }\n },\n };\n}\n\nexport const GestureStateManager = {\n create,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["longPressGesture.ts"],"names":["BaseGesture","LongPressGesture","constructor","handlerName","shouldCancelWhenOutside","minDuration","duration","config","minDurationMs","maxDistance","distance","maxDist"],"mappings":";;AAAA,SAASA,WAAT,QAA+C,WAA/C;AAMA,OAAO,MAAMC,gBAAN,SAA+BD,WAA/B,CAAgF;AAGrFE,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF8C,EAE9C;;AAGZ,SAAKC,WAAL,GAAmB,yBAAnB;AACA,SAAKC,uBAAL,CAA6B,IAA7B;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEC,EAAAA,WAAW,CAACC,QAAD,EAAmB;AAC5B,SAAKC,MAAL,CAAYC,aAAZ,GAA4BF,QAA5B;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEG,EAAAA,WAAW,CAACC,QAAD,EAAmB;AAC5B,SAAKH,MAAL,CAAYI,OAAZ,GAAsBD,QAAtB;AACA,WAAO,IAAP;AACD;;AA5BoF","sourcesContent":["import { BaseGesture, BaseGestureConfig } from './gesture';\nimport {\n LongPressGestureConfig,\n LongPressGestureHandlerEventPayload,\n} from '../LongPressGestureHandler';\n\nexport class LongPressGesture extends BaseGesture<LongPressGestureHandlerEventPayload> {\n public config: BaseGestureConfig & LongPressGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'LongPressGestureHandler';\n this.shouldCancelWhenOutside(true);\n }\n\n /**\n * Minimum time, expressed in milliseconds, that a finger must remain pressed on the corresponding view.\n * The default value is 500.\n * @param duration\n */\n minDuration(duration: number) {\n this.config.minDurationMs = duration;\n return this;\n }\n\n /**\n * Maximum distance, expressed in points, that defines how far the finger is allowed to travel during a long press gesture.\n * @param distance\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/long-press-gesture#maxdistancevalue-number\n */\n maxDistance(distance: number) {\n this.config.maxDist = distance;\n return this;\n }\n}\n\nexport type LongPressGestureType = InstanceType<typeof LongPressGesture>;\n"]}
1
+ {"version":3,"sources":["longPressGesture.ts"],"names":["BaseGesture","LongPressGesture","constructor","handlerName","shouldCancelWhenOutside","minDuration","duration","config","minDurationMs","maxDistance","distance","maxDist"],"mappings":";;AAAA,SAASA,WAAT,QAA+C,WAA/C;AAIA,OAAO,MAAMC,gBAAN,SAA+BD,WAA/B,CAAgF;AAGrFE,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF8C,EAE9C;;AAGZ,SAAKC,WAAL,GAAmB,yBAAnB;AACA,SAAKC,uBAAL,CAA6B,IAA7B;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEC,EAAAA,WAAW,CAACC,QAAD,EAAmB;AAC5B,SAAKC,MAAL,CAAYC,aAAZ,GAA4BF,QAA5B;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEG,EAAAA,WAAW,CAACC,QAAD,EAAmB;AAC5B,SAAKH,MAAL,CAAYI,OAAZ,GAAsBD,QAAtB;AACA,WAAO,IAAP;AACD;;AA5BoF","sourcesContent":["import { BaseGesture, BaseGestureConfig } from './gesture';\nimport { LongPressGestureConfig } from '../LongPressGestureHandler';\nimport type { LongPressGestureHandlerEventPayload } from '../GestureHandlerEventPayload';\n\nexport class LongPressGesture extends BaseGesture<LongPressGestureHandlerEventPayload> {\n public config: BaseGestureConfig & LongPressGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'LongPressGestureHandler';\n this.shouldCancelWhenOutside(true);\n }\n\n /**\n * Minimum time, expressed in milliseconds, that a finger must remain pressed on the corresponding view.\n * The default value is 500.\n * @param duration\n */\n minDuration(duration: number) {\n this.config.minDurationMs = duration;\n return this;\n }\n\n /**\n * Maximum distance, expressed in points, that defines how far the finger is allowed to travel during a long press gesture.\n * @param distance\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/long-press-gesture#maxdistancevalue-number\n */\n maxDistance(distance: number) {\n this.config.maxDist = distance;\n return this;\n }\n}\n\nexport type LongPressGestureType = InstanceType<typeof LongPressGesture>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["nativeGesture.ts"],"names":["BaseGesture","NativeGesture","constructor","handlerName","shouldActivateOnStart","value","config","disallowInterruption"],"mappings":";;AAAA,SAA4BA,WAA5B,QAA+C,WAA/C;AAMA,OAAO,MAAMC,aAAN,SAA4BD,WAA5B,CAAyE;AAG9EE,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF+C,EAE/C;;AAGZ,SAAKC,WAAL,GAAmB,0BAAnB;AACD;AAED;AACF;AACA;AACA;;;AACEC,EAAAA,qBAAqB,CAACC,KAAD,EAAiB;AACpC,SAAKC,MAAL,CAAYF,qBAAZ,GAAoCC,KAApC;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;;;AACEE,EAAAA,oBAAoB,CAACF,KAAD,EAAiB;AACnC,SAAKC,MAAL,CAAYC,oBAAZ,GAAmCF,KAAnC;AACA,WAAO,IAAP;AACD;;AAzB6E","sourcesContent":["import { BaseGestureConfig, BaseGesture } from './gesture';\nimport {\n NativeViewGestureConfig,\n NativeViewGestureHandlerPayload,\n} from '../NativeViewGestureHandler';\n\nexport class NativeGesture extends BaseGesture<NativeViewGestureHandlerPayload> {\n public config: BaseGestureConfig & NativeViewGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'NativeViewGestureHandler';\n }\n\n /**\n * When true, underlying handler will activate unconditionally when in `BEGAN` or `UNDETERMINED` state.\n * @param value\n */\n shouldActivateOnStart(value: boolean) {\n this.config.shouldActivateOnStart = value;\n return this;\n }\n\n /**\n * When true, cancels all other gesture handlers when this `NativeViewGestureHandler` receives an `ACTIVE` state event.\n * @param value\n */\n disallowInterruption(value: boolean) {\n this.config.disallowInterruption = value;\n return this;\n }\n}\n\nexport type NativeGestureType = InstanceType<typeof NativeGesture>;\n"]}
1
+ {"version":3,"sources":["nativeGesture.ts"],"names":["BaseGesture","NativeGesture","constructor","handlerName","shouldActivateOnStart","value","config","disallowInterruption"],"mappings":";;AAAA,SAA4BA,WAA5B,QAA+C,WAA/C;AAIA,OAAO,MAAMC,aAAN,SAA4BD,WAA5B,CAAyE;AAG9EE,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF+C,EAE/C;;AAGZ,SAAKC,WAAL,GAAmB,0BAAnB;AACD;AAED;AACF;AACA;AACA;;;AACEC,EAAAA,qBAAqB,CAACC,KAAD,EAAiB;AACpC,SAAKC,MAAL,CAAYF,qBAAZ,GAAoCC,KAApC;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;;;AACEE,EAAAA,oBAAoB,CAACF,KAAD,EAAiB;AACnC,SAAKC,MAAL,CAAYC,oBAAZ,GAAmCF,KAAnC;AACA,WAAO,IAAP;AACD;;AAzB6E","sourcesContent":["import { BaseGestureConfig, BaseGesture } from './gesture';\nimport { NativeViewGestureConfig } from '../NativeViewGestureHandler';\nimport type { NativeViewGestureHandlerPayload } from '../GestureHandlerEventPayload';\n\nexport class NativeGesture extends BaseGesture<NativeViewGestureHandlerPayload> {\n public config: BaseGestureConfig & NativeViewGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'NativeViewGestureHandler';\n }\n\n /**\n * When true, underlying handler will activate unconditionally when in `BEGAN` or `UNDETERMINED` state.\n * @param value\n */\n shouldActivateOnStart(value: boolean) {\n this.config.shouldActivateOnStart = value;\n return this;\n }\n\n /**\n * When true, cancels all other gesture handlers when this `NativeViewGestureHandler` receives an `ACTIVE` state event.\n * @param value\n */\n disallowInterruption(value: boolean) {\n this.config.disallowInterruption = value;\n return this;\n }\n}\n\nexport type NativeGestureType = InstanceType<typeof NativeGesture>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["panGesture.ts"],"names":["ContinousBaseGesture","changeEventCalculator","current","previous","changePayload","undefined","changeX","translationX","changeY","translationY","PanGesture","constructor","handlerName","activeOffsetY","offset","Array","isArray","config","activeOffsetYStart","activeOffsetYEnd","activeOffsetX","activeOffsetXStart","activeOffsetXEnd","failOffsetY","failOffsetYStart","failOffsetYEnd","failOffsetX","failOffsetXStart","failOffsetXEnd","minPointers","maxPointers","minDistance","distance","minDist","minVelocity","velocity","minVelocityX","minVelocityY","averageTouches","value","avgTouches","enableTrackpadTwoFingerGesture","activateAfterLongPress","duration","onChange","callback","handlers"],"mappings":";;AAAA,SAA4BA,oBAA5B,QAAwD,WAAxD;;AAYA,SAASC,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;AACA;;AACA,MAAIC,aAAJ;;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1BD,IAAAA,aAAa,GAAG;AACdE,MAAAA,OAAO,EAAEJ,OAAO,CAACK,YADH;AAEdC,MAAAA,OAAO,EAAEN,OAAO,CAACO;AAFH,KAAhB;AAID,GALD,MAKO;AACLL,IAAAA,aAAa,GAAG;AACdE,MAAAA,OAAO,EAAEJ,OAA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AAmB;AAC5B,SAAKf,MAAL,CAAYgB,OAAZ,GAAsBD,QAAtB;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;;;AACEE,EAAAA,WAAW,CAACC,QAAD,EAAmB;AAC5B,SAAKlB,MAAL,CAAYiB,WAAZ,GAA0BC,QAA1B;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;;;AACEC,EAAAA,YAAY,CAACD,QAAD,EAAmB;AAC7B,SAAKlB,MAAL,CAAYmB,YAAZ,GAA2BD,QAA3B;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;;;AACEE,EAAAA,YAAY,CAACF,QAAD,EAAmB;AAC7B,SAAKlB,MAAL,CAAYoB,YAAZ,GAA2BF,QAA3B;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACEG,EAAAA,cAAc,CAACC,KAAD,EAAiB;AAC7B,SAAKtB,MAAL,CAAYuB,UAAZ,GAAyBD,KAAzB;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACEE,EAAAA,8BAA8B,CAACF,KAAD,EAAiB;AAC7C,SAAKtB,MAAL,CAAYwB,8BAAZ,GAA6CF,KAA7C;AACA,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACEG,EAAAA,sBAAsB,CAACC,QAAD,EAAmB;AACvC,SAAK1B,MAAL,CAAYyB,sBAAZ,GAAqCC,QAArC;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,QAAQ,CACNC,QADM,EAMN;AACA;AACA,SAAKC,QAAL,CAAc7C,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAM2C,QAAN,CAAeC,QAAf,CAAP;AACD;;AAvLD","sourcesContent":["import { BaseGestureConfig, ContinousBaseGesture } from './gesture';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\nimport {\n PanGestureConfig,\n PanGestureHandlerEventPayload,\n} from '../PanGestureHandler';\n\nexport type PanGestureChangeEventPayload = {\n changeX: number;\n changeY: number;\n};\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent<PanGestureHandlerEventPayload>,\n previous?: GestureUpdateEvent<PanGestureHandlerEventPayload>\n) {\n 'worklet';\n let changePayload: PanGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n changeX: current.translationX,\n changeY: current.translationY,\n };\n } else {\n changePayload = {\n changeX: current.translationX - previous.translationX,\n changeY: current.translationY - previous.translationY,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class PanGesture extends ContinousBaseGesture<\n PanGestureHandlerEventPayload,\n PanGestureChangeEventPayload\n> {\n public config: BaseGestureConfig & PanGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'PanGestureHandler';\n }\n\n /**\n * Range along Y axis (in points) where fingers travels without activation of gesture.\n * @param offset\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#activeoffsetyvalue-number--number\n */\n activeOffsetY(\n offset: number | [activeOffsetYStart: number, activeOffsetYEnd: number]\n ) {\n if (Array.isArray(offset)) {\n this.config.activeOffsetYStart = offset[0];\n this.config.activeOffsetYEnd = offset[1];\n } else if (offset < 0) {\n this.config.activeOffsetYStart = offset;\n } else {\n this.config.activeOffsetYEnd = offset;\n }\n return this;\n }\n\n /**\n * Range along X axis (in points) where fingers travels without activation of gesture.\n * @param offset\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#activeoffsetxvalue-number--number\n */\n activeOffsetX(\n offset: number | [activeOffsetXStart: number, activeOffsetXEnd: number]\n ) {\n if (Array.isArray(offset)) {\n this.config.activeOffsetXStart = offset[0];\n this.config.activeOffsetXEnd = offset[1];\n } else if (offset < 0) {\n this.config.activeOffsetXStart = offset;\n } else {\n this.config.activeOffsetXEnd = offset;\n }\n return this;\n }\n\n /**\n * When the finger moves outside this range (in points) along Y axis and gesture hasn't yet activated it will fail recognizing the gesture.\n * @param offset\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#failoffsetyvalue-number--number\n */\n failOffsetY(\n offset: number | [failOffsetYStart: number, failOffsetYEnd: number]\n ) {\n if (Array.isArray(offset)) {\n this.config.failOffsetYStart = offset[0];\n this.config.failOffsetYEnd = offset[1];\n } else if (offset < 0) {\n this.config.failOffsetYStart = offset;\n } else {\n this.config.failOffsetYEnd = offset;\n }\n return this;\n }\n\n /**\n * When the finger moves outside this range (in points) along X axis and gesture hasn't yet activated it will fail recognizing the gesture.\n * @param offset\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#failoffsetxvalue-number--number\n */\n failOffsetX(\n offset: number | [failOffsetXStart: number, failOffsetXEnd: number]\n ) {\n if (Array.isArray(offset)) {\n this.config.failOffsetXStart = offset[0];\n this.config.failOffsetXEnd = offset[1];\n } else if (offset < 0) {\n this.config.failOffsetXStart = offset;\n } else {\n this.config.failOffsetXEnd = offset;\n }\n return this;\n }\n\n /**\n * A number of fingers that is required to be placed before gesture can activate. Should be a higher or equal to 0 integer.\n * @param minPointers\n */\n minPointers(minPointers: number) {\n this.config.minPointers = minPointers;\n return this;\n }\n\n /**\n * When the given number of fingers is placed on the screen and gesture hasn't yet activated it will fail recognizing the gesture.\n * Should be a higher or equal to 0 integer.\n * @param maxPointers\n */\n maxPointers(maxPointers: number) {\n this.config.maxPointers = maxPointers;\n return this;\n }\n\n /**\n * Minimum distance the finger (or multiple finger) need to travel before the gesture activates.\n * Expressed in points.\n * @param distance\n */\n minDistance(distance: number) {\n this.config.minDist = distance;\n return this;\n }\n\n /**\n * Minimum velocity the finger has to reach in order to activate handler.\n * @param velocity\n */\n minVelocity(velocity: number) {\n this.config.minVelocity = velocity;\n return this;\n }\n\n /**\n * Minimum velocity along X axis the finger has to reach in order to activate handler.\n * @param velocity\n */\n minVelocityX(velocity: number) {\n this.config.minVelocityX = velocity;\n return this;\n }\n\n /**\n * Minimum velocity along Y axis the finger has to reach in order to activate handler.\n * @param velocity\n */\n minVelocityY(velocity: number) {\n this.config.minVelocityY = velocity;\n return this;\n }\n\n /**\n * #### Android only\n * Android, by default, will calculate translation values based on the position of the leading pointer (the first one that was placed on the screen).\n * This modifier allows that behavior to be changed to the one that is default on iOS - the averaged position of all active pointers will be used to calculate the translation values.\n * @param value\n */\n averageTouches(value: boolean) {\n this.config.avgTouches = value;\n return this;\n }\n\n /**\n * #### iOS only\n * Enables two-finger gestures on supported devices, for example iPads with trackpads.\n * @param value\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture/#enabletrackpadtwofingergesturevalue-boolean-ios-only\n */\n enableTrackpadTwoFingerGesture(value: boolean) {\n this.config.enableTrackpadTwoFingerGesture = value;\n return this;\n }\n\n /**\n * Duration in milliseconds of the LongPress gesture before Pan is allowed to activate.\n * @param duration\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture/#activateafterlongpressduration-number\n */\n activateAfterLongPress(duration: number) {\n this.config.activateAfterLongPress = duration;\n return this;\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n PanGestureHandlerEventPayload & PanGestureChangeEventPayload\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, PanGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type PanGestureType = InstanceType<typeof PanGesture>;\n"]}
1
+ {"version":3,"sources":["panGesture.ts"],"names":["ContinousBaseGesture","changeEventCalculator","current","previous","changePayload","undefined","changeX","translationX","changeY","translationY","PanGesture","constructor","handlerName","activeOffsetY","offset","Array","isArray","config","activeOffsetYStart","activeOffsetYEnd","activeOffsetX","activeOffsetXStart","activeOffsetXEnd","failOffsetY","failOffsetYStart","failOffsetYEnd","failOffsetX","failOffsetXStart","failOffsetXEnd","minPointers","maxPointers","minDistance","distance","minDist","minVelocity","velocity","minVelocityX","minVelocityY","averageTouches","value","avgTouches","enableTrackpadTwoFingerGesture","activateAfterLongPress","duration","onChange","callback","handlers"],"mappings":";;AAAA,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C,QAArC;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,QAAQ,CACNC,QADM,EAMN;AACA;AACA,SAAKC,QAAL,CAAc7C,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAM2C,QAAN,CAAeC,QAAf,CAAP;AACD;;AAvLD","sourcesContent":["import { BaseGestureConfig, ContinousBaseGesture } from './gesture';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\nimport { PanGestureConfig } from '../PanGestureHandler';\nimport type { PanGestureHandlerEventPayload } from '../GestureHandlerEventPayload';\n\nexport type PanGestureChangeEventPayload = {\n changeX: number;\n changeY: number;\n};\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent<PanGestureHandlerEventPayload>,\n previous?: GestureUpdateEvent<PanGestureHandlerEventPayload>\n) {\n 'worklet';\n let changePayload: PanGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n changeX: current.translationX,\n changeY: current.translationY,\n };\n } else {\n changePayload = {\n changeX: current.translationX - previous.translationX,\n changeY: current.translationY - previous.translationY,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class PanGesture extends ContinousBaseGesture<\n PanGestureHandlerEventPayload,\n PanGestureChangeEventPayload\n> {\n public config: BaseGestureConfig & PanGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'PanGestureHandler';\n }\n\n /**\n * Range along Y axis (in points) where fingers travels without activation of gesture.\n * @param offset\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#activeoffsetyvalue-number--number\n */\n activeOffsetY(\n offset: number | [activeOffsetYStart: number, activeOffsetYEnd: number]\n ) {\n if (Array.isArray(offset)) {\n this.config.activeOffsetYStart = offset[0];\n this.config.activeOffsetYEnd = offset[1];\n } else if (offset < 0) {\n this.config.activeOffsetYStart = offset;\n } else {\n this.config.activeOffsetYEnd = offset;\n }\n return this;\n }\n\n /**\n * Range along X axis (in points) where fingers travels without activation of gesture.\n * @param offset\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#activeoffsetxvalue-number--number\n */\n activeOffsetX(\n offset: number | [activeOffsetXStart: number, activeOffsetXEnd: number]\n ) {\n if (Array.isArray(offset)) {\n this.config.activeOffsetXStart = offset[0];\n this.config.activeOffsetXEnd = offset[1];\n } else if (offset < 0) {\n this.config.activeOffsetXStart = offset;\n } else {\n this.config.activeOffsetXEnd = offset;\n }\n return this;\n }\n\n /**\n * When the finger moves outside this range (in points) along Y axis and gesture hasn't yet activated it will fail recognizing the gesture.\n * @param offset\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#failoffsetyvalue-number--number\n */\n failOffsetY(\n offset: number | [failOffsetYStart: number, failOffsetYEnd: number]\n ) {\n if (Array.isArray(offset)) {\n this.config.failOffsetYStart = offset[0];\n this.config.failOffsetYEnd = offset[1];\n } else if (offset < 0) {\n this.config.failOffsetYStart = offset;\n } else {\n this.config.failOffsetYEnd = offset;\n }\n return this;\n }\n\n /**\n * When the finger moves outside this range (in points) along X axis and gesture hasn't yet activated it will fail recognizing the gesture.\n * @param offset\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#failoffsetxvalue-number--number\n */\n failOffsetX(\n offset: number | [failOffsetXStart: number, failOffsetXEnd: number]\n ) {\n if (Array.isArray(offset)) {\n this.config.failOffsetXStart = offset[0];\n this.config.failOffsetXEnd = offset[1];\n } else if (offset < 0) {\n this.config.failOffsetXStart = offset;\n } else {\n this.config.failOffsetXEnd = offset;\n }\n return this;\n }\n\n /**\n * A number of fingers that is required to be placed before gesture can activate. Should be a higher or equal to 0 integer.\n * @param minPointers\n */\n minPointers(minPointers: number) {\n this.config.minPointers = minPointers;\n return this;\n }\n\n /**\n * When the given number of fingers is placed on the screen and gesture hasn't yet activated it will fail recognizing the gesture.\n * Should be a higher or equal to 0 integer.\n * @param maxPointers\n */\n maxPointers(maxPointers: number) {\n this.config.maxPointers = maxPointers;\n return this;\n }\n\n /**\n * Minimum distance the finger (or multiple finger) need to travel before the gesture activates.\n * Expressed in points.\n * @param distance\n */\n minDistance(distance: number) {\n this.config.minDist = distance;\n return this;\n }\n\n /**\n * Minimum velocity the finger has to reach in order to activate handler.\n * @param velocity\n */\n minVelocity(velocity: number) {\n this.config.minVelocity = velocity;\n return this;\n }\n\n /**\n * Minimum velocity along X axis the finger has to reach in order to activate handler.\n * @param velocity\n */\n minVelocityX(velocity: number) {\n this.config.minVelocityX = velocity;\n return this;\n }\n\n /**\n * Minimum velocity along Y axis the finger has to reach in order to activate handler.\n * @param velocity\n */\n minVelocityY(velocity: number) {\n this.config.minVelocityY = velocity;\n return this;\n }\n\n /**\n * #### Android only\n * Android, by default, will calculate translation values based on the position of the leading pointer (the first one that was placed on the screen).\n * This modifier allows that behavior to be changed to the one that is default on iOS - the averaged position of all active pointers will be used to calculate the translation values.\n * @param value\n */\n averageTouches(value: boolean) {\n this.config.avgTouches = value;\n return this;\n }\n\n /**\n * #### iOS only\n * Enables two-finger gestures on supported devices, for example iPads with trackpads.\n * @param value\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture/#enabletrackpadtwofingergesturevalue-boolean-ios-only\n */\n enableTrackpadTwoFingerGesture(value: boolean) {\n this.config.enableTrackpadTwoFingerGesture = value;\n return this;\n }\n\n /**\n * Duration in milliseconds of the LongPress gesture before Pan is allowed to activate.\n * @param duration\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture/#activateafterlongpressduration-number\n */\n activateAfterLongPress(duration: number) {\n this.config.activateAfterLongPress = duration;\n return this;\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n PanGestureHandlerEventPayload & PanGestureChangeEventPayload\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, PanGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type PanGestureType = InstanceType<typeof PanGesture>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["pinchGesture.ts"],"names":["ContinousBaseGesture","changeEventCalculator","current","previous","changePayload","undefined","scaleChange","scale","PinchGesture","constructor","handlerName","onChange","callback","handlers"],"mappings":"AAAA,SAASA,oBAAT,QAAqC,WAArC;;AAQA,SAASC,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;AACA;;AACA,MAAIC,aAAJ;;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1BD,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK;AADP,KAAhB;AAGD,GAJD,MAIO;AACLH,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK,KAAR,GAAgBJ,QAAQ,CAACI;AADxB,KAAhB;AAGD;;AAED,SAAO,EAAE,GAAGL,OAAL;AAAc,OAAGE;AAAjB,GAAP;AACD;;AAED,OAAO,MAAMI,YAAN,SAA2BR,oBAA3B,CAGL;AACAS,EAAAA,WAAW,GAAG;AACZ;AAEA,SAAKC,WAAL,GAAmB,qBAAnB;AACD;;AAEDC,EAAAA,QAAQ,CACNC,QADM,EAMN;AACA;AACA,SAAKC,QAAL,CAAcZ,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAMU,QAAN,CAAeC,QAAf,CAAP;AACD;;AAjBD","sourcesContent":["import { ContinousBaseGesture } from './gesture';\nimport { PinchGestureHandlerEventPayload } from '../PinchGestureHandler';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\n\nexport type PinchGestureChangeEventPayload = {\n scaleChange: number;\n};\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent<PinchGestureHandlerEventPayload>,\n previous?: GestureUpdateEvent<PinchGestureHandlerEventPayload>\n) {\n 'worklet';\n let changePayload: PinchGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n scaleChange: current.scale,\n };\n } else {\n changePayload = {\n scaleChange: current.scale / previous.scale,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class PinchGesture extends ContinousBaseGesture<\n PinchGestureHandlerEventPayload,\n PinchGestureChangeEventPayload\n> {\n constructor() {\n super();\n\n this.handlerName = 'PinchGestureHandler';\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n PinchGestureHandlerEventPayload & PinchGestureChangeEventPayload\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, PinchGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type PinchGestureType = InstanceType<typeof PinchGesture>;\n"]}
1
+ {"version":3,"sources":["pinchGesture.ts"],"names":["ContinousBaseGesture","changeEventCalculator","current","previous","changePayload","undefined","scaleChange","scale","PinchGesture","constructor","handlerName","onChange","callback","handlers"],"mappings":"AAAA,SAASA,oBAAT,QAAqC,WAArC;;AAQA,SAASC,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;AACA;;AACA,MAAIC,aAAJ;;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1BD,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK;AADP,KAAhB;AAGD,GAJD,MAIO;AACLH,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK,KAAR,GAAgBJ,QAAQ,CAACI;AADxB,KAAhB;AAGD;;AAED,SAAO,EAAE,GAAGL,OAAL;AAAc,OAAGE;AAAjB,GAAP;AACD;;AAED,OAAO,MAAMI,YAAN,SAA2BR,oBAA3B,CAGL;AACAS,EAAAA,WAAW,GAAG;AACZ;AAEA,SAAKC,WAAL,GAAmB,qBAAnB;AACD;;AAEDC,EAAAA,QAAQ,CACNC,QADM,EAMN;AACA;AACA,SAAKC,QAAL,CAAcZ,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAMU,QAAN,CAAeC,QAAf,CAAP;AACD;;AAjBD","sourcesContent":["import { ContinousBaseGesture } from './gesture';\nimport type { PinchGestureHandlerEventPayload } from '../GestureHandlerEventPayload';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\n\nexport type PinchGestureChangeEventPayload = {\n scaleChange: number;\n};\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent<PinchGestureHandlerEventPayload>,\n previous?: GestureUpdateEvent<PinchGestureHandlerEventPayload>\n) {\n 'worklet';\n let changePayload: PinchGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n scaleChange: current.scale,\n };\n } else {\n changePayload = {\n scaleChange: current.scale / previous.scale,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class PinchGesture extends ContinousBaseGesture<\n PinchGestureHandlerEventPayload,\n PinchGestureChangeEventPayload\n> {\n constructor() {\n super();\n\n this.handlerName = 'PinchGestureHandler';\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n PinchGestureHandlerEventPayload & PinchGestureChangeEventPayload\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, PinchGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type PinchGestureType = InstanceType<typeof PinchGesture>;\n"]}