react-native-gesture-handler 1.10.3 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (382) hide show
  1. package/README.md +7 -6
  2. package/android/build.gradle +49 -1
  3. package/android/common/src/main/java/com/swmansion/common/GestureHandlerStateManager.kt +5 -0
  4. package/android/gradle.properties +19 -0
  5. package/android/lib/src/main/java/com/swmansion/gesturehandler/BaseGestureHandlerInteractionController.kt +18 -0
  6. package/android/lib/src/main/java/com/swmansion/gesturehandler/Extensions.kt +11 -0
  7. package/android/lib/src/main/java/com/swmansion/gesturehandler/FlingGestureHandler.kt +96 -0
  8. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandler.kt +713 -0
  9. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerInteractionController.kt +8 -0
  10. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.kt +562 -0
  11. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistry.kt +8 -0
  12. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistryImpl.kt +21 -0
  13. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureUtils.kt +49 -0
  14. package/android/lib/src/main/java/com/swmansion/gesturehandler/LongPressGestureHandler.kt +97 -0
  15. package/android/lib/src/main/java/com/swmansion/gesturehandler/ManualGestureHandler.kt +11 -0
  16. package/android/lib/src/main/java/com/swmansion/gesturehandler/NativeViewGestureHandler.kt +129 -0
  17. package/android/lib/src/main/java/com/swmansion/gesturehandler/OnTouchEventListener.kt +9 -0
  18. package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.kt +289 -0
  19. package/android/lib/src/main/java/com/swmansion/gesturehandler/PinchGestureHandler.kt +88 -0
  20. package/android/lib/src/main/java/com/swmansion/gesturehandler/{PointerEventsConfig.java → PointerEventsConfig.kt} +3 -5
  21. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureDetector.kt +125 -0
  22. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureHandler.kt +79 -0
  23. package/android/lib/src/main/java/com/swmansion/gesturehandler/TapGestureHandler.kt +167 -0
  24. package/android/lib/src/main/java/com/swmansion/gesturehandler/ViewConfigurationHelper.kt +10 -0
  25. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +348 -0
  26. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.kt +57 -0
  27. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +59 -0
  28. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDataExtractor.kt +8 -0
  29. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +61 -0
  30. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +686 -0
  31. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerPackage.kt +17 -0
  32. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.kt +95 -0
  33. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +132 -0
  34. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootInterface.kt +5 -0
  35. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +68 -0
  36. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.kt +34 -0
  37. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +66 -0
  38. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +69 -0
  39. package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt +51 -0
  40. package/ios/Handlers/RNFlingHandler.m +78 -5
  41. package/ios/Handlers/RNForceTouchHandler.m +29 -4
  42. package/ios/Handlers/RNLongPressHandler.m +105 -3
  43. package/ios/Handlers/RNManualHandler.h +4 -0
  44. package/ios/Handlers/RNManualHandler.m +73 -0
  45. package/ios/Handlers/RNNativeViewHandler.m +30 -2
  46. package/ios/Handlers/RNPanHandler.m +64 -4
  47. package/ios/Handlers/RNPinchHandler.m +61 -2
  48. package/ios/Handlers/RNRotationHandler.m +60 -1
  49. package/ios/Handlers/RNTapHandler.m +55 -8
  50. package/ios/RNGestureHandler.h +18 -4
  51. package/ios/RNGestureHandler.m +123 -13
  52. package/ios/RNGestureHandlerEvents.h +9 -0
  53. package/ios/RNGestureHandlerEvents.m +34 -0
  54. package/ios/RNGestureHandlerManager.h +7 -0
  55. package/ios/RNGestureHandlerManager.m +62 -34
  56. package/ios/RNGestureHandlerModule.m +39 -3
  57. package/ios/RNGestureHandlerPointerTracker.h +25 -0
  58. package/ios/RNGestureHandlerPointerTracker.m +237 -0
  59. package/ios/RNGestureHandlerRegistry.h +1 -0
  60. package/ios/RNGestureHandlerRegistry.m +10 -0
  61. package/ios/RNGestureHandlerStateManager.h +5 -0
  62. package/ios/RNManualActivationRecognizer.h +10 -0
  63. package/ios/RNManualActivationRecognizer.m +80 -0
  64. package/ios/RNRootViewGestureRecognizer.m +1 -1
  65. package/ios/RNTouchEventType.h +9 -0
  66. package/lib/commonjs/EventType.js +16 -0
  67. package/lib/commonjs/EventType.js.map +1 -0
  68. package/lib/commonjs/GestureHandlerRootView.android.js +1 -13
  69. package/lib/commonjs/GestureHandlerRootView.android.js.map +1 -1
  70. package/lib/commonjs/GestureHandlerRootView.js +11 -3
  71. package/lib/commonjs/GestureHandlerRootView.js.map +1 -1
  72. package/lib/commonjs/RNGestureHandlerModule.js +3 -1
  73. package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
  74. package/lib/commonjs/RNGestureHandlerModule.web.js +2 -2
  75. package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
  76. package/lib/commonjs/components/DrawerLayout.js +41 -37
  77. package/lib/commonjs/components/DrawerLayout.js.map +1 -1
  78. package/lib/commonjs/components/GestureButtons.js.map +1 -1
  79. package/lib/commonjs/components/GestureComponents.js +31 -12
  80. package/lib/commonjs/components/GestureComponents.js.map +1 -1
  81. package/lib/commonjs/components/Swipeable.js +10 -6
  82. package/lib/commonjs/components/Swipeable.js.map +1 -1
  83. package/lib/commonjs/components/touchables/GenericTouchable.js +2 -1
  84. package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
  85. package/lib/commonjs/components/touchables/TouchableOpacity.js +1 -1
  86. package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -1
  87. package/lib/commonjs/gestureHandlerRootHOC.js +1 -1
  88. package/lib/commonjs/gestureHandlerRootHOC.js.map +1 -1
  89. package/lib/commonjs/handlers/FlingGestureHandler.js +23 -0
  90. package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -0
  91. package/lib/commonjs/handlers/ForceTouchGestureHandler.js +44 -0
  92. package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -0
  93. package/lib/commonjs/handlers/LongPressGestureHandler.js +23 -0
  94. package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -0
  95. package/lib/commonjs/handlers/NativeViewGestureHandler.js +6 -4
  96. package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -1
  97. package/lib/commonjs/handlers/PanGestureHandler.js +121 -0
  98. package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -0
  99. package/lib/commonjs/handlers/PinchGestureHandler.js +21 -0
  100. package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -0
  101. package/lib/commonjs/handlers/RotationGestureHandler.js +21 -0
  102. package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -0
  103. package/lib/commonjs/handlers/TapGestureHandler.js +23 -0
  104. package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -0
  105. package/lib/commonjs/handlers/createHandler.js +52 -83
  106. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  107. package/lib/commonjs/handlers/gestureHandlerCommon.js +80 -0
  108. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -0
  109. package/lib/commonjs/handlers/gestures/GestureDetector.js +440 -0
  110. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -0
  111. package/lib/commonjs/handlers/gestures/eventReceiver.js +135 -0
  112. package/lib/commonjs/handlers/gestures/eventReceiver.js.map +1 -0
  113. package/lib/commonjs/handlers/gestures/flingGesture.js +34 -0
  114. package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -0
  115. package/lib/commonjs/handlers/gestures/forceTouchGesture.js +65 -0
  116. package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -0
  117. package/lib/commonjs/handlers/gestures/gesture.js +193 -0
  118. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -0
  119. package/lib/commonjs/handlers/gestures/gestureComposition.js +94 -0
  120. package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -0
  121. package/lib/commonjs/handlers/gestures/gestureObjects.js +85 -0
  122. package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -0
  123. package/lib/commonjs/handlers/gestures/gestureStateManager.js +58 -0
  124. package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -0
  125. package/lib/commonjs/handlers/gestures/longPressGesture.js +34 -0
  126. package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -0
  127. package/lib/commonjs/handlers/gestures/manualGesture.js +31 -0
  128. package/lib/commonjs/handlers/gestures/manualGesture.js.map +1 -0
  129. package/lib/commonjs/handlers/gestures/nativeGesture.js +34 -0
  130. package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -0
  131. package/lib/commonjs/handlers/gestures/panGesture.js +144 -0
  132. package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -0
  133. package/lib/commonjs/handlers/gestures/pinchGesture.js +45 -0
  134. package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -0
  135. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +24 -0
  136. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -0
  137. package/lib/commonjs/handlers/gestures/rotationGesture.js +45 -0
  138. package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -0
  139. package/lib/commonjs/handlers/gestures/tapGesture.js +59 -0
  140. package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -0
  141. package/lib/commonjs/handlers/handlersRegistry.js +31 -0
  142. package/lib/commonjs/handlers/handlersRegistry.js.map +1 -0
  143. package/lib/commonjs/index.js +146 -8
  144. package/lib/commonjs/index.js.map +1 -1
  145. package/lib/commonjs/init.js +13 -0
  146. package/lib/commonjs/init.js.map +1 -0
  147. package/lib/commonjs/mocks.js +31 -2
  148. package/lib/commonjs/mocks.js.map +1 -1
  149. package/lib/commonjs/utils.js +15 -0
  150. package/lib/commonjs/utils.js.map +1 -0
  151. package/lib/commonjs/web/Errors.js +1 -1
  152. package/lib/commonjs/web/Errors.js.map +1 -1
  153. package/lib/commonjs/web/GestureHandler.js +4 -6
  154. package/lib/commonjs/web/GestureHandler.js.map +1 -1
  155. package/lib/commonjs/web/NodeManager.js +8 -2
  156. package/lib/commonjs/web/NodeManager.js.map +1 -1
  157. package/lib/module/EventType.js +8 -0
  158. package/lib/module/EventType.js.map +1 -0
  159. package/lib/module/GestureHandlerRootView.android.js +2 -14
  160. package/lib/module/GestureHandlerRootView.android.js.map +1 -1
  161. package/lib/module/GestureHandlerRootView.js +5 -1
  162. package/lib/module/GestureHandlerRootView.js.map +1 -1
  163. package/lib/module/RNGestureHandlerModule.js +3 -1
  164. package/lib/module/RNGestureHandlerModule.js.map +1 -1
  165. package/lib/module/RNGestureHandlerModule.web.js +2 -2
  166. package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
  167. package/lib/module/components/DrawerLayout.js +43 -40
  168. package/lib/module/components/DrawerLayout.js.map +1 -1
  169. package/lib/module/components/GestureButtons.js.map +1 -1
  170. package/lib/module/components/GestureComponents.js +29 -11
  171. package/lib/module/components/GestureComponents.js.map +1 -1
  172. package/lib/module/components/Swipeable.js +9 -6
  173. package/lib/module/components/Swipeable.js.map +1 -1
  174. package/lib/module/components/touchables/GenericTouchable.js +2 -1
  175. package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
  176. package/lib/module/components/touchables/TouchableOpacity.js +1 -1
  177. package/lib/module/components/touchables/TouchableOpacity.js.map +1 -1
  178. package/lib/module/gestureHandlerRootHOC.js +1 -1
  179. package/lib/module/gestureHandlerRootHOC.js.map +1 -1
  180. package/lib/module/handlers/FlingGestureHandler.js +10 -0
  181. package/lib/module/handlers/FlingGestureHandler.js.map +1 -0
  182. package/lib/module/handlers/ForceTouchGestureHandler.js +29 -0
  183. package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -0
  184. package/lib/module/handlers/LongPressGestureHandler.js +10 -0
  185. package/lib/module/handlers/LongPressGestureHandler.js.map +1 -0
  186. package/lib/module/handlers/NativeViewGestureHandler.js +4 -3
  187. package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -1
  188. package/lib/module/handlers/PanGestureHandler.js +106 -0
  189. package/lib/module/handlers/PanGestureHandler.js.map +1 -0
  190. package/lib/module/handlers/PinchGestureHandler.js +9 -0
  191. package/lib/module/handlers/PinchGestureHandler.js.map +1 -0
  192. package/lib/module/handlers/RotationGestureHandler.js +9 -0
  193. package/lib/module/handlers/RotationGestureHandler.js.map +1 -0
  194. package/lib/module/handlers/TapGestureHandler.js +10 -0
  195. package/lib/module/handlers/TapGestureHandler.js.map +1 -0
  196. package/lib/module/handlers/createHandler.js +41 -76
  197. package/lib/module/handlers/createHandler.js.map +1 -1
  198. package/lib/module/handlers/gestureHandlerCommon.js +66 -0
  199. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -0
  200. package/lib/module/handlers/gestures/GestureDetector.js +402 -0
  201. package/lib/module/handlers/gestures/GestureDetector.js.map +1 -0
  202. package/lib/module/handlers/gestures/eventReceiver.js +120 -0
  203. package/lib/module/handlers/gestures/eventReceiver.js.map +1 -0
  204. package/lib/module/handlers/gestures/flingGesture.js +24 -0
  205. package/lib/module/handlers/gestures/flingGesture.js.map +1 -0
  206. package/lib/module/handlers/gestures/forceTouchGesture.js +56 -0
  207. package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -0
  208. package/lib/module/handlers/gestures/gesture.js +175 -0
  209. package/lib/module/handlers/gestures/gesture.js.map +1 -0
  210. package/lib/module/handlers/gestures/gestureComposition.js +79 -0
  211. package/lib/module/handlers/gestures/gestureComposition.js.map +1 -0
  212. package/lib/module/handlers/gestures/gestureObjects.js +67 -0
  213. package/lib/module/handlers/gestures/gestureObjects.js.map +1 -0
  214. package/lib/module/handlers/gestures/gestureStateManager.js +48 -0
  215. package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -0
  216. package/lib/module/handlers/gestures/longPressGesture.js +24 -0
  217. package/lib/module/handlers/gestures/longPressGesture.js.map +1 -0
  218. package/lib/module/handlers/gestures/manualGesture.js +22 -0
  219. package/lib/module/handlers/gestures/manualGesture.js.map +1 -0
  220. package/lib/module/handlers/gestures/nativeGesture.js +24 -0
  221. package/lib/module/handlers/gestures/nativeGesture.js.map +1 -0
  222. package/lib/module/handlers/gestures/panGesture.js +135 -0
  223. package/lib/module/handlers/gestures/panGesture.js.map +1 -0
  224. package/lib/module/handlers/gestures/pinchGesture.js +36 -0
  225. package/lib/module/handlers/gestures/pinchGesture.js.map +1 -0
  226. package/lib/module/handlers/gestures/reanimatedWrapper.js +19 -0
  227. package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -0
  228. package/lib/module/handlers/gestures/rotationGesture.js +36 -0
  229. package/lib/module/handlers/gestures/rotationGesture.js.map +1 -0
  230. package/lib/module/handlers/gestures/tapGesture.js +49 -0
  231. package/lib/module/handlers/gestures/tapGesture.js.map +1 -0
  232. package/lib/module/handlers/handlersRegistry.js +16 -0
  233. package/lib/module/handlers/handlersRegistry.js.map +1 -0
  234. package/lib/module/index.js +22 -1
  235. package/lib/module/index.js.map +1 -1
  236. package/lib/module/init.js +5 -0
  237. package/lib/module/init.js.map +1 -0
  238. package/lib/module/mocks.js +31 -2
  239. package/lib/module/mocks.js.map +1 -1
  240. package/lib/module/utils.js +8 -0
  241. package/lib/module/utils.js.map +1 -0
  242. package/lib/module/web/Errors.js +1 -1
  243. package/lib/module/web/Errors.js.map +1 -1
  244. package/lib/module/web/GestureHandler.js +4 -6
  245. package/lib/module/web/GestureHandler.js.map +1 -1
  246. package/lib/module/web/NodeManager.js +8 -2
  247. package/lib/module/web/NodeManager.js.map +1 -1
  248. package/lib/typescript/EventType.d.ts +8 -0
  249. package/lib/typescript/GestureHandlerRootView.android.d.ts +2 -4
  250. package/lib/typescript/GestureHandlerRootView.d.ts +5 -2
  251. package/lib/typescript/RNGestureHandlerModule.d.ts +1 -1
  252. package/lib/typescript/RNGestureHandlerModule.web.d.ts +1 -1
  253. package/lib/typescript/components/DrawerLayout.d.ts +50 -1
  254. package/lib/typescript/components/GestureButtons.d.ts +36 -0
  255. package/lib/typescript/components/GestureComponents.d.ts +8 -35
  256. package/lib/typescript/components/Swipeable.d.ts +73 -6
  257. package/lib/typescript/components/touchables/GenericTouchable.d.ts +2 -2
  258. package/lib/typescript/components/touchables/TouchableHighlight.d.ts +1 -0
  259. package/lib/typescript/components/touchables/TouchableOpacity.d.ts +1 -0
  260. package/lib/typescript/handlers/FlingGestureHandler.d.ts +33 -0
  261. package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +43 -0
  262. package/lib/typescript/handlers/LongPressGestureHandler.d.ts +55 -0
  263. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +19 -4
  264. package/lib/typescript/handlers/PanGestureHandler.d.ts +137 -0
  265. package/lib/typescript/handlers/PinchGestureHandler.d.ts +28 -0
  266. package/lib/typescript/handlers/RotationGestureHandler.d.ts +28 -0
  267. package/lib/typescript/handlers/TapGestureHandler.d.ts +56 -0
  268. package/lib/typescript/handlers/createHandler.d.ts +1 -1
  269. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +62 -0
  270. package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts +8 -1
  271. package/lib/typescript/handlers/gestures/GestureDetector.d.ts +16 -0
  272. package/lib/typescript/handlers/gestures/eventReceiver.d.ts +2 -0
  273. package/lib/typescript/handlers/gestures/flingGesture.d.ts +9 -0
  274. package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +16 -0
  275. package/lib/typescript/handlers/gestures/gesture.d.ts +97 -0
  276. package/lib/typescript/handlers/gestures/gestureComposition.d.ts +21 -0
  277. package/lib/typescript/handlers/gestures/gestureObjects.d.ts +39 -0
  278. package/lib/typescript/handlers/gestures/gestureStateManager.d.ts +9 -0
  279. package/lib/typescript/handlers/gestures/longPressGesture.d.ts +9 -0
  280. package/lib/typescript/handlers/gestures/manualGesture.d.ts +7 -0
  281. package/lib/typescript/handlers/gestures/nativeGesture.d.ts +9 -0
  282. package/lib/typescript/handlers/gestures/panGesture.d.ts +26 -0
  283. package/lib/typescript/handlers/gestures/pinchGesture.d.ts +12 -0
  284. package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +14 -0
  285. package/lib/typescript/handlers/gestures/rotationGesture.d.ts +12 -0
  286. package/lib/typescript/handlers/gestures/tapGesture.d.ts +14 -0
  287. package/lib/typescript/handlers/handlersRegistry.d.ts +6 -0
  288. package/lib/typescript/index.d.ts +29 -2
  289. package/lib/typescript/init.d.ts +1 -0
  290. package/lib/typescript/mocks.d.ts +21 -2
  291. package/lib/typescript/utils.d.ts +1 -0
  292. package/lib/typescript/web/FlingGestureHandler.d.ts +0 -1
  293. package/lib/typescript/web/GestureHandler.d.ts +0 -1
  294. package/lib/typescript/web/PanGestureHandler.d.ts +0 -1
  295. package/lib/typescript/web/PinchGestureHandler.d.ts +0 -1
  296. package/lib/typescript/web/PressGestureHandler.d.ts +0 -1
  297. package/lib/typescript/web/RotationGestureHandler.d.ts +0 -1
  298. package/lib/typescript/web/TapGestureHandler.d.ts +0 -1
  299. package/package.json +8 -5
  300. package/src/EventType.ts +10 -0
  301. package/src/GestureHandlerRootView.android.tsx +9 -25
  302. package/src/GestureHandlerRootView.tsx +11 -2
  303. package/src/RNGestureHandlerModule.ts +5 -1
  304. package/src/RNGestureHandlerModule.web.ts +1 -0
  305. package/src/components/DrawerLayout.tsx +114 -41
  306. package/src/components/GestureButtons.tsx +45 -5
  307. package/src/components/GestureComponents.tsx +47 -41
  308. package/src/components/Swipeable.tsx +108 -21
  309. package/src/components/touchables/GenericTouchable.tsx +2 -1
  310. package/src/components/touchables/TouchableOpacity.tsx +1 -1
  311. package/src/handlers/FlingGestureHandler.ts +57 -0
  312. package/src/handlers/ForceTouchGestureHandler.ts +83 -0
  313. package/src/handlers/LongPressGestureHandler.ts +84 -0
  314. package/src/handlers/NativeViewGestureHandler.ts +31 -7
  315. package/src/handlers/PanGestureHandler.ts +321 -0
  316. package/src/handlers/PinchGestureHandler.ts +46 -0
  317. package/src/handlers/RotationGestureHandler.ts +46 -0
  318. package/src/handlers/TapGestureHandler.ts +90 -0
  319. package/src/handlers/createHandler.ts +54 -79
  320. package/src/handlers/gestureHandlerCommon.ts +185 -0
  321. package/src/handlers/gestureHandlerTypesCompat.ts +19 -5
  322. package/src/handlers/gestures/GestureDetector.tsx +519 -0
  323. package/src/handlers/gestures/eventReceiver.ts +151 -0
  324. package/src/handlers/gestures/flingGesture.ts +27 -0
  325. package/src/handlers/gestures/forceTouchGesture.ts +74 -0
  326. package/src/handlers/gestures/gesture.ts +292 -0
  327. package/src/handlers/gestures/gestureComposition.ts +109 -0
  328. package/src/handlers/gestures/gestureObjects.ts +79 -0
  329. package/src/handlers/gestures/gestureStateManager.ts +60 -0
  330. package/src/handlers/gestures/longPressGesture.ts +27 -0
  331. package/src/handlers/gestures/manualGesture.ts +31 -0
  332. package/src/handlers/gestures/nativeGesture.ts +27 -0
  333. package/src/handlers/gestures/panGesture.ts +147 -0
  334. package/src/handlers/gestures/pinchGesture.ts +51 -0
  335. package/src/handlers/gestures/reanimatedWrapper.ts +45 -0
  336. package/src/handlers/gestures/rotationGesture.ts +51 -0
  337. package/src/handlers/gestures/tapGesture.ts +52 -0
  338. package/src/handlers/handlersRegistry.ts +22 -0
  339. package/src/index.ts +57 -17
  340. package/src/init.ts +5 -0
  341. package/src/mocks.ts +42 -2
  342. package/src/utils.ts +7 -0
  343. package/src/web/GestureHandler.ts +1 -2
  344. package/src/web/NodeManager.ts +5 -0
  345. package/android/lib/src/main/java/com/swmansion/gesturehandler/BaseGestureHandlerInteractionController.java +0 -23
  346. package/android/lib/src/main/java/com/swmansion/gesturehandler/FlingGestureHandler.java +0 -110
  347. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandler.java +0 -531
  348. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerInteractionController.java +0 -8
  349. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.java +0 -543
  350. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistry.java +0 -10
  351. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistryImpl.java +0 -29
  352. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureUtils.java +0 -53
  353. package/android/lib/src/main/java/com/swmansion/gesturehandler/LongPressGestureHandler.java +0 -81
  354. package/android/lib/src/main/java/com/swmansion/gesturehandler/NativeViewGestureHandler.java +0 -110
  355. package/android/lib/src/main/java/com/swmansion/gesturehandler/OnTouchEventListener.java +0 -8
  356. package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.java +0 -312
  357. package/android/lib/src/main/java/com/swmansion/gesturehandler/PinchGestureHandler.java +0 -109
  358. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureDetector.java +0 -169
  359. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureHandler.java +0 -96
  360. package/android/lib/src/main/java/com/swmansion/gesturehandler/TapGestureHandler.java +0 -172
  361. package/android/lib/src/main/java/com/swmansion/gesturehandler/ViewConfigurationHelper.java +0 -10
  362. package/android/src/main/java/com/facebook/react/views/modal/RNGHModalUtils.java +0 -21
  363. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java +0 -296
  364. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.java +0 -72
  365. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java +0 -77
  366. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDataExtractor.java +0 -8
  367. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.java +0 -86
  368. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java +0 -731
  369. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerPackage.java +0 -31
  370. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.java +0 -101
  371. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.java +0 -151
  372. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootInterface.java +0 -7
  373. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.java +0 -76
  374. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.java +0 -49
  375. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java +0 -82
  376. package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.java +0 -61
  377. package/lib/commonjs/handlers/gestureHandlers.js +0 -236
  378. package/lib/commonjs/handlers/gestureHandlers.js.map +0 -1
  379. package/lib/module/handlers/gestureHandlers.js +0 -216
  380. package/lib/module/handlers/gestureHandlers.js.map +0 -1
  381. package/lib/typescript/handlers/gestureHandlers.d.ts +0 -158
  382. package/src/handlers/gestureHandlers.ts +0 -511
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { BaseGestureHandlerProps } from './gestureHandlerCommon';
3
+ export declare const forceTouchGestureHandlerProps: readonly ["minForce", "maxForce", "feedbackOnActivation"];
4
+ declare class ForceTouchFallback extends React.Component {
5
+ static forceTouchAvailable: boolean;
6
+ componentDidMount(): void;
7
+ render(): React.ReactNode;
8
+ }
9
+ export declare type ForceTouchGestureHandlerEventPayload = {
10
+ x: number;
11
+ y: number;
12
+ absoluteX: number;
13
+ absoluteY: number;
14
+ /**
15
+ * The pressure of a touch.
16
+ */
17
+ force: number;
18
+ };
19
+ export interface ForceTouchGestureConfig {
20
+ /**
21
+ *
22
+ * A minimal pressure that is required before handler can activate. Should be a
23
+ * value from range `[0.0, 1.0]`. Default is `0.2`.
24
+ */
25
+ minForce?: number;
26
+ /**
27
+ * A maximal pressure that could be applied for handler. If the pressure is
28
+ * greater, handler fails. Should be a value from range `[0.0, 1.0]`.
29
+ */
30
+ maxForce?: number;
31
+ /**
32
+ * Boolean value defining if haptic feedback has to be performed on
33
+ * activation.
34
+ */
35
+ feedbackOnActivation?: boolean;
36
+ }
37
+ export interface ForceTouchGestureHandlerProps extends BaseGestureHandlerProps<ForceTouchGestureHandlerEventPayload>, ForceTouchGestureConfig {
38
+ }
39
+ export declare type ForceTouchGestureHandler = typeof ForceTouchGestureHandler & {
40
+ forceTouchAvailable: boolean;
41
+ };
42
+ export declare const ForceTouchGestureHandler: typeof ForceTouchFallback | React.ComponentClass<ForceTouchGestureHandlerProps & React.RefAttributes<any>, any> | React.FunctionComponent<ForceTouchGestureHandlerProps & React.RefAttributes<any>>;
43
+ export {};
@@ -0,0 +1,55 @@
1
+ import { BaseGestureHandlerProps } from './gestureHandlerCommon';
2
+ export declare const longPressGestureHandlerProps: readonly ["minDurationMs", "maxDist"];
3
+ export declare type LongPressGestureHandlerEventPayload = {
4
+ /**
5
+ * X coordinate, expressed in points, of the current position of the pointer
6
+ * (finger or a leading pointer when there are multiple fingers placed)
7
+ * relative to the view attached to the handler.
8
+ */
9
+ x: number;
10
+ /**
11
+ * Y coordinate, expressed in points, of the current position of the pointer
12
+ * (finger or a leading pointer when there are multiple fingers placed)
13
+ * relative to the view attached to the handler.
14
+ */
15
+ y: number;
16
+ /**
17
+ * X coordinate, expressed in points, of the current position of the pointer
18
+ * (finger or a leading pointer when there are multiple fingers placed)
19
+ * relative to the root view. It is recommended to use `absoluteX` instead of
20
+ * `x` in cases when the view attached to the handler can be transformed as an
21
+ * effect of the gesture.
22
+ */
23
+ absoluteX: number;
24
+ /**
25
+ * Y coordinate, expressed in points, of the current position of the pointer
26
+ * (finger or a leading pointer when there are multiple fingers placed)
27
+ * relative to the root view. It is recommended to use `absoluteY` instead of
28
+ * `y` in cases when the view attached to the handler can be transformed as an
29
+ * effect of the gesture.
30
+ */
31
+ absoluteY: number;
32
+ /**
33
+ * Duration of the long press (time since the start of the event), expressed
34
+ * in milliseconds.
35
+ */
36
+ duration: number;
37
+ };
38
+ export interface LongPressGestureConfig {
39
+ /**
40
+ * Minimum time, expressed in milliseconds, that a finger must remain pressed on
41
+ * the corresponding view. The default value is 500.
42
+ */
43
+ minDurationMs?: number;
44
+ /**
45
+ * Maximum distance, expressed in points, that defines how far the finger is
46
+ * allowed to travel during a long press gesture. If the finger travels
47
+ * further than the defined distance and the handler hasn't yet activated, it
48
+ * will fail to recognize the gesture. The default value is 10.
49
+ */
50
+ maxDist?: number;
51
+ }
52
+ export interface LongPressGestureHandlerProps extends BaseGestureHandlerProps<LongPressGestureHandlerEventPayload>, LongPressGestureConfig {
53
+ }
54
+ export declare type LongPressGestureHandler = typeof LongPressGestureHandler;
55
+ export declare const LongPressGestureHandler: import("react").ComponentType<LongPressGestureHandlerProps & import("react").RefAttributes<any>>;
@@ -1,12 +1,27 @@
1
- /// <reference types="react" />
2
- import { BaseGestureHandlerProps } from './gestureHandlers';
3
- export interface NativeViewGestureHandlerProps extends BaseGestureHandlerProps<NativeViewGestureHandlerPayload> {
1
+ import { BaseGestureHandlerProps } from './gestureHandlerCommon';
2
+ export declare const nativeViewGestureHandlerProps: readonly ["shouldActivateOnStart", "disallowInterruption"];
3
+ export interface NativeViewGestureConfig {
4
+ /**
5
+ * Android only.
6
+ *
7
+ * Determines whether the handler should check for an existing touch event on
8
+ * instantiation.
9
+ */
4
10
  shouldActivateOnStart?: boolean;
11
+ /**
12
+ * When `true`, cancels all other gesture handlers when this
13
+ * `NativeViewGestureHandler` receives an `ACTIVE` state event.
14
+ */
5
15
  disallowInterruption?: boolean;
6
16
  }
17
+ export interface NativeViewGestureHandlerProps extends BaseGestureHandlerProps<NativeViewGestureHandlerPayload>, NativeViewGestureConfig {
18
+ }
7
19
  export declare type NativeViewGestureHandlerPayload = {
20
+ /**
21
+ * True if gesture was performed inside of containing view, false otherwise.
22
+ */
8
23
  pointerInside: boolean;
9
24
  };
10
- export declare const nativeViewProps: readonly ["id", "enabled", "minPointers", "waitFor", "simultaneousHandlers", "shouldCancelWhenOutside", "hitSlop", "onBegan", "onFailed", "onCancelled", "onActivated", "onEnded", "onGestureEvent", "onHandlerStateChange", "shouldActivateOnStart", "disallowInterruption"];
25
+ export declare const nativeViewProps: readonly ["id", "enabled", "shouldCancelWhenOutside", "hitSlop", "waitFor", "simultaneousHandlers", "onBegan", "onFailed", "onCancelled", "onActivated", "onEnded", "onGestureEvent", "onHandlerStateChange", "shouldActivateOnStart", "disallowInterruption"];
11
26
  export declare type NativeViewGestureHandler = typeof NativeViewGestureHandler;
12
27
  export declare const NativeViewGestureHandler: import("react").ComponentType<NativeViewGestureHandlerProps & import("react").RefAttributes<any>>;
@@ -0,0 +1,137 @@
1
+ import { BaseGestureHandlerProps } from './gestureHandlerCommon';
2
+ export declare const panGestureHandlerProps: readonly ["activeOffsetY", "activeOffsetX", "failOffsetY", "failOffsetX", "minDist", "minVelocity", "minVelocityX", "minVelocityY", "minPointers", "maxPointers", "avgTouches", "enableTrackpadTwoFingerGesture"];
3
+ export declare const panGestureHandlerCustomNativeProps: readonly ["activeOffsetYStart", "activeOffsetYEnd", "activeOffsetXStart", "activeOffsetXEnd", "failOffsetYStart", "failOffsetYEnd", "failOffsetXStart", "failOffsetXEnd"];
4
+ export declare type PanGestureHandlerEventPayload = {
5
+ /**
6
+ * X coordinate of the current position of the pointer (finger or a leading
7
+ * pointer when there are multiple fingers placed) relative to the view
8
+ * attached to the handler. Expressed in point units.
9
+ */
10
+ x: number;
11
+ /**
12
+ * Y coordinate of the current position of the pointer (finger or a leading
13
+ * pointer when there are multiple fingers placed) relative to the view
14
+ * attached to the handler. Expressed in point units.
15
+ */
16
+ y: number;
17
+ /**
18
+ * X coordinate of the current position of the pointer (finger or a leading
19
+ * pointer when there are multiple fingers placed) relative to the root view.
20
+ * The value is expressed in point units. It is recommended to use it instead
21
+ * of `x` in cases when the original view can be transformed as an effect of
22
+ * the gesture.
23
+ */
24
+ absoluteX: number;
25
+ /**
26
+ * Y coordinate of the current position of the pointer (finger or a leading
27
+ * pointer when there are multiple fingers placed) relative to the root view.
28
+ * The value is expressed in point units. It is recommended to use it instead
29
+ * of `y` in cases when the original view can be transformed as an
30
+ * effect of the gesture.
31
+ */
32
+ absoluteY: number;
33
+ /**
34
+ * Translation of the pan gesture along X axis accumulated over the time of
35
+ * the gesture. The value is expressed in the point units.
36
+ */
37
+ translationX: number;
38
+ /**
39
+ * Translation of the pan gesture along Y axis accumulated over the time of
40
+ * the gesture. The value is expressed in the point units.
41
+ */
42
+ translationY: number;
43
+ /**
44
+ * Velocity of the pan gesture along the X axis in the current moment. The
45
+ * value is expressed in point units per second.
46
+ */
47
+ velocityX: number;
48
+ /**
49
+ * Velocity of the pan gesture along the Y axis in the current moment. The
50
+ * value is expressed in point units per second.
51
+ */
52
+ velocityY: number;
53
+ };
54
+ interface CommonPanProperties {
55
+ /**
56
+ * Minimum distance the finger (or multiple finger) need to travel before the
57
+ * handler activates. Expressed in points.
58
+ */
59
+ minDist?: number;
60
+ /**
61
+ * Android only.
62
+ */
63
+ avgTouches?: boolean;
64
+ /**
65
+ * Enables two-finger gestures on supported devices, for example iPads with
66
+ * trackpads. If not enabled the gesture will require click + drag, with
67
+ * enableTrackpadTwoFingerGesture swiping with two fingers will also trigger
68
+ * the gesture.
69
+ */
70
+ enableTrackpadTwoFingerGesture?: boolean;
71
+ /**
72
+ * A number of fingers that is required to be placed before handler can
73
+ * activate. Should be a higher or equal to 0 integer.
74
+ */
75
+ minPointers?: number;
76
+ /**
77
+ * When the given number of fingers is placed on the screen and handler hasn't
78
+ * yet activated it will fail recognizing the gesture. Should be a higher or
79
+ * equal to 0 integer.
80
+ */
81
+ maxPointers?: number;
82
+ minVelocity?: number;
83
+ minVelocityX?: number;
84
+ minVelocityY?: number;
85
+ }
86
+ export interface PanGestureConfig extends CommonPanProperties {
87
+ activeOffsetYStart?: number;
88
+ activeOffsetYEnd?: number;
89
+ activeOffsetXStart?: number;
90
+ activeOffsetXEnd?: number;
91
+ failOffsetYStart?: number;
92
+ failOffsetYEnd?: number;
93
+ failOffsetXStart?: number;
94
+ failOffsetXEnd?: number;
95
+ }
96
+ export interface PanGestureHandlerProps extends BaseGestureHandlerProps<PanGestureHandlerEventPayload>, CommonPanProperties {
97
+ /**
98
+ * Range along X axis (in points) where fingers travels without activation of
99
+ * handler. Moving outside of this range implies activation of handler. Range
100
+ * can be given as an array or a single number. If range is set as an array,
101
+ * first value must be lower or equal to 0, a the second one higher or equal
102
+ * to 0. If only one number `p` is given a range of `(-inf, p)` will be used
103
+ * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
104
+ */
105
+ activeOffsetY?: number | number[];
106
+ /**
107
+ * Range along X axis (in points) where fingers travels without activation of
108
+ * handler. Moving outside of this range implies activation of handler. Range
109
+ * can be given as an array or a single number. If range is set as an array,
110
+ * first value must be lower or equal to 0, a the second one higher or equal
111
+ * to 0. If only one number `p` is given a range of `(-inf, p)` will be used
112
+ * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
113
+ */
114
+ activeOffsetX?: number | number[];
115
+ /**
116
+ * When the finger moves outside this range (in points) along Y axis and
117
+ * handler hasn't yet activated it will fail recognizing the gesture. Range
118
+ * can be given as an array or a single number. If range is set as an array,
119
+ * first value must be lower or equal to 0, a the second one higher or equal
120
+ * to 0. If only one number `p` is given a range of `(-inf, p)` will be used
121
+ * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
122
+ */
123
+ failOffsetY?: number | number[];
124
+ /**
125
+ * When the finger moves outside this range (in points) along X axis and
126
+ * handler hasn't yet activated it will fail recognizing the gesture. Range
127
+ * can be given as an array or a single number. If range is set as an array,
128
+ * first value must be lower or equal to 0, a the second one higher or equal
129
+ * to 0. If only one number `p` is given a range of `(-inf, p)` will be used
130
+ * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
131
+ */
132
+ failOffsetX?: number | number[];
133
+ }
134
+ export declare type PanGestureHandler = typeof PanGestureHandler;
135
+ export declare const PanGestureHandler: import("react").ComponentType<PanGestureHandlerProps & import("react").RefAttributes<any>>;
136
+ export declare function managePanProps(props: PanGestureHandlerProps): PanGestureHandlerProps & Partial<Record<"failOffsetXStart" | "failOffsetYStart" | "failOffsetXEnd" | "failOffsetYEnd" | "activeOffsetXStart" | "activeOffsetXEnd" | "activeOffsetYStart" | "activeOffsetYEnd", number>>;
137
+ export {};
@@ -0,0 +1,28 @@
1
+ import { BaseGestureHandlerProps } from './gestureHandlerCommon';
2
+ export declare type PinchGestureHandlerEventPayload = {
3
+ /**
4
+ * The scale factor relative to the points of the two touches in screen
5
+ * coordinates.
6
+ */
7
+ scale: number;
8
+ /**
9
+ * Position expressed in points along X axis of center anchor point of
10
+ * gesture.
11
+ */
12
+ focalX: number;
13
+ /**
14
+ * Position expressed in points along Y axis of center anchor point of
15
+ * gesture.
16
+ */
17
+ focalY: number;
18
+ /**
19
+ *
20
+ * Velocity of the pan gesture the current moment. The value is expressed in
21
+ * point units per second.
22
+ */
23
+ velocity: number;
24
+ };
25
+ export interface PinchGestureHandlerProps extends BaseGestureHandlerProps<PinchGestureHandlerEventPayload> {
26
+ }
27
+ export declare type PinchGestureHandler = typeof PinchGestureHandler;
28
+ export declare const PinchGestureHandler: import("react").ComponentType<PinchGestureHandlerProps & import("react").RefAttributes<any>>;
@@ -0,0 +1,28 @@
1
+ import { BaseGestureHandlerProps } from './gestureHandlerCommon';
2
+ export declare type RotationGestureHandlerEventPayload = {
3
+ /**
4
+ * Amount rotated, expressed in radians, from the gesture's focal point
5
+ * (anchor).
6
+ */
7
+ rotation: number;
8
+ /**
9
+ * X coordinate, expressed in points, of the gesture's central focal point
10
+ * (anchor).
11
+ */
12
+ anchorX: number;
13
+ /**
14
+ * Y coordinate, expressed in points, of the gesture's central focal point
15
+ * (anchor).
16
+ */
17
+ anchorY: number;
18
+ /**
19
+ *
20
+ * Instantaneous velocity, expressed in point units per second, of the
21
+ * gesture.
22
+ */
23
+ velocity: number;
24
+ };
25
+ export interface RotationGestureHandlerProps extends BaseGestureHandlerProps<RotationGestureHandlerEventPayload> {
26
+ }
27
+ export declare type RotationGestureHandler = typeof RotationGestureHandler;
28
+ export declare const RotationGestureHandler: import("react").ComponentType<RotationGestureHandlerProps & import("react").RefAttributes<any>>;
@@ -0,0 +1,56 @@
1
+ import { BaseGestureHandlerProps } from './gestureHandlerCommon';
2
+ export declare const tapGestureHandlerProps: readonly ["maxDurationMs", "maxDelayMs", "numberOfTaps", "maxDeltaX", "maxDeltaY", "maxDist", "minPointers"];
3
+ export declare type TapGestureHandlerEventPayload = {
4
+ x: number;
5
+ y: number;
6
+ absoluteX: number;
7
+ absoluteY: number;
8
+ };
9
+ export interface TapGestureConfig {
10
+ /**
11
+ * Minimum number of pointers (fingers) required to be placed before the
12
+ * handler activates. Should be a positive integer.
13
+ * The default value is 1.
14
+ */
15
+ minPointers?: number;
16
+ /**
17
+ * Maximum time, expressed in milliseconds, that defines how fast a finger
18
+ * must be released after a touch. The default value is 500.
19
+ */
20
+ maxDurationMs?: number;
21
+ /**
22
+ * Maximum time, expressed in milliseconds, that can pass before the next tap
23
+ * if many taps are required. The default value is 500.
24
+ */
25
+ maxDelayMs?: number;
26
+ /**
27
+ * Number of tap gestures required to activate the handler. The default value
28
+ * is 1.
29
+ */
30
+ numberOfTaps?: number;
31
+ /**
32
+ * Maximum distance, expressed in points, that defines how far the finger is
33
+ * allowed to travel along the X axis during a tap gesture. If the finger
34
+ * travels further than the defined distance along the X axis and the handler
35
+ * hasn't yet activated, it will fail to recognize the gesture.
36
+ */
37
+ maxDeltaX?: number;
38
+ /**
39
+ * Maximum distance, expressed in points, that defines how far the finger is
40
+ * allowed to travel along the Y axis during a tap gesture. If the finger
41
+ * travels further than the defined distance along the Y axis and the handler
42
+ * hasn't yet activated, it will fail to recognize the gesture.
43
+ */
44
+ maxDeltaY?: number;
45
+ /**
46
+ * Maximum distance, expressed in points, that defines how far the finger is
47
+ * allowed to travel during a tap gesture. If the finger travels further than
48
+ * the defined distance and the handler hasn't yet
49
+ * activated, it will fail to recognize the gesture.
50
+ */
51
+ maxDist?: number;
52
+ }
53
+ export interface TapGestureHandlerProps extends BaseGestureHandlerProps<TapGestureHandlerEventPayload>, TapGestureConfig {
54
+ }
55
+ export declare type TapGestureHandler = typeof TapGestureHandler;
56
+ export declare const TapGestureHandler: import("react").ComponentType<TapGestureHandlerProps & import("react").RefAttributes<any>>;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { BaseGestureHandlerProps } from './gestureHandlers';
2
+ import { BaseGestureHandlerProps } from './gestureHandlerCommon';
3
3
  declare type CreateHandlerArgs<HandlerPropsT extends Record<string, unknown>> = Readonly<{
4
4
  name: string;
5
5
  allowedProps: Readonly<Extract<keyof HandlerPropsT, string>[]>;
@@ -0,0 +1,62 @@
1
+ import * as React from 'react';
2
+ import { State } from '../State';
3
+ import { EventType } from '../EventType';
4
+ import { ValueOf } from '../typeUtils';
5
+ export declare const baseGestureHandlerProps: readonly ["id", "enabled", "shouldCancelWhenOutside", "hitSlop", "waitFor", "simultaneousHandlers", "onBegan", "onFailed", "onCancelled", "onActivated", "onEnded", "onGestureEvent", "onHandlerStateChange"];
6
+ export declare const baseGestureHandlerWithMonitorProps: string[];
7
+ export interface GestureEventPayload {
8
+ handlerTag: number;
9
+ numberOfPointers: number;
10
+ state: ValueOf<typeof State>;
11
+ }
12
+ export interface HandlerStateChangeEventPayload {
13
+ handlerTag: number;
14
+ numberOfPointers: number;
15
+ state: ValueOf<typeof State>;
16
+ oldState: ValueOf<typeof State>;
17
+ }
18
+ export declare type HitSlop = number | Partial<Record<'left' | 'right' | 'top' | 'bottom' | 'vertical' | 'horizontal', number>> | Record<'width' | 'left', number> | Record<'width' | 'right', number> | Record<'height' | 'top', number> | Record<'height' | 'bottom', number>;
19
+ export interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {
20
+ nativeEvent: Readonly<GestureEventPayload & ExtraEventPayloadT>;
21
+ }
22
+ export interface HandlerStateChangeEvent<ExtraEventPayloadT = Record<string, unknown>> {
23
+ nativeEvent: Readonly<HandlerStateChangeEventPayload & ExtraEventPayloadT>;
24
+ }
25
+ export declare type TouchData = {
26
+ id: number;
27
+ x: number;
28
+ y: number;
29
+ absoluteX: number;
30
+ absoluteY: number;
31
+ };
32
+ export declare type GestureTouchEvent = {
33
+ handlerTag: number;
34
+ numberOfTouches: number;
35
+ state: ValueOf<typeof State>;
36
+ eventType: EventType;
37
+ allTouches: TouchData[];
38
+ changedTouches: TouchData[];
39
+ };
40
+ export declare type GestureUpdateEvent<GestureEventPayloadT = Record<string, unknown>> = GestureEventPayload & GestureEventPayloadT;
41
+ export declare type GestureStateChangeEvent<GestureStateChangeEventPayloadT = Record<string, unknown>> = HandlerStateChangeEventPayload & GestureStateChangeEventPayloadT;
42
+ export declare type CommonGestureConfig = {
43
+ enabled?: boolean;
44
+ shouldCancelWhenOutside?: boolean;
45
+ hitSlop?: HitSlop;
46
+ };
47
+ export declare type BaseGestureHandlerProps<ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>> = CommonGestureConfig & {
48
+ id?: string;
49
+ waitFor?: React.Ref<unknown> | React.Ref<unknown>[];
50
+ simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[];
51
+ onBegan?: (event: HandlerStateChangeEvent) => void;
52
+ onFailed?: (event: HandlerStateChangeEvent) => void;
53
+ onCancelled?: (event: HandlerStateChangeEvent) => void;
54
+ onActivated?: (event: HandlerStateChangeEvent) => void;
55
+ onEnded?: (event: HandlerStateChangeEvent) => void;
56
+ onGestureEvent?: (event: GestureEvent<ExtraEventPayloadT>) => void;
57
+ onHandlerStateChange?: (event: HandlerStateChangeEvent<ExtraEventPayloadT>) => void;
58
+ };
59
+ export declare function filterConfig(props: Record<string, unknown>, validProps: string[], defaults?: Record<string, unknown>): {
60
+ [x: string]: unknown;
61
+ };
62
+ export declare function findNodeHandle(node: null | number | React.Component<any, any> | React.ComponentClass<any>): null | number | React.Component<any, any> | React.ComponentClass<any>;
@@ -1,5 +1,12 @@
1
1
  import { BaseButtonProps, BorderlessButtonProps, RawButtonProps, RectButtonProps } from '../components/GestureButtons';
2
- import { FlingGestureHandlerEventPayload, FlingGestureHandlerProps, ForceTouchGestureHandlerEventPayload, ForceTouchGestureHandlerProps, GestureEvent, GestureEventPayload, HandlerStateChangeEvent, HandlerStateChangeEventPayload, LongPressGestureHandlerEventPayload, LongPressGestureHandlerProps, PanGestureHandlerEventPayload, PanGestureHandlerProps, PinchGestureHandlerEventPayload, PinchGestureHandlerProps, RotationGestureHandlerEventPayload, RotationGestureHandlerProps, TapGestureHandlerEventPayload, TapGestureHandlerProps } from './gestureHandlers';
2
+ import { GestureEvent, GestureEventPayload, HandlerStateChangeEvent, HandlerStateChangeEventPayload } from './gestureHandlerCommon';
3
+ import { FlingGestureHandlerEventPayload, FlingGestureHandlerProps } from './FlingGestureHandler';
4
+ import { ForceTouchGestureHandlerEventPayload, ForceTouchGestureHandlerProps } from './ForceTouchGestureHandler';
5
+ import { LongPressGestureHandlerEventPayload, LongPressGestureHandlerProps } from './LongPressGestureHandler';
6
+ import { PanGestureHandlerEventPayload, PanGestureHandlerProps } from './PanGestureHandler';
7
+ import { PinchGestureHandlerEventPayload, PinchGestureHandlerProps } from './PinchGestureHandler';
8
+ import { RotationGestureHandlerEventPayload, RotationGestureHandlerProps } from './RotationGestureHandler';
9
+ import { TapGestureHandlerEventPayload, TapGestureHandlerProps } from './TapGestureHandler';
3
10
  import { NativeViewGestureHandlerPayload, NativeViewGestureHandlerProps } from './NativeViewGestureHandler';
4
11
  export declare type GestureHandlerGestureEventNativeEvent = GestureEventPayload;
5
12
  export declare type GestureHandlerStateChangeNativeEvent = HandlerStateChangeEventPayload;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { GestureType, HandlerCallbacks } from './gesture';
3
+ import { SharedValue } from './reanimatedWrapper';
4
+ import { ComposedGesture } from './gestureComposition';
5
+ export declare type GestureConfigReference = {
6
+ config: GestureType[];
7
+ animatedEventHandler: unknown;
8
+ animatedHandlers: SharedValue<HandlerCallbacks<Record<string, unknown>>[] | null> | null;
9
+ firstExecution: boolean;
10
+ useAnimated: boolean;
11
+ };
12
+ interface GestureDetectorProps {
13
+ gesture?: ComposedGesture | GestureType;
14
+ }
15
+ export declare const GestureDetector: React.FunctionComponent<GestureDetectorProps>;
16
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function startListening(): void;
2
+ export declare function stopListening(): void;
@@ -0,0 +1,9 @@
1
+ import { BaseGesture, BaseGestureConfig } from './gesture';
2
+ import { FlingGestureConfig, FlingGestureHandlerEventPayload } from '../FlingGestureHandler';
3
+ export declare class FlingGesture extends BaseGesture<FlingGestureHandlerEventPayload> {
4
+ config: BaseGestureConfig & FlingGestureConfig;
5
+ constructor();
6
+ numberOfPointers(pointers: number): this;
7
+ direction(direction: number): this;
8
+ }
9
+ export declare type FlingGestureType = InstanceType<typeof FlingGesture>;
@@ -0,0 +1,16 @@
1
+ import { BaseGestureConfig, ContinousBaseGesture } from './gesture';
2
+ import { ForceTouchGestureConfig, ForceTouchGestureHandlerEventPayload } from '../ForceTouchGestureHandler';
3
+ import { GestureUpdateEvent } from '../gestureHandlerCommon';
4
+ declare type ForceTouchGestureChangeEventPayload = {
5
+ forceChange: number;
6
+ };
7
+ export declare class ForceTouchGesture extends ContinousBaseGesture<ForceTouchGestureHandlerEventPayload, ForceTouchGestureChangeEventPayload> {
8
+ config: BaseGestureConfig & ForceTouchGestureConfig;
9
+ constructor();
10
+ minForce(force: number): this;
11
+ maxForce(force: number): this;
12
+ feedbackOnActivation(value: boolean): this;
13
+ onChange(callback: (event: GestureUpdateEvent<GestureUpdateEvent<ForceTouchGestureHandlerEventPayload & ForceTouchGestureChangeEventPayload>>) => void): this;
14
+ }
15
+ export declare type ForceTouchGestureType = InstanceType<typeof ForceTouchGesture>;
16
+ export {};
@@ -0,0 +1,97 @@
1
+ import { FlingGestureHandlerEventPayload } from '../FlingGestureHandler';
2
+ import { ForceTouchGestureHandlerEventPayload } from '../ForceTouchGestureHandler';
3
+ import { HitSlop, CommonGestureConfig, GestureTouchEvent, GestureStateChangeEvent, GestureUpdateEvent } from '../gestureHandlerCommon';
4
+ import { GestureStateManagerType } from './gestureStateManager';
5
+ import { LongPressGestureHandlerEventPayload } from '../LongPressGestureHandler';
6
+ import { PanGestureHandlerEventPayload } from '../PanGestureHandler';
7
+ import { PinchGestureHandlerEventPayload } from '../PinchGestureHandler';
8
+ import { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';
9
+ import { TapGestureHandlerEventPayload } from '../TapGestureHandler';
10
+ import { NativeViewGestureHandlerPayload } from '../NativeViewGestureHandler';
11
+ export declare type GestureType = BaseGesture<Record<string, unknown>> | BaseGesture<Record<string, never>> | BaseGesture<TapGestureHandlerEventPayload> | BaseGesture<PanGestureHandlerEventPayload> | BaseGesture<LongPressGestureHandlerEventPayload> | BaseGesture<RotationGestureHandlerEventPayload> | BaseGesture<PinchGestureHandlerEventPayload> | BaseGesture<FlingGestureHandlerEventPayload> | BaseGesture<ForceTouchGestureHandlerEventPayload> | BaseGesture<NativeViewGestureHandlerPayload>;
12
+ export declare type GestureRef = number | GestureType | React.RefObject<GestureType | undefined> | React.RefObject<React.ComponentType | undefined>;
13
+ export interface BaseGestureConfig extends CommonGestureConfig, Record<string, unknown> {
14
+ ref?: React.MutableRefObject<GestureType | undefined>;
15
+ requireToFail?: GestureRef[];
16
+ simultaneousWith?: GestureRef[];
17
+ needsPointerData?: boolean;
18
+ manualActivation?: boolean;
19
+ }
20
+ declare type TouchEventHandlerType = (event: GestureTouchEvent, stateManager: GestureStateManagerType) => void;
21
+ export declare type HandlerCallbacks<EventPayloadT extends Record<string, unknown>> = {
22
+ handlerTag: number;
23
+ onBegin?: (event: GestureStateChangeEvent<EventPayloadT>) => void;
24
+ onStart?: (event: GestureStateChangeEvent<EventPayloadT>) => void;
25
+ onEnd?: (event: GestureStateChangeEvent<EventPayloadT>, success: boolean) => void;
26
+ onFinalize?: (event: GestureStateChangeEvent<EventPayloadT>, success: boolean) => void;
27
+ onUpdate?: (event: GestureUpdateEvent<EventPayloadT>) => void;
28
+ onChange?: (event: any) => void;
29
+ onTouchesDown?: TouchEventHandlerType;
30
+ onTouchesMove?: TouchEventHandlerType;
31
+ onTouchesUp?: TouchEventHandlerType;
32
+ onTouchesCancelled?: TouchEventHandlerType;
33
+ changeEventCalculator?: (current: GestureUpdateEvent<Record<string, unknown>>, previous?: GestureUpdateEvent<Record<string, unknown>>) => GestureUpdateEvent<Record<string, unknown>>;
34
+ isWorklet: boolean[];
35
+ };
36
+ export declare const CALLBACK_TYPE: {
37
+ readonly UNDEFINED: 0;
38
+ readonly BEGAN: 1;
39
+ readonly START: 2;
40
+ readonly UPDATE: 3;
41
+ readonly CHANGE: 4;
42
+ readonly END: 5;
43
+ readonly FINALIZE: 6;
44
+ readonly TOUCHES_DOWN: 7;
45
+ readonly TOUCHES_MOVE: 8;
46
+ readonly TOUCHES_UP: 9;
47
+ readonly TOUCHES_CANCELLED: 10;
48
+ };
49
+ export declare type CALLBACK_TYPE = typeof CALLBACK_TYPE[keyof typeof CALLBACK_TYPE];
50
+ export declare abstract class Gesture {
51
+ /**
52
+ * Return array of gestures, providing the same interface for creating and updating
53
+ * handlers, no matter which object was used to create gesture instance.
54
+ */
55
+ abstract toGestureArray(): GestureType[];
56
+ /**
57
+ * Assign handlerTag to the gesture instance and set ref.current (if a ref is set)
58
+ */
59
+ abstract initialize(): void;
60
+ /**
61
+ * Make sure that values of properties defining relations are arrays. Do any necessary
62
+ * preprocessing required to configure relations between handlers. Called just before
63
+ * updating the handler on the native side.
64
+ */
65
+ abstract prepare(): void;
66
+ }
67
+ export declare abstract class BaseGesture<EventPayloadT extends Record<string, unknown>> extends Gesture {
68
+ handlerTag: number;
69
+ handlerName: string;
70
+ config: BaseGestureConfig;
71
+ handlers: HandlerCallbacks<EventPayloadT>;
72
+ private addDependency;
73
+ withRef(ref: React.MutableRefObject<GestureType | undefined>): this;
74
+ protected isWorklet(callback: Function): boolean;
75
+ onBegin(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void): this;
76
+ onStart(callback: (event: GestureStateChangeEvent<EventPayloadT>) => void): this;
77
+ onEnd(callback: (event: GestureStateChangeEvent<EventPayloadT>, success: boolean) => void): this;
78
+ onFinalize(callback: (event: GestureStateChangeEvent<EventPayloadT>, success: boolean) => void): this;
79
+ onTouchesDown(callback: TouchEventHandlerType): this;
80
+ onTouchesMove(callback: TouchEventHandlerType): this;
81
+ onTouchesUp(callback: TouchEventHandlerType): this;
82
+ onTouchesCancelled(callback: TouchEventHandlerType): this;
83
+ enabled(enabled: boolean): this;
84
+ shouldCancelWhenOutside(value: boolean): this;
85
+ hitSlop(hitSlop: HitSlop): this;
86
+ simultaneousWithExternalGesture(...gestures: Exclude<GestureRef, number>[]): this;
87
+ requireExternalGestureToFail(...gestures: Exclude<GestureRef, number>[]): this;
88
+ initialize(): void;
89
+ toGestureArray(): GestureType[];
90
+ prepare(): void;
91
+ }
92
+ export declare abstract class ContinousBaseGesture<EventPayloadT extends Record<string, unknown>, EventChangePayloadT extends Record<string, unknown>> extends BaseGesture<EventPayloadT> {
93
+ onUpdate(callback: (event: GestureUpdateEvent<EventPayloadT>) => void): this;
94
+ onChange(callback: (event: GestureUpdateEvent<EventPayloadT & EventChangePayloadT>) => void): this;
95
+ manualActivation(manualActivation: boolean): this;
96
+ }
97
+ export {};
@@ -0,0 +1,21 @@
1
+ import { Gesture, GestureType } from './gesture';
2
+ export declare class ComposedGesture extends Gesture {
3
+ protected gestures: Gesture[];
4
+ protected simultaneousGestures: GestureType[];
5
+ protected requireGesturesToFail: GestureType[];
6
+ constructor(...gestures: Gesture[]);
7
+ protected prepareSingleGesture(gesture: Gesture, simultaneousGestures: GestureType[], requireGesturesToFail: GestureType[]): void;
8
+ prepare(): void;
9
+ initialize(): void;
10
+ toGestureArray(): GestureType[];
11
+ }
12
+ export declare class SimultaneousGesture extends ComposedGesture {
13
+ prepare(): void;
14
+ }
15
+ export declare class ExclusiveGesture extends ComposedGesture {
16
+ prepare(): void;
17
+ }
18
+ export declare type ComposedGestureType = InstanceType<typeof ComposedGesture>;
19
+ export declare type RaceGestureType = ComposedGestureType;
20
+ export declare type SimultaneousGestureType = InstanceType<typeof SimultaneousGesture>;
21
+ export declare type ExclusiveGestureType = InstanceType<typeof ExclusiveGesture>;