react-native-gesture-handler 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (313) hide show
  1. package/README.md +1 -0
  2. package/RNGestureHandler.podspec +17 -5
  3. package/android/build.gradle +71 -15
  4. package/android/lib/src/main/java/com/swmansion/gesturehandler/FlingGestureHandler.kt +2 -1
  5. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.kt +30 -9
  6. package/android/lib/src/main/java/com/swmansion/gesturehandler/LongPressGestureHandler.kt +5 -2
  7. package/android/lib/src/main/java/com/swmansion/gesturehandler/NativeViewGestureHandler.kt +2 -1
  8. package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.kt +2 -1
  9. package/android/lib/src/main/java/com/swmansion/gesturehandler/TapGestureHandler.kt +3 -2
  10. package/android/src/fabric/java/com/swmansion/gesturehandler/RNGestureHandlerComponentsRegistry.java +1 -1
  11. package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +0 -8
  12. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +7 -1
  13. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +1 -1
  14. package/android/src/main/jni/CMakeLists.txt +59 -0
  15. package/ios/RNGestureHandlerButtonComponentView.mm +1 -1
  16. package/ios/RNGestureHandlerManager.mm +0 -5
  17. package/ios/RNGestureHandlerRootViewComponentView.mm +1 -1
  18. package/lib/commonjs/EnableExperimentalWebImplementation.js +24 -0
  19. package/lib/commonjs/EnableExperimentalWebImplementation.js.map +1 -0
  20. package/lib/commonjs/RNGestureHandlerModule.macos.js +87 -30
  21. package/lib/commonjs/RNGestureHandlerModule.macos.js.map +1 -1
  22. package/lib/commonjs/RNGestureHandlerModule.web.js +87 -25
  23. package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
  24. package/lib/commonjs/RNRenderer.js +16 -0
  25. package/lib/commonjs/RNRenderer.js.map +1 -0
  26. package/lib/commonjs/RNRenderer.web.js +11 -0
  27. package/lib/commonjs/RNRenderer.web.js.map +1 -0
  28. package/lib/commonjs/components/DrawerLayout.js +3 -1
  29. package/lib/commonjs/components/DrawerLayout.js.map +1 -1
  30. package/lib/commonjs/components/GestureButtons.js +42 -9
  31. package/lib/commonjs/components/GestureButtons.js.map +1 -1
  32. package/lib/commonjs/components/GestureComponents.js +41 -4
  33. package/lib/commonjs/components/GestureComponents.js.map +1 -1
  34. package/lib/commonjs/components/GestureComponents.web.js +7 -2
  35. package/lib/commonjs/components/GestureComponents.web.js.map +1 -1
  36. package/lib/commonjs/components/Swipeable.js +3 -1
  37. package/lib/commonjs/components/Swipeable.js.map +1 -1
  38. package/lib/commonjs/components/touchables/GenericTouchable.js +2 -1
  39. package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
  40. package/lib/commonjs/handlers/createHandler.js +8 -1
  41. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  42. package/lib/commonjs/handlers/gestures/GestureDetector.js +67 -12
  43. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
  44. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +7 -0
  45. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -1
  46. package/lib/commonjs/index.js +14 -0
  47. package/lib/commonjs/index.js.map +1 -1
  48. package/lib/commonjs/web/constants.js +3 -51
  49. package/lib/commonjs/web/constants.js.map +1 -1
  50. package/lib/commonjs/web/detectors/RotationGestureDetector.js +169 -0
  51. package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -0
  52. package/lib/commonjs/web/detectors/ScaleGestureDetector.js +167 -0
  53. package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -0
  54. package/lib/commonjs/web/handlers/FlingGestureHandler.js +154 -0
  55. package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -0
  56. package/lib/commonjs/web/handlers/GestureHandler.js +538 -0
  57. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -0
  58. package/lib/commonjs/web/handlers/LongPressGestureHandler.js +147 -0
  59. package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -0
  60. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +116 -0
  61. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -0
  62. package/lib/commonjs/web/handlers/PanGestureHandler.js +451 -0
  63. package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -0
  64. package/lib/commonjs/web/handlers/PinchGestureHandler.js +171 -0
  65. package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -0
  66. package/lib/commonjs/web/handlers/RotationGestureHandler.js +187 -0
  67. package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -0
  68. package/lib/commonjs/web/handlers/TapGestureHandler.js +296 -0
  69. package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -0
  70. package/lib/commonjs/web/interfaces.js +34 -0
  71. package/lib/commonjs/web/interfaces.js.map +1 -0
  72. package/lib/commonjs/web/tools/EventManager.js +169 -0
  73. package/lib/commonjs/web/tools/EventManager.js.map +1 -0
  74. package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +283 -0
  75. package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -0
  76. package/lib/commonjs/web/tools/InteractionManager.js +102 -0
  77. package/lib/commonjs/web/tools/InteractionManager.js.map +1 -0
  78. package/lib/commonjs/web/tools/NodeManager.js +48 -0
  79. package/lib/commonjs/web/tools/NodeManager.js.map +1 -0
  80. package/lib/commonjs/web/tools/PointerTracker.js +132 -0
  81. package/lib/commonjs/web/tools/PointerTracker.js.map +1 -0
  82. package/lib/commonjs/{web → web_hammer}/DiscreteGestureHandler.js +0 -0
  83. package/lib/commonjs/{web → web_hammer}/DiscreteGestureHandler.js.map +0 -0
  84. package/lib/commonjs/{web → web_hammer}/DraggingGestureHandler.js +0 -0
  85. package/lib/commonjs/{web → web_hammer}/DraggingGestureHandler.js.map +0 -0
  86. package/lib/commonjs/{web → web_hammer}/Errors.js +0 -0
  87. package/lib/commonjs/{web → web_hammer}/Errors.js.map +0 -0
  88. package/lib/commonjs/{web → web_hammer}/FlingGestureHandler.js +0 -0
  89. package/lib/commonjs/{web → web_hammer}/FlingGestureHandler.js.map +0 -0
  90. package/lib/commonjs/{web → web_hammer}/GestureHandler.js +83 -42
  91. package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -0
  92. package/lib/commonjs/{web → web_hammer}/IndiscreteGestureHandler.js +0 -0
  93. package/lib/commonjs/{web → web_hammer}/IndiscreteGestureHandler.js.map +0 -0
  94. package/lib/commonjs/{web → web_hammer}/LongPressGestureHandler.js +0 -0
  95. package/lib/commonjs/{web → web_hammer}/LongPressGestureHandler.js.map +0 -0
  96. package/lib/commonjs/{web → web_hammer}/NativeViewGestureHandler.js +4 -0
  97. package/lib/commonjs/web_hammer/NativeViewGestureHandler.js.map +1 -0
  98. package/lib/commonjs/{web → web_hammer}/NodeManager.js +0 -0
  99. package/lib/commonjs/web_hammer/NodeManager.js.map +1 -0
  100. package/lib/commonjs/{web → web_hammer}/PanGestureHandler.js +0 -0
  101. package/lib/commonjs/{web → web_hammer}/PanGestureHandler.js.map +0 -0
  102. package/lib/commonjs/{web → web_hammer}/PinchGestureHandler.js +0 -0
  103. package/lib/commonjs/{web → web_hammer}/PinchGestureHandler.js.map +0 -0
  104. package/lib/commonjs/{web → web_hammer}/PressGestureHandler.js +0 -0
  105. package/lib/commonjs/{web → web_hammer}/PressGestureHandler.js.map +0 -0
  106. package/lib/commonjs/{web → web_hammer}/RotationGestureHandler.js +0 -0
  107. package/lib/commonjs/{web → web_hammer}/RotationGestureHandler.js.map +0 -0
  108. package/lib/commonjs/{web → web_hammer}/TapGestureHandler.js +0 -0
  109. package/lib/commonjs/{web → web_hammer}/TapGestureHandler.js.map +0 -0
  110. package/lib/commonjs/web_hammer/constants.js +64 -0
  111. package/lib/commonjs/web_hammer/constants.js.map +1 -0
  112. package/lib/commonjs/{web → web_hammer}/utils.js +0 -0
  113. package/lib/commonjs/{web → web_hammer}/utils.js.map +0 -0
  114. package/lib/module/EnableExperimentalWebImplementation.js +15 -0
  115. package/lib/module/EnableExperimentalWebImplementation.js.map +1 -0
  116. package/lib/module/RNGestureHandlerModule.macos.js +74 -29
  117. package/lib/module/RNGestureHandlerModule.macos.js.map +1 -1
  118. package/lib/module/RNGestureHandlerModule.web.js +73 -24
  119. package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
  120. package/lib/module/RNRenderer.js +4 -0
  121. package/lib/module/RNRenderer.js.map +1 -0
  122. package/lib/module/RNRenderer.web.js +4 -0
  123. package/lib/module/RNRenderer.web.js.map +1 -0
  124. package/lib/module/components/DrawerLayout.js +3 -1
  125. package/lib/module/components/DrawerLayout.js.map +1 -1
  126. package/lib/module/components/GestureButtons.js +43 -9
  127. package/lib/module/components/GestureButtons.js.map +1 -1
  128. package/lib/module/components/GestureComponents.js +39 -4
  129. package/lib/module/components/GestureComponents.js.map +1 -1
  130. package/lib/module/components/GestureComponents.web.js +6 -2
  131. package/lib/module/components/GestureComponents.web.js.map +1 -1
  132. package/lib/module/components/Swipeable.js +3 -1
  133. package/lib/module/components/Swipeable.js.map +1 -1
  134. package/lib/module/components/touchables/GenericTouchable.js +2 -1
  135. package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
  136. package/lib/module/handlers/createHandler.js +9 -2
  137. package/lib/module/handlers/createHandler.js.map +1 -1
  138. package/lib/module/handlers/gestures/GestureDetector.js +64 -11
  139. package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
  140. package/lib/module/handlers/gestures/reanimatedWrapper.js +7 -0
  141. package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
  142. package/lib/module/index.js +2 -1
  143. package/lib/module/index.js.map +1 -1
  144. package/lib/module/web/constants.js +1 -36
  145. package/lib/module/web/constants.js.map +1 -1
  146. package/lib/module/web/detectors/RotationGestureDetector.js +159 -0
  147. package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -0
  148. package/lib/module/web/detectors/ScaleGestureDetector.js +156 -0
  149. package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -0
  150. package/lib/module/web/handlers/FlingGestureHandler.js +139 -0
  151. package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -0
  152. package/lib/module/web/handlers/GestureHandler.js +521 -0
  153. package/lib/module/web/handlers/GestureHandler.js.map +1 -0
  154. package/lib/module/web/handlers/LongPressGestureHandler.js +133 -0
  155. package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -0
  156. package/lib/module/web/handlers/NativeViewGestureHandler.js +103 -0
  157. package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -0
  158. package/lib/module/web/handlers/PanGestureHandler.js +434 -0
  159. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -0
  160. package/lib/module/web/handlers/PinchGestureHandler.js +155 -0
  161. package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -0
  162. package/lib/module/web/handlers/RotationGestureHandler.js +171 -0
  163. package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -0
  164. package/lib/module/web/handlers/TapGestureHandler.js +281 -0
  165. package/lib/module/web/handlers/TapGestureHandler.js.map +1 -0
  166. package/lib/module/web/interfaces.js +26 -0
  167. package/lib/module/web/interfaces.js.map +1 -0
  168. package/lib/module/web/tools/EventManager.js +160 -0
  169. package/lib/module/web/tools/EventManager.js.map +1 -0
  170. package/lib/module/web/tools/GestureHandlerOrchestrator.js +270 -0
  171. package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -0
  172. package/lib/module/web/tools/InteractionManager.js +93 -0
  173. package/lib/module/web/tools/InteractionManager.js.map +1 -0
  174. package/lib/module/web/tools/NodeManager.js +39 -0
  175. package/lib/module/web/tools/NodeManager.js.map +1 -0
  176. package/lib/module/web/tools/PointerTracker.js +122 -0
  177. package/lib/module/web/tools/PointerTracker.js.map +1 -0
  178. package/lib/module/{web → web_hammer}/DiscreteGestureHandler.js +0 -0
  179. package/lib/module/{web → web_hammer}/DiscreteGestureHandler.js.map +0 -0
  180. package/lib/module/{web → web_hammer}/DraggingGestureHandler.js +0 -0
  181. package/lib/module/{web → web_hammer}/DraggingGestureHandler.js.map +0 -0
  182. package/lib/module/{web → web_hammer}/Errors.js +0 -0
  183. package/lib/module/{web → web_hammer}/Errors.js.map +0 -0
  184. package/lib/module/{web → web_hammer}/FlingGestureHandler.js +0 -0
  185. package/lib/module/{web → web_hammer}/FlingGestureHandler.js.map +0 -0
  186. package/lib/module/{web → web_hammer}/GestureHandler.js +83 -42
  187. package/lib/module/web_hammer/GestureHandler.js.map +1 -0
  188. package/lib/module/{web → web_hammer}/IndiscreteGestureHandler.js +0 -0
  189. package/lib/module/{web → web_hammer}/IndiscreteGestureHandler.js.map +0 -0
  190. package/lib/module/{web → web_hammer}/LongPressGestureHandler.js +0 -0
  191. package/lib/module/{web → web_hammer}/LongPressGestureHandler.js.map +0 -0
  192. package/lib/module/{web → web_hammer}/NativeViewGestureHandler.js +4 -0
  193. package/lib/module/web_hammer/NativeViewGestureHandler.js.map +1 -0
  194. package/lib/module/{web → web_hammer}/NodeManager.js +0 -0
  195. package/lib/module/web_hammer/NodeManager.js.map +1 -0
  196. package/lib/module/{web → web_hammer}/PanGestureHandler.js +0 -0
  197. package/lib/module/{web → web_hammer}/PanGestureHandler.js.map +0 -0
  198. package/lib/module/{web → web_hammer}/PinchGestureHandler.js +0 -0
  199. package/lib/module/{web → web_hammer}/PinchGestureHandler.js.map +0 -0
  200. package/lib/module/{web → web_hammer}/PressGestureHandler.js +0 -0
  201. package/lib/module/{web → web_hammer}/PressGestureHandler.js.map +0 -0
  202. package/lib/module/{web → web_hammer}/RotationGestureHandler.js +0 -0
  203. package/lib/module/{web → web_hammer}/RotationGestureHandler.js.map +0 -0
  204. package/lib/module/{web → web_hammer}/TapGestureHandler.js +0 -0
  205. package/lib/module/{web → web_hammer}/TapGestureHandler.js.map +0 -0
  206. package/lib/module/web_hammer/constants.js +43 -0
  207. package/lib/module/web_hammer/constants.js.map +1 -0
  208. package/lib/module/{web → web_hammer}/utils.js +0 -0
  209. package/lib/module/{web → web_hammer}/utils.js.map +0 -0
  210. package/lib/typescript/EnableExperimentalWebImplementation.d.ts +2 -0
  211. package/lib/typescript/RNGestureHandlerModule.macos.d.ts +28 -18
  212. package/lib/typescript/RNGestureHandlerModule.web.d.ts +29 -18
  213. package/lib/typescript/RNRenderer.d.ts +1 -0
  214. package/lib/typescript/RNRenderer.web.d.ts +3 -0
  215. package/lib/typescript/components/DrawerLayout.d.ts +1 -1
  216. package/lib/typescript/components/GestureButtons.d.ts +16 -0
  217. package/lib/typescript/components/GestureComponents.d.ts +7 -3
  218. package/lib/typescript/components/GestureComponents.web.d.ts +1 -0
  219. package/lib/typescript/components/Swipeable.d.ts +1 -1
  220. package/lib/typescript/index.d.ts +2 -1
  221. package/lib/typescript/web/constants.d.ts +1 -33
  222. package/lib/typescript/web/detectors/RotationGestureDetector.d.ts +30 -0
  223. package/lib/typescript/web/detectors/ScaleGestureDetector.d.ts +30 -0
  224. package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +31 -0
  225. package/lib/typescript/web/handlers/GestureHandler.d.ts +84 -0
  226. package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +33 -0
  227. package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +16 -0
  228. package/lib/typescript/web/handlers/PanGestureHandler.d.ts +68 -0
  229. package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +30 -0
  230. package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +30 -0
  231. package/lib/typescript/web/handlers/TapGestureHandler.d.ts +49 -0
  232. package/lib/typescript/web/interfaces.d.ts +97 -0
  233. package/lib/typescript/web/tools/EventManager.d.ts +28 -0
  234. package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +28 -0
  235. package/lib/typescript/web/tools/InteractionManager.d.ts +13 -0
  236. package/lib/typescript/web/tools/NodeManager.d.ts +11 -0
  237. package/lib/typescript/web/tools/PointerTracker.d.ts +28 -0
  238. package/lib/typescript/{web → web_hammer}/DiscreteGestureHandler.d.ts +0 -0
  239. package/lib/typescript/{web → web_hammer}/DraggingGestureHandler.d.ts +0 -0
  240. package/lib/typescript/{web → web_hammer}/Errors.d.ts +0 -0
  241. package/lib/typescript/{web → web_hammer}/FlingGestureHandler.d.ts +1 -0
  242. package/lib/typescript/{web → web_hammer}/GestureHandler.d.ts +6 -0
  243. package/lib/typescript/{web → web_hammer}/IndiscreteGestureHandler.d.ts +1 -0
  244. package/lib/typescript/{web → web_hammer}/LongPressGestureHandler.d.ts +1 -0
  245. package/lib/typescript/{web → web_hammer}/NativeViewGestureHandler.d.ts +1 -0
  246. package/lib/typescript/web_hammer/NodeManager.d.ts +8 -0
  247. package/lib/typescript/{web → web_hammer}/PanGestureHandler.d.ts +1 -0
  248. package/lib/typescript/{web → web_hammer}/PinchGestureHandler.d.ts +0 -0
  249. package/lib/typescript/{web → web_hammer}/PressGestureHandler.d.ts +2 -0
  250. package/lib/typescript/{web → web_hammer}/RotationGestureHandler.d.ts +0 -0
  251. package/lib/typescript/{web → web_hammer}/TapGestureHandler.d.ts +1 -0
  252. package/lib/typescript/web_hammer/constants.d.ts +39 -0
  253. package/lib/typescript/{web → web_hammer}/utils.d.ts +0 -0
  254. package/package.json +1 -1
  255. package/src/EnableExperimentalWebImplementation.ts +18 -0
  256. package/src/RNGestureHandlerModule.macos.ts +81 -29
  257. package/src/RNGestureHandlerModule.web.ts +89 -26
  258. package/src/RNRenderer.ts +3 -0
  259. package/src/RNRenderer.web.ts +3 -0
  260. package/src/components/DrawerLayout.tsx +3 -4
  261. package/src/components/GestureButtons.tsx +57 -0
  262. package/src/components/GestureComponents.tsx +66 -6
  263. package/src/components/GestureComponents.web.tsx +5 -0
  264. package/src/components/Swipeable.tsx +3 -1
  265. package/src/components/touchables/GenericTouchable.tsx +1 -0
  266. package/src/handlers/createHandler.tsx +13 -2
  267. package/src/handlers/gestures/GestureDetector.tsx +78 -12
  268. package/src/handlers/gestures/reanimatedWrapper.ts +7 -0
  269. package/src/index.ts +3 -0
  270. package/src/web/constants.ts +1 -41
  271. package/src/web/detectors/RotationGestureDetector.ts +199 -0
  272. package/src/web/detectors/ScaleGestureDetector.ts +208 -0
  273. package/src/web/handlers/FlingGestureHandler.ts +146 -0
  274. package/src/web/handlers/GestureHandler.ts +572 -0
  275. package/src/web/handlers/LongPressGestureHandler.ts +122 -0
  276. package/src/web/handlers/NativeViewGestureHandler.ts +109 -0
  277. package/src/web/handlers/PanGestureHandler.ts +488 -0
  278. package/src/web/handlers/PinchGestureHandler.ts +162 -0
  279. package/src/web/handlers/RotationGestureHandler.ts +181 -0
  280. package/src/web/handlers/TapGestureHandler.ts +275 -0
  281. package/src/web/interfaces.ts +114 -0
  282. package/src/web/tools/EventManager.ts +186 -0
  283. package/src/web/tools/GestureHandlerOrchestrator.ts +329 -0
  284. package/src/web/tools/InteractionManager.ts +108 -0
  285. package/src/web/tools/NodeManager.ts +43 -0
  286. package/src/web/tools/PointerTracker.ts +130 -0
  287. package/src/{web → web_hammer}/DiscreteGestureHandler.ts +0 -0
  288. package/src/{web → web_hammer}/DraggingGestureHandler.ts +0 -0
  289. package/src/{web → web_hammer}/Errors.ts +0 -0
  290. package/src/{web → web_hammer}/FlingGestureHandler.ts +0 -0
  291. package/src/{web → web_hammer}/GestureHandler.ts +102 -55
  292. package/src/{web → web_hammer}/IndiscreteGestureHandler.ts +0 -0
  293. package/src/{web → web_hammer}/LongPressGestureHandler.ts +0 -0
  294. package/src/{web → web_hammer}/NativeViewGestureHandler.ts +4 -0
  295. package/src/{web → web_hammer}/NodeManager.ts +6 -3
  296. package/src/{web → web_hammer}/PanGestureHandler.ts +0 -0
  297. package/src/{web → web_hammer}/PinchGestureHandler.ts +0 -0
  298. package/src/{web → web_hammer}/PressGestureHandler.ts +0 -0
  299. package/src/{web → web_hammer}/RotationGestureHandler.ts +0 -0
  300. package/src/{web → web_hammer}/TapGestureHandler.ts +0 -0
  301. package/src/web_hammer/constants.ts +48 -0
  302. package/src/{web → web_hammer}/utils.ts +0 -0
  303. package/android/src/main/jni/Android.mk +0 -52
  304. package/android/src/main/jni/OnLoad.cpp +0 -9
  305. package/android/src/main/jni/RNGestureHandlerComponentsRegistry.cpp +0 -71
  306. package/android/src/main/jni/RNGestureHandlerComponentsRegistry.h +0 -34
  307. package/lib/commonjs/web/GestureHandler.js.map +0 -1
  308. package/lib/commonjs/web/NativeViewGestureHandler.js.map +0 -1
  309. package/lib/commonjs/web/NodeManager.js.map +0 -1
  310. package/lib/module/web/GestureHandler.js.map +0 -1
  311. package/lib/module/web/NativeViewGestureHandler.js.map +0 -1
  312. package/lib/module/web/NodeManager.js.map +0 -1
  313. package/lib/typescript/web/NodeManager.d.ts +0 -8
@@ -14,6 +14,12 @@ let gestureInstances = 0;
14
14
  class GestureHandler {
15
15
  get id() {
16
16
  return `${this.name}${this.gestureInstance}`;
17
+ } // a simple way to check if GestureHandler is NativeViewGestureHandler, since importing it
18
+ // here to use instanceof would cause import cycle
19
+
20
+
21
+ get isNative() {
22
+ return false;
17
23
  }
18
24
 
19
25
  get isDiscrete() {
@@ -216,7 +222,7 @@ class GestureHandler {
216
222
  ...props
217
223
  }) {
218
224
  this.clearSelfAsPending();
219
- this.config = ensureConfig({
225
+ this.config = this.ensureConfig({
220
226
  enabled,
221
227
  ...props
222
228
  });
@@ -332,17 +338,30 @@ class GestureHandler {
332
338
  }
333
339
  }
334
340
 
341
+ shouldUseTouchEvents(config) {
342
+ var _config$simultaneousH, _config$simultaneousH2;
343
+
344
+ return (_config$simultaneousH = (_config$simultaneousH2 = config.simultaneousHandlers) === null || _config$simultaneousH2 === void 0 ? void 0 : _config$simultaneousH2.some(handler => handler.isNative)) !== null && _config$simultaneousH !== void 0 ? _config$simultaneousH : false;
345
+ }
346
+
335
347
  setView(ref, propsRef) {
336
348
  if (ref == null) {
337
349
  this.destroy();
338
350
  this.view = null;
339
351
  return;
340
- }
352
+ } // @ts-ignore window doesn't exist on global type as we don't want to use Node types
353
+
341
354
 
355
+ const SUPPORTS_TOUCH = ('ontouchstart' in window);
342
356
  this.propsRef = propsRef;
343
357
  this.ref = ref;
344
- this.view = findNodeHandle(ref);
345
- this.hammer = new Hammer.Manager(this.view);
358
+ this.view = findNodeHandle(ref); // When the browser starts handling the gesture (e.g. scrolling), it sends a pointercancel event and stops
359
+ // sending additional pointer events. This is not the case with touch events, so if the gesture is simultaneous
360
+ // with a NativeGestureHandler, we need to check if touch events are supported and use them if possible.
361
+
362
+ this.hammer = SUPPORTS_TOUCH && this.shouldUseTouchEvents(this.config) ? new Hammer.Manager(this.view, {
363
+ inputClass: Hammer.TouchInput
364
+ }) : new Hammer.Manager(this.view);
346
365
  this.oldState = State.UNDETERMINED;
347
366
  this.previousState = State.UNDETERMINED;
348
367
  this.lastSentState = null;
@@ -431,7 +450,66 @@ class GestureHandler {
431
450
  };
432
451
  }
433
452
 
434
- simulateCancelEvent(_inputData) {}
453
+ simulateCancelEvent(_inputData) {} // Validate the props
454
+
455
+
456
+ ensureConfig(config) {
457
+ const props = { ...config
458
+ }; // TODO(TS) We use ! to assert that if property is present then value is not empty (null, undefined)
459
+
460
+ if ('minDist' in config) {
461
+ props.minDist = config.minDist;
462
+ props.minDistSq = props.minDist * props.minDist;
463
+ }
464
+
465
+ if ('minVelocity' in config) {
466
+ props.minVelocity = config.minVelocity;
467
+ props.minVelocitySq = props.minVelocity * props.minVelocity;
468
+ }
469
+
470
+ if ('maxDist' in config) {
471
+ props.maxDist = config.maxDist;
472
+ props.maxDistSq = config.maxDist * config.maxDist;
473
+ }
474
+
475
+ if ('waitFor' in config) {
476
+ props.waitFor = asArray(config.waitFor).map(({
477
+ handlerTag
478
+ }) => NodeManager.getHandler(handlerTag)).filter(v => v);
479
+ } else {
480
+ props.waitFor = null;
481
+ }
482
+
483
+ if ('simultaneousHandlers' in config) {
484
+ const shouldUseTouchEvents = this.shouldUseTouchEvents(this.config);
485
+ props.simultaneousHandlers = asArray(config.simultaneousHandlers).map(handler => {
486
+ if (typeof handler === 'number') {
487
+ return NodeManager.getHandler(handler);
488
+ } else {
489
+ return NodeManager.getHandler(handler.handlerTag);
490
+ }
491
+ }).filter(v => v);
492
+
493
+ if (shouldUseTouchEvents !== this.shouldUseTouchEvents(props)) {
494
+ requestAnimationFrame(() => {
495
+ // if the undelying event API needs to be changed, we need to unmount and mount
496
+ // the hammer instance again.
497
+ this.destroy();
498
+ this.setView(this.ref, this.propsRef);
499
+ });
500
+ }
501
+ } else {
502
+ props.simultaneousHandlers = null;
503
+ }
504
+
505
+ const configProps = ['minPointers', 'maxPointers', 'minDist', 'maxDist', 'maxDistSq', 'minVelocitySq', 'minDistSq', 'minVelocity', 'failOffsetXStart', 'failOffsetYStart', 'failOffsetXEnd', 'failOffsetYEnd', 'activeOffsetXStart', 'activeOffsetXEnd', 'activeOffsetYStart', 'activeOffsetYEnd'];
506
+ configProps.forEach(prop => {
507
+ if (typeof props[prop] === 'undefined') {
508
+ props[prop] = Number.NaN;
509
+ }
510
+ });
511
+ return props; // TODO(TS) how to convince TS that props are filled?
512
+ }
435
513
 
436
514
  } // TODO(TS) investigate this method
437
515
  // Used for sending data to a callback or AnimatedEvent
@@ -473,43 +551,6 @@ function invokeNullableMethod(method, event) {
473
551
  }
474
552
  }
475
553
  }
476
- } // Validate the props
477
-
478
-
479
- function ensureConfig(config) {
480
- const props = { ...config
481
- }; // TODO(TS) We use ! to assert that if property is present then value is not empty (null, undefined)
482
-
483
- if ('minDist' in config) {
484
- props.minDist = config.minDist;
485
- props.minDistSq = props.minDist * props.minDist;
486
- }
487
-
488
- if ('minVelocity' in config) {
489
- props.minVelocity = config.minVelocity;
490
- props.minVelocitySq = props.minVelocity * props.minVelocity;
491
- }
492
-
493
- if ('maxDist' in config) {
494
- props.maxDist = config.maxDist;
495
- props.maxDistSq = config.maxDist * config.maxDist;
496
- }
497
-
498
- if ('waitFor' in config) {
499
- props.waitFor = asArray(config.waitFor).map(({
500
- handlerTag
501
- }) => NodeManager.getHandler(handlerTag)).filter(v => v);
502
- } else {
503
- props.waitFor = null;
504
- }
505
-
506
- const configProps = ['minPointers', 'maxPointers', 'minDist', 'maxDist', 'maxDistSq', 'minVelocitySq', 'minDistSq', 'minVelocity', 'failOffsetXStart', 'failOffsetYStart', 'failOffsetXEnd', 'failOffsetYEnd', 'activeOffsetXStart', 'activeOffsetXEnd', 'activeOffsetYStart', 'activeOffsetYEnd'];
507
- configProps.forEach(prop => {
508
- if (typeof props[prop] === 'undefined') {
509
- props[prop] = Number.NaN;
510
- }
511
- });
512
- return props; // TODO(TS) how to convince TS that props are filled?
513
554
  }
514
555
 
515
556
  function asArray(value) {
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["GestureHandler.ts"],"names":["Hammer","findNodeHandle","State","EventMap","NodeManager","gestureInstances","GestureHandler","id","name","gestureInstance","isNative","isDiscrete","shouldEnableGestureOnSetup","Error","constructor","UNDETERMINED","Array","isArray","config","waitFor","gesture","removePendingGesture","clearSelfAsPending","hammer","stop","destroy","x","y","rect","view","getBoundingClientRect","pointerInside","left","right","top","bottom","nativeEvent","onGestureHandlerEvent","onGestureHandlerStateChange","propsRef","current","event","transformEventData","invokeNullableMethod","lastSentState","state","get","enable","recognizer","inputData","enabled","isGestureRunning","hasGestureFailed","options","maxPointers","_stillWaiting","_getPendingGestures","length","hasCustomActivationCriteria","deltaRotation","initialRotation","rotation","success","failed","isGestureEnabledForEvent","getConfig","simulateCancelEvent","params","getHammerConfig","set","onWaitingEnded","_gesture","pendingGestures","addPendingGesture","_config","_recognizer","_event","NativeGestureClass","updateHasCustomActivationCriteria","updateGestureConfig","props","ensureConfig","sync","getState","type","eventType","numberOfPointers","changedTouch","changedPointers","isPointInView","clientX","clientY","previousState","oldState","transformNativeEvent","handlerTag","target","ref","undefined","timeStamp","Date","now","cancelPendingGestures","Object","values","cancelEvent","notifyPendingGestures","onGestureEnded","forceInvalidate","sendEvent","INPUT_CANCEL","isFinal","onRawEvent","isFirst","shouldUseTouchEvents","simultaneousHandlers","some","handler","setView","SUPPORTS_TOUCH","window","Manager","inputClass","TouchInput","add","on","ev","setTimeout","setupEvents","onStart","onGestureActivated","deltaX","deltaY","__initialX","__initialY","onSuccess","stillWaiting","filter","pointers","minPointers","_inputData","minDist","minDistSq","minVelocity","minVelocitySq","maxDist","maxDistSq","asArray","map","getHandler","v","requestAnimationFrame","configProps","forEach","prop","Number","NaN","method","__getHandler","argMapping","__nodeConfig","index","key","value","entries","nativeValue","setValue"],"mappings":";;AAAA;;AACA;AACA,OAAOA,MAAP,MAAmB,gBAAnB;AACA,SAASC,cAAT,QAA+B,cAA/B;AAEA,SAASC,KAAT,QAAsB,UAAtB;AACA,SAASC,QAAT,QAAyB,aAAzB;AACA,OAAO,KAAKC,WAAZ,MAA6B,eAA7B,C,CAEA;;AA2BA,IAAIC,gBAAgB,GAAG,CAAvB;;AAEA,MAAeC,cAAf,CAA8B;AAsBtB,MAAFC,EAAE,GAAG;AACP,WAAQ,GAAE,KAAKC,IAAK,GAAE,KAAKC,eAAgB,EAA3C;AACD,GAxB2B,CA0B5B;AACA;;;AACY,MAARC,QAAQ,GAAG;AACb,WAAO,KAAP;AACD;;AAEa,MAAVC,UAAU,GAAG;AACf,WAAO,KAAP;AACD;;AAE6B,MAA1BC,0BAA0B,GAAY;AACxC,UAAM,IAAIC,KAAJ,CAAU,yDAAV,CAAN;AACD;;AAEDC,EAAAA,WAAW,GAAG;AAAA;;AAAA,8CAtCY,KAsCZ;;AAAA,kCArCe,IAqCf;;AAAA;;AAAA,8CAnCe,KAmCf;;AAAA,oCAlC2B,IAkC3B;;AAAA,6CAjC6B,IAiC7B;;AAAA;;AAAA;;AAAA,oCA9Ba,EA8Bb;;AAAA,2CA7BmBZ,KAAK,CAACa,YA6BzB;;AAAA,6CA5BkC,EA4BlC;;AAAA,sCA3BYb,KAAK,CAACa,YA2BlB;;AAAA,2CA1BwB,IA0BxB;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,gDAmCO,MAAM;AACzB,U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ASlB,OAAT,CAAoBgB,KAApB,EAAoC;AAClC;AACA,SAAOA,KAAK,IAAI,IAAT,GAAgB,EAAhB,GAAqBnJ,KAAK,CAACC,OAAN,CAAckJ,KAAd,IAAuBA,KAAvB,GAA+B,CAACA,KAAD,CAA3D;AACD;;AAED,eAAe7J,cAAf","sourcesContent":["/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\nimport Hammer from '@egjs/hammerjs';\nimport { findNodeHandle } from 'react-native';\n\nimport { State } from '../State';\nimport { EventMap } from './constants';\nimport * as NodeManager from './NodeManager';\n\n// TODO(TS) Replace with HammerInput if https://github.com/DefinitelyTyped/DefinitelyTyped/pull/50438/files is merged\nexport type HammerInputExt = Omit<HammerInput, 'destroy' | 'handler' | 'init'>;\n\nexport type Config = Partial<{\n enabled: boolean;\n minPointers: number;\n maxPointers: number;\n minDist: number;\n minDistSq: number;\n minVelocity: number;\n minVelocitySq: number;\n maxDist: number;\n maxDistSq: number;\n failOffsetXStart: number;\n failOffsetYStart: number;\n failOffsetXEnd: number;\n failOffsetYEnd: number;\n activeOffsetXStart: number;\n activeOffsetXEnd: number;\n activeOffsetYStart: number;\n activeOffsetYEnd: number;\n waitFor: any[] | null;\n simultaneousHandlers: any[] | null;\n}>;\n\ntype NativeEvent = ReturnType<GestureHandler['transformEventData']>;\n\nlet gestureInstances = 0;\n\nabstract class GestureHandler {\n public handlerTag: any;\n public isGestureRunning = false;\n public view: number | null = null;\n protected hasCustomActivationCriteria: boolean;\n protected hasGestureFailed = false;\n protected hammer: HammerManager | null = null;\n protected initialRotation: number | null = null;\n protected __initialX: any;\n protected __initialY: any;\n protected config: Config = {};\n protected previousState: State = State.UNDETERMINED;\n private pendingGestures: Record<string, this> = {};\n private oldState: State = State.UNDETERMINED;\n private lastSentState: State | null = null;\n private gestureInstance: number;\n private _stillWaiting: any;\n private propsRef: any;\n private ref: any;\n\n abstract get name(): string;\n\n get id() {\n return `${this.name}${this.gestureInstance}`;\n }\n\n // a simple way to check if GestureHandler is NativeViewGestureHandler, since importing it\n // here to use instanceof would cause import cycle\n get isNative() {\n return false;\n }\n\n get isDiscrete() {\n return false;\n }\n\n get shouldEnableGestureOnSetup(): boolean {\n throw new Error('Must override GestureHandler.shouldEnableGestureOnSetup');\n }\n\n constructor() {\n this.gestureInstance = gestureInstances++;\n this.hasCustomActivationCriteria = false;\n }\n\n getConfig() {\n return this.config;\n }\n\n onWaitingEnded(_gesture: this) {}\n\n removePendingGesture(id: string) {\n delete this.pendingGestures[id];\n }\n\n addPendingGesture(gesture: this) {\n this.pendingGestures[gesture.id] = gesture;\n }\n\n isGestureEnabledForEvent(\n _config: any,\n _recognizer: any,\n _event: any\n ): { failed?: boolean; success?: boolean } {\n return { success: true };\n }\n\n get NativeGestureClass(): RecognizerStatic {\n throw new Error('Must override GestureHandler.NativeGestureClass');\n }\n\n updateHasCustomActivationCriteria(_config: Config) {\n return true;\n }\n\n clearSelfAsPending = () => {\n if (Array.isArray(this.config.waitFor)) {\n for (const gesture of this.config.waitFor) {\n gesture.removePendingGesture(this.id);\n }\n }\n };\n\n updateGestureConfig({ enabled = true, ...props }) {\n this.clearSelfAsPending();\n\n this.config = this.ensureConfig({ enabled, ...props });\n this.hasCustomActivationCriteria = this.updateHasCustomActivationCriteria(\n this.config\n );\n if (Array.isArray(this.config.waitFor)) {\n for (const gesture of this.config.waitFor) {\n gesture.addPendingGesture(this);\n }\n }\n\n if (this.hammer) {\n this.sync();\n }\n return this.config;\n }\n\n destroy = () => {\n this.clearSelfAsPending();\n\n if (this.hammer) {\n this.hammer.stop(false);\n this.hammer.destroy();\n }\n this.hammer = null;\n };\n\n isPointInView = ({ x, y }: { x: number; y: number }) => {\n // @ts-ignore FIXME(TS)\n const rect = this.view!.getBoundingClientRect();\n const pointerInside =\n x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;\n return pointerInside;\n };\n\n getState(type: keyof typeof EventMap): State {\n // @ts-ignore TODO(TS) check if this is needed\n if (type == 0) {\n return 0;\n }\n return EventMap[type];\n }\n\n transformEventData(event: HammerInputExt) {\n const { eventType, maxPointers: numberOfPointers } = event;\n // const direction = DirectionMap[ev.direction];\n const changedTouch = event.changedPointers[0];\n const pointerInside = this.isPointInView({\n x: changedTouch.clientX,\n y: changedTouch.clientY,\n });\n\n // TODO(TS) Remove cast after https://github.com/DefinitelyTyped/DefinitelyTyped/pull/50966 is merged.\n const state = this.getState(eventType as 1 | 2 | 4 | 8);\n if (state !== this.previousState) {\n this.oldState = this.previousState;\n this.previousState = state;\n }\n\n return {\n nativeEvent: {\n numberOfPointers,\n state,\n pointerInside,\n ...this.transformNativeEvent(event),\n // onHandlerStateChange only\n handlerTag: this.handlerTag,\n target: this.ref,\n // send oldState only when the state was changed, or is different than ACTIVE\n // GestureDetector relies on the presence of `oldState` to differentiate between\n // update events and state change events\n oldState:\n state !== this.previousState || state != 4\n ? this.oldState\n : undefined,\n },\n timeStamp: Date.now(),\n };\n }\n\n transformNativeEvent(_event: HammerInputExt) {\n return {};\n }\n\n sendEvent = (nativeEvent: HammerInputExt) => {\n const {\n onGestureHandlerEvent,\n onGestureHandlerStateChange,\n } = this.propsRef.current;\n\n const event = this.transformEventData(nativeEvent);\n\n invokeNullableMethod(onGestureHandlerEvent, event);\n if (this.lastSentState !== event.nativeEvent.state) {\n this.lastSentState = event.nativeEvent.state as State;\n invokeNullableMethod(onGestureHandlerStateChange, event);\n }\n };\n\n cancelPendingGestures(event: HammerInputExt) {\n for (const gesture of Object.values(this.pendingGestures)) {\n if (gesture && gesture.isGestureRunning) {\n gesture.hasGestureFailed = true;\n gesture.cancelEvent(event);\n }\n }\n }\n\n notifyPendingGestures() {\n for (const gesture of Object.values(this.pendingGestures)) {\n if (gesture) {\n gesture.onWaitingEnded(this);\n }\n }\n }\n\n // FIXME event is undefined in runtime when firstly invoked (see Draggable example), check other functions taking event as input\n onGestureEnded(event: HammerInputExt) {\n this.isGestureRunning = false;\n this.cancelPendingGestures(event);\n }\n\n forceInvalidate(event: HammerInputExt) {\n if (this.isGestureRunning) {\n this.hasGestureFailed = true;\n this.cancelEvent(event);\n }\n }\n\n cancelEvent(event: HammerInputExt) {\n this.notifyPendingGestures();\n this.sendEvent({\n ...event,\n eventType: Hammer.INPUT_CANCEL,\n isFinal: true,\n });\n this.onGestureEnded(event);\n }\n\n onRawEvent({ isFirst }: HammerInputExt) {\n if (isFirst) {\n this.hasGestureFailed = false;\n }\n }\n\n shouldUseTouchEvents(config: Config) {\n return (\n config.simultaneousHandlers?.some((handler) => handler.isNative) ?? false\n );\n }\n\n setView(ref: Parameters<typeof findNodeHandle>['0'], propsRef: any) {\n if (ref == null) {\n this.destroy();\n this.view = null;\n return;\n }\n\n // @ts-ignore window doesn't exist on global type as we don't want to use Node types\n const SUPPORTS_TOUCH = 'ontouchstart' in window;\n this.propsRef = propsRef;\n this.ref = ref;\n\n this.view = findNodeHandle(ref);\n\n // When the browser starts handling the gesture (e.g. scrolling), it sends a pointercancel event and stops\n // sending additional pointer events. This is not the case with touch events, so if the gesture is simultaneous\n // with a NativeGestureHandler, we need to check if touch events are supported and use them if possible.\n this.hammer =\n SUPPORTS_TOUCH && this.shouldUseTouchEvents(this.config)\n ? new Hammer.Manager(this.view as any, {\n inputClass: Hammer.TouchInput,\n })\n : new Hammer.Manager(this.view as any);\n\n this.oldState = State.UNDETERMINED;\n this.previousState = State.UNDETERMINED;\n this.lastSentState = null;\n\n const { NativeGestureClass } = this;\n // @ts-ignore TODO(TS)\n const gesture = new NativeGestureClass(this.getHammerConfig());\n this.hammer.add(gesture);\n\n this.hammer.on('hammer.input', (ev: HammerInput) => {\n if (!this.config.enabled) {\n this.hasGestureFailed = false;\n this.isGestureRunning = false;\n return;\n }\n\n this.onRawEvent((ev as unknown) as HammerInputExt);\n\n // TODO: Bacon: Check against something other than null\n // The isFirst value is not called when the first rotation is calculated.\n if (this.initialRotation === null && ev.rotation !== 0) {\n this.initialRotation = ev.rotation;\n }\n if (ev.isFinal) {\n // in favor of a willFail otherwise the last frame of the gesture will be captured.\n setTimeout(() => {\n this.initialRotation = null;\n this.hasGestureFailed = false;\n });\n }\n });\n\n this.setupEvents();\n this.sync();\n }\n\n setupEvents() {\n // TODO(TS) Hammer types aren't exactly that what we get in runtime\n if (!this.isDiscrete) {\n this.hammer!.on(`${this.name}start`, (event: HammerInput) =>\n this.onStart((event as unknown) as HammerInputExt)\n );\n this.hammer!.on(\n `${this.name}end ${this.name}cancel`,\n (event: HammerInput) => {\n this.onGestureEnded((event as unknown) as HammerInputExt);\n }\n );\n }\n this.hammer!.on(this.name, (ev: HammerInput) =>\n this.onGestureActivated((ev as unknown) as HammerInputExt)\n ); // TODO(TS) remove cast after https://github.com/DefinitelyTyped/DefinitelyTyped/pull/50438 is merged\n }\n\n onStart({ deltaX, deltaY, rotation }: HammerInputExt) {\n // Reset the state for the next gesture\n this.oldState = State.UNDETERMINED;\n this.previousState = State.UNDETERMINED;\n this.lastSentState = null;\n\n this.isGestureRunning = true;\n this.__initialX = deltaX;\n this.__initialY = deltaY;\n this.initialRotation = rotation;\n }\n\n onGestureActivated(ev: HammerInputExt) {\n this.sendEvent(ev);\n }\n\n onSuccess() {}\n\n _getPendingGestures() {\n if (Array.isArray(this.config.waitFor) && this.config.waitFor.length) {\n // Get the list of gestures that this gesture is still waiting for.\n // Use `=== false` in case a ref that isn't a gesture handler is used.\n const stillWaiting = this.config.waitFor.filter(\n ({ hasGestureFailed }) => hasGestureFailed === false\n );\n return stillWaiting;\n }\n return [];\n }\n\n getHammerConfig() {\n const pointers =\n this.config.minPointers === this.config.maxPointers\n ? this.config.minPointers\n : 0;\n return {\n pointers,\n };\n }\n\n sync = () => {\n const gesture = this.hammer!.get(this.name);\n if (!gesture) return;\n\n const enable = (recognizer: any, inputData: any) => {\n if (!this.config.enabled) {\n this.isGestureRunning = false;\n this.hasGestureFailed = false;\n return false;\n }\n\n // Prevent events before the system is ready.\n if (\n !inputData ||\n !recognizer.options ||\n typeof inputData.maxPointers === 'undefined'\n ) {\n return this.shouldEnableGestureOnSetup;\n }\n\n if (this.hasGestureFailed) {\n return false;\n }\n\n if (!this.isDiscrete) {\n if (this.isGestureRunning) {\n return true;\n }\n // The built-in hammer.js \"waitFor\" doesn't work across multiple views.\n // Only process if there are views to wait for.\n this._stillWaiting = this._getPendingGestures();\n // This gesture should continue waiting.\n if (this._stillWaiting.length) {\n // Check to see if one of the gestures you're waiting for has started.\n // If it has then the gesture should fail.\n for (const gesture of this._stillWaiting) {\n // When the target gesture has started, this gesture must force fail.\n if (!gesture.isDiscrete && gesture.isGestureRunning) {\n this.hasGestureFailed = true;\n this.isGestureRunning = false;\n return false;\n }\n }\n // This gesture shouldn't start until the others have finished.\n return false;\n }\n }\n\n // Use default behaviour\n if (!this.hasCustomActivationCriteria) {\n return true;\n }\n\n const deltaRotation =\n this.initialRotation == null\n ? 0\n : inputData.rotation - this.initialRotation;\n // @ts-ignore FIXME(TS)\n const { success, failed } = this.isGestureEnabledForEvent(\n this.getConfig(),\n recognizer,\n {\n ...inputData,\n deltaRotation,\n }\n );\n\n if (failed) {\n this.simulateCancelEvent(inputData);\n this.hasGestureFailed = true;\n }\n return success;\n };\n\n const params = this.getHammerConfig();\n // @ts-ignore FIXME(TS)\n gesture.set({ ...params, enable });\n };\n\n simulateCancelEvent(_inputData: any) {}\n\n // Validate the props\n ensureConfig(config: Config): Required<Config> {\n const props = { ...config };\n\n // TODO(TS) We use ! to assert that if property is present then value is not empty (null, undefined)\n if ('minDist' in config) {\n props.minDist = config.minDist;\n props.minDistSq = props.minDist! * props.minDist!;\n }\n if ('minVelocity' in config) {\n props.minVelocity = config.minVelocity;\n props.minVelocitySq = props.minVelocity! * props.minVelocity!;\n }\n if ('maxDist' in config) {\n props.maxDist = config.maxDist;\n props.maxDistSq = config.maxDist! * config.maxDist!;\n }\n if ('waitFor' in config) {\n props.waitFor = asArray(config.waitFor)\n .map(({ handlerTag }: { handlerTag: number }) =>\n NodeManager.getHandler(handlerTag)\n )\n .filter((v) => v);\n } else {\n props.waitFor = null;\n }\n if ('simultaneousHandlers' in config) {\n const shouldUseTouchEvents = this.shouldUseTouchEvents(this.config);\n props.simultaneousHandlers = asArray(config.simultaneousHandlers)\n .map((handler: number | GestureHandler) => {\n if (typeof handler === 'number') {\n return NodeManager.getHandler(handler);\n } else {\n return NodeManager.getHandler(handler.handlerTag);\n }\n })\n .filter((v) => v);\n\n if (shouldUseTouchEvents !== this.shouldUseTouchEvents(props)) {\n requestAnimationFrame(() => {\n // if the undelying event API needs to be changed, we need to unmount and mount\n // the hammer instance again.\n this.destroy();\n this.setView(this.ref, this.propsRef);\n });\n }\n } else {\n props.simultaneousHandlers = null;\n }\n\n const configProps = [\n 'minPointers',\n 'maxPointers',\n 'minDist',\n 'maxDist',\n 'maxDistSq',\n 'minVelocitySq',\n 'minDistSq',\n 'minVelocity',\n 'failOffsetXStart',\n 'failOffsetYStart',\n 'failOffsetXEnd',\n 'failOffsetYEnd',\n 'activeOffsetXStart',\n 'activeOffsetXEnd',\n 'activeOffsetYStart',\n 'activeOffsetYEnd',\n ] as const;\n configProps.forEach((prop: typeof configProps[number]) => {\n if (typeof props[prop] === 'undefined') {\n props[prop] = Number.NaN;\n }\n });\n return props as Required<Config>; // TODO(TS) how to convince TS that props are filled?\n }\n}\n\n// TODO(TS) investigate this method\n// Used for sending data to a callback or AnimatedEvent\nfunction invokeNullableMethod(\n method:\n | ((event: NativeEvent) => void)\n | { __getHandler: () => (event: NativeEvent) => void }\n | { __nodeConfig: { argMapping: any } },\n event: NativeEvent\n) {\n if (method) {\n if (typeof method === 'function') {\n method(event);\n } else {\n // For use with reanimated's AnimatedEvent\n if (\n '__getHandler' in method &&\n typeof method.__getHandler === 'function'\n ) {\n const handler = method.__getHandler();\n invokeNullableMethod(handler, event);\n } else {\n if ('__nodeConfig' in method) {\n const { argMapping } = method.__nodeConfig;\n if (Array.isArray(argMapping)) {\n for (const [index, [key, value]] of argMapping.entries()) {\n if (key in event.nativeEvent) {\n // @ts-ignore fix method type\n const nativeValue = event.nativeEvent[key];\n if (value && value.setValue) {\n // Reanimated API\n value.setValue(nativeValue);\n } else {\n // RN Animated API\n method.__nodeConfig.argMapping[index] = [key, nativeValue];\n }\n }\n }\n }\n }\n }\n }\n }\n}\n\nfunction asArray<T>(value: T | T[]) {\n // TODO(TS) use config.waitFor type\n return value == null ? [] : Array.isArray(value) ? value : [value];\n}\n\nexport default GestureHandler;\n"]}
@@ -4,6 +4,10 @@ import PressGestureHandler from './PressGestureHandler';
4
4
  import { TEST_MIN_IF_NOT_NAN, VEC_LEN_SQ } from './utils';
5
5
 
6
6
  class NativeViewGestureHandler extends PressGestureHandler {
7
+ get isNative() {
8
+ return true;
9
+ }
10
+
7
11
  onRawEvent(ev) {
8
12
  super.onRawEvent(ev);
9
13
 
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["NativeViewGestureHandler.ts"],"names":["DiscreteGestureHandler","NodeManager","PressGestureHandler","TEST_MIN_IF_NOT_NAN","VEC_LEN_SQ","NativeViewGestureHandler","isNative","onRawEvent","ev","isFinal","x","deltaX","y","deltaY","config","disallowInterruption","gestures","Object","values","getNodes","filter","gesture","handlerTag","view","isGestureRunning","contains","forceInvalidate"],"mappings":"AAAA,OAAOA,sBAAP,MAAmC,0BAAnC;AAEA,OAAO,KAAKC,WAAZ,MAA6B,eAA7B;AACA,OAAOC,mBAAP,MAAgC,uBAAhC;AACA,SAASC,mBAAT,EAA8BC,UAA9B,QAAgD,SAAhD;;AAEA,MAAMC,wBAAN,SAAuCH,mBAAvC,CAA2D;AAC7C,MAARI,QAAQ,GAAG;AACb,WAAO,IAAP;AACD;;AAEDC,EAAAA,UAAU,CAACC,EAAD,EAAqB;AAC7B,UAAMD,UAAN,CAAiBC,EAAjB;;AACA,QAAI,CAACA,EAAE,CAACC,OAAR,EAAiB;AACf;AACA,UAAIN,mBAAmB,CAACC,UAAU,CAAC;AAAEM,QAAAA,CAAC,EAAEF,EAAE,CAACG,MAAR;AAAgBC,QAAAA,CAAC,EAAEJ,EAAE,CAACK;AAAtB,OAAD,CAAX,EAA6C,EAA7C,CAAvB,EAAyE;AACvE;AACA,YAAI,KAAKC,MAAL,CAAYC,oBAAhB,EAAsC;AACpC,gBAAMC,QAAQ,GAAGC,MAAM,CAACC,MAAP,CAAcjB,WAAW,CAACkB,QAAZ,EAAd,EAAsCC,MAAtC,CACdC,OAAD,IAAa;AACX,kBAAM;AAAEC,cAAAA,UAAF;AAAcC,cAAAA,IAAd;AAAoBC,cAAAA;AAApB,gBAAyCH,OAA/C;AACA,mBACE;AACAC,cAAAA,UAAU,KAAK,KAAKA,UAApB,IACA;AACAE,cAAAA,gBAFA,IAGA;AACAH,cAAAA,OAAO,YAAYrB,sBAJnB,IAKA;AACAuB,cAAAA,IANA,IAOA;AACA,mBAAKA,IAAL,CAAUE,QAAV,CAAmBF,IAAnB;AAVF;AAYD,WAfc,CAAjB,CADoC,CAkBpC;;AACA,eAAK,MAAMF,OAAX,IAAsBL,QAAtB,EAAgC;AAC9B;AACAK,YAAAA,OAAO,CAACK,eAAR,CAAwBlB,EAAxB;AACD;AACF;AACF;AACF;AACF;;AArCwD;;AAwC3D,eAAeH,wBAAf","sourcesContent":["import DiscreteGestureHandler from './DiscreteGestureHandler';\nimport { HammerInputExt } from './GestureHandler';\nimport * as NodeManager from './NodeManager';\nimport PressGestureHandler from './PressGestureHandler';\nimport { TEST_MIN_IF_NOT_NAN, VEC_LEN_SQ } from './utils';\n\nclass NativeViewGestureHandler extends PressGestureHandler {\n get isNative() {\n return true;\n }\n\n onRawEvent(ev: HammerInputExt) {\n super.onRawEvent(ev);\n if (!ev.isFinal) {\n // if (this.ref instanceof ScrollView) {\n if (TEST_MIN_IF_NOT_NAN(VEC_LEN_SQ({ x: ev.deltaX, y: ev.deltaY }), 10)) {\n // @ts-ignore FIXME(TS) config type\n if (this.config.disallowInterruption) {\n const gestures = Object.values(NodeManager.getNodes()).filter(\n (gesture) => {\n const { handlerTag, view, isGestureRunning } = gesture;\n return (\n // Check if this gesture isn't self\n handlerTag !== this.handlerTag &&\n // Ensure the gesture needs to be cancelled\n isGestureRunning &&\n // ScrollView can cancel discrete gestures like taps and presses\n gesture instanceof DiscreteGestureHandler &&\n // Ensure a view exists and is a child of the current view\n view &&\n // @ts-ignore FIXME(TS) view type\n this.view.contains(view)\n );\n }\n );\n // Cancel all of the gestures that passed the filter\n for (const gesture of gestures) {\n // TODO: Bacon: Send some cached event.\n gesture.forceInvalidate(ev);\n }\n }\n }\n }\n }\n}\n\nexport default NativeViewGestureHandler;\n"]}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["NodeManager.ts"],"names":["gestures","getHandler","tag","Error","createGestureHandler","handlerTag","handler","dropGestureHandler","destroy","getNodes"],"mappings":"AAGA,MAAMA,QAGL,GAAG,EAHJ;AAKA,OAAO,SAASC,UAAT,CAAoBC,GAApB,EAAiC;AACtC,MAAIA,GAAG,IAAIF,QAAX,EAAqB,OAAOA,QAAQ,CAACE,GAAD,CAAf;AAErB,QAAM,IAAIC,KAAJ,CAAW,sBAAqBD,GAAI,EAApC,CAAN;AACD;AAED,OAAO,SAASE,oBAAT,CACLC,UADK,EAELC,OAFK,EAGL;AACA,MAAID,UAAU,IAAIL,QAAlB,EAA4B;AAC1B,UAAM,IAAIG,KAAJ,CAAW,oBAAmBE,UAAW,iBAAzC,CAAN;AACD;;AACDL,EAAAA,QAAQ,CAACK,UAAD,CAAR,GAAuBC,OAAvB,CAJA,CAKA;;AACAN,EAAAA,QAAQ,CAACK,UAAD,CAAR,CAAqBA,UAArB,GAAkCA,UAAlC;AACD;AAED,OAAO,SAASE,kBAAT,CAA4BF,UAA5B,EAAgD;AACrD;AACA;AACA,MAAI,EAAEA,UAAU,IAAIL,QAAhB,CAAJ,EAA+B;AAC7B;AACD;;AACDC,EAAAA,UAAU,CAACI,UAAD,CAAV,CAAuBG,OAAvB,GANqD,CAOrD;;AACA,SAAOR,QAAQ,CAACK,UAAD,CAAf;AACD;AAED,OAAO,SAASI,QAAT,GAAoB;AACzB,SAAO,EAAE,GAAGT;AAAL,GAAP;AACD","sourcesContent":["import { ValueOf } from '../typeUtils';\nimport { HammerGestures } from '../RNGestureHandlerModule.web';\n\nconst gestures: Record<\n number,\n InstanceType<ValueOf<typeof HammerGestures>>\n> = {};\n\nexport function getHandler(tag: number) {\n if (tag in gestures) return gestures[tag];\n\n throw new Error(`No handler for tag ${tag}`);\n}\n\nexport function createGestureHandler(\n handlerTag: number,\n handler: InstanceType<ValueOf<typeof HammerGestures>>\n) {\n if (handlerTag in gestures) {\n throw new Error(`Handler with tag ${handlerTag} already exists`);\n }\n gestures[handlerTag] = handler;\n // @ts-ignore no types for web handlers yet\n gestures[handlerTag].handlerTag = handlerTag;\n}\n\nexport function dropGestureHandler(handlerTag: number) {\n // Since React 18, there are cases where componentWillUnmount gets called twice in a row\n // so skip this if the tag was already removed.\n if (!(handlerTag in gestures)) {\n return;\n }\n getHandler(handlerTag).destroy();\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete gestures[handlerTag];\n}\n\nexport function getNodes() {\n return { ...gestures };\n}\n"]}
@@ -0,0 +1,43 @@
1
+ import Hammer from '@egjs/hammerjs';
2
+ import { State } from '../State';
3
+ export const CONTENT_TOUCHES_DELAY = 240;
4
+ export const CONTENT_TOUCHES_QUICK_TAP_END_DELAY = 50;
5
+ export const MULTI_FINGER_PAN_MAX_PINCH_THRESHOLD = 0.1;
6
+ export const MULTI_FINGER_PAN_MAX_ROTATION_THRESHOLD = 7;
7
+ export const DEG_RAD = Math.PI / 180; // Map Hammer values to RNGH
8
+
9
+ export const EventMap = {
10
+ [Hammer.INPUT_START]: State.BEGAN,
11
+ [Hammer.INPUT_MOVE]: State.ACTIVE,
12
+ [Hammer.INPUT_END]: State.END,
13
+ [Hammer.INPUT_CANCEL]: State.FAILED
14
+ };
15
+ export const Direction = {
16
+ RIGHT: 1,
17
+ LEFT: 2,
18
+ UP: 4,
19
+ DOWN: 8
20
+ };
21
+ export const DirectionMap = {
22
+ [Hammer.DIRECTION_RIGHT]: Direction.RIGHT,
23
+ [Hammer.DIRECTION_LEFT]: Direction.LEFT,
24
+ [Hammer.DIRECTION_UP]: Direction.UP,
25
+ [Hammer.DIRECTION_DOWN]: Direction.DOWN
26
+ };
27
+ export const HammerInputNames = {
28
+ [Hammer.INPUT_START]: 'START',
29
+ [Hammer.INPUT_MOVE]: 'MOVE',
30
+ [Hammer.INPUT_END]: 'END',
31
+ [Hammer.INPUT_CANCEL]: 'CANCEL'
32
+ };
33
+ export const HammerDirectionNames = {
34
+ [Hammer.DIRECTION_HORIZONTAL]: 'HORIZONTAL',
35
+ [Hammer.DIRECTION_UP]: 'UP',
36
+ [Hammer.DIRECTION_DOWN]: 'DOWN',
37
+ [Hammer.DIRECTION_VERTICAL]: 'VERTICAL',
38
+ [Hammer.DIRECTION_NONE]: 'NONE',
39
+ [Hammer.DIRECTION_ALL]: 'ALL',
40
+ [Hammer.DIRECTION_RIGHT]: 'RIGHT',
41
+ [Hammer.DIRECTION_LEFT]: 'LEFT'
42
+ };
43
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["constants.ts"],"names":["Hammer","State","CONTENT_TOUCHES_DELAY","CONTENT_TOUCHES_QUICK_TAP_END_DELAY","MULTI_FINGER_PAN_MAX_PINCH_THRESHOLD","MULTI_FINGER_PAN_MAX_ROTATION_THRESHOLD","DEG_RAD","Math","PI","EventMap","INPUT_START","BEGAN","INPUT_MOVE","ACTIVE","INPUT_END","END","INPUT_CANCEL","FAILED","Direction","RIGHT","LEFT","UP","DOWN","DirectionMap","DIRECTION_RIGHT","DIRECTION_LEFT","DIRECTION_UP","DIRECTION_DOWN","HammerInputNames","HammerDirectionNames","DIRECTION_HORIZONTAL","DIRECTION_VERTICAL","DIRECTION_NONE","DIRECTION_ALL"],"mappings":"AAAA,OAAOA,MAAP,MAAmB,gBAAnB;AAEA,SAASC,KAAT,QAAsB,UAAtB;AAEA,OAAO,MAAMC,qBAAqB,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G;AAElC,GAAC9B,MAAM,CAAC0B,YAAR,GAAuB,IAFW;AAGlC,GAAC1B,MAAM,CAAC2B,cAAR,GAAyB,MAHS;AAIlC,GAAC3B,MAAM,CAAC+B,kBAAR,GAA6B,UAJK;AAKlC,GAAC/B,MAAM,CAACgC,cAAR,GAAyB,MALS;AAMlC,GAAChC,MAAM,CAACiC,aAAR,GAAwB,KANU;AAOlC,GAACjC,MAAM,CAACwB,eAAR,GAA0B,OAPQ;AAQlC,GAACxB,MAAM,CAACyB,cAAR,GAAyB;AARS,CAA7B","sourcesContent":["import Hammer from '@egjs/hammerjs';\n\nimport { State } from '../State';\n\nexport const CONTENT_TOUCHES_DELAY = 240;\nexport const CONTENT_TOUCHES_QUICK_TAP_END_DELAY = 50;\nexport const MULTI_FINGER_PAN_MAX_PINCH_THRESHOLD = 0.1;\nexport const MULTI_FINGER_PAN_MAX_ROTATION_THRESHOLD = 7;\nexport const DEG_RAD = Math.PI / 180;\n\n// Map Hammer values to RNGH\nexport const EventMap = {\n [Hammer.INPUT_START]: State.BEGAN,\n [Hammer.INPUT_MOVE]: State.ACTIVE,\n [Hammer.INPUT_END]: State.END,\n [Hammer.INPUT_CANCEL]: State.FAILED,\n} as const;\n\nexport const Direction = {\n RIGHT: 1,\n LEFT: 2,\n UP: 4,\n DOWN: 8,\n};\n\nexport const DirectionMap = {\n [Hammer.DIRECTION_RIGHT]: Direction.RIGHT,\n [Hammer.DIRECTION_LEFT]: Direction.LEFT,\n [Hammer.DIRECTION_UP]: Direction.UP,\n [Hammer.DIRECTION_DOWN]: Direction.DOWN,\n};\n\nexport const HammerInputNames = {\n [Hammer.INPUT_START]: 'START',\n [Hammer.INPUT_MOVE]: 'MOVE',\n [Hammer.INPUT_END]: 'END',\n [Hammer.INPUT_CANCEL]: 'CANCEL',\n};\nexport const HammerDirectionNames = {\n [Hammer.DIRECTION_HORIZONTAL]: 'HORIZONTAL',\n [Hammer.DIRECTION_UP]: 'UP',\n [Hammer.DIRECTION_DOWN]: 'DOWN',\n [Hammer.DIRECTION_VERTICAL]: 'VERTICAL',\n [Hammer.DIRECTION_NONE]: 'NONE',\n [Hammer.DIRECTION_ALL]: 'ALL',\n [Hammer.DIRECTION_RIGHT]: 'RIGHT',\n [Hammer.DIRECTION_LEFT]: 'LEFT',\n};\n"]}
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ export declare function enableExperimentalWebImplementation(shouldEnable?: boolean): void;
2
+ export declare function isExperimentalWebImplementationEnabled(): boolean;
@@ -1,33 +1,43 @@
1
1
  import { ActionType } from './ActionType';
2
- import FlingGestureHandler from './web/FlingGestureHandler';
3
- import LongPressGestureHandler from './web/LongPressGestureHandler';
4
- import NativeViewGestureHandler from './web/NativeViewGestureHandler';
5
- import PanGestureHandler from './web/PanGestureHandler';
6
- import PinchGestureHandler from './web/PinchGestureHandler';
7
- import RotationGestureHandler from './web/RotationGestureHandler';
8
- import TapGestureHandler from './web/TapGestureHandler';
2
+ import PanGestureHandler from './web/handlers/PanGestureHandler';
3
+ import TapGestureHandler from './web/handlers/TapGestureHandler';
4
+ import LongPressGestureHandler from './web/handlers/LongPressGestureHandler';
5
+ import PinchGestureHandler from './web/handlers/PinchGestureHandler';
6
+ import RotationGestureHandler from './web/handlers/RotationGestureHandler';
7
+ import FlingGestureHandler from './web/handlers/FlingGestureHandler';
8
+ import NativeViewGestureHandler from './web/handlers/NativeViewGestureHandler';
9
+ import HammerNativeViewGestureHandler from './web_hammer/NativeViewGestureHandler';
10
+ import HammerPanGestureHandler from './web_hammer/PanGestureHandler';
11
+ import HammerTapGestureHandler from './web_hammer/TapGestureHandler';
12
+ import HammerLongPressGestureHandler from './web_hammer/LongPressGestureHandler';
13
+ import HammerPinchGestureHandler from './web_hammer/PinchGestureHandler';
14
+ import HammerRotationGestureHandler from './web_hammer/RotationGestureHandler';
15
+ import HammerFlingGestureHandler from './web_hammer/FlingGestureHandler';
9
16
  export declare const Gestures: {
17
+ NativeViewGestureHandler: typeof NativeViewGestureHandler;
10
18
  PanGestureHandler: typeof PanGestureHandler;
11
- RotationGestureHandler: typeof RotationGestureHandler;
12
- PinchGestureHandler: typeof PinchGestureHandler;
13
19
  TapGestureHandler: typeof TapGestureHandler;
14
- NativeViewGestureHandler: typeof NativeViewGestureHandler;
15
20
  LongPressGestureHandler: typeof LongPressGestureHandler;
21
+ PinchGestureHandler: typeof PinchGestureHandler;
22
+ RotationGestureHandler: typeof RotationGestureHandler;
16
23
  FlingGestureHandler: typeof FlingGestureHandler;
17
24
  };
25
+ export declare const HammerGestures: {
26
+ NativeViewGestureHandler: typeof HammerNativeViewGestureHandler;
27
+ PanGestureHandler: typeof HammerPanGestureHandler;
28
+ TapGestureHandler: typeof HammerTapGestureHandler;
29
+ LongPressGestureHandler: typeof HammerLongPressGestureHandler;
30
+ PinchGestureHandler: typeof HammerPinchGestureHandler;
31
+ RotationGestureHandler: typeof HammerRotationGestureHandler;
32
+ FlingGestureHandler: typeof HammerFlingGestureHandler;
33
+ };
18
34
  declare const _default: {
19
- Direction: {
20
- RIGHT: number;
21
- LEFT: number;
22
- UP: number;
23
- DOWN: number;
24
- };
25
- handleSetJSResponder(): void;
35
+ handleSetJSResponder(tag: number, blockNativeResponder: boolean): void;
26
36
  handleClearJSResponder(): void;
27
37
  createGestureHandler<T>(handlerName: keyof typeof Gestures, handlerTag: number, config: T): void;
28
38
  attachGestureHandler(handlerTag: number, newView: number, _actionType: ActionType, propsRef: React.RefObject<unknown>): void;
29
39
  updateGestureHandler(handlerTag: number, newConfig: any): void;
30
- getGestureHandlerNode(handlerTag: number): LongPressGestureHandler | NativeViewGestureHandler | PanGestureHandler | RotationGestureHandler | PinchGestureHandler | TapGestureHandler | FlingGestureHandler;
40
+ getGestureHandlerNode(handlerTag: number): PanGestureHandler | TapGestureHandler | LongPressGestureHandler | PinchGestureHandler | RotationGestureHandler | FlingGestureHandler | NativeViewGestureHandler | HammerNativeViewGestureHandler | HammerPanGestureHandler | HammerTapGestureHandler | HammerLongPressGestureHandler | HammerPinchGestureHandler | HammerRotationGestureHandler | HammerFlingGestureHandler;
31
41
  dropGestureHandler(handlerTag: number): void;
32
42
  flushOperations(): void;
33
43
  };
@@ -1,33 +1,44 @@
1
1
  import { ActionType } from './ActionType';
2
- import FlingGestureHandler from './web/FlingGestureHandler';
3
- import LongPressGestureHandler from './web/LongPressGestureHandler';
4
- import NativeViewGestureHandler from './web/NativeViewGestureHandler';
5
- import PanGestureHandler from './web/PanGestureHandler';
6
- import PinchGestureHandler from './web/PinchGestureHandler';
7
- import RotationGestureHandler from './web/RotationGestureHandler';
8
- import TapGestureHandler from './web/TapGestureHandler';
2
+ import PanGestureHandler from './web/handlers/PanGestureHandler';
3
+ import TapGestureHandler from './web/handlers/TapGestureHandler';
4
+ import LongPressGestureHandler from './web/handlers/LongPressGestureHandler';
5
+ import PinchGestureHandler from './web/handlers/PinchGestureHandler';
6
+ import RotationGestureHandler from './web/handlers/RotationGestureHandler';
7
+ import FlingGestureHandler from './web/handlers/FlingGestureHandler';
8
+ import NativeViewGestureHandler from './web/handlers/NativeViewGestureHandler';
9
+ import HammerNativeViewGestureHandler from './web_hammer/NativeViewGestureHandler';
10
+ import HammerPanGestureHandler from './web_hammer/PanGestureHandler';
11
+ import HammerTapGestureHandler from './web_hammer/TapGestureHandler';
12
+ import HammerLongPressGestureHandler from './web_hammer/LongPressGestureHandler';
13
+ import HammerPinchGestureHandler from './web_hammer/PinchGestureHandler';
14
+ import HammerRotationGestureHandler from './web_hammer/RotationGestureHandler';
15
+ import HammerFlingGestureHandler from './web_hammer/FlingGestureHandler';
16
+ import { Config } from './web/interfaces';
9
17
  export declare const Gestures: {
18
+ NativeViewGestureHandler: typeof NativeViewGestureHandler;
10
19
  PanGestureHandler: typeof PanGestureHandler;
11
- RotationGestureHandler: typeof RotationGestureHandler;
12
- PinchGestureHandler: typeof PinchGestureHandler;
13
20
  TapGestureHandler: typeof TapGestureHandler;
14
- NativeViewGestureHandler: typeof NativeViewGestureHandler;
15
21
  LongPressGestureHandler: typeof LongPressGestureHandler;
22
+ PinchGestureHandler: typeof PinchGestureHandler;
23
+ RotationGestureHandler: typeof RotationGestureHandler;
16
24
  FlingGestureHandler: typeof FlingGestureHandler;
17
25
  };
26
+ export declare const HammerGestures: {
27
+ NativeViewGestureHandler: typeof HammerNativeViewGestureHandler;
28
+ PanGestureHandler: typeof HammerPanGestureHandler;
29
+ TapGestureHandler: typeof HammerTapGestureHandler;
30
+ LongPressGestureHandler: typeof HammerLongPressGestureHandler;
31
+ PinchGestureHandler: typeof HammerPinchGestureHandler;
32
+ RotationGestureHandler: typeof HammerRotationGestureHandler;
33
+ FlingGestureHandler: typeof HammerFlingGestureHandler;
34
+ };
18
35
  declare const _default: {
19
- Direction: {
20
- RIGHT: number;
21
- LEFT: number;
22
- UP: number;
23
- DOWN: number;
24
- };
25
36
  handleSetJSResponder(tag: number, blockNativeResponder: boolean): void;
26
37
  handleClearJSResponder(): void;
27
38
  createGestureHandler<T>(handlerName: keyof typeof Gestures, handlerTag: number, config: T): void;
28
39
  attachGestureHandler(handlerTag: number, newView: number, _actionType: ActionType, propsRef: React.RefObject<unknown>): void;
29
- updateGestureHandler(handlerTag: number, newConfig: any): void;
30
- getGestureHandlerNode(handlerTag: number): LongPressGestureHandler | NativeViewGestureHandler | PanGestureHandler | RotationGestureHandler | PinchGestureHandler | TapGestureHandler | FlingGestureHandler;
40
+ updateGestureHandler(handlerTag: number, newConfig: Config): void;
41
+ getGestureHandlerNode(handlerTag: number): PanGestureHandler | TapGestureHandler | LongPressGestureHandler | PinchGestureHandler | RotationGestureHandler | FlingGestureHandler | NativeViewGestureHandler | HammerNativeViewGestureHandler | HammerPanGestureHandler | HammerTapGestureHandler | HammerLongPressGestureHandler | HammerPinchGestureHandler | HammerRotationGestureHandler | HammerFlingGestureHandler;
31
42
  dropGestureHandler(handlerTag: number): void;
32
43
  flushOperations(): void;
33
44
  };
@@ -0,0 +1 @@
1
+ export { default as RNRenderer } from 'react-native/Libraries/Renderer/shims/ReactNative';
@@ -0,0 +1,3 @@
1
+ export declare const RNRenderer: {
2
+ findHostInstance_DEPRECATED: (_ref: any) => null;
3
+ };
@@ -105,7 +105,7 @@ export default class DrawerLayout extends Component<DrawerLayoutProps, DrawerLay
105
105
  enableTrackpadTwoFingerGesture: boolean;
106
106
  };
107
107
  constructor(props: DrawerLayoutProps);
108
- UNSAFE_componentWillUpdate(props: DrawerLayoutProps, state: DrawerLayoutState): void;
108
+ shouldComponentUpdate(props: DrawerLayoutProps, state: DrawerLayoutState): boolean;
109
109
  private openValue?;
110
110
  private onGestureEvent?;
111
111
  private accessibilityIsModalView;
@@ -44,6 +44,11 @@ export interface BaseButtonProps extends RawButtonProps {
44
44
  * `TouchableHighlight` from RN core).
45
45
  */
46
46
  onPress?: (pointerInside: boolean) => void;
47
+ /**
48
+ * Called when the button gets pressed and is held for `delayLongPress`
49
+ * milliseconds.
50
+ */
51
+ onLongPress?: () => void;
47
52
  /**
48
53
  * Called when button changes from inactive to active and vice versa. It
49
54
  * passes active state as a boolean variable as a first parameter for that
@@ -52,6 +57,11 @@ export interface BaseButtonProps extends RawButtonProps {
52
57
  onActiveStateChange?: (active: boolean) => void;
53
58
  style?: StyleProp<ViewStyle>;
54
59
  testID?: string;
60
+ /**
61
+ * Delay, in milliseconds, after which the `onLongPress` callback gets called.
62
+ * Defaults to 600.
63
+ */
64
+ delayLongPress?: number;
55
65
  }
56
66
  export interface RectButtonProps extends BaseButtonProps {
57
67
  /**
@@ -75,9 +85,15 @@ export interface BorderlessButtonProps extends BaseButtonProps {
75
85
  }
76
86
  export declare const RawButton: React.ForwardRefExoticComponent<RawButtonProps & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
77
87
  export declare class BaseButton extends React.Component<BaseButtonProps> {
88
+ static defaultProps: {
89
+ delayLongPress: number;
90
+ };
78
91
  private lastActive;
92
+ private longPressTimeout;
93
+ private longPressDetected;
79
94
  constructor(props: BaseButtonProps);
80
95
  private handleEvent;
96
+ private onLongPress;
81
97
  private onHandlerStateChange;
82
98
  private onGestureEvent;
83
99
  render(): JSX.Element;
@@ -1,11 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import { PropsWithChildren, ForwardedRef, RefAttributes, ReactElement } from 'react';
3
- import { ScrollView as RNScrollView, ScrollViewProps as RNScrollViewProps, Switch as RNSwitch, SwitchProps as RNSwitchProps, TextInput as RNTextInput, TextInputProps as RNTextInputProps, DrawerLayoutAndroid as RNDrawerLayoutAndroid, DrawerLayoutAndroidProps as RNDrawerLayoutAndroidProps, FlatList as RNFlatList, FlatListProps as RNFlatListProps } from 'react-native';
3
+ import { ScrollView as RNScrollView, ScrollViewProps as RNScrollViewProps, Switch as RNSwitch, SwitchProps as RNSwitchProps, TextInput as RNTextInput, TextInputProps as RNTextInputProps, DrawerLayoutAndroid as RNDrawerLayoutAndroid, DrawerLayoutAndroidProps as RNDrawerLayoutAndroidProps, FlatList as RNFlatList, FlatListProps as RNFlatListProps, RefreshControl as RNRefreshControl } from 'react-native';
4
4
  import { NativeViewGestureHandlerProps } from '../handlers/NativeViewGestureHandler';
5
- export declare const ScrollView: React.ForwardRefExoticComponent<RNScrollViewProps & {
5
+ export declare const RefreshControl: React.ForwardRefExoticComponent<import("react-native").RefreshControlProps & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
6
+ export declare type RefreshControl = typeof RefreshControl & RNRefreshControl;
7
+ declare const GHScrollView: React.ForwardRefExoticComponent<RNScrollViewProps & {
6
8
  children?: React.ReactNode;
7
9
  } & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
8
- export declare type ScrollView = typeof ScrollView & RNScrollView;
10
+ export declare const ScrollView: React.ForwardRefExoticComponent<RNScrollViewProps & NativeViewGestureHandlerProps & React.RefAttributes<RNScrollView>>;
11
+ export declare type ScrollView = typeof GHScrollView & RNScrollView;
9
12
  export declare const Switch: React.ForwardRefExoticComponent<RNSwitchProps & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
10
13
  export declare type Switch = typeof Switch & RNSwitch;
11
14
  export declare const TextInput: React.ForwardRefExoticComponent<RNTextInputProps & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
@@ -16,3 +19,4 @@ export declare const DrawerLayoutAndroid: React.ForwardRefExoticComponent<RNDraw
16
19
  export declare type DrawerLayoutAndroid = typeof DrawerLayoutAndroid & RNDrawerLayoutAndroid;
17
20
  export declare const FlatList: <ItemT = any>(props: React.PropsWithChildren<RNFlatListProps<ItemT> & React.RefAttributes<FlatList<ItemT>> & NativeViewGestureHandlerProps>, ref: React.ForwardedRef<FlatList<ItemT>>) => ReactElement | null;
18
21
  export declare type FlatList<ItemT = any> = typeof FlatList & RNFlatList<ItemT>;
22
+ export {};
@@ -4,4 +4,5 @@ export declare const ScrollView: React.ForwardRefExoticComponent<import("react-n
4
4
  export declare const Switch: React.ForwardRefExoticComponent<import("react-native").SwitchProps & import("..").NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
5
5
  export declare const TextInput: React.ForwardRefExoticComponent<import("react-native").TextInputProps & import("..").NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
6
6
  export declare const DrawerLayoutAndroid: React.ForwardRefExoticComponent<import("react-native").DrawerLayoutAndroidProps & import("..").NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
7
+ export declare const RefreshControl: React.ForwardRefExoticComponent<import("react-native").ViewProps & import("..").NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
7
8
  export declare const FlatList: React.ForwardRefExoticComponent<FlatListProps<unknown> & React.RefAttributes<unknown>>;
@@ -136,7 +136,7 @@ export default class Swipeable extends Component<SwipeableProps, SwipeableState>
136
136
  useNativeAnimations: boolean;
137
137
  };
138
138
  constructor(props: SwipeableProps);
139
- UNSAFE_componentWillUpdate(props: SwipeableProps, state: SwipeableState): void;
139
+ shouldComponentUpdate(props: SwipeableProps, state: SwipeableState): boolean;
140
140
  private onGestureEvent?;
141
141
  private transX?;
142
142
  private showLeftAction?;
@@ -40,8 +40,9 @@ export { NativeViewGestureHandler } from './handlers/NativeViewGestureHandler';
40
40
  export type { RawButtonProps, BaseButtonProps, RectButtonProps, BorderlessButtonProps, } from './components/GestureButtons';
41
41
  export { RawButton, BaseButton, RectButton, BorderlessButton, } from './components/GestureButtons';
42
42
  export { TouchableHighlight, TouchableNativeFeedback, TouchableOpacity, TouchableWithoutFeedback, } from './components/touchables';
43
- export { ScrollView, Switch, TextInput, DrawerLayoutAndroid, FlatList, } from './components/GestureComponents';
43
+ export { ScrollView, Switch, TextInput, DrawerLayoutAndroid, FlatList, RefreshControl, } from './components/GestureComponents';
44
44
  export type { GestureHandlerGestureEvent, GestureHandlerStateChangeEvent, GestureHandlerGestureEventNativeEvent, GestureHandlerStateChangeNativeEvent, NativeViewGestureHandlerGestureEvent, NativeViewGestureHandlerStateChangeEvent, TapGestureHandlerGestureEvent, TapGestureHandlerStateChangeEvent, ForceTouchGestureHandlerGestureEvent, ForceTouchGestureHandlerStateChangeEvent, LongPressGestureHandlerGestureEvent, LongPressGestureHandlerStateChangeEvent, PanGestureHandlerGestureEvent, PanGestureHandlerStateChangeEvent, PinchGestureHandlerGestureEvent, PinchGestureHandlerStateChangeEvent, RotationGestureHandlerGestureEvent, RotationGestureHandlerStateChangeEvent, FlingGestureHandlerGestureEvent, FlingGestureHandlerStateChangeEvent, NativeViewGestureHandlerProperties, TapGestureHandlerProperties, LongPressGestureHandlerProperties, PanGestureHandlerProperties, PinchGestureHandlerProperties, RotationGestureHandlerProperties, FlingGestureHandlerProperties, ForceTouchGestureHandlerProperties, RawButtonProperties, BaseButtonProperties, RectButtonProperties, BorderlessButtonProperties, } from './handlers/gestureHandlerTypesCompat';
45
45
  export { default as Swipeable } from './components/Swipeable';
46
46
  export type { DrawerLayoutProps, DrawerPosition, DrawerState, DrawerType, DrawerLockMode, DrawerKeyboardDismissMode, } from './components/DrawerLayout';
47
47
  export { default as DrawerLayout } from './components/DrawerLayout';
48
+ export { enableExperimentalWebImplementation } from './EnableExperimentalWebImplementation';