react-native-gesture-handler 2.16.0 → 2.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. package/README.md +1 -0
  2. package/lib/commonjs/RNGestureHandlerModule.js +97 -4
  3. package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
  4. package/lib/commonjs/RNGestureHandlerModule.native.js +16 -0
  5. package/lib/commonjs/RNGestureHandlerModule.native.js.map +1 -0
  6. package/lib/commonjs/RNRenderer.js +5 -10
  7. package/lib/commonjs/RNRenderer.js.map +1 -1
  8. package/lib/commonjs/RNRenderer.native.js +16 -0
  9. package/lib/commonjs/RNRenderer.native.js.map +1 -0
  10. package/lib/commonjs/components/GestureComponents.js +19 -82
  11. package/lib/commonjs/components/GestureComponents.js.map +1 -1
  12. package/lib/commonjs/components/GestureComponents.native.js +115 -0
  13. package/lib/commonjs/components/GestureComponents.native.js.map +1 -0
  14. package/lib/commonjs/components/GestureHandlerButton.js +13 -3
  15. package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
  16. package/lib/commonjs/components/GestureHandlerButton.native.js +14 -0
  17. package/lib/commonjs/components/GestureHandlerButton.native.js.map +1 -0
  18. package/lib/commonjs/components/GestureHandlerRootView.js +0 -6
  19. package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
  20. package/lib/commonjs/components/{GestureHandlerRootView.web.js → GestureHandlerRootView.native.js} +7 -1
  21. package/lib/commonjs/components/GestureHandlerRootView.native.js.map +1 -0
  22. package/lib/commonjs/getReactNativeVersion.js +1 -12
  23. package/lib/commonjs/getReactNativeVersion.js.map +1 -1
  24. package/lib/commonjs/getReactNativeVersion.native.js +22 -0
  25. package/lib/commonjs/getReactNativeVersion.native.js.map +1 -0
  26. package/lib/commonjs/getShadowNodeFromRef.js +5 -34
  27. package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
  28. package/lib/commonjs/getShadowNodeFromRef.native.js +44 -0
  29. package/lib/commonjs/getShadowNodeFromRef.native.js.map +1 -0
  30. package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
  31. package/lib/commonjs/handlers/PressabilityDebugView.js +5 -7
  32. package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -1
  33. package/lib/commonjs/handlers/PressabilityDebugView.native.js +14 -0
  34. package/lib/commonjs/handlers/PressabilityDebugView.native.js.map +1 -0
  35. package/lib/commonjs/handlers/createHandler.js +9 -3
  36. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  37. package/lib/commonjs/handlers/customDirectEventTypes.js +5 -8
  38. package/lib/commonjs/handlers/customDirectEventTypes.js.map +1 -1
  39. package/lib/commonjs/handlers/customDirectEventTypes.native.js +14 -0
  40. package/lib/commonjs/handlers/customDirectEventTypes.native.js.map +1 -0
  41. package/lib/commonjs/handlers/gestures/GestureDetector.js +15 -0
  42. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
  43. package/lib/commonjs/handlers/gestures/flingGesture.js +13 -0
  44. package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -1
  45. package/lib/commonjs/handlers/gestures/forceTouchGesture.js +17 -0
  46. package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -1
  47. package/lib/commonjs/handlers/gestures/gesture.js +135 -0
  48. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
  49. package/lib/commonjs/handlers/gestures/gestureObjects.js +66 -0
  50. package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -1
  51. package/lib/commonjs/handlers/gestures/gestureStateManager.web.js +1 -1
  52. package/lib/commonjs/handlers/gestures/gestureStateManager.web.js.map +1 -1
  53. package/lib/commonjs/handlers/gestures/hoverGesture.js +1 -1
  54. package/lib/commonjs/handlers/gestures/hoverGesture.js.map +1 -1
  55. package/lib/commonjs/handlers/gestures/longPressGesture.js +12 -0
  56. package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
  57. package/lib/commonjs/handlers/gestures/nativeGesture.js +10 -0
  58. package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -1
  59. package/lib/commonjs/handlers/gestures/panGesture.js +76 -0
  60. package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -1
  61. package/lib/commonjs/handlers/gestures/tapGesture.js +42 -0
  62. package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
  63. package/lib/commonjs/utils.js +5 -1
  64. package/lib/commonjs/utils.js.map +1 -1
  65. package/lib/commonjs/web/handlers/GestureHandler.js +7 -7
  66. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  67. package/lib/commonjs/web/handlers/PanGestureHandler.js +3 -1
  68. package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
  69. package/lib/commonjs/web/interfaces.js.map +1 -1
  70. package/lib/module/RNGestureHandlerModule.js +84 -4
  71. package/lib/module/RNGestureHandlerModule.js.map +1 -1
  72. package/lib/module/RNGestureHandlerModule.native.js +5 -0
  73. package/lib/module/RNGestureHandlerModule.native.js.map +1 -0
  74. package/lib/module/RNRenderer.js +3 -3
  75. package/lib/module/RNRenderer.js.map +1 -1
  76. package/lib/module/RNRenderer.native.js +4 -0
  77. package/lib/module/RNRenderer.native.js.map +1 -0
  78. package/lib/module/components/GestureComponents.js +18 -80
  79. package/lib/module/components/GestureComponents.js.map +1 -1
  80. package/lib/module/components/GestureComponents.native.js +90 -0
  81. package/lib/module/components/GestureComponents.native.js.map +1 -0
  82. package/lib/module/components/GestureHandlerButton.js +8 -2
  83. package/lib/module/components/GestureHandlerButton.js.map +1 -1
  84. package/lib/module/components/GestureHandlerButton.native.js +3 -0
  85. package/lib/module/components/GestureHandlerButton.native.js.map +1 -0
  86. package/lib/module/components/GestureHandlerRootView.js +0 -5
  87. package/lib/module/components/GestureHandlerRootView.js.map +1 -1
  88. package/lib/module/components/{GestureHandlerRootView.web.js → GestureHandlerRootView.native.js} +6 -1
  89. package/lib/module/components/GestureHandlerRootView.native.js.map +1 -0
  90. package/lib/module/getReactNativeVersion.js +1 -7
  91. package/lib/module/getReactNativeVersion.js.map +1 -1
  92. package/lib/module/getReactNativeVersion.native.js +10 -0
  93. package/lib/module/getReactNativeVersion.native.js.map +1 -0
  94. package/lib/module/getShadowNodeFromRef.js +4 -33
  95. package/lib/module/getShadowNodeFromRef.js.map +1 -1
  96. package/lib/module/getShadowNodeFromRef.native.js +37 -0
  97. package/lib/module/getShadowNodeFromRef.native.js.map +1 -0
  98. package/lib/module/handlers/PanGestureHandler.js.map +1 -1
  99. package/lib/module/handlers/PressabilityDebugView.js +4 -2
  100. package/lib/module/handlers/PressabilityDebugView.js.map +1 -1
  101. package/lib/module/handlers/PressabilityDebugView.native.js +3 -0
  102. package/lib/module/handlers/PressabilityDebugView.native.js.map +1 -0
  103. package/lib/module/handlers/createHandler.js +9 -3
  104. package/lib/module/handlers/createHandler.js.map +1 -1
  105. package/lib/module/handlers/customDirectEventTypes.js +4 -2
  106. package/lib/module/handlers/customDirectEventTypes.js.map +1 -1
  107. package/lib/module/handlers/customDirectEventTypes.native.js +3 -0
  108. package/lib/module/handlers/customDirectEventTypes.native.js.map +1 -0
  109. package/lib/module/handlers/gestures/GestureDetector.js +15 -0
  110. package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
  111. package/lib/module/handlers/gestures/flingGesture.js +13 -0
  112. package/lib/module/handlers/gestures/flingGesture.js.map +1 -1
  113. package/lib/module/handlers/gestures/forceTouchGesture.js +17 -0
  114. package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -1
  115. package/lib/module/handlers/gestures/gesture.js +135 -0
  116. package/lib/module/handlers/gestures/gesture.js.map +1 -1
  117. package/lib/module/handlers/gestures/gestureObjects.js +67 -0
  118. package/lib/module/handlers/gestures/gestureObjects.js.map +1 -1
  119. package/lib/module/handlers/gestures/gestureStateManager.web.js +1 -1
  120. package/lib/module/handlers/gestures/gestureStateManager.web.js.map +1 -1
  121. package/lib/module/handlers/gestures/hoverGesture.js +1 -1
  122. package/lib/module/handlers/gestures/hoverGesture.js.map +1 -1
  123. package/lib/module/handlers/gestures/longPressGesture.js +12 -0
  124. package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
  125. package/lib/module/handlers/gestures/nativeGesture.js +10 -0
  126. package/lib/module/handlers/gestures/nativeGesture.js.map +1 -1
  127. package/lib/module/handlers/gestures/panGesture.js +76 -0
  128. package/lib/module/handlers/gestures/panGesture.js.map +1 -1
  129. package/lib/module/handlers/gestures/tapGesture.js +42 -0
  130. package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
  131. package/lib/module/utils.js +5 -1
  132. package/lib/module/utils.js.map +1 -1
  133. package/lib/module/web/handlers/GestureHandler.js +7 -7
  134. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  135. package/lib/module/web/handlers/PanGestureHandler.js +3 -1
  136. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
  137. package/lib/module/web/interfaces.js.map +1 -1
  138. package/lib/typescript/RNGestureHandlerModule.d.ts +15 -2
  139. package/lib/typescript/RNGestureHandlerModule.native.d.ts +2 -0
  140. package/lib/typescript/RNRenderer.d.ts +3 -1
  141. package/lib/typescript/RNRenderer.native.d.ts +1 -0
  142. package/lib/typescript/components/GestureComponents.d.ts +7 -21
  143. package/lib/typescript/components/GestureComponents.native.d.ts +22 -0
  144. package/lib/typescript/components/GestureHandlerButton.d.ts +3 -3
  145. package/lib/typescript/components/GestureHandlerButton.native.d.ts +4 -0
  146. package/lib/typescript/getReactNativeVersion.d.ts +1 -4
  147. package/lib/typescript/getReactNativeVersion.native.d.ts +4 -0
  148. package/lib/typescript/getShadowNodeFromRef.d.ts +1 -1
  149. package/lib/typescript/getShadowNodeFromRef.native.d.ts +1 -0
  150. package/lib/typescript/handlers/PanGestureHandler.d.ts +4 -4
  151. package/lib/typescript/handlers/PressabilityDebugView.d.ts +1 -1
  152. package/lib/typescript/handlers/PressabilityDebugView.native.d.ts +1 -0
  153. package/lib/typescript/handlers/customDirectEventTypes.d.ts +2 -1
  154. package/lib/typescript/handlers/customDirectEventTypes.native.d.ts +1 -0
  155. package/lib/typescript/handlers/gestures/GestureDetector.d.ts +36 -0
  156. package/lib/typescript/handlers/gestures/flingGesture.d.ts +11 -0
  157. package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +14 -0
  158. package/lib/typescript/handlers/gestures/gesture.d.ts +113 -0
  159. package/lib/typescript/handlers/gestures/gestureObjects.d.ts +57 -0
  160. package/lib/typescript/handlers/gestures/hoverGesture.d.ts +1 -1
  161. package/lib/typescript/handlers/gestures/longPressGesture.d.ts +10 -0
  162. package/lib/typescript/handlers/gestures/nativeGesture.d.ts +8 -0
  163. package/lib/typescript/handlers/gestures/panGesture.d.ts +67 -4
  164. package/lib/typescript/handlers/gestures/tapGesture.d.ts +35 -0
  165. package/lib/typescript/web/handlers/GestureHandler.d.ts +2 -2
  166. package/lib/typescript/web/handlers/IGestureHandler.d.ts +1 -1
  167. package/lib/typescript/web/interfaces.d.ts +1 -0
  168. package/package.json +3 -2
  169. package/src/RNGestureHandlerModule.native.ts +5 -0
  170. package/src/RNGestureHandlerModule.ts +104 -4
  171. package/src/RNRenderer.native.ts +3 -0
  172. package/src/RNRenderer.ts +3 -3
  173. package/src/components/GestureComponents.native.tsx +148 -0
  174. package/src/components/GestureComponents.tsx +24 -131
  175. package/src/components/GestureHandlerButton.native.tsx +5 -0
  176. package/src/components/GestureHandlerButton.tsx +5 -4
  177. package/src/components/{GestureHandlerRootView.web.tsx → GestureHandlerRootView.native.tsx} +6 -0
  178. package/src/components/GestureHandlerRootView.tsx +0 -6
  179. package/src/getReactNativeVersion.native.ts +11 -0
  180. package/src/getReactNativeVersion.ts +1 -9
  181. package/src/getShadowNodeFromRef.native.ts +44 -0
  182. package/src/getShadowNodeFromRef.ts +4 -41
  183. package/src/handlers/PanGestureHandler.ts +8 -4
  184. package/src/handlers/PressabilityDebugView.native.tsx +2 -0
  185. package/src/handlers/PressabilityDebugView.tsx +4 -2
  186. package/src/handlers/createHandler.tsx +14 -10
  187. package/src/handlers/customDirectEventTypes.native.ts +2 -0
  188. package/src/handlers/customDirectEventTypes.ts +5 -2
  189. package/src/handlers/gestures/GestureDetector.tsx +47 -4
  190. package/src/handlers/gestures/flingGesture.ts +11 -0
  191. package/src/handlers/gestures/forceTouchGesture.ts +14 -0
  192. package/src/handlers/gestures/gesture.ts +113 -0
  193. package/src/handlers/gestures/gestureObjects.ts +57 -0
  194. package/src/handlers/gestures/gestureStateManager.web.ts +1 -1
  195. package/src/handlers/gestures/hoverGesture.ts +1 -1
  196. package/src/handlers/gestures/longPressGesture.ts +10 -0
  197. package/src/handlers/gestures/nativeGesture.ts +8 -0
  198. package/src/handlers/gestures/panGesture.ts +75 -4
  199. package/src/handlers/gestures/tapGesture.ts +35 -0
  200. package/src/utils.ts +9 -2
  201. package/src/web/handlers/GestureHandler.ts +9 -9
  202. package/src/web/handlers/IGestureHandler.ts +1 -1
  203. package/src/web/handlers/PanGestureHandler.ts +4 -0
  204. package/src/web/interfaces.ts +1 -0
  205. package/lib/commonjs/RNGestureHandlerModule.web.js +0 -109
  206. package/lib/commonjs/RNGestureHandlerModule.web.js.map +0 -1
  207. package/lib/commonjs/RNRenderer.web.js +0 -11
  208. package/lib/commonjs/RNRenderer.web.js.map +0 -1
  209. package/lib/commonjs/components/GestureComponents.web.js +0 -52
  210. package/lib/commonjs/components/GestureComponents.web.js.map +0 -1
  211. package/lib/commonjs/components/GestureHandlerButton.web.js +0 -24
  212. package/lib/commonjs/components/GestureHandlerButton.web.js.map +0 -1
  213. package/lib/commonjs/components/GestureHandlerRootView.web.js.map +0 -1
  214. package/lib/commonjs/getReactNativeVersion.web.js +0 -11
  215. package/lib/commonjs/getReactNativeVersion.web.js.map +0 -1
  216. package/lib/commonjs/getShadowNodeFromRef.web.js +0 -15
  217. package/lib/commonjs/getShadowNodeFromRef.web.js.map +0 -1
  218. package/lib/commonjs/handlers/PressabilityDebugView.web.js +0 -12
  219. package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +0 -1
  220. package/lib/commonjs/handlers/customDirectEventTypes.web.js +0 -11
  221. package/lib/commonjs/handlers/customDirectEventTypes.web.js.map +0 -1
  222. package/lib/module/RNGestureHandlerModule.web.js +0 -85
  223. package/lib/module/RNGestureHandlerModule.web.js.map +0 -1
  224. package/lib/module/RNRenderer.web.js +0 -4
  225. package/lib/module/RNRenderer.web.js.map +0 -1
  226. package/lib/module/components/GestureComponents.web.js +0 -28
  227. package/lib/module/components/GestureComponents.web.js.map +0 -1
  228. package/lib/module/components/GestureHandlerButton.web.js +0 -9
  229. package/lib/module/components/GestureHandlerButton.web.js.map +0 -1
  230. package/lib/module/components/GestureHandlerRootView.web.js.map +0 -1
  231. package/lib/module/getReactNativeVersion.web.js +0 -4
  232. package/lib/module/getReactNativeVersion.web.js.map +0 -1
  233. package/lib/module/getShadowNodeFromRef.web.js +0 -8
  234. package/lib/module/getShadowNodeFromRef.web.js.map +0 -1
  235. package/lib/module/handlers/PressabilityDebugView.web.js +0 -5
  236. package/lib/module/handlers/PressabilityDebugView.web.js.map +0 -1
  237. package/lib/module/handlers/customDirectEventTypes.web.js +0 -5
  238. package/lib/module/handlers/customDirectEventTypes.web.js.map +0 -1
  239. package/lib/typescript/RNGestureHandlerModule.web.d.ts +0 -15
  240. package/lib/typescript/RNRenderer.web.d.ts +0 -3
  241. package/lib/typescript/components/GestureComponents.web.d.ts +0 -8
  242. package/lib/typescript/components/GestureHandlerButton.web.d.ts +0 -4
  243. package/lib/typescript/getReactNativeVersion.web.d.ts +0 -1
  244. package/lib/typescript/getShadowNodeFromRef.web.d.ts +0 -1
  245. package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +0 -1
  246. package/lib/typescript/handlers/customDirectEventTypes.web.d.ts +0 -2
  247. package/src/RNGestureHandlerModule.web.ts +0 -105
  248. package/src/RNRenderer.web.ts +0 -3
  249. package/src/components/GestureComponents.web.tsx +0 -41
  250. package/src/components/GestureHandlerButton.web.tsx +0 -6
  251. package/src/getReactNativeVersion.web.ts +0 -3
  252. package/src/getShadowNodeFromRef.web.ts +0 -7
  253. package/src/handlers/PressabilityDebugView.web.tsx +0 -4
  254. package/src/handlers/customDirectEventTypes.web.ts +0 -5
  255. /package/lib/typescript/components/{GestureHandlerRootView.web.d.ts → GestureHandlerRootView.native.d.ts} +0 -0
@@ -15,43 +15,97 @@ import { NativeGesture } from './nativeGesture';
15
15
  import { ManualGesture } from './manualGesture';
16
16
  import { HoverGesture } from './hoverGesture';
17
17
 
18
+ /**
19
+ * `Gesture` is the object that allows you to create and compose gestures.
20
+ *
21
+ * ### Remarks
22
+ * - Consider wrapping your gesture configurations with `useMemo`, as it will reduce the amount of work Gesture Handler has to do under the hood when updating gestures.
23
+ *
24
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/gesture
25
+ */
18
26
  export const GestureObjects = {
27
+ /**
28
+ * A discrete gesture that recognizes one or many taps.
29
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/tap-gesture
30
+ */
19
31
  Tap: () => {
20
32
  return new TapGesture();
21
33
  },
22
34
 
35
+ /**
36
+ * A continuous gesture that can recognize a panning (dragging) gesture and track its movement.
37
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture
38
+ */
23
39
  Pan: () => {
24
40
  return new PanGesture();
25
41
  },
26
42
 
43
+ /**
44
+ * A continuous gesture that recognizes pinch gesture. It allows for tracking the distance between two fingers and use that information to scale or zoom your content.
45
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pinch-gesture
46
+ */
27
47
  Pinch: () => {
28
48
  return new PinchGesture();
29
49
  },
30
50
 
51
+ /**
52
+ * A continuous gesture that can recognize rotation and track its movement.
53
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/rotation-gesture
54
+ */
31
55
  Rotation: () => {
32
56
  return new RotationGesture();
33
57
  },
34
58
 
59
+ /**
60
+ * A discrete gesture that activates when the movement is sufficiently fast.
61
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/fling-gesture
62
+ */
35
63
  Fling: () => {
36
64
  return new FlingGesture();
37
65
  },
38
66
 
67
+ /**
68
+ * A discrete gesture that activates when the corresponding view is pressed for a sufficiently long time.
69
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/long-press-gesture
70
+ */
39
71
  LongPress: () => {
40
72
  return new LongPressGesture();
41
73
  },
42
74
 
75
+ /**
76
+ * #### iOS only
77
+ * A continuous gesture that recognizes force of a touch. It allows for tracking pressure of touch on some iOS devices.
78
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/force-touch-gesture
79
+ */
43
80
  ForceTouch: () => {
44
81
  return new ForceTouchGesture();
45
82
  },
46
83
 
84
+ /**
85
+ * A gesture that allows other touch handling components to participate in RNGH's gesture system.
86
+ * When used, the other component should be the direct child of a `GestureDetector`.
87
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/native-gesture
88
+ */
47
89
  Native: () => {
48
90
  return new NativeGesture();
49
91
  },
50
92
 
93
+ /**
94
+ * A plain gesture that has no specific activation criteria nor event data set.
95
+ * Its state has to be controlled manually using a state manager.
96
+ * It will not fail when all the pointers are lifted from the screen.
97
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/manual-gesture
98
+ */
51
99
  Manual: () => {
52
100
  return new ManualGesture();
53
101
  },
54
102
 
103
+ /**
104
+ * A continuous gesture that can recognize hovering above the view it's attached to.
105
+ * The hover effect may be activated by moving a mouse or a stylus over the view.
106
+ *
107
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/hover-gesture
108
+ */
55
109
  Hover: () => {
56
110
  return new HoverGesture();
57
111
  },
@@ -59,6 +113,7 @@ export const GestureObjects = {
59
113
  /**
60
114
  * Builds a composed gesture consisting of gestures provided as parameters.
61
115
  * The first one that becomes active cancels the rest of gestures.
116
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#race
62
117
  */
63
118
  Race: (...gestures: Gesture[]) => {
64
119
  return new ComposedGesture(...gestures);
@@ -66,6 +121,7 @@ export const GestureObjects = {
66
121
 
67
122
  /**
68
123
  * Builds a composed gesture that allows all base gestures to run simultaneously.
124
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#simultaneous
69
125
  */
70
126
  Simultaneous(...gestures: Gesture[]) {
71
127
  return new SimultaneousGesture(...gestures);
@@ -77,6 +133,7 @@ export const GestureObjects = {
77
133
  * than the second one, second one has higher priority than the third one, and so on.
78
134
  * For example, to make a gesture that recognizes both single and double tap you need
79
135
  * to call Exclusive(doubleTap, singleTap).
136
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/gesture-composition/#exclusive
80
137
  */
81
138
  Exclusive(...gestures: Gesture[]) {
82
139
  return new ExclusiveGesture(...gestures);
@@ -9,7 +9,7 @@ export const GestureStateManager = {
9
9
  },
10
10
 
11
11
  activate: () => {
12
- NodeManager.getHandler(handlerTag).activate();
12
+ NodeManager.getHandler(handlerTag).activate(true);
13
13
  },
14
14
 
15
15
  fail: () => {
@@ -59,8 +59,8 @@ export class HoverGesture extends ContinousBaseGesture<
59
59
  }
60
60
 
61
61
  /**
62
+ * #### iOS only
62
63
  * Sets the visual hover effect.
63
- * iOS only
64
64
  */
65
65
  effect(effect: HoverEffect) {
66
66
  this.config.hoverEffect = effect;
@@ -14,11 +14,21 @@ export class LongPressGesture extends BaseGesture<LongPressGestureHandlerEventPa
14
14
  this.shouldCancelWhenOutside(true);
15
15
  }
16
16
 
17
+ /**
18
+ * Minimum time, expressed in milliseconds, that a finger must remain pressed on the corresponding view.
19
+ * The default value is 500.
20
+ * @param duration
21
+ */
17
22
  minDuration(duration: number) {
18
23
  this.config.minDurationMs = duration;
19
24
  return this;
20
25
  }
21
26
 
27
+ /**
28
+ * Maximum distance, expressed in points, that defines how far the finger is allowed to travel during a long press gesture.
29
+ * @param distance
30
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/long-press-gesture#maxdistancevalue-number
31
+ */
22
32
  maxDistance(distance: number) {
23
33
  this.config.maxDist = distance;
24
34
  return this;
@@ -13,11 +13,19 @@ export class NativeGesture extends BaseGesture<NativeViewGestureHandlerPayload>
13
13
  this.handlerName = 'NativeViewGestureHandler';
14
14
  }
15
15
 
16
+ /**
17
+ * When true, underlying handler will activate unconditionally when in `BEGAN` or `UNDETERMINED` state.
18
+ * @param value
19
+ */
16
20
  shouldActivateOnStart(value: boolean) {
17
21
  this.config.shouldActivateOnStart = value;
18
22
  return this;
19
23
  }
20
24
 
25
+ /**
26
+ * When true, cancels all other gesture handlers when this `NativeViewGestureHandler` receives an `ACTIVE` state event.
27
+ * @param value
28
+ */
21
29
  disallowInterruption(value: boolean) {
22
30
  this.config.disallowInterruption = value;
23
31
  return this;
@@ -43,7 +43,14 @@ export class PanGesture extends ContinousBaseGesture<
43
43
  this.handlerName = 'PanGestureHandler';
44
44
  }
45
45
 
46
- activeOffsetY(offset: number | number[]) {
46
+ /**
47
+ * Range along Y axis (in points) where fingers travels without activation of gesture.
48
+ * @param offset
49
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#activeoffsetyvalue-number--number
50
+ */
51
+ activeOffsetY(
52
+ offset: number | [activeOffsetYStart: number, activeOffsetYEnd: number]
53
+ ) {
47
54
  if (Array.isArray(offset)) {
48
55
  this.config.activeOffsetYStart = offset[0];
49
56
  this.config.activeOffsetYEnd = offset[1];
@@ -55,7 +62,14 @@ export class PanGesture extends ContinousBaseGesture<
55
62
  return this;
56
63
  }
57
64
 
58
- activeOffsetX(offset: number | number[]) {
65
+ /**
66
+ * Range along X axis (in points) where fingers travels without activation of gesture.
67
+ * @param offset
68
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#activeoffsetxvalue-number--number
69
+ */
70
+ activeOffsetX(
71
+ offset: number | [activeOffsetXStart: number, activeOffsetXEnd: number]
72
+ ) {
59
73
  if (Array.isArray(offset)) {
60
74
  this.config.activeOffsetXStart = offset[0];
61
75
  this.config.activeOffsetXEnd = offset[1];
@@ -67,7 +81,14 @@ export class PanGesture extends ContinousBaseGesture<
67
81
  return this;
68
82
  }
69
83
 
70
- failOffsetY(offset: number | number[]) {
84
+ /**
85
+ * When the finger moves outside this range (in points) along Y axis and gesture hasn't yet activated it will fail recognizing the gesture.
86
+ * @param offset
87
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#failoffsetyvalue-number--number
88
+ */
89
+ failOffsetY(
90
+ offset: number | [failOffsetYStart: number, failOffsetYEnd: number]
91
+ ) {
71
92
  if (Array.isArray(offset)) {
72
93
  this.config.failOffsetYStart = offset[0];
73
94
  this.config.failOffsetYEnd = offset[1];
@@ -79,7 +100,14 @@ export class PanGesture extends ContinousBaseGesture<
79
100
  return this;
80
101
  }
81
102
 
82
- failOffsetX(offset: number | number[]) {
103
+ /**
104
+ * When the finger moves outside this range (in points) along X axis and gesture hasn't yet activated it will fail recognizing the gesture.
105
+ * @param offset
106
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#failoffsetxvalue-number--number
107
+ */
108
+ failOffsetX(
109
+ offset: number | [failOffsetXStart: number, failOffsetXEnd: number]
110
+ ) {
83
111
  if (Array.isArray(offset)) {
84
112
  this.config.failOffsetXStart = offset[0];
85
113
  this.config.failOffsetXEnd = offset[1];
@@ -91,46 +119,89 @@ export class PanGesture extends ContinousBaseGesture<
91
119
  return this;
92
120
  }
93
121
 
122
+ /**
123
+ * A number of fingers that is required to be placed before gesture can activate. Should be a higher or equal to 0 integer.
124
+ * @param minPointers
125
+ */
94
126
  minPointers(minPointers: number) {
95
127
  this.config.minPointers = minPointers;
96
128
  return this;
97
129
  }
98
130
 
131
+ /**
132
+ * When the given number of fingers is placed on the screen and gesture hasn't yet activated it will fail recognizing the gesture.
133
+ * Should be a higher or equal to 0 integer.
134
+ * @param maxPointers
135
+ */
99
136
  maxPointers(maxPointers: number) {
100
137
  this.config.maxPointers = maxPointers;
101
138
  return this;
102
139
  }
103
140
 
141
+ /**
142
+ * Minimum distance the finger (or multiple finger) need to travel before the gesture activates.
143
+ * Expressed in points.
144
+ * @param distance
145
+ */
104
146
  minDistance(distance: number) {
105
147
  this.config.minDist = distance;
106
148
  return this;
107
149
  }
108
150
 
151
+ /**
152
+ * Minimum velocity the finger has to reach in order to activate handler.
153
+ * @param velocity
154
+ */
109
155
  minVelocity(velocity: number) {
110
156
  this.config.minVelocity = velocity;
111
157
  return this;
112
158
  }
113
159
 
160
+ /**
161
+ * Minimum velocity along X axis the finger has to reach in order to activate handler.
162
+ * @param velocity
163
+ */
114
164
  minVelocityX(velocity: number) {
115
165
  this.config.minVelocityX = velocity;
116
166
  return this;
117
167
  }
118
168
 
169
+ /**
170
+ * Minimum velocity along Y axis the finger has to reach in order to activate handler.
171
+ * @param velocity
172
+ */
119
173
  minVelocityY(velocity: number) {
120
174
  this.config.minVelocityY = velocity;
121
175
  return this;
122
176
  }
123
177
 
178
+ /**
179
+ * #### Android only
180
+ * Android, by default, will calculate translation values based on the position of the leading pointer (the first one that was placed on the screen).
181
+ * This modifier allows that behavior to be changed to the one that is default on iOS - the averaged position of all active pointers will be used to calculate the translation values.
182
+ * @param value
183
+ */
124
184
  averageTouches(value: boolean) {
125
185
  this.config.avgTouches = value;
126
186
  return this;
127
187
  }
128
188
 
189
+ /**
190
+ * #### iOS only
191
+ * Enables two-finger gestures on supported devices, for example iPads with trackpads.
192
+ * @param value
193
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture/#enabletrackpadtwofingergesturevalue-boolean-ios-only
194
+ */
129
195
  enableTrackpadTwoFingerGesture(value: boolean) {
130
196
  this.config.enableTrackpadTwoFingerGesture = value;
131
197
  return this;
132
198
  }
133
199
 
200
+ /**
201
+ * Duration in milliseconds of the LongPress gesture before Pan is allowed to activate.
202
+ * @param duration
203
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture/#activateafterlongpressduration-number
204
+ */
134
205
  activateAfterLongPress(duration: number) {
135
206
  this.config.activateAfterLongPress = duration;
136
207
  return this;
@@ -14,36 +14,71 @@ export class TapGesture extends BaseGesture<TapGestureHandlerEventPayload> {
14
14
  this.shouldCancelWhenOutside(true);
15
15
  }
16
16
 
17
+ /**
18
+ * Minimum number of pointers (fingers) required to be placed before the gesture activates.
19
+ * Should be a positive integer. The default value is 1.
20
+ * @param minPointers
21
+ */
17
22
  minPointers(minPointers: number) {
18
23
  this.config.minPointers = minPointers;
19
24
  return this;
20
25
  }
21
26
 
27
+ /**
28
+ * Number of tap gestures required to activate the gesture.
29
+ * The default value is 1.
30
+ * @param count
31
+ */
22
32
  numberOfTaps(count: number) {
23
33
  this.config.numberOfTaps = count;
24
34
  return this;
25
35
  }
26
36
 
37
+ /**
38
+ * Maximum distance, expressed in points, that defines how far the finger is allowed to travel during a tap gesture.
39
+ * @param maxDist
40
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/tap-gesture#maxdistancevalue-number
41
+ */
27
42
  maxDistance(maxDist: number) {
28
43
  this.config.maxDist = maxDist;
29
44
  return this;
30
45
  }
31
46
 
47
+ /**
48
+ * Maximum time, expressed in milliseconds, that defines how fast a finger must be released after a touch.
49
+ * The default value is 500.
50
+ * @param duration
51
+ */
32
52
  maxDuration(duration: number) {
33
53
  this.config.maxDurationMs = duration;
34
54
  return this;
35
55
  }
36
56
 
57
+ /**
58
+ * Maximum time, expressed in milliseconds, that can pass before the next tap — if many taps are required.
59
+ * The default value is 500.
60
+ * @param delay
61
+ */
37
62
  maxDelay(delay: number) {
38
63
  this.config.maxDelayMs = delay;
39
64
  return this;
40
65
  }
41
66
 
67
+ /**
68
+ * Maximum distance, expressed in points, that defines how far the finger is allowed to travel along the X axis during a tap gesture.
69
+ * @param delta
70
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/tap-gesture#maxdeltaxvalue-number
71
+ */
42
72
  maxDeltaX(delta: number) {
43
73
  this.config.maxDeltaX = delta;
44
74
  return this;
45
75
  }
46
76
 
77
+ /**
78
+ * Maximum distance, expressed in points, that defines how far the finger is allowed to travel along the Y axis during a tap gesture.
79
+ * @param delta
80
+ * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/tap-gesture#maxdeltayvalue-number
81
+ */
47
82
  maxDeltaY(delta: number) {
48
83
  this.config.maxDeltaY = delta;
49
84
  return this;
package/src/utils.ts CHANGED
@@ -18,7 +18,10 @@ export function withPrevAndCurrent<T, Transformed>(
18
18
  const currentArr = [...array];
19
19
  const transformedArr: Transformed[] = [];
20
20
  currentArr.forEach((current, i) => {
21
- const previous = previousArr[i];
21
+ // This type cast is fine and solves problem mentioned in https://github.com/software-mansion/react-native-gesture-handler/pull/2867 (namely that `previous` can be undefined).
22
+ // Unfortunately, linter on our CI does not allow this type of casting as it is unnecessary. To bypass that we use eslint-disable.
23
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
24
+ const previous = previousArr[i] as Transformed | null;
22
25
  const transformed = mapFn(previous, current);
23
26
  previousArr.push(transformed);
24
27
  transformedArr.push(transformed);
@@ -50,5 +53,9 @@ export function isFabric(): boolean {
50
53
  export function isRemoteDebuggingEnabled(): boolean {
51
54
  // react-native-reanimated checks if in remote debugging in the same way
52
55
  // @ts-ignore global is available but node types are not included
53
- return !(global as any).nativeCallSyncHook || (global as any).__REMOTEDEV__;
56
+ const localGlobal = global as any;
57
+ return (
58
+ (!localGlobal.nativeCallSyncHook || !!localGlobal.__REMOTEDEV__) &&
59
+ !localGlobal.RN$Bridgeless
60
+ );
54
61
  }
@@ -23,7 +23,7 @@ export default abstract class GestureHandler implements IGestureHandler {
23
23
  private lastSentState: State | null = null;
24
24
  protected currentState: State = State.UNDETERMINED;
25
25
 
26
- protected shouldCancellWhenOutside = false;
26
+ protected shouldCancelWhenOutside = false;
27
27
  protected hasCustomActivationCriteria = false;
28
28
  protected enabled = false;
29
29
 
@@ -176,13 +176,13 @@ export default abstract class GestureHandler implements IGestureHandler {
176
176
  }
177
177
  }
178
178
 
179
- public activate(_force = false) {
179
+ public activate(force = false) {
180
180
  if (
181
- this.currentState === State.UNDETERMINED ||
182
- this.currentState === State.BEGAN
181
+ (this.config.manualActivation !== true || force) &&
182
+ (this.currentState === State.UNDETERMINED ||
183
+ this.currentState === State.BEGAN)
183
184
  ) {
184
185
  this.delegate.onActivate();
185
-
186
186
  this.moveToState(State.ACTIVE);
187
187
  }
188
188
  }
@@ -317,7 +317,7 @@ export default abstract class GestureHandler implements IGestureHandler {
317
317
  }
318
318
  }
319
319
  protected onPointerLeave(event: AdaptedEvent): void {
320
- if (this.shouldCancellWhenOutside) {
320
+ if (this.shouldCancelWhenOutside) {
321
321
  switch (this.currentState) {
322
322
  case State.ACTIVE:
323
323
  this.cancel();
@@ -362,7 +362,7 @@ export default abstract class GestureHandler implements IGestureHandler {
362
362
  if (
363
363
  this.enabled &&
364
364
  this.active &&
365
- (!out || (out && !this.shouldCancellWhenOutside))
365
+ (!out || (out && !this.shouldCancelWhenOutside))
366
366
  ) {
367
367
  this.sendEvent(this.currentState, this.currentState);
368
368
  }
@@ -805,11 +805,11 @@ export default abstract class GestureHandler implements IGestureHandler {
805
805
  }
806
806
 
807
807
  protected setShouldCancelWhenOutside(shouldCancel: boolean) {
808
- this.shouldCancellWhenOutside = shouldCancel;
808
+ this.shouldCancelWhenOutside = shouldCancel;
809
809
  }
810
810
 
811
811
  protected getShouldCancelWhenOutside(): boolean {
812
- return this.shouldCancellWhenOutside;
812
+ return this.shouldCancelWhenOutside;
813
813
  }
814
814
 
815
815
  public getPointerType(): PointerType {
@@ -23,7 +23,7 @@ export default interface IGestureHandler {
23
23
  getTrackedPointersID: () => number[];
24
24
 
25
25
  begin: () => void;
26
- activate: () => void;
26
+ activate: (force: boolean) => void;
27
27
  end: () => void;
28
28
  fail: () => void;
29
29
  cancel: () => void;
@@ -20,6 +20,7 @@ export default class PanGestureHandler extends GestureHandler {
20
20
  'failOffsetYEnd',
21
21
  'minVelocityX',
22
22
  'minVelocityY',
23
+ 'minVelocity',
23
24
  ];
24
25
 
25
26
  public velocityX = 0;
@@ -221,6 +222,9 @@ export default class PanGestureHandler extends GestureHandler {
221
222
  this.lastX = this.tracker.getLastAvgX();
222
223
  this.lastY = this.tracker.getLastAvgY();
223
224
 
225
+ this.startX = this.lastX;
226
+ this.startY = this.lastY;
227
+
224
228
  this.tryBegin(event);
225
229
  this.checkBegan();
226
230
  }
@@ -47,6 +47,7 @@ export interface Config extends Record<string, ConfigArgs> {
47
47
  mouseButton?: MouseButton;
48
48
  enableContextMenu?: boolean;
49
49
  touchAction?: TouchAction;
50
+ manualActivation?: boolean;
50
51
 
51
52
  activateAfterLongPress?: number;
52
53
  failOffsetXStart?: number;
@@ -1,109 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _EnableNewWebImplementation = require("./EnableNewWebImplementation");
11
-
12
- var _Gestures = require("./web/Gestures");
13
-
14
- var _InteractionManager = _interopRequireDefault(require("./web/tools/InteractionManager"));
15
-
16
- var _NodeManager = _interopRequireDefault(require("./web/tools/NodeManager"));
17
-
18
- var HammerNodeManager = _interopRequireWildcard(require("./web_hammer/NodeManager"));
19
-
20
- var _GestureHandlerWebDelegate = require("./web/tools/GestureHandlerWebDelegate");
21
-
22
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
23
-
24
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
-
28
- var _default = {
29
- handleSetJSResponder(tag, blockNativeResponder) {
30
- console.warn('handleSetJSResponder: ', tag, blockNativeResponder);
31
- },
32
-
33
- handleClearJSResponder() {
34
- console.warn('handleClearJSResponder: ');
35
- },
36
-
37
- createGestureHandler(handlerName, handlerTag, config) {
38
- if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
39
- if (!(handlerName in _Gestures.Gestures)) {
40
- throw new Error(`react-native-gesture-handler: ${handlerName} is not supported on web.`);
41
- }
42
-
43
- const GestureClass = _Gestures.Gestures[handlerName];
44
-
45
- _NodeManager.default.createGestureHandler(handlerTag, new GestureClass(new _GestureHandlerWebDelegate.GestureHandlerWebDelegate()));
46
-
47
- _InteractionManager.default.getInstance().configureInteractions(_NodeManager.default.getHandler(handlerTag), config);
48
- } else {
49
- if (!(handlerName in _Gestures.HammerGestures)) {
50
- throw new Error(`react-native-gesture-handler: ${handlerName} is not supported on web.`);
51
- } // @ts-ignore If it doesn't exist, the error is thrown
52
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
53
-
54
-
55
- const GestureClass = _Gestures.HammerGestures[handlerName]; // eslint-disable-next-line @typescript-eslint/no-unsafe-call
56
-
57
- HammerNodeManager.createGestureHandler(handlerTag, new GestureClass());
58
- }
59
-
60
- this.updateGestureHandler(handlerTag, config);
61
- },
62
-
63
- attachGestureHandler(handlerTag, // eslint-disable-next-line @typescript-eslint/no-explicit-any
64
- newView, _actionType, propsRef) {
65
- if (!(newView instanceof HTMLElement || newView instanceof _react.default.Component)) {
66
- return;
67
- }
68
-
69
- if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
70
- //@ts-ignore Types should be HTMLElement or React.Component
71
- _NodeManager.default.getHandler(handlerTag).init(newView, propsRef);
72
- } else {
73
- //@ts-ignore Types should be HTMLElement or React.Component
74
- HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);
75
- }
76
- },
77
-
78
- updateGestureHandler(handlerTag, newConfig) {
79
- if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
80
- _NodeManager.default.getHandler(handlerTag).updateGestureConfig(newConfig);
81
-
82
- _InteractionManager.default.getInstance().configureInteractions(_NodeManager.default.getHandler(handlerTag), newConfig);
83
- } else {
84
- HammerNodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
85
- }
86
- },
87
-
88
- getGestureHandlerNode(handlerTag) {
89
- if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
90
- return _NodeManager.default.getHandler(handlerTag);
91
- } else {
92
- return HammerNodeManager.getHandler(handlerTag);
93
- }
94
- },
95
-
96
- dropGestureHandler(handlerTag) {
97
- if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
98
- _NodeManager.default.dropGestureHandler(handlerTag);
99
- } else {
100
- HammerNodeManager.dropGestureHandler(handlerTag);
101
- }
102
- },
103
-
104
- // eslint-disable-next-line @typescript-eslint/no-empty-function
105
- flushOperations() {}
106
-
107
- };
108
- exports.default = _default;
109
- //# sourceMappingURL=RNGestureHandlerModule.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["RNGestureHandlerModule.web.ts"],"names":["handleSetJSResponder","tag","blockNativeResponder","console","warn","handleClearJSResponder","createGestureHandler","handlerName","handlerTag","config","Gestures","Error","GestureClass","NodeManager","GestureHandlerWebDelegate","InteractionManager","getInstance","configureInteractions","getHandler","HammerGestures","HammerNodeManager","updateGestureHandler","attachGestureHandler","newView","_actionType","propsRef","HTMLElement","React","Component","init","setView","newConfig","updateGestureConfig","getGestureHandlerNode","dropGestureHandler","flushOperations"],"mappings":"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","sourcesContent":["import React from 'react';\n\nimport type { ActionType } from './ActionType';\nimport { isNewWebImplementationEnabled } from './EnableNewWebImplementation';\nimport { Gestures, HammerGestures } from './web/Gestures';\nimport type { Config } from './web/interfaces';\nimport InteractionManager from './web/tools/InteractionManager';\nimport NodeManager from './web/tools/NodeManager';\nimport * as HammerNodeManager from './web_hammer/NodeManager';\nimport { GestureHandlerWebDelegate } from './web/tools/GestureHandlerWebDelegate';\n\nexport default {\n handleSetJSResponder(tag: number, blockNativeResponder: boolean) {\n console.warn('handleSetJSResponder: ', tag, blockNativeResponder);\n },\n handleClearJSResponder() {\n console.warn('handleClearJSResponder: ');\n },\n createGestureHandler<T>(\n handlerName: keyof typeof Gestures,\n handlerTag: number,\n config: T\n ) {\n if (isNewWebImplementationEnabled()) {\n if (!(handlerName in Gestures)) {\n throw new Error(\n `react-native-gesture-handler: ${handlerName} is not supported on web.`\n );\n }\n\n const GestureClass = Gestures[handlerName];\n NodeManager.createGestureHandler(\n handlerTag,\n new GestureClass(new GestureHandlerWebDelegate())\n );\n InteractionManager.getInstance().configureInteractions(\n NodeManager.getHandler(handlerTag),\n config as unknown as Config\n );\n } else {\n if (!(handlerName in HammerGestures)) {\n throw new Error(\n `react-native-gesture-handler: ${handlerName} is not supported on web.`\n );\n }\n\n // @ts-ignore If it doesn't exist, the error is thrown\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const GestureClass = HammerGestures[handlerName];\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n HammerNodeManager.createGestureHandler(handlerTag, new GestureClass());\n }\n\n this.updateGestureHandler(handlerTag, config as unknown as Config);\n },\n attachGestureHandler(\n handlerTag: number,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n newView: any,\n _actionType: ActionType,\n propsRef: React.RefObject<unknown>\n ) {\n if (\n !(newView instanceof HTMLElement || newView instanceof React.Component)\n ) {\n return;\n }\n\n if (isNewWebImplementationEnabled()) {\n //@ts-ignore Types should be HTMLElement or React.Component\n NodeManager.getHandler(handlerTag).init(newView, propsRef);\n } else {\n //@ts-ignore Types should be HTMLElement or React.Component\n HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);\n }\n },\n updateGestureHandler(handlerTag: number, newConfig: Config) {\n if (isNewWebImplementationEnabled()) {\n NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);\n\n InteractionManager.getInstance().configureInteractions(\n NodeManager.getHandler(handlerTag),\n newConfig\n );\n } else {\n HammerNodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);\n }\n },\n getGestureHandlerNode(handlerTag: number) {\n if (isNewWebImplementationEnabled()) {\n return NodeManager.getHandler(handlerTag);\n } else {\n return HammerNodeManager.getHandler(handlerTag);\n }\n },\n dropGestureHandler(handlerTag: number) {\n if (isNewWebImplementationEnabled()) {\n NodeManager.dropGestureHandler(handlerTag);\n } else {\n HammerNodeManager.dropGestureHandler(handlerTag);\n }\n },\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n flushOperations() {},\n};\n"]}
@@ -1,11 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.RNRenderer = void 0;
7
- const RNRenderer = {
8
- findHostInstance_DEPRECATED: _ref => null
9
- };
10
- exports.RNRenderer = RNRenderer;
11
- //# sourceMappingURL=RNRenderer.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["RNRenderer.web.ts"],"names":["RNRenderer","findHostInstance_DEPRECATED","_ref"],"mappings":";;;;;;AAAO,MAAMA,UAAU,GAAG;AACxBC,EAAAA,2BAA2B,EAAGC,IAAD,IAAe;AADpB,CAAnB","sourcesContent":["export const RNRenderer = {\n findHostInstance_DEPRECATED: (_ref: any) => null,\n};\n"]}