react-native-gesture-handler 2.27.1 → 2.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (426) hide show
  1. package/RNGestureHandler.podspec +3 -2
  2. package/ReanimatedSwipeable/package.json +4 -4
  3. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +14 -8
  4. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +10 -5
  5. package/android/src/main/jni/CMakeLists.txt +5 -0
  6. package/android/src/main/jni/cpp-adapter.cpp +6 -0
  7. package/apple/RNGestureHandler.h +4 -0
  8. package/apple/RNGestureHandler.mm +41 -6
  9. package/apple/RNGestureHandlerModule.mm +5 -0
  10. package/jestSetup.js +22 -3
  11. package/lib/commonjs/components/Pressable/Pressable.js +12 -21
  12. package/lib/commonjs/components/Pressable/Pressable.js.map +1 -1
  13. package/lib/commonjs/components/Pressable/StateMachine.js +8 -2
  14. package/lib/commonjs/components/Pressable/StateMachine.js.map +1 -1
  15. package/lib/commonjs/components/Pressable/stateDefinitions.js +22 -23
  16. package/lib/commonjs/components/Pressable/stateDefinitions.js.map +1 -1
  17. package/lib/commonjs/components/{ReanimatedSwipeable.js → ReanimatedSwipeable/ReanimatedSwipeable.js} +30 -39
  18. package/lib/commonjs/components/ReanimatedSwipeable/ReanimatedSwipeable.js.map +1 -0
  19. package/lib/commonjs/components/ReanimatedSwipeable/ReanimatedSwipeableProps.js +12 -0
  20. package/lib/commonjs/components/ReanimatedSwipeable/ReanimatedSwipeableProps.js.map +1 -0
  21. package/lib/commonjs/components/ReanimatedSwipeable/index.js +21 -0
  22. package/lib/commonjs/components/ReanimatedSwipeable/index.js.map +1 -0
  23. package/lib/commonjs/components/gestureHandlerRootHOC.js +4 -1
  24. package/lib/commonjs/components/gestureHandlerRootHOC.js.map +1 -1
  25. package/lib/commonjs/handlers/createHandler.js +1 -1
  26. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  27. package/lib/commonjs/handlers/gestures/GestureDetector/index.js +1 -1
  28. package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
  29. package/lib/commonjs/mocks/Pressable.js +13 -0
  30. package/lib/commonjs/mocks/Pressable.js.map +1 -0
  31. package/lib/commonjs/{mocks.js → mocks/mocks.js} +8 -11
  32. package/lib/commonjs/mocks/mocks.js.map +1 -0
  33. package/lib/commonjs/web/handlers/GestureHandler.js +5 -2
  34. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  35. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +0 -5
  36. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  37. package/lib/commonjs/web/tools/KeyboardEventManager.js +34 -8
  38. package/lib/commonjs/web/tools/KeyboardEventManager.js.map +1 -1
  39. package/lib/module/components/Pressable/Pressable.js +14 -23
  40. package/lib/module/components/Pressable/Pressable.js.map +1 -1
  41. package/lib/module/components/Pressable/StateMachine.js +8 -2
  42. package/lib/module/components/Pressable/StateMachine.js.map +1 -1
  43. package/lib/module/components/Pressable/stateDefinitions.js +21 -22
  44. package/lib/module/components/Pressable/stateDefinitions.js.map +1 -1
  45. package/lib/module/components/{ReanimatedSwipeable.js → ReanimatedSwipeable/ReanimatedSwipeable.js} +24 -33
  46. package/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js.map +1 -0
  47. package/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeableProps.js +8 -0
  48. package/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeableProps.js.map +1 -0
  49. package/lib/module/components/ReanimatedSwipeable/index.js +5 -0
  50. package/lib/module/components/ReanimatedSwipeable/index.js.map +1 -0
  51. package/lib/module/components/gestureHandlerRootHOC.js +5 -0
  52. package/lib/module/components/gestureHandlerRootHOC.js.map +1 -1
  53. package/lib/module/handlers/createHandler.js +1 -1
  54. package/lib/module/handlers/createHandler.js.map +1 -1
  55. package/lib/module/handlers/gestures/GestureDetector/index.js +1 -1
  56. package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
  57. package/lib/module/mocks/Pressable.js +4 -0
  58. package/lib/module/mocks/Pressable.js.map +1 -0
  59. package/lib/module/{mocks.js → mocks/mocks.js} +7 -11
  60. package/lib/module/mocks/mocks.js.map +1 -0
  61. package/lib/module/web/handlers/GestureHandler.js +5 -2
  62. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  63. package/lib/module/web/tools/GestureHandlerWebDelegate.js +0 -5
  64. package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  65. package/lib/module/web/tools/KeyboardEventManager.js +34 -8
  66. package/lib/module/web/tools/KeyboardEventManager.js.map +1 -1
  67. package/lib/typescript/ActionType.d.ts +1 -0
  68. package/lib/typescript/Directions.d.ts +1 -0
  69. package/lib/typescript/EnableNewWebImplementation.d.ts +1 -0
  70. package/lib/typescript/GestureHandlerRootViewContext.d.ts +1 -0
  71. package/lib/typescript/PlatformConstants.d.ts +1 -0
  72. package/lib/typescript/PlatformConstants.web.d.ts +1 -0
  73. package/lib/typescript/PointerType.d.ts +1 -0
  74. package/lib/typescript/RNGestureHandlerModule.d.ts +1 -0
  75. package/lib/typescript/RNGestureHandlerModule.web.d.ts +1 -0
  76. package/lib/typescript/RNGestureHandlerModule.windows.d.ts +1 -0
  77. package/lib/typescript/RNRenderer.d.ts +1 -0
  78. package/lib/typescript/RNRenderer.web.d.ts +1 -0
  79. package/lib/typescript/State.d.ts +1 -0
  80. package/lib/typescript/TouchEventType.d.ts +1 -0
  81. package/lib/typescript/components/DrawerLayout.d.ts +1 -0
  82. package/lib/typescript/components/GestureButtons.d.ts +1 -0
  83. package/lib/typescript/components/GestureButtonsProps.d.ts +10 -1
  84. package/lib/typescript/components/GestureButtonsProps.d.ts.map +1 -1
  85. package/lib/typescript/components/GestureComponents.d.ts +1 -0
  86. package/lib/typescript/components/GestureComponents.web.d.ts +1 -0
  87. package/lib/typescript/components/GestureHandlerButton.d.ts +1 -0
  88. package/lib/typescript/components/GestureHandlerButton.web.d.ts +1 -0
  89. package/lib/typescript/components/GestureHandlerRootView.android.d.ts +1 -0
  90. package/lib/typescript/components/GestureHandlerRootView.d.ts +1 -0
  91. package/lib/typescript/components/GestureHandlerRootView.web.d.ts +1 -0
  92. package/lib/typescript/components/Pressable/Pressable.d.ts +1 -0
  93. package/lib/typescript/components/Pressable/Pressable.d.ts.map +1 -1
  94. package/lib/typescript/components/Pressable/PressableProps.d.ts +3 -4
  95. package/lib/typescript/components/Pressable/PressableProps.d.ts.map +1 -1
  96. package/lib/typescript/components/Pressable/StateMachine.d.ts +4 -2
  97. package/lib/typescript/components/Pressable/StateMachine.d.ts.map +1 -1
  98. package/lib/typescript/components/Pressable/index.d.ts +1 -0
  99. package/lib/typescript/components/Pressable/stateDefinitions.d.ts +3 -2
  100. package/lib/typescript/components/Pressable/stateDefinitions.d.ts.map +1 -1
  101. package/lib/typescript/components/Pressable/utils.d.ts +1 -0
  102. package/lib/typescript/components/ReanimatedDrawerLayout.d.ts +1 -0
  103. package/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeable.d.ts +6 -0
  104. package/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeable.d.ts.map +1 -0
  105. package/lib/typescript/components/{ReanimatedSwipeable.d.ts → ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts} +10 -7
  106. package/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts.map +1 -0
  107. package/lib/typescript/components/ReanimatedSwipeable/index.d.ts +3 -0
  108. package/lib/typescript/components/ReanimatedSwipeable/index.d.ts.map +1 -0
  109. package/lib/typescript/components/Swipeable.d.ts +1 -0
  110. package/lib/typescript/components/Text.d.ts +1 -0
  111. package/lib/typescript/components/gestureHandlerRootHOC.d.ts +5 -0
  112. package/lib/typescript/components/gestureHandlerRootHOC.d.ts.map +1 -1
  113. package/lib/typescript/components/touchables/ExtraButtonProps.d.ts +1 -0
  114. package/lib/typescript/components/touchables/GenericTouchable.d.ts +1 -0
  115. package/lib/typescript/components/touchables/GenericTouchableProps.d.ts +1 -0
  116. package/lib/typescript/components/touchables/TouchableHighlight.d.ts +1 -0
  117. package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +1 -0
  118. package/lib/typescript/components/touchables/TouchableNativeFeedback.d.ts +1 -0
  119. package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.d.ts +1 -0
  120. package/lib/typescript/components/touchables/TouchableOpacity.d.ts +1 -0
  121. package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +1 -0
  122. package/lib/typescript/components/touchables/index.d.ts +1 -0
  123. package/lib/typescript/components/utils.d.ts +1 -0
  124. package/lib/typescript/findNodeHandle.d.ts +1 -0
  125. package/lib/typescript/findNodeHandle.web.d.ts +1 -0
  126. package/lib/typescript/getShadowNodeFromRef.d.ts +1 -0
  127. package/lib/typescript/getShadowNodeFromRef.web.d.ts +1 -0
  128. package/lib/typescript/ghQueueMicrotask.d.ts +1 -0
  129. package/lib/typescript/handlers/FlingGestureHandler.d.ts +1 -0
  130. package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +1 -0
  131. package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +1 -0
  132. package/lib/typescript/handlers/LongPressGestureHandler.d.ts +1 -0
  133. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +1 -0
  134. package/lib/typescript/handlers/PanGestureHandler.d.ts +1 -0
  135. package/lib/typescript/handlers/PinchGestureHandler.d.ts +1 -0
  136. package/lib/typescript/handlers/PressabilityDebugView.d.ts +1 -0
  137. package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +1 -0
  138. package/lib/typescript/handlers/RotationGestureHandler.d.ts +1 -0
  139. package/lib/typescript/handlers/TapGestureHandler.d.ts +1 -0
  140. package/lib/typescript/handlers/createHandler.d.ts +1 -0
  141. package/lib/typescript/handlers/createNativeWrapper.d.ts +1 -0
  142. package/lib/typescript/handlers/customDirectEventTypes.d.ts +1 -0
  143. package/lib/typescript/handlers/customDirectEventTypes.web.d.ts +1 -0
  144. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +1 -0
  145. package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts +1 -0
  146. package/lib/typescript/handlers/gestures/GestureDetector/Wrap.d.ts +1 -0
  147. package/lib/typescript/handlers/gestures/GestureDetector/Wrap.web.d.ts +1 -0
  148. package/lib/typescript/handlers/gestures/GestureDetector/attachHandlers.d.ts +1 -0
  149. package/lib/typescript/handlers/gestures/GestureDetector/dropHandlers.d.ts +1 -0
  150. package/lib/typescript/handlers/gestures/GestureDetector/index.d.ts +1 -0
  151. package/lib/typescript/handlers/gestures/GestureDetector/needsToReattach.d.ts +1 -0
  152. package/lib/typescript/handlers/gestures/GestureDetector/types.d.ts +1 -0
  153. package/lib/typescript/handlers/gestures/GestureDetector/updateHandlers.d.ts +1 -0
  154. package/lib/typescript/handlers/gestures/GestureDetector/useAnimatedGesture.d.ts +1 -0
  155. package/lib/typescript/handlers/gestures/GestureDetector/useDetectorUpdater.d.ts +1 -0
  156. package/lib/typescript/handlers/gestures/GestureDetector/useMountReactions.d.ts +1 -0
  157. package/lib/typescript/handlers/gestures/GestureDetector/useViewRefHandler.d.ts +1 -0
  158. package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts +1 -0
  159. package/lib/typescript/handlers/gestures/eventReceiver.d.ts +1 -0
  160. package/lib/typescript/handlers/gestures/flingGesture.d.ts +1 -0
  161. package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +1 -0
  162. package/lib/typescript/handlers/gestures/gesture.d.ts +1 -0
  163. package/lib/typescript/handlers/gestures/gestureComposition.d.ts +1 -0
  164. package/lib/typescript/handlers/gestures/gestureObjects.d.ts +1 -0
  165. package/lib/typescript/handlers/gestures/gestureStateManager.d.ts +1 -0
  166. package/lib/typescript/handlers/gestures/gestureStateManager.web.d.ts +1 -0
  167. package/lib/typescript/handlers/gestures/hoverGesture.d.ts +1 -0
  168. package/lib/typescript/handlers/gestures/longPressGesture.d.ts +1 -0
  169. package/lib/typescript/handlers/gestures/manualGesture.d.ts +1 -0
  170. package/lib/typescript/handlers/gestures/nativeGesture.d.ts +1 -0
  171. package/lib/typescript/handlers/gestures/panGesture.d.ts +1 -0
  172. package/lib/typescript/handlers/gestures/pinchGesture.d.ts +1 -0
  173. package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +1 -0
  174. package/lib/typescript/handlers/gestures/rotationGesture.d.ts +1 -0
  175. package/lib/typescript/handlers/gestures/tapGesture.d.ts +1 -0
  176. package/lib/typescript/handlers/getNextHandlerTag.d.ts +1 -0
  177. package/lib/typescript/handlers/handlersRegistry.d.ts +1 -0
  178. package/lib/typescript/handlers/utils.d.ts +1 -0
  179. package/lib/typescript/index.d.ts +1 -0
  180. package/lib/typescript/init.d.ts +1 -0
  181. package/lib/typescript/jestUtils/index.d.ts +1 -0
  182. package/lib/typescript/jestUtils/jestUtils.d.ts +1 -0
  183. package/lib/typescript/mocks/Pressable.d.ts +2 -0
  184. package/lib/typescript/mocks/Pressable.d.ts.map +1 -0
  185. package/lib/typescript/{mocks.d.ts → mocks/mocks.d.ts} +5 -4
  186. package/lib/typescript/mocks/mocks.d.ts.map +1 -0
  187. package/lib/typescript/mountRegistry.d.ts +1 -0
  188. package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +1 -0
  189. package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +1 -0
  190. package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts +1 -0
  191. package/lib/typescript/typeUtils.d.ts +1 -0
  192. package/lib/typescript/utils.d.ts +1 -0
  193. package/lib/typescript/web/Gestures.d.ts +1 -0
  194. package/lib/typescript/web/constants.d.ts +1 -0
  195. package/lib/typescript/web/detectors/RotationGestureDetector.d.ts +1 -0
  196. package/lib/typescript/web/detectors/ScaleGestureDetector.d.ts +1 -0
  197. package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +1 -0
  198. package/lib/typescript/web/handlers/GestureHandler.d.ts +1 -0
  199. package/lib/typescript/web/handlers/GestureHandler.d.ts.map +1 -1
  200. package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +1 -0
  201. package/lib/typescript/web/handlers/IGestureHandler.d.ts +1 -0
  202. package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +1 -0
  203. package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +1 -0
  204. package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +1 -0
  205. package/lib/typescript/web/handlers/PanGestureHandler.d.ts +1 -0
  206. package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +1 -0
  207. package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +1 -0
  208. package/lib/typescript/web/handlers/TapGestureHandler.d.ts +1 -0
  209. package/lib/typescript/web/interfaces.d.ts +1 -0
  210. package/lib/typescript/web/tools/CircularBuffer.d.ts +1 -0
  211. package/lib/typescript/web/tools/EventManager.d.ts +1 -0
  212. package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +1 -0
  213. package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +1 -0
  214. package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +1 -0
  215. package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts.map +1 -1
  216. package/lib/typescript/web/tools/InteractionManager.d.ts +1 -0
  217. package/lib/typescript/web/tools/KeyboardEventManager.d.ts +7 -3
  218. package/lib/typescript/web/tools/KeyboardEventManager.d.ts.map +1 -1
  219. package/lib/typescript/web/tools/LeastSquareSolver.d.ts +1 -0
  220. package/lib/typescript/web/tools/NodeManager.d.ts +1 -0
  221. package/lib/typescript/web/tools/PointerEventManager.d.ts +1 -0
  222. package/lib/typescript/web/tools/PointerTracker.d.ts +1 -0
  223. package/lib/typescript/web/tools/Vector.d.ts +1 -0
  224. package/lib/typescript/web/tools/VelocityTracker.d.ts +1 -0
  225. package/lib/typescript/web/tools/WheelEventManager.d.ts +1 -0
  226. package/lib/typescript/web/utils.d.ts +1 -0
  227. package/lib/typescript/web_hammer/DiscreteGestureHandler.d.ts +1 -0
  228. package/lib/typescript/web_hammer/DraggingGestureHandler.d.ts +1 -0
  229. package/lib/typescript/web_hammer/Errors.d.ts +1 -0
  230. package/lib/typescript/web_hammer/FlingGestureHandler.d.ts +1 -0
  231. package/lib/typescript/web_hammer/GestureHandler.d.ts +1 -0
  232. package/lib/typescript/web_hammer/IndiscreteGestureHandler.d.ts +1 -0
  233. package/lib/typescript/web_hammer/LongPressGestureHandler.d.ts +1 -0
  234. package/lib/typescript/web_hammer/NativeViewGestureHandler.d.ts +1 -0
  235. package/lib/typescript/web_hammer/NodeManager.d.ts +1 -0
  236. package/lib/typescript/web_hammer/PanGestureHandler.d.ts +1 -0
  237. package/lib/typescript/web_hammer/PinchGestureHandler.d.ts +1 -0
  238. package/lib/typescript/web_hammer/PressGestureHandler.d.ts +1 -0
  239. package/lib/typescript/web_hammer/RotationGestureHandler.d.ts +1 -0
  240. package/lib/typescript/web_hammer/TapGestureHandler.d.ts +1 -0
  241. package/lib/typescript/web_hammer/constants.d.ts +1 -0
  242. package/lib/typescript/web_hammer/utils.d.ts +1 -0
  243. package/package.json +4 -3
  244. package/scripts/gesture_handler_utils.rb +25 -0
  245. package/src/components/GestureButtonsProps.ts +10 -0
  246. package/src/components/Pressable/Pressable.tsx +20 -31
  247. package/src/components/Pressable/PressableProps.tsx +2 -4
  248. package/src/components/Pressable/StateMachine.tsx +12 -4
  249. package/src/components/Pressable/stateDefinitions.ts +23 -23
  250. package/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx +603 -0
  251. package/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts +199 -0
  252. package/src/components/ReanimatedSwipeable/index.ts +6 -0
  253. package/src/components/gestureHandlerRootHOC.tsx +4 -0
  254. package/src/handlers/createHandler.tsx +1 -1
  255. package/src/handlers/gestures/GestureDetector/index.tsx +1 -1
  256. package/src/mocks/Pressable.tsx +1 -0
  257. package/src/{mocks.tsx → mocks/mocks.tsx} +7 -11
  258. package/src/web/handlers/GestureHandler.ts +8 -3
  259. package/src/web/tools/GestureHandlerWebDelegate.ts +0 -5
  260. package/src/web/tools/KeyboardEventManager.ts +50 -8
  261. package/lib/commonjs/components/ReanimatedSwipeable.js.map +0 -1
  262. package/lib/commonjs/mocks.js.map +0 -1
  263. package/lib/module/components/ReanimatedSwipeable.js.map +0 -1
  264. package/lib/module/mocks.js.map +0 -1
  265. package/lib/typescript/ActionType.js +0 -6
  266. package/lib/typescript/Directions.js +0 -18
  267. package/lib/typescript/EnableNewWebImplementation.js +0 -30
  268. package/lib/typescript/GestureHandlerRootViewContext.js +0 -2
  269. package/lib/typescript/PlatformConstants.js +0 -3
  270. package/lib/typescript/PlatformConstants.web.js +0 -5
  271. package/lib/typescript/PointerType.js +0 -8
  272. package/lib/typescript/RNGestureHandlerModule.js +0 -4
  273. package/lib/typescript/RNGestureHandlerModule.web.js +0 -92
  274. package/lib/typescript/RNGestureHandlerModule.windows.js +0 -47
  275. package/lib/typescript/RNRenderer.js +0 -3
  276. package/lib/typescript/RNRenderer.web.js +0 -3
  277. package/lib/typescript/State.js +0 -9
  278. package/lib/typescript/TouchEventType.js +0 -7
  279. package/lib/typescript/components/DrawerLayout.js +0 -417
  280. package/lib/typescript/components/GestureButtons.js +0 -165
  281. package/lib/typescript/components/GestureButtonsProps.js +0 -1
  282. package/lib/typescript/components/GestureComponents.js +0 -67
  283. package/lib/typescript/components/GestureComponents.web.js +0 -21
  284. package/lib/typescript/components/GestureHandlerButton.js +0 -2
  285. package/lib/typescript/components/GestureHandlerButton.web.js +0 -3
  286. package/lib/typescript/components/GestureHandlerRootView.android.js +0 -17
  287. package/lib/typescript/components/GestureHandlerRootView.js +0 -16
  288. package/lib/typescript/components/GestureHandlerRootView.web.js +0 -11
  289. package/lib/typescript/components/Pressable/Pressable.js +0 -231
  290. package/lib/typescript/components/Pressable/PressableProps.js +0 -1
  291. package/lib/typescript/components/Pressable/StateMachine.js +0 -34
  292. package/lib/typescript/components/Pressable/index.js +0 -1
  293. package/lib/typescript/components/Pressable/stateDefinitions.js +0 -104
  294. package/lib/typescript/components/Pressable/utils.js +0 -80
  295. package/lib/typescript/components/ReanimatedDrawerLayout.js +0 -364
  296. package/lib/typescript/components/ReanimatedSwipeable.d.ts.map +0 -1
  297. package/lib/typescript/components/ReanimatedSwipeable.js +0 -400
  298. package/lib/typescript/components/Swipeable.js +0 -287
  299. package/lib/typescript/components/Text.js +0 -38
  300. package/lib/typescript/components/gestureHandlerRootHOC.js +0 -18
  301. package/lib/typescript/components/touchables/ExtraButtonProps.js +0 -1
  302. package/lib/typescript/components/touchables/GenericTouchable.js +0 -221
  303. package/lib/typescript/components/touchables/GenericTouchableProps.js +0 -1
  304. package/lib/typescript/components/touchables/TouchableHighlight.js +0 -75
  305. package/lib/typescript/components/touchables/TouchableNativeFeedback.android.js +0 -65
  306. package/lib/typescript/components/touchables/TouchableNativeFeedback.js +0 -6
  307. package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.js +0 -1
  308. package/lib/typescript/components/touchables/TouchableOpacity.js +0 -51
  309. package/lib/typescript/components/touchables/TouchableWithoutFeedback.js +0 -10
  310. package/lib/typescript/components/touchables/index.js +0 -4
  311. package/lib/typescript/components/utils.js +0 -11
  312. package/lib/typescript/findNodeHandle.js +0 -2
  313. package/lib/typescript/findNodeHandle.web.js +0 -31
  314. package/lib/typescript/getShadowNodeFromRef.js +0 -45
  315. package/lib/typescript/getShadowNodeFromRef.web.js +0 -7
  316. package/lib/typescript/ghQueueMicrotask.js +0 -7
  317. package/lib/typescript/handlers/FlingGestureHandler.js +0 -19
  318. package/lib/typescript/handlers/ForceTouchGestureHandler.js +0 -37
  319. package/lib/typescript/handlers/GestureHandlerEventPayload.js +0 -1
  320. package/lib/typescript/handlers/LongPressGestureHandler.js +0 -22
  321. package/lib/typescript/handlers/NativeViewGestureHandler.js +0 -20
  322. package/lib/typescript/handlers/PanGestureHandler.js +0 -128
  323. package/lib/typescript/handlers/PinchGestureHandler.js +0 -12
  324. package/lib/typescript/handlers/PressabilityDebugView.js +0 -2
  325. package/lib/typescript/handlers/PressabilityDebugView.web.js +0 -4
  326. package/lib/typescript/handlers/RotationGestureHandler.js +0 -12
  327. package/lib/typescript/handlers/TapGestureHandler.js +0 -26
  328. package/lib/typescript/handlers/createHandler.js +0 -375
  329. package/lib/typescript/handlers/createNativeWrapper.js +0 -67
  330. package/lib/typescript/handlers/customDirectEventTypes.js +0 -2
  331. package/lib/typescript/handlers/customDirectEventTypes.web.js +0 -4
  332. package/lib/typescript/handlers/gestureHandlerCommon.js +0 -42
  333. package/lib/typescript/handlers/gestureHandlerTypesCompat.js +0 -1
  334. package/lib/typescript/handlers/gestures/GestureDetector/Wrap.js +0 -22
  335. package/lib/typescript/handlers/gestures/GestureDetector/Wrap.web.js +0 -24
  336. package/lib/typescript/handlers/gestures/GestureDetector/attachHandlers.js +0 -55
  337. package/lib/typescript/handlers/gestures/GestureDetector/dropHandlers.js +0 -12
  338. package/lib/typescript/handlers/gestures/GestureDetector/index.js +0 -114
  339. package/lib/typescript/handlers/gestures/GestureDetector/needsToReattach.js +0 -18
  340. package/lib/typescript/handlers/gestures/GestureDetector/types.js +0 -1
  341. package/lib/typescript/handlers/gestures/GestureDetector/updateHandlers.js +0 -54
  342. package/lib/typescript/handlers/gestures/GestureDetector/useAnimatedGesture.js +0 -137
  343. package/lib/typescript/handlers/gestures/GestureDetector/useDetectorUpdater.js +0 -48
  344. package/lib/typescript/handlers/gestures/GestureDetector/useMountReactions.js +0 -35
  345. package/lib/typescript/handlers/gestures/GestureDetector/useViewRefHandler.js +0 -32
  346. package/lib/typescript/handlers/gestures/GestureDetector/utils.js +0 -140
  347. package/lib/typescript/handlers/gestures/eventReceiver.js +0 -105
  348. package/lib/typescript/handlers/gestures/flingGesture.js +0 -27
  349. package/lib/typescript/handlers/gestures/forceTouchGesture.js +0 -57
  350. package/lib/typescript/handlers/gestures/gesture.js +0 -303
  351. package/lib/typescript/handlers/gestures/gestureComposition.js +0 -78
  352. package/lib/typescript/handlers/gestures/gestureObjects.js +0 -125
  353. package/lib/typescript/handlers/gestures/gestureStateManager.js +0 -60
  354. package/lib/typescript/handlers/gestures/gestureStateManager.web.js +0 -19
  355. package/lib/typescript/handlers/gestures/hoverGesture.js +0 -45
  356. package/lib/typescript/handlers/gestures/longPressGesture.js +0 -35
  357. package/lib/typescript/handlers/gestures/manualGesture.js +0 -16
  358. package/lib/typescript/handlers/gestures/nativeGesture.js +0 -24
  359. package/lib/typescript/handlers/gestures/panGesture.js +0 -181
  360. package/lib/typescript/handlers/gestures/pinchGesture.js +0 -27
  361. package/lib/typescript/handlers/gestures/reanimatedWrapper.js +0 -23
  362. package/lib/typescript/handlers/gestures/rotationGesture.js +0 -27
  363. package/lib/typescript/handlers/gestures/tapGesture.js +0 -72
  364. package/lib/typescript/handlers/getNextHandlerTag.js +0 -4
  365. package/lib/typescript/handlers/handlersRegistry.js +0 -36
  366. package/lib/typescript/handlers/utils.js +0 -58
  367. package/lib/typescript/index.js +0 -28
  368. package/lib/typescript/init.js +0 -15
  369. package/lib/typescript/jestUtils/index.js +0 -1
  370. package/lib/typescript/jestUtils/jestUtils.js +0 -290
  371. package/lib/typescript/mocks.d.ts.map +0 -1
  372. package/lib/typescript/mocks.js +0 -59
  373. package/lib/typescript/mountRegistry.js +0 -29
  374. package/lib/typescript/specs/NativeRNGestureHandlerModule.js +0 -2
  375. package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.js +0 -2
  376. package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.js +0 -2
  377. package/lib/typescript/typeUtils.js +0 -1
  378. package/lib/typescript/utils.js +0 -80
  379. package/lib/typescript/web/Gestures.js +0 -38
  380. package/lib/typescript/web/constants.js +0 -2
  381. package/lib/typescript/web/detectors/RotationGestureDetector.js +0 -122
  382. package/lib/typescript/web/detectors/ScaleGestureDetector.js +0 -117
  383. package/lib/typescript/web/handlers/FlingGestureHandler.js +0 -133
  384. package/lib/typescript/web/handlers/GestureHandler.js +0 -656
  385. package/lib/typescript/web/handlers/HoverGestureHandler.js +0 -37
  386. package/lib/typescript/web/handlers/IGestureHandler.js +0 -1
  387. package/lib/typescript/web/handlers/LongPressGestureHandler.js +0 -136
  388. package/lib/typescript/web/handlers/ManualGestureHandler.js +0 -29
  389. package/lib/typescript/web/handlers/NativeViewGestureHandler.js +0 -133
  390. package/lib/typescript/web/handlers/PanGestureHandler.js +0 -420
  391. package/lib/typescript/web/handlers/PinchGestureHandler.js +0 -117
  392. package/lib/typescript/web/handlers/RotationGestureHandler.js +0 -122
  393. package/lib/typescript/web/handlers/TapGestureHandler.js +0 -202
  394. package/lib/typescript/web/interfaces.js +0 -25
  395. package/lib/typescript/web/tools/CircularBuffer.js +0 -37
  396. package/lib/typescript/web/tools/EventManager.js +0 -85
  397. package/lib/typescript/web/tools/GestureHandlerDelegate.js +0 -1
  398. package/lib/typescript/web/tools/GestureHandlerOrchestrator.js +0 -273
  399. package/lib/typescript/web/tools/GestureHandlerWebDelegate.js +0 -169
  400. package/lib/typescript/web/tools/InteractionManager.js +0 -91
  401. package/lib/typescript/web/tools/KeyboardEventManager.js +0 -73
  402. package/lib/typescript/web/tools/LeastSquareSolver.js +0 -147
  403. package/lib/typescript/web/tools/NodeManager.js +0 -28
  404. package/lib/typescript/web/tools/PointerEventManager.js +0 -179
  405. package/lib/typescript/web/tools/PointerTracker.js +0 -161
  406. package/lib/typescript/web/tools/Vector.js +0 -43
  407. package/lib/typescript/web/tools/VelocityTracker.js +0 -76
  408. package/lib/typescript/web/tools/WheelEventManager.js +0 -40
  409. package/lib/typescript/web/utils.js +0 -233
  410. package/lib/typescript/web_hammer/DiscreteGestureHandler.js +0 -48
  411. package/lib/typescript/web_hammer/DraggingGestureHandler.js +0 -25
  412. package/lib/typescript/web_hammer/Errors.js +0 -5
  413. package/lib/typescript/web_hammer/FlingGestureHandler.js +0 -119
  414. package/lib/typescript/web_hammer/GestureHandler.js +0 -469
  415. package/lib/typescript/web_hammer/IndiscreteGestureHandler.js +0 -26
  416. package/lib/typescript/web_hammer/LongPressGestureHandler.js +0 -46
  417. package/lib/typescript/web_hammer/NativeViewGestureHandler.js +0 -40
  418. package/lib/typescript/web_hammer/NodeManager.js +0 -28
  419. package/lib/typescript/web_hammer/PanGestureHandler.js +0 -151
  420. package/lib/typescript/web_hammer/PinchGestureHandler.js +0 -19
  421. package/lib/typescript/web_hammer/PressGestureHandler.js +0 -133
  422. package/lib/typescript/web_hammer/RotationGestureHandler.js +0 -20
  423. package/lib/typescript/web_hammer/TapGestureHandler.js +0 -142
  424. package/lib/typescript/web_hammer/constants.js +0 -42
  425. package/lib/typescript/web_hammer/utils.js +0 -15
  426. package/src/components/ReanimatedSwipeable.tsx +0 -811
@@ -1,78 +0,0 @@
1
- import { BaseGesture, Gesture } from './gesture';
2
- function extendRelation(currentRelation, extendWith) {
3
- if (currentRelation === undefined) {
4
- return [...extendWith];
5
- }
6
- else {
7
- return [...currentRelation, ...extendWith];
8
- }
9
- }
10
- export class ComposedGesture extends Gesture {
11
- gestures = [];
12
- simultaneousGestures = [];
13
- requireGesturesToFail = [];
14
- constructor(...gestures) {
15
- super();
16
- this.gestures = gestures;
17
- }
18
- prepareSingleGesture(gesture, simultaneousGestures, requireGesturesToFail) {
19
- if (gesture instanceof BaseGesture) {
20
- const newConfig = { ...gesture.config };
21
- // No need to extend `blocksHandlers` here, because it's not changed in composition.
22
- // The same effect is achieved by reversing the order of 2 gestures in `Exclusive`
23
- newConfig.simultaneousWith = extendRelation(newConfig.simultaneousWith, simultaneousGestures);
24
- newConfig.requireToFail = extendRelation(newConfig.requireToFail, requireGesturesToFail);
25
- gesture.config = newConfig;
26
- }
27
- else if (gesture instanceof ComposedGesture) {
28
- gesture.simultaneousGestures = simultaneousGestures;
29
- gesture.requireGesturesToFail = requireGesturesToFail;
30
- gesture.prepare();
31
- }
32
- }
33
- prepare() {
34
- for (const gesture of this.gestures) {
35
- this.prepareSingleGesture(gesture, this.simultaneousGestures, this.requireGesturesToFail);
36
- }
37
- }
38
- initialize() {
39
- for (const gesture of this.gestures) {
40
- gesture.initialize();
41
- }
42
- }
43
- toGestureArray() {
44
- return this.gestures.flatMap((gesture) => gesture.toGestureArray());
45
- }
46
- }
47
- export class SimultaneousGesture extends ComposedGesture {
48
- prepare() {
49
- // This piece of magic works something like this:
50
- // for every gesture in the array
51
- const simultaneousArrays = this.gestures.map((gesture) =>
52
- // we take the array it's in
53
- this.gestures
54
- // and make a copy without it
55
- .filter((x) => x !== gesture)
56
- // then we flatmap the result to get list of raw (not composed) gestures
57
- // this way we don't make the gestures simultaneous with themselves, which is
58
- // important when the gesture is `ExclusiveGesture` - we don't want to make
59
- // exclusive gestures simultaneous
60
- .flatMap((x) => x.toGestureArray()));
61
- for (let i = 0; i < this.gestures.length; i++) {
62
- this.prepareSingleGesture(this.gestures[i], simultaneousArrays[i], this.requireGesturesToFail);
63
- }
64
- }
65
- }
66
- export class ExclusiveGesture extends ComposedGesture {
67
- prepare() {
68
- // Transforms the array of gestures into array of grouped raw (not composed) gestures
69
- // i.e. [gesture1, gesture2, ComposedGesture(gesture3, gesture4)] -> [[gesture1], [gesture2], [gesture3, gesture4]]
70
- const gestureArrays = this.gestures.map((gesture) => gesture.toGestureArray());
71
- let requireToFail = [];
72
- for (let i = 0; i < this.gestures.length; i++) {
73
- this.prepareSingleGesture(this.gestures[i], this.simultaneousGestures, this.requireGesturesToFail.concat(requireToFail));
74
- // Every group gets to wait for all groups before it
75
- requireToFail = requireToFail.concat(gestureArrays[i]);
76
- }
77
- }
78
- }
@@ -1,125 +0,0 @@
1
- import { FlingGesture } from './flingGesture';
2
- import { ForceTouchGesture } from './forceTouchGesture';
3
- import { ComposedGesture, ExclusiveGesture, SimultaneousGesture, } from './gestureComposition';
4
- import { LongPressGesture } from './longPressGesture';
5
- import { PanGesture } from './panGesture';
6
- import { PinchGesture } from './pinchGesture';
7
- import { RotationGesture } from './rotationGesture';
8
- import { TapGesture } from './tapGesture';
9
- import { NativeGesture } from './nativeGesture';
10
- import { ManualGesture } from './manualGesture';
11
- import { HoverGesture } from './hoverGesture';
12
- /**
13
- * `Gesture` is the object that allows you to create and compose gestures.
14
- *
15
- * ### Remarks
16
- * - Consider wrapping your gesture configurations with `useMemo`, as it will reduce the amount of work Gesture Handler has to do under the hood when updating gestures.
17
- *
18
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/gesture
19
- */
20
- export const GestureObjects = {
21
- /**
22
- * A discrete gesture that recognizes one or many taps.
23
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/tap-gesture
24
- */
25
- Tap: () => {
26
- return new TapGesture();
27
- },
28
- /**
29
- * A continuous gesture that can recognize a panning (dragging) gesture and track its movement.
30
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture
31
- */
32
- Pan: () => {
33
- return new PanGesture();
34
- },
35
- /**
36
- * A continuous gesture that recognizes pinch gesture. It allows for tracking the distance between two fingers and use that information to scale or zoom your content.
37
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pinch-gesture
38
- */
39
- Pinch: () => {
40
- return new PinchGesture();
41
- },
42
- /**
43
- * A continuous gesture that can recognize rotation and track its movement.
44
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/rotation-gesture
45
- */
46
- Rotation: () => {
47
- return new RotationGesture();
48
- },
49
- /**
50
- * A discrete gesture that activates when the movement is sufficiently fast.
51
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/fling-gesture
52
- */
53
- Fling: () => {
54
- return new FlingGesture();
55
- },
56
- /**
57
- * A discrete gesture that activates when the corresponding view is pressed for a sufficiently long time.
58
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/long-press-gesture
59
- */
60
- LongPress: () => {
61
- return new LongPressGesture();
62
- },
63
- /**
64
- * @deprecated ForceTouch gesture is deprecated and will be removed in the future.
65
- *
66
- * #### iOS only
67
- * A continuous gesture that recognizes force of a touch. It allows for tracking pressure of touch on some iOS devices.
68
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/force-touch-gesture
69
- */
70
- ForceTouch: () => {
71
- return new ForceTouchGesture();
72
- },
73
- /**
74
- * A gesture that allows other touch handling components to participate in RNGH's gesture system.
75
- * When used, the other component should be the direct child of a `GestureDetector`.
76
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/native-gesture
77
- */
78
- Native: () => {
79
- return new NativeGesture();
80
- },
81
- /**
82
- * A plain gesture that has no specific activation criteria nor event data set.
83
- * Its state has to be controlled manually using a state manager.
84
- * It will not fail when all the pointers are lifted from the screen.
85
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/manual-gesture
86
- */
87
- Manual: () => {
88
- return new ManualGesture();
89
- },
90
- /**
91
- * A continuous gesture that can recognize hovering above the view it's attached to.
92
- * The hover effect may be activated by moving a mouse or a stylus over the view.
93
- *
94
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/hover-gesture
95
- */
96
- Hover: () => {
97
- return new HoverGesture();
98
- },
99
- /**
100
- * Builds a composed gesture consisting of gestures provided as parameters.
101
- * The first one that becomes active cancels the rest of gestures.
102
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#race
103
- */
104
- Race: (...gestures) => {
105
- return new ComposedGesture(...gestures);
106
- },
107
- /**
108
- * Builds a composed gesture that allows all base gestures to run simultaneously.
109
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#simultaneous
110
- */
111
- Simultaneous(...gestures) {
112
- return new SimultaneousGesture(...gestures);
113
- },
114
- /**
115
- * Builds a composed gesture where only one of the provided gestures can become active.
116
- * Priority is decided through the order of gestures: the first one has higher priority
117
- * than the second one, second one has higher priority than the third one, and so on.
118
- * For example, to make a gesture that recognizes both single and double tap you need
119
- * to call Exclusive(doubleTap, singleTap).
120
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#exclusive
121
- */
122
- Exclusive(...gestures) {
123
- return new ExclusiveGesture(...gestures);
124
- },
125
- };
@@ -1,60 +0,0 @@
1
- import { Reanimated } from './reanimatedWrapper';
2
- import { State } from '../../State';
3
- import { tagMessage } from '../../utils';
4
- const warningMessage = tagMessage('react-native-reanimated is required in order to use synchronous state management');
5
- // Check if reanimated module is available, but look for useSharedValue as conditional
6
- // require of reanimated can sometimes return content of `utils.ts` file (?)
7
- const REANIMATED_AVAILABLE = Reanimated?.useSharedValue !== undefined;
8
- const setGestureState = Reanimated?.setGestureState;
9
- function create(handlerTag) {
10
- 'worklet';
11
- return {
12
- begin: () => {
13
- 'worklet';
14
- if (REANIMATED_AVAILABLE) {
15
- // When Reanimated is available, setGestureState should be defined
16
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
17
- setGestureState(handlerTag, State.BEGAN);
18
- }
19
- else {
20
- console.warn(warningMessage);
21
- }
22
- },
23
- activate: () => {
24
- 'worklet';
25
- if (REANIMATED_AVAILABLE) {
26
- // When Reanimated is available, setGestureState should be defined
27
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
28
- setGestureState(handlerTag, State.ACTIVE);
29
- }
30
- else {
31
- console.warn(warningMessage);
32
- }
33
- },
34
- fail: () => {
35
- 'worklet';
36
- if (REANIMATED_AVAILABLE) {
37
- // When Reanimated is available, setGestureState should be defined
38
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
39
- setGestureState(handlerTag, State.FAILED);
40
- }
41
- else {
42
- console.warn(warningMessage);
43
- }
44
- },
45
- end: () => {
46
- 'worklet';
47
- if (REANIMATED_AVAILABLE) {
48
- // When Reanimated is available, setGestureState should be defined
49
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
50
- setGestureState(handlerTag, State.END);
51
- }
52
- else {
53
- console.warn(warningMessage);
54
- }
55
- },
56
- };
57
- }
58
- export const GestureStateManager = {
59
- create,
60
- };
@@ -1,19 +0,0 @@
1
- import NodeManager from '../../web/tools/NodeManager';
2
- export const GestureStateManager = {
3
- create(handlerTag) {
4
- return {
5
- begin: () => {
6
- NodeManager.getHandler(handlerTag).begin();
7
- },
8
- activate: () => {
9
- NodeManager.getHandler(handlerTag).activate(true);
10
- },
11
- fail: () => {
12
- NodeManager.getHandler(handlerTag).fail();
13
- },
14
- end: () => {
15
- NodeManager.getHandler(handlerTag).end();
16
- },
17
- };
18
- },
19
- };
@@ -1,45 +0,0 @@
1
- import { ContinousBaseGesture } from './gesture';
2
- export var HoverEffect;
3
- (function (HoverEffect) {
4
- HoverEffect[HoverEffect["NONE"] = 0] = "NONE";
5
- HoverEffect[HoverEffect["LIFT"] = 1] = "LIFT";
6
- HoverEffect[HoverEffect["HIGHLIGHT"] = 2] = "HIGHLIGHT";
7
- })(HoverEffect || (HoverEffect = {}));
8
- export const hoverGestureHandlerProps = ['hoverEffect'];
9
- function changeEventCalculator(current, previous) {
10
- 'worklet';
11
- let changePayload;
12
- if (previous === undefined) {
13
- changePayload = {
14
- changeX: current.x,
15
- changeY: current.y,
16
- };
17
- }
18
- else {
19
- changePayload = {
20
- changeX: current.x - previous.x,
21
- changeY: current.y - previous.y,
22
- };
23
- }
24
- return { ...current, ...changePayload };
25
- }
26
- export class HoverGesture extends ContinousBaseGesture {
27
- config = {};
28
- constructor() {
29
- super();
30
- this.handlerName = 'HoverGestureHandler';
31
- }
32
- /**
33
- * #### iOS only
34
- * Sets the visual hover effect.
35
- */
36
- effect(effect) {
37
- this.config.hoverEffect = effect;
38
- return this;
39
- }
40
- onChange(callback) {
41
- // @ts-ignore TS being overprotective, HoverGestureHandlerEventPayload is Record
42
- this.handlers.changeEventCalculator = changeEventCalculator;
43
- return super.onChange(callback);
44
- }
45
- }
@@ -1,35 +0,0 @@
1
- import { BaseGesture } from './gesture';
2
- export class LongPressGesture extends BaseGesture {
3
- config = {};
4
- constructor() {
5
- super();
6
- this.handlerName = 'LongPressGestureHandler';
7
- this.shouldCancelWhenOutside(true);
8
- }
9
- /**
10
- * Minimum time, expressed in milliseconds, that a finger must remain pressed on the corresponding view.
11
- * The default value is 500.
12
- * @param duration
13
- */
14
- minDuration(duration) {
15
- this.config.minDurationMs = duration;
16
- return this;
17
- }
18
- /**
19
- * Maximum distance, expressed in points, that defines how far the finger is allowed to travel during a long press gesture.
20
- * @param distance
21
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/long-press-gesture#maxdistancevalue-number
22
- */
23
- maxDistance(distance) {
24
- this.config.maxDist = distance;
25
- return this;
26
- }
27
- /**
28
- * Determine exact number of points required to handle the long press gesture.
29
- * @param pointers
30
- */
31
- numberOfPointers(pointers) {
32
- this.config.numberOfPointers = pointers;
33
- return this;
34
- }
35
- }
@@ -1,16 +0,0 @@
1
- import { ContinousBaseGesture } from './gesture';
2
- function changeEventCalculator(current, _previous) {
3
- 'worklet';
4
- return current;
5
- }
6
- export class ManualGesture extends ContinousBaseGesture {
7
- constructor() {
8
- super();
9
- this.handlerName = 'ManualGestureHandler';
10
- }
11
- onChange(callback) {
12
- // @ts-ignore TS being overprotective, Record<string, never> is Record
13
- this.handlers.changeEventCalculator = changeEventCalculator;
14
- return super.onChange(callback);
15
- }
16
- }
@@ -1,24 +0,0 @@
1
- import { BaseGesture } from './gesture';
2
- export class NativeGesture extends BaseGesture {
3
- config = {};
4
- constructor() {
5
- super();
6
- this.handlerName = 'NativeViewGestureHandler';
7
- }
8
- /**
9
- * When true, underlying handler will activate unconditionally when in `BEGAN` or `UNDETERMINED` state.
10
- * @param value
11
- */
12
- shouldActivateOnStart(value) {
13
- this.config.shouldActivateOnStart = value;
14
- return this;
15
- }
16
- /**
17
- * When true, cancels all other gesture handlers when this `NativeViewGestureHandler` receives an `ACTIVE` state event.
18
- * @param value
19
- */
20
- disallowInterruption(value) {
21
- this.config.disallowInterruption = value;
22
- return this;
23
- }
24
- }
@@ -1,181 +0,0 @@
1
- import { ContinousBaseGesture } from './gesture';
2
- function changeEventCalculator(current, previous) {
3
- 'worklet';
4
- let changePayload;
5
- if (previous === undefined) {
6
- changePayload = {
7
- changeX: current.translationX,
8
- changeY: current.translationY,
9
- };
10
- }
11
- else {
12
- changePayload = {
13
- changeX: current.translationX - previous.translationX,
14
- changeY: current.translationY - previous.translationY,
15
- };
16
- }
17
- return { ...current, ...changePayload };
18
- }
19
- export class PanGesture extends ContinousBaseGesture {
20
- config = {};
21
- constructor() {
22
- super();
23
- this.handlerName = 'PanGestureHandler';
24
- }
25
- /**
26
- * Range along Y axis (in points) where fingers travels without activation of gesture.
27
- * @param offset
28
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#activeoffsetyvalue-number--number
29
- */
30
- activeOffsetY(offset) {
31
- if (Array.isArray(offset)) {
32
- this.config.activeOffsetYStart = offset[0];
33
- this.config.activeOffsetYEnd = offset[1];
34
- }
35
- else if (offset < 0) {
36
- this.config.activeOffsetYStart = offset;
37
- }
38
- else {
39
- this.config.activeOffsetYEnd = offset;
40
- }
41
- return this;
42
- }
43
- /**
44
- * Range along X axis (in points) where fingers travels without activation of gesture.
45
- * @param offset
46
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#activeoffsetxvalue-number--number
47
- */
48
- activeOffsetX(offset) {
49
- if (Array.isArray(offset)) {
50
- this.config.activeOffsetXStart = offset[0];
51
- this.config.activeOffsetXEnd = offset[1];
52
- }
53
- else if (offset < 0) {
54
- this.config.activeOffsetXStart = offset;
55
- }
56
- else {
57
- this.config.activeOffsetXEnd = offset;
58
- }
59
- return this;
60
- }
61
- /**
62
- * When the finger moves outside this range (in points) along Y axis and gesture hasn't yet activated it will fail recognizing the gesture.
63
- * @param offset
64
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#failoffsetyvalue-number--number
65
- */
66
- failOffsetY(offset) {
67
- if (Array.isArray(offset)) {
68
- this.config.failOffsetYStart = offset[0];
69
- this.config.failOffsetYEnd = offset[1];
70
- }
71
- else if (offset < 0) {
72
- this.config.failOffsetYStart = offset;
73
- }
74
- else {
75
- this.config.failOffsetYEnd = offset;
76
- }
77
- return this;
78
- }
79
- /**
80
- * When the finger moves outside this range (in points) along X axis and gesture hasn't yet activated it will fail recognizing the gesture.
81
- * @param offset
82
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#failoffsetxvalue-number--number
83
- */
84
- failOffsetX(offset) {
85
- if (Array.isArray(offset)) {
86
- this.config.failOffsetXStart = offset[0];
87
- this.config.failOffsetXEnd = offset[1];
88
- }
89
- else if (offset < 0) {
90
- this.config.failOffsetXStart = offset;
91
- }
92
- else {
93
- this.config.failOffsetXEnd = offset;
94
- }
95
- return this;
96
- }
97
- /**
98
- * A number of fingers that is required to be placed before gesture can activate. Should be a higher or equal to 0 integer.
99
- * @param minPointers
100
- */
101
- minPointers(minPointers) {
102
- this.config.minPointers = minPointers;
103
- return this;
104
- }
105
- /**
106
- * When the given number of fingers is placed on the screen and gesture hasn't yet activated it will fail recognizing the gesture.
107
- * Should be a higher or equal to 0 integer.
108
- * @param maxPointers
109
- */
110
- maxPointers(maxPointers) {
111
- this.config.maxPointers = maxPointers;
112
- return this;
113
- }
114
- /**
115
- * Minimum distance the finger (or multiple finger) need to travel before the gesture activates.
116
- * Expressed in points.
117
- * @param distance
118
- */
119
- minDistance(distance) {
120
- this.config.minDist = distance;
121
- return this;
122
- }
123
- /**
124
- * Minimum velocity the finger has to reach in order to activate handler.
125
- * @param velocity
126
- */
127
- minVelocity(velocity) {
128
- this.config.minVelocity = velocity;
129
- return this;
130
- }
131
- /**
132
- * Minimum velocity along X axis the finger has to reach in order to activate handler.
133
- * @param velocity
134
- */
135
- minVelocityX(velocity) {
136
- this.config.minVelocityX = velocity;
137
- return this;
138
- }
139
- /**
140
- * Minimum velocity along Y axis the finger has to reach in order to activate handler.
141
- * @param velocity
142
- */
143
- minVelocityY(velocity) {
144
- this.config.minVelocityY = velocity;
145
- return this;
146
- }
147
- /**
148
- * #### Android only
149
- * Android, by default, will calculate translation values based on the position of the leading pointer (the first one that was placed on the screen).
150
- * 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.
151
- * @param value
152
- */
153
- averageTouches(value) {
154
- this.config.avgTouches = value;
155
- return this;
156
- }
157
- /**
158
- * #### iOS only
159
- * Enables two-finger gestures on supported devices, for example iPads with trackpads.
160
- * @param value
161
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture/#enabletrackpadtwofingergesturevalue-boolean-ios-only
162
- */
163
- enableTrackpadTwoFingerGesture(value) {
164
- this.config.enableTrackpadTwoFingerGesture = value;
165
- return this;
166
- }
167
- /**
168
- * Duration in milliseconds of the LongPress gesture before Pan is allowed to activate.
169
- * @param duration
170
- * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture/#activateafterlongpressduration-number
171
- */
172
- activateAfterLongPress(duration) {
173
- this.config.activateAfterLongPress = duration;
174
- return this;
175
- }
176
- onChange(callback) {
177
- // @ts-ignore TS being overprotective, PanGestureHandlerEventPayload is Record
178
- this.handlers.changeEventCalculator = changeEventCalculator;
179
- return super.onChange(callback);
180
- }
181
- }
@@ -1,27 +0,0 @@
1
- import { ContinousBaseGesture } from './gesture';
2
- function changeEventCalculator(current, previous) {
3
- 'worklet';
4
- let changePayload;
5
- if (previous === undefined) {
6
- changePayload = {
7
- scaleChange: current.scale,
8
- };
9
- }
10
- else {
11
- changePayload = {
12
- scaleChange: current.scale / previous.scale,
13
- };
14
- }
15
- return { ...current, ...changePayload };
16
- }
17
- export class PinchGesture extends ContinousBaseGesture {
18
- constructor() {
19
- super();
20
- this.handlerName = 'PinchGestureHandler';
21
- }
22
- onChange(callback) {
23
- // @ts-ignore TS being overprotective, PinchGestureHandlerEventPayload is Record
24
- this.handlers.changeEventCalculator = changeEventCalculator;
25
- return super.onChange(callback);
26
- }
27
- }
@@ -1,23 +0,0 @@
1
- import { tagMessage } from '../../utils';
2
- let Reanimated;
3
- try {
4
- Reanimated = require('react-native-reanimated');
5
- }
6
- catch (e) {
7
- // When 'react-native-reanimated' is not available we want to quietly continue
8
- // @ts-ignore TS demands the variable to be initialized
9
- Reanimated = undefined;
10
- }
11
- if (!Reanimated?.useSharedValue) {
12
- // @ts-ignore Make sure the loaded module is actually Reanimated, if it's not
13
- // reset the module to undefined so we can fallback to the default implementation
14
- Reanimated = undefined;
15
- }
16
- if (Reanimated !== undefined && !Reanimated.setGestureState) {
17
- // The loaded module is Reanimated but it doesn't have the setGestureState defined
18
- Reanimated.setGestureState = () => {
19
- 'worklet';
20
- console.warn(tagMessage('Please use newer version of react-native-reanimated in order to control state of the gestures.'));
21
- };
22
- }
23
- export { Reanimated };
@@ -1,27 +0,0 @@
1
- import { ContinousBaseGesture } from './gesture';
2
- function changeEventCalculator(current, previous) {
3
- 'worklet';
4
- let changePayload;
5
- if (previous === undefined) {
6
- changePayload = {
7
- rotationChange: current.rotation,
8
- };
9
- }
10
- else {
11
- changePayload = {
12
- rotationChange: current.rotation - previous.rotation,
13
- };
14
- }
15
- return { ...current, ...changePayload };
16
- }
17
- export class RotationGesture extends ContinousBaseGesture {
18
- constructor() {
19
- super();
20
- this.handlerName = 'RotationGestureHandler';
21
- }
22
- onChange(callback) {
23
- // @ts-ignore TS being overprotective, RotationGestureHandlerEventPayload is Record
24
- this.handlers.changeEventCalculator = changeEventCalculator;
25
- return super.onChange(callback);
26
- }
27
- }