react-native-gesture-handler 1.10.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (580) hide show
  1. package/DrawerLayout/package.json +3 -3
  2. package/README.md +7 -6
  3. package/Swipeable/package.json +3 -3
  4. package/android/build.gradle +48 -1
  5. package/android/common/src/main/java/com/swmansion/common/GestureHandlerStateManager.kt +5 -0
  6. package/android/gradle.properties +19 -0
  7. package/android/lib/src/main/java/com/swmansion/gesturehandler/BaseGestureHandlerInteractionController.kt +18 -0
  8. package/android/lib/src/main/java/com/swmansion/gesturehandler/Extensions.kt +11 -0
  9. package/android/lib/src/main/java/com/swmansion/gesturehandler/FlingGestureHandler.kt +96 -0
  10. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandler.kt +713 -0
  11. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerInteractionController.kt +8 -0
  12. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.kt +562 -0
  13. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistry.kt +8 -0
  14. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistryImpl.kt +21 -0
  15. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureUtils.kt +49 -0
  16. package/android/lib/src/main/java/com/swmansion/gesturehandler/LongPressGestureHandler.kt +97 -0
  17. package/android/lib/src/main/java/com/swmansion/gesturehandler/ManualGestureHandler.kt +11 -0
  18. package/android/lib/src/main/java/com/swmansion/gesturehandler/NativeViewGestureHandler.kt +129 -0
  19. package/android/lib/src/main/java/com/swmansion/gesturehandler/OnTouchEventListener.kt +9 -0
  20. package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.kt +289 -0
  21. package/android/lib/src/main/java/com/swmansion/gesturehandler/PinchGestureHandler.kt +88 -0
  22. package/android/lib/src/main/java/com/swmansion/gesturehandler/{PointerEventsConfig.java → PointerEventsConfig.kt} +3 -5
  23. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureDetector.kt +125 -0
  24. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureHandler.kt +79 -0
  25. package/android/lib/src/main/java/com/swmansion/gesturehandler/TapGestureHandler.kt +167 -0
  26. package/android/lib/src/main/java/com/swmansion/gesturehandler/ViewConfigurationHelper.kt +10 -0
  27. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +348 -0
  28. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.kt +57 -0
  29. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +59 -0
  30. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDataExtractor.kt +8 -0
  31. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +61 -0
  32. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +686 -0
  33. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerPackage.kt +17 -0
  34. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.kt +95 -0
  35. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +132 -0
  36. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootInterface.kt +5 -0
  37. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +68 -0
  38. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.kt +34 -0
  39. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +66 -0
  40. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +69 -0
  41. package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt +51 -0
  42. package/ios/Handlers/RNFlingHandler.m +78 -5
  43. package/ios/Handlers/RNForceTouchHandler.m +29 -4
  44. package/ios/Handlers/RNLongPressHandler.m +105 -3
  45. package/ios/Handlers/RNManualHandler.h +4 -0
  46. package/ios/Handlers/RNManualHandler.m +73 -0
  47. package/ios/Handlers/RNNativeViewHandler.m +30 -2
  48. package/ios/Handlers/RNPanHandler.m +64 -4
  49. package/ios/Handlers/RNPinchHandler.m +61 -2
  50. package/ios/Handlers/RNRotationHandler.m +60 -1
  51. package/ios/Handlers/RNTapHandler.m +55 -8
  52. package/ios/RNGestureHandler.h +18 -4
  53. package/ios/RNGestureHandler.m +123 -13
  54. package/ios/RNGestureHandler.xcodeproj/project.xcworkspace/xcuserdata/jakubpiasecki.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  55. package/ios/RNGestureHandler.xcodeproj/xcuserdata/jakubpiasecki.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
  56. package/ios/RNGestureHandlerEvents.h +9 -0
  57. package/ios/RNGestureHandlerEvents.m +34 -0
  58. package/ios/RNGestureHandlerManager.h +7 -0
  59. package/ios/RNGestureHandlerManager.m +62 -34
  60. package/ios/RNGestureHandlerModule.m +39 -3
  61. package/ios/RNGestureHandlerPointerTracker.h +25 -0
  62. package/ios/RNGestureHandlerPointerTracker.m +237 -0
  63. package/ios/RNGestureHandlerRegistry.h +1 -0
  64. package/ios/RNGestureHandlerRegistry.m +10 -0
  65. package/ios/RNGestureHandlerStateManager.h +5 -0
  66. package/ios/RNManualActivationRecognizer.h +10 -0
  67. package/ios/RNManualActivationRecognizer.m +80 -0
  68. package/ios/RNRootViewGestureRecognizer.m +1 -1
  69. package/ios/RNTouchEventType.h +9 -0
  70. package/jestSetup.js +7 -1
  71. package/lib/commonjs/Directions.js +15 -0
  72. package/lib/commonjs/Directions.js.map +1 -0
  73. package/lib/commonjs/EventType.js +16 -0
  74. package/lib/commonjs/EventType.js.map +1 -0
  75. package/lib/commonjs/GestureHandlerRootView.android.js +24 -0
  76. package/lib/commonjs/GestureHandlerRootView.android.js.map +1 -0
  77. package/lib/commonjs/GestureHandlerRootView.js +20 -0
  78. package/lib/commonjs/GestureHandlerRootView.js.map +1 -0
  79. package/lib/commonjs/PlatformConstants.js +15 -0
  80. package/lib/commonjs/PlatformConstants.js.map +1 -0
  81. package/lib/commonjs/PlatformConstants.web.js +14 -0
  82. package/lib/commonjs/PlatformConstants.web.js.map +1 -0
  83. package/lib/commonjs/RNGestureHandlerModule.js +22 -0
  84. package/lib/commonjs/RNGestureHandlerModule.js.map +1 -0
  85. package/lib/commonjs/RNGestureHandlerModule.web.js +80 -0
  86. package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -0
  87. package/lib/commonjs/State.js +18 -0
  88. package/lib/commonjs/State.js.map +1 -0
  89. package/lib/commonjs/components/DrawerLayout.js +535 -0
  90. package/lib/commonjs/components/DrawerLayout.js.map +1 -0
  91. package/lib/commonjs/components/GestureButtons.js +207 -0
  92. package/lib/commonjs/components/GestureButtons.js.map +1 -0
  93. package/lib/commonjs/components/GestureComponents.js +76 -0
  94. package/lib/commonjs/components/GestureComponents.js.map +1 -0
  95. package/lib/commonjs/components/GestureComponents.web.js +46 -0
  96. package/lib/commonjs/components/GestureComponents.web.js.map +1 -0
  97. package/lib/commonjs/components/GestureHandlerButton.js +13 -0
  98. package/lib/commonjs/components/GestureHandlerButton.js.map +1 -0
  99. package/lib/commonjs/components/GestureHandlerButton.web.js +24 -0
  100. package/lib/commonjs/components/GestureHandlerButton.web.js.map +1 -0
  101. package/lib/commonjs/components/Swipeable.js +365 -0
  102. package/lib/commonjs/components/Swipeable.js.map +1 -0
  103. package/lib/commonjs/components/touchables/GenericTouchable.js +278 -0
  104. package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -0
  105. package/lib/commonjs/components/touchables/TouchableHighlight.js +109 -0
  106. package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -0
  107. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +100 -0
  108. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -0
  109. package/lib/commonjs/components/touchables/TouchableNativeFeedback.js +12 -0
  110. package/lib/commonjs/components/touchables/TouchableNativeFeedback.js.map +1 -0
  111. package/lib/commonjs/components/touchables/TouchableOpacity.js +75 -0
  112. package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -0
  113. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +26 -0
  114. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -0
  115. package/lib/commonjs/components/touchables/index.js +40 -0
  116. package/lib/commonjs/components/touchables/index.js.map +1 -0
  117. package/lib/commonjs/gestureHandlerRootHOC.js +39 -0
  118. package/lib/commonjs/gestureHandlerRootHOC.js.map +1 -0
  119. package/lib/commonjs/handlers/FlingGestureHandler.js +23 -0
  120. package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -0
  121. package/lib/commonjs/handlers/ForceTouchGestureHandler.js +44 -0
  122. package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -0
  123. package/lib/commonjs/handlers/LongPressGestureHandler.js +23 -0
  124. package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -0
  125. package/lib/commonjs/handlers/NativeViewGestureHandler.js +25 -0
  126. package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -0
  127. package/lib/commonjs/handlers/PanGestureHandler.js +121 -0
  128. package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -0
  129. package/lib/commonjs/handlers/PinchGestureHandler.js +21 -0
  130. package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -0
  131. package/lib/commonjs/handlers/RotationGestureHandler.js +21 -0
  132. package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -0
  133. package/lib/commonjs/handlers/TapGestureHandler.js +23 -0
  134. package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -0
  135. package/lib/commonjs/handlers/createHandler.js +373 -0
  136. package/lib/commonjs/handlers/createHandler.js.map +1 -0
  137. package/lib/commonjs/handlers/createNativeWrapper.js +70 -0
  138. package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -0
  139. package/lib/commonjs/handlers/gestureHandlerCommon.js +80 -0
  140. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -0
  141. package/lib/commonjs/handlers/gestureHandlerTypesCompat.js +2 -0
  142. package/lib/commonjs/handlers/gestureHandlerTypesCompat.js.map +1 -0
  143. package/lib/commonjs/handlers/gestures/GestureDetector.js +426 -0
  144. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -0
  145. package/lib/commonjs/handlers/gestures/eventReceiver.js +124 -0
  146. package/lib/commonjs/handlers/gestures/eventReceiver.js.map +1 -0
  147. package/lib/commonjs/handlers/gestures/flingGesture.js +34 -0
  148. package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -0
  149. package/lib/commonjs/handlers/gestures/forceTouchGesture.js +39 -0
  150. package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -0
  151. package/lib/commonjs/handlers/gestures/gesture.js +185 -0
  152. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -0
  153. package/lib/commonjs/handlers/gestures/gestureComposition.js +94 -0
  154. package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -0
  155. package/lib/commonjs/handlers/gestures/gestureObjects.js +85 -0
  156. package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -0
  157. package/lib/commonjs/handlers/gestures/gestureStateManager.js +58 -0
  158. package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -0
  159. package/lib/commonjs/handlers/gestures/longPressGesture.js +34 -0
  160. package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -0
  161. package/lib/commonjs/handlers/gestures/manualGesture.js +19 -0
  162. package/lib/commonjs/handlers/gestures/manualGesture.js.map +1 -0
  163. package/lib/commonjs/handlers/gestures/nativeGesture.js +34 -0
  164. package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -0
  165. package/lib/commonjs/handlers/gestures/panGesture.js +116 -0
  166. package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -0
  167. package/lib/commonjs/handlers/gestures/pinchGesture.js +19 -0
  168. package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -0
  169. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +24 -0
  170. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -0
  171. package/lib/commonjs/handlers/gestures/rotationGesture.js +19 -0
  172. package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -0
  173. package/lib/commonjs/handlers/gestures/tapGesture.js +59 -0
  174. package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -0
  175. package/lib/commonjs/handlers/handlersRegistry.js +31 -0
  176. package/lib/commonjs/handlers/handlersRegistry.js.map +1 -0
  177. package/lib/commonjs/index.js +338 -0
  178. package/lib/commonjs/index.js.map +1 -0
  179. package/lib/commonjs/init.js +13 -0
  180. package/lib/commonjs/init.js.map +1 -0
  181. package/lib/commonjs/mocks.js +64 -0
  182. package/lib/commonjs/mocks.js.map +1 -0
  183. package/lib/commonjs/typeUtils.js +2 -0
  184. package/lib/commonjs/typeUtils.js.map +1 -0
  185. package/lib/commonjs/utils.js +15 -0
  186. package/lib/commonjs/utils.js.map +1 -0
  187. package/lib/commonjs/web/DiscreteGestureHandler.js +105 -0
  188. package/lib/commonjs/web/DiscreteGestureHandler.js.map +1 -0
  189. package/lib/commonjs/web/DraggingGestureHandler.js +53 -0
  190. package/lib/commonjs/web/DraggingGestureHandler.js.map +1 -0
  191. package/lib/commonjs/web/Errors.js +16 -0
  192. package/lib/commonjs/web/Errors.js.map +1 -0
  193. package/lib/commonjs/web/FlingGestureHandler.js +170 -0
  194. package/lib/commonjs/web/FlingGestureHandler.js.map +1 -0
  195. package/lib/commonjs/web/GestureHandler.js +533 -0
  196. package/lib/commonjs/web/GestureHandler.js.map +1 -0
  197. package/lib/commonjs/web/IndiscreteGestureHandler.js +54 -0
  198. package/lib/commonjs/web/IndiscreteGestureHandler.js.map +1 -0
  199. package/lib/commonjs/web/LongPressGestureHandler.js +71 -0
  200. package/lib/commonjs/web/LongPressGestureHandler.js.map +1 -0
  201. package/lib/commonjs/web/NativeViewGestureHandler.js +62 -0
  202. package/lib/commonjs/web/NativeViewGestureHandler.js.map +1 -0
  203. package/lib/commonjs/web/NodeManager.js +43 -0
  204. package/lib/commonjs/web/NodeManager.js.map +1 -0
  205. package/lib/commonjs/web/PanGestureHandler.js +189 -0
  206. package/lib/commonjs/web/PanGestureHandler.js.map +1 -0
  207. package/lib/commonjs/web/PinchGestureHandler.js +40 -0
  208. package/lib/commonjs/web/PinchGestureHandler.js.map +1 -0
  209. package/lib/commonjs/web/PressGestureHandler.js +188 -0
  210. package/lib/commonjs/web/PressGestureHandler.js.map +1 -0
  211. package/lib/commonjs/web/RotationGestureHandler.js +44 -0
  212. package/lib/commonjs/web/RotationGestureHandler.js.map +1 -0
  213. package/lib/commonjs/web/TapGestureHandler.js +192 -0
  214. package/lib/commonjs/web/TapGestureHandler.js.map +1 -0
  215. package/lib/commonjs/web/constants.js +64 -0
  216. package/lib/commonjs/web/constants.js.map +1 -0
  217. package/lib/commonjs/web/utils.js +42 -0
  218. package/lib/commonjs/web/utils.js.map +1 -0
  219. package/lib/module/Directions.js +7 -0
  220. package/lib/module/Directions.js.map +1 -0
  221. package/lib/module/EventType.js +8 -0
  222. package/lib/module/EventType.js.map +1 -0
  223. package/lib/module/GestureHandlerRootView.android.js +10 -0
  224. package/lib/module/GestureHandlerRootView.android.js.map +1 -0
  225. package/lib/module/GestureHandlerRootView.js +7 -0
  226. package/lib/module/GestureHandlerRootView.js.map +1 -0
  227. package/lib/module/PlatformConstants.js +5 -0
  228. package/lib/module/PlatformConstants.js.map +1 -0
  229. package/lib/module/PlatformConstants.web.js +7 -0
  230. package/lib/module/PlatformConstants.web.js.map +1 -0
  231. package/lib/module/RNGestureHandlerModule.js +13 -0
  232. package/lib/module/RNGestureHandlerModule.js.map +1 -0
  233. package/lib/module/RNGestureHandlerModule.web.js +56 -0
  234. package/lib/module/RNGestureHandlerModule.web.js.map +1 -0
  235. package/lib/module/State.js +10 -0
  236. package/lib/module/State.js.map +1 -0
  237. package/lib/module/components/DrawerLayout.js +520 -0
  238. package/lib/module/components/DrawerLayout.js.map +1 -0
  239. package/lib/module/components/GestureButtons.js +172 -0
  240. package/lib/module/components/GestureButtons.js.map +1 -0
  241. package/lib/module/components/GestureComponents.js +53 -0
  242. package/lib/module/components/GestureComponents.js.map +1 -0
  243. package/lib/module/components/GestureComponents.web.js +25 -0
  244. package/lib/module/components/GestureComponents.web.js.map +1 -0
  245. package/{dist/src → lib/module}/components/GestureHandlerButton.js +1 -0
  246. package/lib/module/components/GestureHandlerButton.js.map +1 -0
  247. package/lib/module/components/GestureHandlerButton.web.js +9 -0
  248. package/lib/module/components/GestureHandlerButton.web.js.map +1 -0
  249. package/lib/module/components/Swipeable.js +347 -0
  250. package/lib/module/components/Swipeable.js.map +1 -0
  251. package/lib/module/components/touchables/GenericTouchable.js +262 -0
  252. package/lib/module/components/touchables/GenericTouchable.js.map +1 -0
  253. package/lib/module/components/touchables/TouchableHighlight.js +95 -0
  254. package/lib/module/components/touchables/TouchableHighlight.js.map +1 -0
  255. package/lib/module/components/touchables/TouchableNativeFeedback.android.js +84 -0
  256. package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -0
  257. package/{dist/src → lib/module}/components/touchables/TouchableNativeFeedback.js +1 -0
  258. package/lib/module/components/touchables/TouchableNativeFeedback.js.map +1 -0
  259. package/lib/module/components/touchables/TouchableOpacity.js +61 -0
  260. package/lib/module/components/touchables/TouchableOpacity.js.map +1 -0
  261. package/lib/module/components/touchables/TouchableWithoutFeedback.js +10 -0
  262. package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +1 -0
  263. package/{dist/src → lib/module}/components/touchables/index.js +1 -0
  264. package/lib/module/components/touchables/index.js.map +1 -0
  265. package/lib/module/gestureHandlerRootHOC.js +21 -0
  266. package/lib/module/gestureHandlerRootHOC.js.map +1 -0
  267. package/lib/module/handlers/FlingGestureHandler.js +10 -0
  268. package/lib/module/handlers/FlingGestureHandler.js.map +1 -0
  269. package/lib/module/handlers/ForceTouchGestureHandler.js +29 -0
  270. package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -0
  271. package/lib/module/handlers/LongPressGestureHandler.js +10 -0
  272. package/lib/module/handlers/LongPressGestureHandler.js.map +1 -0
  273. package/lib/module/handlers/NativeViewGestureHandler.js +11 -0
  274. package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -0
  275. package/lib/module/handlers/PanGestureHandler.js +106 -0
  276. package/lib/module/handlers/PanGestureHandler.js.map +1 -0
  277. package/lib/module/handlers/PinchGestureHandler.js +9 -0
  278. package/lib/module/handlers/PinchGestureHandler.js.map +1 -0
  279. package/lib/module/handlers/RotationGestureHandler.js +9 -0
  280. package/lib/module/handlers/RotationGestureHandler.js.map +1 -0
  281. package/lib/module/handlers/TapGestureHandler.js +10 -0
  282. package/lib/module/handlers/TapGestureHandler.js.map +1 -0
  283. package/lib/module/handlers/createHandler.js +348 -0
  284. package/lib/module/handlers/createHandler.js.map +1 -0
  285. package/lib/module/handlers/createNativeWrapper.js +58 -0
  286. package/lib/module/handlers/createNativeWrapper.js.map +1 -0
  287. package/lib/module/handlers/gestureHandlerCommon.js +66 -0
  288. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -0
  289. package/lib/module/handlers/gestureHandlerTypesCompat.js +2 -0
  290. package/lib/module/handlers/gestureHandlerTypesCompat.js.map +1 -0
  291. package/lib/module/handlers/gestures/GestureDetector.js +389 -0
  292. package/lib/module/handlers/gestures/GestureDetector.js.map +1 -0
  293. package/lib/module/handlers/gestures/eventReceiver.js +109 -0
  294. package/lib/module/handlers/gestures/eventReceiver.js.map +1 -0
  295. package/lib/module/handlers/gestures/flingGesture.js +24 -0
  296. package/lib/module/handlers/gestures/flingGesture.js.map +1 -0
  297. package/lib/module/handlers/gestures/forceTouchGesture.js +29 -0
  298. package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -0
  299. package/lib/module/handlers/gestures/gesture.js +167 -0
  300. package/lib/module/handlers/gestures/gesture.js.map +1 -0
  301. package/lib/module/handlers/gestures/gestureComposition.js +79 -0
  302. package/lib/module/handlers/gestures/gestureComposition.js.map +1 -0
  303. package/lib/module/handlers/gestures/gestureObjects.js +67 -0
  304. package/lib/module/handlers/gestures/gestureObjects.js.map +1 -0
  305. package/lib/module/handlers/gestures/gestureStateManager.js +48 -0
  306. package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -0
  307. package/lib/module/handlers/gestures/longPressGesture.js +24 -0
  308. package/lib/module/handlers/gestures/longPressGesture.js.map +1 -0
  309. package/lib/module/handlers/gestures/manualGesture.js +9 -0
  310. package/lib/module/handlers/gestures/manualGesture.js.map +1 -0
  311. package/lib/module/handlers/gestures/nativeGesture.js +24 -0
  312. package/lib/module/handlers/gestures/nativeGesture.js.map +1 -0
  313. package/lib/module/handlers/gestures/panGesture.js +106 -0
  314. package/lib/module/handlers/gestures/panGesture.js.map +1 -0
  315. package/lib/module/handlers/gestures/pinchGesture.js +9 -0
  316. package/lib/module/handlers/gestures/pinchGesture.js.map +1 -0
  317. package/lib/module/handlers/gestures/reanimatedWrapper.js +19 -0
  318. package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -0
  319. package/lib/module/handlers/gestures/rotationGesture.js +9 -0
  320. package/lib/module/handlers/gestures/rotationGesture.js.map +1 -0
  321. package/lib/module/handlers/gestures/tapGesture.js +49 -0
  322. package/lib/module/handlers/gestures/tapGesture.js.map +1 -0
  323. package/lib/module/handlers/handlersRegistry.js +16 -0
  324. package/lib/module/handlers/handlersRegistry.js.map +1 -0
  325. package/lib/module/index.js +34 -0
  326. package/lib/module/index.js.map +1 -0
  327. package/lib/module/init.js +5 -0
  328. package/lib/module/init.js.map +1 -0
  329. package/lib/module/mocks.js +54 -0
  330. package/lib/module/mocks.js.map +1 -0
  331. package/lib/module/typeUtils.js +2 -0
  332. package/lib/module/typeUtils.js.map +1 -0
  333. package/lib/module/utils.js +8 -0
  334. package/lib/module/utils.js.map +1 -0
  335. package/lib/module/web/DiscreteGestureHandler.js +94 -0
  336. package/lib/module/web/DiscreteGestureHandler.js.map +1 -0
  337. package/lib/module/web/DraggingGestureHandler.js +40 -0
  338. package/lib/module/web/DraggingGestureHandler.js.map +1 -0
  339. package/lib/module/web/Errors.js +7 -0
  340. package/lib/module/web/Errors.js.map +1 -0
  341. package/lib/module/web/FlingGestureHandler.js +156 -0
  342. package/lib/module/web/FlingGestureHandler.js.map +1 -0
  343. package/lib/module/web/GestureHandler.js +518 -0
  344. package/lib/module/web/GestureHandler.js.map +1 -0
  345. package/lib/module/web/IndiscreteGestureHandler.js +44 -0
  346. package/lib/module/web/IndiscreteGestureHandler.js.map +1 -0
  347. package/lib/module/web/LongPressGestureHandler.js +58 -0
  348. package/lib/module/web/LongPressGestureHandler.js.map +1 -0
  349. package/lib/module/web/NativeViewGestureHandler.js +45 -0
  350. package/lib/module/web/NativeViewGestureHandler.js.map +1 -0
  351. package/lib/module/web/NodeManager.js +30 -0
  352. package/lib/module/web/NodeManager.js.map +1 -0
  353. package/lib/module/web/PanGestureHandler.js +175 -0
  354. package/lib/module/web/PanGestureHandler.js.map +1 -0
  355. package/lib/module/web/PinchGestureHandler.js +29 -0
  356. package/lib/module/web/PinchGestureHandler.js.map +1 -0
  357. package/lib/module/web/PressGestureHandler.js +174 -0
  358. package/lib/module/web/PressGestureHandler.js.map +1 -0
  359. package/lib/module/web/RotationGestureHandler.js +32 -0
  360. package/lib/module/web/RotationGestureHandler.js.map +1 -0
  361. package/lib/module/web/TapGestureHandler.js +180 -0
  362. package/lib/module/web/TapGestureHandler.js.map +1 -0
  363. package/lib/module/web/constants.js +43 -0
  364. package/lib/module/web/constants.js.map +1 -0
  365. package/lib/module/web/utils.js +19 -0
  366. package/lib/module/web/utils.js.map +1 -0
  367. package/lib/typescript/Directions.d.ts +7 -0
  368. package/lib/typescript/EventType.d.ts +8 -0
  369. package/lib/typescript/GestureHandlerRootView.android.d.ts +2 -0
  370. package/lib/typescript/GestureHandlerRootView.d.ts +5 -0
  371. package/{dist/src → lib/typescript}/PlatformConstants.d.ts +0 -0
  372. package/{dist/src → lib/typescript}/PlatformConstants.web.d.ts +0 -0
  373. package/{dist/src → lib/typescript}/RNGestureHandlerModule.d.ts +1 -8
  374. package/{dist/src → lib/typescript}/RNGestureHandlerModule.web.d.ts +1 -1
  375. package/{dist/src → lib/typescript}/State.d.ts +0 -0
  376. package/{dist/src → lib/typescript}/components/DrawerLayout.d.ts +50 -1
  377. package/{dist/src → lib/typescript}/components/GestureButtons.d.ts +36 -0
  378. package/lib/typescript/components/GestureComponents.d.ts +18 -0
  379. package/{dist/src → lib/typescript}/components/GestureComponents.web.d.ts +4 -4
  380. package/{dist/src → lib/typescript}/components/GestureHandlerButton.d.ts +0 -0
  381. package/{dist/src → lib/typescript}/components/GestureHandlerButton.web.d.ts +0 -0
  382. package/lib/typescript/components/Swipeable.d.ts +150 -0
  383. package/{dist/src → lib/typescript}/components/touchables/GenericTouchable.d.ts +3 -3
  384. package/{dist/src → lib/typescript}/components/touchables/TouchableHighlight.d.ts +1 -0
  385. package/{dist/src → lib/typescript}/components/touchables/TouchableNativeFeedback.android.d.ts +0 -0
  386. package/{dist/src → lib/typescript}/components/touchables/TouchableNativeFeedback.d.ts +0 -0
  387. package/{dist/src → lib/typescript}/components/touchables/TouchableOpacity.d.ts +1 -0
  388. package/{dist/src → lib/typescript}/components/touchables/TouchableWithoutFeedback.d.ts +0 -0
  389. package/{dist/src → lib/typescript}/components/touchables/index.d.ts +0 -0
  390. package/{dist/src → lib/typescript}/gestureHandlerRootHOC.d.ts +0 -0
  391. package/lib/typescript/handlers/FlingGestureHandler.d.ts +33 -0
  392. package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +43 -0
  393. package/lib/typescript/handlers/LongPressGestureHandler.d.ts +55 -0
  394. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +27 -0
  395. package/lib/typescript/handlers/PanGestureHandler.d.ts +137 -0
  396. package/lib/typescript/handlers/PinchGestureHandler.d.ts +28 -0
  397. package/lib/typescript/handlers/RotationGestureHandler.d.ts +28 -0
  398. package/lib/typescript/handlers/TapGestureHandler.d.ts +56 -0
  399. package/{dist/src → lib/typescript}/handlers/createHandler.d.ts +1 -1
  400. package/{dist/src → lib/typescript}/handlers/createNativeWrapper.d.ts +0 -0
  401. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +62 -0
  402. package/{dist/src → lib/typescript}/handlers/gestureHandlerTypesCompat.d.ts +8 -1
  403. package/lib/typescript/handlers/gestures/GestureDetector.d.ts +16 -0
  404. package/lib/typescript/handlers/gestures/eventReceiver.d.ts +2 -0
  405. package/lib/typescript/handlers/gestures/flingGesture.d.ts +9 -0
  406. package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +10 -0
  407. package/lib/typescript/handlers/gestures/gesture.d.ts +93 -0
  408. package/lib/typescript/handlers/gestures/gestureComposition.d.ts +21 -0
  409. package/lib/typescript/handlers/gestures/gestureObjects.d.ts +39 -0
  410. package/lib/typescript/handlers/gestures/gestureStateManager.d.ts +9 -0
  411. package/lib/typescript/handlers/gestures/longPressGesture.d.ts +9 -0
  412. package/lib/typescript/handlers/gestures/manualGesture.d.ts +5 -0
  413. package/lib/typescript/handlers/gestures/nativeGesture.d.ts +9 -0
  414. package/lib/typescript/handlers/gestures/panGesture.d.ts +19 -0
  415. package/lib/typescript/handlers/gestures/pinchGesture.d.ts +6 -0
  416. package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +14 -0
  417. package/lib/typescript/handlers/gestures/rotationGesture.d.ts +6 -0
  418. package/lib/typescript/handlers/gestures/tapGesture.d.ts +14 -0
  419. package/lib/typescript/handlers/handlersRegistry.d.ts +6 -0
  420. package/lib/typescript/index.d.ts +44 -0
  421. package/lib/typescript/init.d.ts +1 -0
  422. package/lib/typescript/mocks.d.ts +43 -0
  423. package/{dist/src → lib/typescript}/typeUtils.d.ts +0 -0
  424. package/lib/typescript/utils.d.ts +1 -0
  425. package/{dist/src → lib/typescript}/web/DiscreteGestureHandler.d.ts +0 -0
  426. package/{dist/src → lib/typescript}/web/DraggingGestureHandler.d.ts +0 -0
  427. package/{dist/src → lib/typescript}/web/Errors.d.ts +0 -0
  428. package/{dist/src → lib/typescript}/web/FlingGestureHandler.d.ts +0 -1
  429. package/{dist/src → lib/typescript}/web/GestureHandler.d.ts +0 -1
  430. package/{dist/src → lib/typescript}/web/IndiscreteGestureHandler.d.ts +0 -0
  431. package/{dist/src → lib/typescript}/web/LongPressGestureHandler.d.ts +0 -0
  432. package/{dist/src → lib/typescript}/web/NativeViewGestureHandler.d.ts +0 -0
  433. package/{dist/src → lib/typescript}/web/NodeManager.d.ts +0 -0
  434. package/{dist/src → lib/typescript}/web/PanGestureHandler.d.ts +0 -1
  435. package/{dist/src → lib/typescript}/web/PinchGestureHandler.d.ts +0 -1
  436. package/{dist/src → lib/typescript}/web/PressGestureHandler.d.ts +0 -1
  437. package/{dist/src → lib/typescript}/web/RotationGestureHandler.d.ts +0 -1
  438. package/{dist/src → lib/typescript}/web/TapGestureHandler.d.ts +0 -1
  439. package/{dist/src → lib/typescript}/web/constants.d.ts +0 -0
  440. package/{dist/src → lib/typescript}/web/utils.d.ts +0 -0
  441. package/package.json +38 -15
  442. package/src/Directions.ts +8 -2
  443. package/src/EventType.ts +10 -0
  444. package/src/GestureHandlerRootView.android.tsx +9 -25
  445. package/src/GestureHandlerRootView.tsx +11 -2
  446. package/src/PlatformConstants.ts +3 -2
  447. package/src/RNGestureHandlerModule.ts +15 -9
  448. package/src/RNGestureHandlerModule.web.ts +1 -0
  449. package/src/components/DrawerLayout.tsx +114 -41
  450. package/src/components/GestureButtons.tsx +45 -5
  451. package/src/components/GestureComponents.tsx +47 -41
  452. package/src/components/Swipeable.tsx +108 -21
  453. package/src/components/touchables/GenericTouchable.tsx +3 -2
  454. package/src/components/touchables/TouchableOpacity.tsx +1 -1
  455. package/src/handlers/FlingGestureHandler.ts +57 -0
  456. package/src/handlers/ForceTouchGestureHandler.ts +83 -0
  457. package/src/handlers/LongPressGestureHandler.ts +84 -0
  458. package/src/handlers/NativeViewGestureHandler.ts +31 -7
  459. package/src/handlers/PanGestureHandler.ts +321 -0
  460. package/src/handlers/PinchGestureHandler.ts +46 -0
  461. package/src/handlers/RotationGestureHandler.ts +46 -0
  462. package/src/handlers/TapGestureHandler.ts +90 -0
  463. package/src/handlers/createHandler.ts +60 -81
  464. package/src/handlers/gestureHandlerCommon.ts +185 -0
  465. package/src/handlers/gestureHandlerTypesCompat.ts +19 -5
  466. package/src/handlers/gestures/GestureDetector.tsx +498 -0
  467. package/src/handlers/gestures/eventReceiver.ts +135 -0
  468. package/src/handlers/gestures/flingGesture.ts +27 -0
  469. package/src/handlers/gestures/forceTouchGesture.ts +32 -0
  470. package/src/handlers/gestures/gesture.ts +279 -0
  471. package/src/handlers/gestures/gestureComposition.ts +109 -0
  472. package/src/handlers/gestures/gestureObjects.ts +79 -0
  473. package/src/handlers/gestures/gestureStateManager.ts +60 -0
  474. package/src/handlers/gestures/longPressGesture.ts +27 -0
  475. package/src/handlers/gestures/manualGesture.ts +11 -0
  476. package/src/handlers/gestures/nativeGesture.ts +27 -0
  477. package/src/handlers/gestures/panGesture.ts +105 -0
  478. package/src/handlers/gestures/pinchGesture.ts +12 -0
  479. package/src/handlers/gestures/reanimatedWrapper.ts +45 -0
  480. package/src/handlers/gestures/rotationGesture.ts +12 -0
  481. package/src/handlers/gestures/tapGesture.ts +52 -0
  482. package/src/handlers/handlersRegistry.ts +22 -0
  483. package/src/index.ts +156 -0
  484. package/src/init.ts +5 -0
  485. package/src/mocks.ts +65 -0
  486. package/src/utils.ts +7 -0
  487. package/src/web/GestureHandler.ts +2 -3
  488. package/src/web/NativeViewGestureHandler.ts +1 -3
  489. package/src/web/NodeManager.ts +5 -0
  490. package/android/lib/src/main/java/com/swmansion/gesturehandler/BaseGestureHandlerInteractionController.java +0 -23
  491. package/android/lib/src/main/java/com/swmansion/gesturehandler/FlingGestureHandler.java +0 -110
  492. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandler.java +0 -531
  493. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerInteractionController.java +0 -8
  494. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.java +0 -543
  495. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistry.java +0 -10
  496. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistryImpl.java +0 -29
  497. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureUtils.java +0 -53
  498. package/android/lib/src/main/java/com/swmansion/gesturehandler/LongPressGestureHandler.java +0 -81
  499. package/android/lib/src/main/java/com/swmansion/gesturehandler/NativeViewGestureHandler.java +0 -110
  500. package/android/lib/src/main/java/com/swmansion/gesturehandler/OnTouchEventListener.java +0 -8
  501. package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.java +0 -312
  502. package/android/lib/src/main/java/com/swmansion/gesturehandler/PinchGestureHandler.java +0 -109
  503. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureDetector.java +0 -169
  504. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureHandler.java +0 -96
  505. package/android/lib/src/main/java/com/swmansion/gesturehandler/TapGestureHandler.java +0 -172
  506. package/android/lib/src/main/java/com/swmansion/gesturehandler/ViewConfigurationHelper.java +0 -10
  507. package/android/src/main/java/com/facebook/react/views/modal/RNGHModalUtils.java +0 -21
  508. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java +0 -296
  509. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.java +0 -72
  510. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java +0 -77
  511. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDataExtractor.java +0 -8
  512. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.java +0 -86
  513. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java +0 -731
  514. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerPackage.java +0 -31
  515. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.java +0 -101
  516. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.java +0 -151
  517. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootInterface.java +0 -7
  518. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.java +0 -76
  519. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.java +0 -49
  520. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java +0 -82
  521. package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.java +0 -61
  522. package/dist/index.d.ts +0 -13
  523. package/dist/index.js +0 -16
  524. package/dist/src/Directions.d.ts +0 -7
  525. package/dist/src/Directions.js +0 -2
  526. package/dist/src/GestureHandlerRootView.android.d.ts +0 -4
  527. package/dist/src/GestureHandlerRootView.android.expo.d.ts +0 -2
  528. package/dist/src/GestureHandlerRootView.android.expo.js +0 -2
  529. package/dist/src/GestureHandlerRootView.android.js +0 -21
  530. package/dist/src/GestureHandlerRootView.d.ts +0 -2
  531. package/dist/src/GestureHandlerRootView.js +0 -2
  532. package/dist/src/PlatformConstants.js +0 -2
  533. package/dist/src/PlatformConstants.web.js +0 -5
  534. package/dist/src/RNGestureHandlerModule.js +0 -3
  535. package/dist/src/RNGestureHandlerModule.web.js +0 -47
  536. package/dist/src/State.js +0 -9
  537. package/dist/src/__mocks__/RNGestureHandlerModule.d.ts +0 -23
  538. package/dist/src/__mocks__/RNGestureHandlerModule.js +0 -25
  539. package/dist/src/components/DrawerLayout.js +0 -391
  540. package/dist/src/components/GestureButtons.js +0 -113
  541. package/dist/src/components/GestureComponents.d.ts +0 -45
  542. package/dist/src/components/GestureComponents.js +0 -18
  543. package/dist/src/components/GestureComponents.web.js +0 -18
  544. package/dist/src/components/GestureHandlerButton.web.js +0 -3
  545. package/dist/src/components/Swipeable.d.ts +0 -83
  546. package/dist/src/components/Swipeable.js +0 -249
  547. package/dist/src/components/touchables/GenericTouchable.js +0 -210
  548. package/dist/src/components/touchables/TouchableHighlight.js +0 -73
  549. package/dist/src/components/touchables/TouchableNativeFeedback.android.js +0 -63
  550. package/dist/src/components/touchables/TouchableOpacity.js +0 -50
  551. package/dist/src/components/touchables/TouchableWithoutFeedback.js +0 -5
  552. package/dist/src/gestureHandlerRootHOC.js +0 -17
  553. package/dist/src/handlers/NativeViewGestureHandler.d.ts +0 -12
  554. package/dist/src/handlers/NativeViewGestureHandler.js +0 -13
  555. package/dist/src/handlers/createHandler.js +0 -292
  556. package/dist/src/handlers/createNativeWrapper.js +0 -51
  557. package/dist/src/handlers/gestureHandlerTypesCompat.js +0 -1
  558. package/dist/src/handlers/gestureHandlers.d.ts +0 -158
  559. package/dist/src/handlers/gestureHandlers.js +0 -247
  560. package/dist/src/typeUtils.js +0 -1
  561. package/dist/src/web/DiscreteGestureHandler.js +0 -48
  562. package/dist/src/web/DraggingGestureHandler.js +0 -25
  563. package/dist/src/web/Errors.js +0 -5
  564. package/dist/src/web/FlingGestureHandler.js +0 -119
  565. package/dist/src/web/GestureHandler.js +0 -413
  566. package/dist/src/web/IndiscreteGestureHandler.js +0 -26
  567. package/dist/src/web/LongPressGestureHandler.js +0 -46
  568. package/dist/src/web/NativeViewGestureHandler.js +0 -39
  569. package/dist/src/web/NodeManager.js +0 -22
  570. package/dist/src/web/PanGestureHandler.js +0 -145
  571. package/dist/src/web/PinchGestureHandler.js +0 -19
  572. package/dist/src/web/PressGestureHandler.js +0 -135
  573. package/dist/src/web/RotationGestureHandler.js +0 -20
  574. package/dist/src/web/TapGestureHandler.js +0 -143
  575. package/dist/src/web/constants.js +0 -42
  576. package/dist/src/web/utils.js +0 -15
  577. package/index.ts +0 -117
  578. package/src/GestureHandlerRootView.android.expo.tsx +0 -3
  579. package/src/__mocks__/RNGestureHandlerModule.ts +0 -27
  580. package/src/handlers/gestureHandlers.ts +0 -511
@@ -0,0 +1,279 @@
1
+ import { FlingGestureHandlerEventPayload } from '../FlingGestureHandler';
2
+ import { ForceTouchGestureHandlerEventPayload } from '../ForceTouchGestureHandler';
3
+ import {
4
+ HitSlop,
5
+ CommonGestureConfig,
6
+ GestureTouchEvent,
7
+ GestureStateChangeEvent,
8
+ GestureUpdateEvent,
9
+ } from '../gestureHandlerCommon';
10
+ import { getNextHandlerTag } from '../handlersRegistry';
11
+ import { GestureStateManagerType } from './gestureStateManager';
12
+ import { LongPressGestureHandlerEventPayload } from '../LongPressGestureHandler';
13
+ import { PanGestureHandlerEventPayload } from '../PanGestureHandler';
14
+ import { PinchGestureHandlerEventPayload } from '../PinchGestureHandler';
15
+ import { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';
16
+ import { TapGestureHandlerEventPayload } from '../TapGestureHandler';
17
+ import { NativeViewGestureHandlerPayload } from '../NativeViewGestureHandler';
18
+
19
+ export type GestureType =
20
+ | BaseGesture<Record<string, unknown>>
21
+ | BaseGesture<Record<string, never>>
22
+ | BaseGesture<TapGestureHandlerEventPayload>
23
+ | BaseGesture<PanGestureHandlerEventPayload>
24
+ | BaseGesture<LongPressGestureHandlerEventPayload>
25
+ | BaseGesture<RotationGestureHandlerEventPayload>
26
+ | BaseGesture<PinchGestureHandlerEventPayload>
27
+ | BaseGesture<FlingGestureHandlerEventPayload>
28
+ | BaseGesture<ForceTouchGestureHandlerEventPayload>
29
+ | BaseGesture<NativeViewGestureHandlerPayload>;
30
+
31
+ export type GestureRef =
32
+ | number
33
+ | GestureType
34
+ | React.RefObject<GestureType | undefined>
35
+ | React.RefObject<React.ComponentType | undefined>; // allow adding a ref to a gesture handler
36
+ export interface BaseGestureConfig
37
+ extends CommonGestureConfig,
38
+ Record<string, unknown> {
39
+ ref?: React.MutableRefObject<GestureType | undefined>;
40
+ requireToFail?: GestureRef[];
41
+ simultaneousWith?: GestureRef[];
42
+ needsPointerData?: boolean;
43
+ manualActivation?: boolean;
44
+ }
45
+
46
+ type TouchEventHandlerType = (
47
+ event: GestureTouchEvent,
48
+ stateManager: GestureStateManagerType
49
+ ) => void;
50
+
51
+ export type HandlerCallbacks<EventPayloadT extends Record<string, unknown>> = {
52
+ handlerTag: number;
53
+ onBegin?: (event: GestureStateChangeEvent<EventPayloadT>) => void;
54
+ onStart?: (event: GestureStateChangeEvent<EventPayloadT>) => void;
55
+ onEnd?: (
56
+ event: GestureStateChangeEvent<EventPayloadT>,
57
+ success: boolean
58
+ ) => void;
59
+ onFinalize?: (
60
+ event: GestureStateChangeEvent<EventPayloadT>,
61
+ success: boolean
62
+ ) => void;
63
+ onUpdate?: (event: GestureUpdateEvent<EventPayloadT>) => void;
64
+ onTouchesDown?: TouchEventHandlerType;
65
+ onTouchesMove?: TouchEventHandlerType;
66
+ onTouchesUp?: TouchEventHandlerType;
67
+ onTouchesCancelled?: TouchEventHandlerType;
68
+ isWorklet: boolean[];
69
+ };
70
+
71
+ export const CALLBACK_TYPE = {
72
+ UNDEFINED: 0,
73
+ BEGAN: 1,
74
+ START: 2,
75
+ UPDATE: 3,
76
+ END: 4,
77
+ FINALIZE: 5,
78
+ TOUCHES_DOWN: 6,
79
+ TOUCHES_MOVE: 7,
80
+ TOUCHES_UP: 8,
81
+ TOUCHES_CANCELLED: 9,
82
+ } as const;
83
+
84
+ // Allow using CALLBACK_TYPE as object and type
85
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
86
+ export type CALLBACK_TYPE = typeof CALLBACK_TYPE[keyof typeof CALLBACK_TYPE];
87
+
88
+ export abstract class Gesture {
89
+ /**
90
+ * Return array of gestures, providing the same interface for creating and updating
91
+ * handlers, no matter which object was used to create gesture instance.
92
+ */
93
+ abstract toGestureArray(): GestureType[];
94
+
95
+ /**
96
+ * Assign handlerTag to the gesture instance and set ref.current (if a ref is set)
97
+ */
98
+ abstract initialize(): void;
99
+
100
+ /**
101
+ * Make sure that values of properties defining relations are arrays. Do any necessary
102
+ * preprocessing required to configure relations between handlers. Called just before
103
+ * updating the handler on the native side.
104
+ */
105
+ abstract prepare(): void;
106
+ }
107
+
108
+ export abstract class BaseGesture<
109
+ EventPayloadT extends Record<string, unknown>
110
+ > extends Gesture {
111
+ public handlerTag = -1;
112
+ public handlerName = '';
113
+ public config: BaseGestureConfig = {};
114
+ public handlers: HandlerCallbacks<EventPayloadT> = {
115
+ handlerTag: -1,
116
+ isWorklet: [false, false, false, false],
117
+ };
118
+
119
+ private addDependency(
120
+ key: 'simultaneousWith' | 'requireToFail',
121
+ gesture: Exclude<GestureRef, number>
122
+ ) {
123
+ const value = this.config[key];
124
+ this.config[key] = value
125
+ ? Array<GestureRef>().concat(value, gesture)
126
+ : [gesture];
127
+ }
128
+
129
+ withRef(ref: React.MutableRefObject<GestureType | undefined>) {
130
+ this.config.ref = ref;
131
+ return this;
132
+ }
133
+
134
+ protected isWorklet(
135
+ callback:
136
+ | TouchEventHandlerType
137
+ | ((event: GestureUpdateEvent<EventPayloadT>) => void)
138
+ | ((event: GestureStateChangeEvent<EventPayloadT>) => void)
139
+ ) {
140
+ //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
141
+ return callback.__workletHash !== undefined;
142
+ }
143
+
144
+ onBegin(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void) {
145
+ this.handlers.onBegin = callback;
146
+ this.handlers.isWorklet[CALLBACK_TYPE.BEGAN] = this.isWorklet(callback);
147
+ return this;
148
+ }
149
+
150
+ onStart(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void) {
151
+ this.handlers.onStart = callback;
152
+ this.handlers.isWorklet[CALLBACK_TYPE.START] = this.isWorklet(callback);
153
+ return this;
154
+ }
155
+
156
+ onEnd(
157
+ callback: (
158
+ event: GestureStateChangeEvent<EventPayloadT>,
159
+ success: boolean
160
+ ) => void
161
+ ) {
162
+ this.handlers.onEnd = callback;
163
+ //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
164
+ this.handlers.isWorklet[CALLBACK_TYPE.END] = this.isWorklet(callback);
165
+ return this;
166
+ }
167
+
168
+ onFinalize(
169
+ callback: (
170
+ event: GestureStateChangeEvent<EventPayloadT>,
171
+ success: boolean
172
+ ) => void
173
+ ) {
174
+ this.handlers.onFinalize = callback;
175
+ //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
176
+ this.handlers.isWorklet[CALLBACK_TYPE.FINALIZE] = this.isWorklet(callback);
177
+ return this;
178
+ }
179
+
180
+ onTouchesDown(callback: TouchEventHandlerType) {
181
+ this.config.needsPointerData = true;
182
+ this.handlers.onTouchesDown = callback;
183
+ this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_DOWN] = this.isWorklet(
184
+ callback
185
+ );
186
+
187
+ return this;
188
+ }
189
+
190
+ onTouchesMove(callback: TouchEventHandlerType) {
191
+ this.config.needsPointerData = true;
192
+ this.handlers.onTouchesMove = callback;
193
+ this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_MOVE] = this.isWorklet(
194
+ callback
195
+ );
196
+
197
+ return this;
198
+ }
199
+
200
+ onTouchesUp(callback: TouchEventHandlerType) {
201
+ this.config.needsPointerData = true;
202
+ this.handlers.onTouchesUp = callback;
203
+ this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_UP] = this.isWorklet(
204
+ callback
205
+ );
206
+
207
+ return this;
208
+ }
209
+
210
+ onTouchesCancelled(callback: TouchEventHandlerType) {
211
+ this.config.needsPointerData = true;
212
+ this.handlers.onTouchesCancelled = callback;
213
+ this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_CANCELLED] = this.isWorklet(
214
+ callback
215
+ );
216
+
217
+ return this;
218
+ }
219
+
220
+ enabled(enabled: boolean) {
221
+ this.config.enabled = enabled;
222
+ return this;
223
+ }
224
+
225
+ shouldCancelWhenOutside(value: boolean) {
226
+ this.config.shouldCancelWhenOutside = value;
227
+ return this;
228
+ }
229
+
230
+ hitSlop(hitSlop: HitSlop) {
231
+ this.config.hitSlop = hitSlop;
232
+ return this;
233
+ }
234
+
235
+ simultaneousWithExternalGesture(...gestures: Exclude<GestureRef, number>[]) {
236
+ for (const gesture of gestures) {
237
+ this.addDependency('simultaneousWith', gesture);
238
+ }
239
+ return this;
240
+ }
241
+
242
+ requireExternalGestureToFail(...gestures: Exclude<GestureRef, number>[]) {
243
+ for (const gesture of gestures) {
244
+ this.addDependency('requireToFail', gesture);
245
+ }
246
+ return this;
247
+ }
248
+
249
+ initialize() {
250
+ this.handlerTag = getNextHandlerTag();
251
+ this.handlers = { ...this.handlers, handlerTag: this.handlerTag };
252
+
253
+ if (this.config.ref) {
254
+ this.config.ref.current = this as GestureType;
255
+ }
256
+ }
257
+
258
+ toGestureArray(): GestureType[] {
259
+ return [this as GestureType];
260
+ }
261
+
262
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
263
+ prepare() {}
264
+ }
265
+
266
+ export abstract class ContinousBaseGesture<
267
+ EventPayloadT extends Record<string, unknown>
268
+ > extends BaseGesture<EventPayloadT> {
269
+ onUpdate(callback: (event: GestureUpdateEvent<EventPayloadT>) => void) {
270
+ this.handlers.onUpdate = callback;
271
+ this.handlers.isWorklet[CALLBACK_TYPE.UPDATE] = this.isWorklet(callback);
272
+ return this;
273
+ }
274
+
275
+ manualActivation(manualActivation: boolean) {
276
+ this.config.manualActivation = manualActivation;
277
+ return this;
278
+ }
279
+ }
@@ -0,0 +1,109 @@
1
+ import { BaseGesture, Gesture, GestureRef, GestureType } from './gesture';
2
+
3
+ function extendRelation(
4
+ currentRelation: GestureRef[] | undefined,
5
+ extendWith: GestureType[]
6
+ ) {
7
+ if (currentRelation === undefined) {
8
+ return [...extendWith];
9
+ } else {
10
+ return [...currentRelation, ...extendWith];
11
+ }
12
+ }
13
+
14
+ export class ComposedGesture extends Gesture {
15
+ protected gestures: Gesture[] = [];
16
+ protected simultaneousGestures: GestureType[] = [];
17
+ protected requireGesturesToFail: GestureType[] = [];
18
+
19
+ constructor(...gestures: Gesture[]) {
20
+ super();
21
+ this.gestures = gestures;
22
+ }
23
+
24
+ protected prepareSingleGesture(
25
+ gesture: Gesture,
26
+ simultaneousGestures: GestureType[],
27
+ requireGesturesToFail: GestureType[]
28
+ ) {
29
+ if (gesture instanceof BaseGesture) {
30
+ const newConfig = { ...gesture.config };
31
+
32
+ newConfig.simultaneousWith = extendRelation(
33
+ newConfig.simultaneousWith,
34
+ simultaneousGestures
35
+ );
36
+ newConfig.requireToFail = extendRelation(
37
+ newConfig.requireToFail,
38
+ requireGesturesToFail
39
+ );
40
+
41
+ gesture.config = newConfig;
42
+ } else if (gesture instanceof ComposedGesture) {
43
+ gesture.simultaneousGestures = simultaneousGestures;
44
+ gesture.requireGesturesToFail = requireGesturesToFail;
45
+ gesture.prepare();
46
+ }
47
+ }
48
+
49
+ prepare() {
50
+ for (const gesture of this.gestures) {
51
+ this.prepareSingleGesture(
52
+ gesture,
53
+ this.simultaneousGestures,
54
+ this.requireGesturesToFail
55
+ );
56
+ }
57
+ }
58
+
59
+ initialize() {
60
+ for (const gesture of this.gestures) {
61
+ gesture.initialize();
62
+ }
63
+ }
64
+
65
+ toGestureArray(): GestureType[] {
66
+ return this.gestures.flatMap((gesture) => gesture.toGestureArray());
67
+ }
68
+ }
69
+
70
+ export class SimultaneousGesture extends ComposedGesture {
71
+ prepare() {
72
+ const simultaneousArray = this.gestures
73
+ .flatMap((gesture) => gesture.toGestureArray())
74
+ .concat(this.simultaneousGestures);
75
+
76
+ for (const gesture of this.gestures) {
77
+ this.prepareSingleGesture(
78
+ gesture,
79
+ simultaneousArray,
80
+ this.requireGesturesToFail
81
+ );
82
+ }
83
+ }
84
+ }
85
+
86
+ export class ExclusiveGesture extends ComposedGesture {
87
+ prepare() {
88
+ const gestureArrays = this.gestures.map((gesture) =>
89
+ gesture.toGestureArray()
90
+ );
91
+
92
+ let requireToFail: GestureType[] = [];
93
+
94
+ for (let i = 0; i < this.gestures.length; i++) {
95
+ this.prepareSingleGesture(
96
+ this.gestures[i],
97
+ this.simultaneousGestures,
98
+ this.requireGesturesToFail.concat(requireToFail)
99
+ );
100
+
101
+ requireToFail = requireToFail.concat(gestureArrays[i]);
102
+ }
103
+ }
104
+ }
105
+
106
+ export type ComposedGestureType = InstanceType<typeof ComposedGesture>;
107
+ export type RaceGestureType = ComposedGestureType;
108
+ export type SimultaneousGestureType = InstanceType<typeof SimultaneousGesture>;
109
+ export type ExclusiveGestureType = InstanceType<typeof ExclusiveGesture>;
@@ -0,0 +1,79 @@
1
+ import { FlingGesture } from './flingGesture';
2
+ import { ForceTouchGesture } from './forceTouchGesture';
3
+ import { Gesture } from './gesture';
4
+ import {
5
+ ComposedGesture,
6
+ ExclusiveGesture,
7
+ SimultaneousGesture,
8
+ } from './gestureComposition';
9
+ import { LongPressGesture } from './longPressGesture';
10
+ import { PanGesture } from './panGesture';
11
+ import { PinchGesture } from './pinchGesture';
12
+ import { RotationGesture } from './rotationGesture';
13
+ import { TapGesture } from './tapGesture';
14
+ import { NativeGesture } from './nativeGesture';
15
+ import { ManualGesture } from './manualGesture';
16
+
17
+ export const GestureObjects = {
18
+ Tap: () => {
19
+ return new TapGesture();
20
+ },
21
+
22
+ Pan: () => {
23
+ return new PanGesture();
24
+ },
25
+
26
+ Pinch: () => {
27
+ return new PinchGesture();
28
+ },
29
+
30
+ Rotation: () => {
31
+ return new RotationGesture();
32
+ },
33
+
34
+ Fling: () => {
35
+ return new FlingGesture();
36
+ },
37
+
38
+ LongPress: () => {
39
+ return new LongPressGesture();
40
+ },
41
+
42
+ ForceTouch: () => {
43
+ return new ForceTouchGesture();
44
+ },
45
+
46
+ Native: () => {
47
+ return new NativeGesture();
48
+ },
49
+
50
+ Manual: () => {
51
+ return new ManualGesture();
52
+ },
53
+
54
+ /**
55
+ * Builds a composed gesture consisting of gestures provided as parameters.
56
+ * The first one that becomes active cancels the rest of gestures.
57
+ */
58
+ Race: (...gestures: Gesture[]) => {
59
+ return new ComposedGesture(...gestures);
60
+ },
61
+
62
+ /**
63
+ * Builds a composed gesture that allows all base gestures to run simultaneously.
64
+ */
65
+ Simultaneous(...gestures: Gesture[]) {
66
+ return new SimultaneousGesture(...gestures);
67
+ },
68
+
69
+ /**
70
+ * Builds a composed gesture where only one of the provided gestures can become active.
71
+ * Priority is decided through the order of gestures: the first one has higher priority
72
+ * than the second one, second one has higher priority than the third one, and so on.
73
+ * For example, to make a gesture that recognizes both single and double tap you need
74
+ * to call Exclusive(doubleTap, singleTap).
75
+ */
76
+ Exclusive(...gestures: Gesture[]) {
77
+ return new ExclusiveGesture(...gestures);
78
+ },
79
+ };
@@ -0,0 +1,60 @@
1
+ import { Reanimated } from './reanimatedWrapper';
2
+ import { State } from '../../State';
3
+
4
+ export interface GestureStateManagerType {
5
+ begin: () => void;
6
+ activate: () => void;
7
+ fail: () => void;
8
+ end: () => void;
9
+ }
10
+
11
+ export const GestureStateManager = {
12
+ create(handlerTag: number): GestureStateManagerType {
13
+ 'worklet';
14
+ return {
15
+ begin: () => {
16
+ 'worklet';
17
+ if (Reanimated) {
18
+ Reanimated.setGestureState(handlerTag, State.BEGAN);
19
+ } else {
20
+ console.warn(
21
+ 'react-native-reanimated is required in order to use synchronous state management'
22
+ );
23
+ }
24
+ },
25
+
26
+ activate: () => {
27
+ 'worklet';
28
+ if (Reanimated) {
29
+ Reanimated.setGestureState(handlerTag, State.ACTIVE);
30
+ } else {
31
+ console.warn(
32
+ 'react-native-reanimated is required in order to use synchronous state management'
33
+ );
34
+ }
35
+ },
36
+
37
+ fail: () => {
38
+ 'worklet';
39
+ if (Reanimated) {
40
+ Reanimated.setGestureState(handlerTag, State.FAILED);
41
+ } else {
42
+ console.warn(
43
+ 'react-native-reanimated is required in order to use synchronous state management'
44
+ );
45
+ }
46
+ },
47
+
48
+ end: () => {
49
+ 'worklet';
50
+ if (Reanimated) {
51
+ Reanimated.setGestureState(handlerTag, State.END);
52
+ } else {
53
+ console.warn(
54
+ 'react-native-reanimated is required in order to use synchronous state management'
55
+ );
56
+ }
57
+ },
58
+ };
59
+ },
60
+ };
@@ -0,0 +1,27 @@
1
+ import { BaseGesture, BaseGestureConfig } from './gesture';
2
+ import {
3
+ LongPressGestureConfig,
4
+ LongPressGestureHandlerEventPayload,
5
+ } from '../LongPressGestureHandler';
6
+
7
+ export class LongPressGesture extends BaseGesture<LongPressGestureHandlerEventPayload> {
8
+ public config: BaseGestureConfig & LongPressGestureConfig = {};
9
+
10
+ constructor() {
11
+ super();
12
+
13
+ this.handlerName = 'LongPressGestureHandler';
14
+ }
15
+
16
+ minDuration(duration: number) {
17
+ this.config.minDurationMs = duration;
18
+ return this;
19
+ }
20
+
21
+ maxDistance(distance: number) {
22
+ this.config.maxDist = distance;
23
+ return this;
24
+ }
25
+ }
26
+
27
+ export type LongPressGestureType = InstanceType<typeof LongPressGesture>;
@@ -0,0 +1,11 @@
1
+ import { ContinousBaseGesture } from './gesture';
2
+
3
+ export class ManualGesture extends ContinousBaseGesture<Record<string, never>> {
4
+ constructor() {
5
+ super();
6
+
7
+ this.handlerName = 'ManualGestureHandler';
8
+ }
9
+ }
10
+
11
+ export type ManualGestureType = InstanceType<typeof ManualGesture>;
@@ -0,0 +1,27 @@
1
+ import { BaseGestureConfig, BaseGesture } from './gesture';
2
+ import {
3
+ NativeViewGestureConfig,
4
+ NativeViewGestureHandlerPayload,
5
+ } from '../NativeViewGestureHandler';
6
+
7
+ export class NativeGesture extends BaseGesture<NativeViewGestureHandlerPayload> {
8
+ public config: BaseGestureConfig & NativeViewGestureConfig = {};
9
+
10
+ constructor() {
11
+ super();
12
+
13
+ this.handlerName = 'NativeViewGestureHandler';
14
+ }
15
+
16
+ shouldActivateOnStart(value: boolean) {
17
+ this.config.shouldActivateOnStart = value;
18
+ return this;
19
+ }
20
+
21
+ disallowInterruption(value: boolean) {
22
+ this.config.disallowInterruption = value;
23
+ return this;
24
+ }
25
+ }
26
+
27
+ export type NativeGestureType = InstanceType<typeof NativeGesture>;
@@ -0,0 +1,105 @@
1
+ import { BaseGestureConfig, ContinousBaseGesture } from './gesture';
2
+ import {
3
+ PanGestureConfig,
4
+ PanGestureHandlerEventPayload,
5
+ } from '../PanGestureHandler';
6
+
7
+ export class PanGesture extends ContinousBaseGesture<PanGestureHandlerEventPayload> {
8
+ public config: BaseGestureConfig & PanGestureConfig = {};
9
+
10
+ constructor() {
11
+ super();
12
+
13
+ this.handlerName = 'PanGestureHandler';
14
+ }
15
+
16
+ activeOffsetY(offset: number | number[]) {
17
+ if (Array.isArray(offset)) {
18
+ this.config.activeOffsetYStart = offset[0];
19
+ this.config.activeOffsetYEnd = offset[1];
20
+ } else if (offset < 0) {
21
+ this.config.activeOffsetYStart = offset;
22
+ } else {
23
+ this.config.activeOffsetYEnd = offset;
24
+ }
25
+ return this;
26
+ }
27
+
28
+ activeOffsetX(offset: number | number[]) {
29
+ if (Array.isArray(offset)) {
30
+ this.config.activeOffsetXStart = offset[0];
31
+ this.config.activeOffsetXEnd = offset[1];
32
+ } else if (offset < 0) {
33
+ this.config.activeOffsetXStart = offset;
34
+ } else {
35
+ this.config.activeOffsetXEnd = offset;
36
+ }
37
+ return this;
38
+ }
39
+
40
+ failOffsetY(offset: number | number[]) {
41
+ if (Array.isArray(offset)) {
42
+ this.config.failOffsetYStart = offset[0];
43
+ this.config.failOffsetYEnd = offset[1];
44
+ } else if (offset < 0) {
45
+ this.config.failOffsetYStart = offset;
46
+ } else {
47
+ this.config.failOffsetYEnd = offset;
48
+ }
49
+ return this;
50
+ }
51
+
52
+ failOffsetX(offset: number | number[]) {
53
+ if (Array.isArray(offset)) {
54
+ this.config.failOffsetXStart = offset[0];
55
+ this.config.failOffsetXEnd = offset[1];
56
+ } else if (offset < 0) {
57
+ this.config.failOffsetXStart = offset;
58
+ } else {
59
+ this.config.failOffsetXEnd = offset;
60
+ }
61
+ return this;
62
+ }
63
+
64
+ minPointers(minPointers: number) {
65
+ this.config.minPointers = minPointers;
66
+ return this;
67
+ }
68
+
69
+ maxPointers(maxPointers: number) {
70
+ this.config.maxPointers = maxPointers;
71
+ return this;
72
+ }
73
+
74
+ minDistance(distance: number) {
75
+ this.config.minDist = distance;
76
+ return this;
77
+ }
78
+
79
+ minVelocity(velocity: number) {
80
+ this.config.minVelocity = velocity;
81
+ return this;
82
+ }
83
+
84
+ minVelocityX(velocity: number) {
85
+ this.config.minVelocityX = velocity;
86
+ return this;
87
+ }
88
+
89
+ minVelocityY(velocity: number) {
90
+ this.config.minVelocityY = velocity;
91
+ return this;
92
+ }
93
+
94
+ averageTouches(value: boolean) {
95
+ this.config.avgTouches = value;
96
+ return this;
97
+ }
98
+
99
+ enableTrackpadTwoFingerGesture(value: boolean) {
100
+ this.config.enableTrackpadTwoFingerGesture = value;
101
+ return this;
102
+ }
103
+ }
104
+
105
+ export type PanGestureType = InstanceType<typeof PanGesture>;