react-native-gesture-handler 2.14.1 → 2.16.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/README.md +1 -0
  2. package/RNGestureHandler.podspec +3 -24
  3. package/android/build.gradle +1 -1
  4. package/android/paper/src/main/java/com/swmansion/gesturehandler/NativeRNGestureHandlerModuleSpec.java +55 -0
  5. package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +69 -4
  6. package/android/src/main/java/com/swmansion/gesturehandler/core/FlingGestureHandler.kt +4 -0
  7. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +69 -0
  8. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +37 -21
  9. package/android/src/main/java/com/swmansion/gesturehandler/core/LongPressGestureHandler.kt +5 -1
  10. package/android/src/main/java/com/swmansion/gesturehandler/core/PanGestureHandler.kt +5 -1
  11. package/android/src/main/java/com/swmansion/gesturehandler/core/TapGestureHandler.kt +7 -3
  12. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +61 -24
  13. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +3 -2
  14. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/GestureHandlerEventDataBuilder.kt +3 -0
  15. package/android/src/main/jni/cpp-adapter.cpp +18 -22
  16. package/{ios → apple}/Handlers/RNFlingHandler.m +29 -8
  17. package/{ios → apple}/Handlers/RNForceTouchHandler.m +28 -8
  18. package/{ios → apple}/Handlers/RNHoverHandler.m +28 -2
  19. package/{ios → apple}/Handlers/RNLongPressHandler.m +27 -5
  20. package/{ios → apple}/Handlers/RNManualHandler.m +25 -4
  21. package/{ios → apple}/Handlers/RNNativeViewHandler.mm +51 -13
  22. package/{ios → apple}/Handlers/RNPanHandler.m +106 -16
  23. package/apple/Handlers/RNPinchHandler.m +175 -0
  24. package/apple/Handlers/RNRotationHandler.m +169 -0
  25. package/{ios → apple}/Handlers/RNTapHandler.m +98 -26
  26. package/apple/RNGHUIKit.h +27 -0
  27. package/{ios → apple}/RNGestureHandler.h +12 -3
  28. package/{ios → apple}/RNGestureHandler.m +68 -7
  29. package/{ios → apple}/RNGestureHandlerButton.h +4 -1
  30. package/{ios → apple}/RNGestureHandlerButton.m +12 -4
  31. package/{ios → apple}/RNGestureHandlerButtonManager.m +4 -2
  32. package/{ios → apple}/RNGestureHandlerEvents.h +19 -10
  33. package/{ios → apple}/RNGestureHandlerEvents.m +29 -11
  34. package/{ios → apple}/RNGestureHandlerManager.h +7 -2
  35. package/{ios → apple}/RNGestureHandlerManager.mm +78 -17
  36. package/apple/RNGestureHandlerModule.h +19 -0
  37. package/{ios → apple}/RNGestureHandlerModule.mm +69 -69
  38. package/{ios → apple}/RNGestureHandlerPointerTracker.h +5 -5
  39. package/{ios → apple}/RNGestureHandlerPointerTracker.m +19 -14
  40. package/apple/RNGestureHandlerPointerType.h +8 -0
  41. package/{ios → apple}/RNGestureHandlerRegistry.h +1 -1
  42. package/{ios → apple}/RNGestureHandlerRegistry.m +1 -1
  43. package/{ios → apple}/RNManualActivationRecognizer.h +8 -0
  44. package/{ios → apple}/RNManualActivationRecognizer.m +27 -7
  45. package/{ios → apple}/RNRootViewGestureRecognizer.m +72 -4
  46. package/lib/commonjs/PointerType.js +16 -0
  47. package/lib/commonjs/PointerType.js.map +1 -0
  48. package/lib/commonjs/RNGestureHandlerModule.js +5 -18
  49. package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
  50. package/lib/commonjs/RNGestureHandlerModule.windows.js +10 -102
  51. package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -1
  52. package/lib/commonjs/components/DrawerLayout.js +2 -0
  53. package/lib/commonjs/components/DrawerLayout.js.map +1 -1
  54. package/lib/commonjs/components/GestureHandlerRootView.android.js +17 -2
  55. package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -1
  56. package/lib/commonjs/components/GestureHandlerRootView.js +15 -2
  57. package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
  58. package/lib/commonjs/components/GestureHandlerRootView.web.js +15 -2
  59. package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -1
  60. package/lib/commonjs/getShadowNodeFromRef.js +19 -2
  61. package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
  62. package/lib/commonjs/handlers/createHandler.js +5 -0
  63. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  64. package/lib/commonjs/handlers/gestureHandlerCommon.js +1 -1
  65. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
  66. package/lib/commonjs/handlers/gestures/GestureDetector.js +11 -1
  67. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
  68. package/lib/commonjs/handlers/gestures/gesture.js +5 -0
  69. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
  70. package/lib/commonjs/index.js +16 -0
  71. package/lib/commonjs/index.js.map +1 -1
  72. package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +13 -0
  73. package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -0
  74. package/lib/commonjs/web/handlers/FlingGestureHandler.js +4 -0
  75. package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
  76. package/lib/commonjs/web/handlers/GestureHandler.js +19 -4
  77. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  78. package/lib/commonjs/web/handlers/LongPressGestureHandler.js +8 -6
  79. package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
  80. package/lib/commonjs/web/handlers/PanGestureHandler.js +4 -0
  81. package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
  82. package/lib/commonjs/web/handlers/TapGestureHandler.js +4 -0
  83. package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
  84. package/lib/commonjs/web/interfaces.js +12 -24
  85. package/lib/commonjs/web/interfaces.js.map +1 -1
  86. package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +3 -3
  87. package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
  88. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +35 -0
  89. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  90. package/lib/commonjs/web/tools/NodeManager.js +3 -2
  91. package/lib/commonjs/web/tools/NodeManager.js.map +1 -1
  92. package/lib/commonjs/web/tools/PointerEventManager.js +40 -10
  93. package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
  94. package/lib/commonjs/web/tools/TouchEventManager.js +3 -2
  95. package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -1
  96. package/lib/commonjs/web/utils.js +6 -0
  97. package/lib/commonjs/web/utils.js.map +1 -1
  98. package/lib/module/PointerType.js +9 -0
  99. package/lib/module/PointerType.js.map +1 -0
  100. package/lib/module/RNGestureHandlerModule.js +4 -18
  101. package/lib/module/RNGestureHandlerModule.js.map +1 -1
  102. package/lib/module/RNGestureHandlerModule.windows.js +10 -81
  103. package/lib/module/RNGestureHandlerModule.windows.js.map +1 -1
  104. package/lib/module/components/DrawerLayout.js +2 -0
  105. package/lib/module/components/DrawerLayout.js.map +1 -1
  106. package/lib/module/components/GestureHandlerRootView.android.js +15 -2
  107. package/lib/module/components/GestureHandlerRootView.android.js.map +1 -1
  108. package/lib/module/components/GestureHandlerRootView.js +15 -3
  109. package/lib/module/components/GestureHandlerRootView.js.map +1 -1
  110. package/lib/module/components/GestureHandlerRootView.web.js +15 -3
  111. package/lib/module/components/GestureHandlerRootView.web.js.map +1 -1
  112. package/lib/module/getShadowNodeFromRef.js +19 -2
  113. package/lib/module/getShadowNodeFromRef.js.map +1 -1
  114. package/lib/module/handlers/createHandler.js +6 -1
  115. package/lib/module/handlers/createHandler.js.map +1 -1
  116. package/lib/module/handlers/gestureHandlerCommon.js +1 -1
  117. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
  118. package/lib/module/handlers/gestures/GestureDetector.js +11 -1
  119. package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
  120. package/lib/module/handlers/gestures/gesture.js +5 -0
  121. package/lib/module/handlers/gestures/gesture.js.map +1 -1
  122. package/lib/module/index.js +2 -0
  123. package/lib/module/index.js.map +1 -1
  124. package/lib/module/specs/NativeRNGestureHandlerModule.js +3 -0
  125. package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -0
  126. package/lib/module/web/handlers/FlingGestureHandler.js +4 -0
  127. package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
  128. package/lib/module/web/handlers/GestureHandler.js +18 -4
  129. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  130. package/lib/module/web/handlers/LongPressGestureHandler.js +8 -5
  131. package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
  132. package/lib/module/web/handlers/PanGestureHandler.js +4 -0
  133. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
  134. package/lib/module/web/handlers/TapGestureHandler.js +4 -0
  135. package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
  136. package/lib/module/web/interfaces.js +9 -20
  137. package/lib/module/web/interfaces.js.map +1 -1
  138. package/lib/module/web/tools/GestureHandlerOrchestrator.js +2 -2
  139. package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
  140. package/lib/module/web/tools/GestureHandlerWebDelegate.js +34 -0
  141. package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  142. package/lib/module/web/tools/NodeManager.js +3 -2
  143. package/lib/module/web/tools/NodeManager.js.map +1 -1
  144. package/lib/module/web/tools/PointerEventManager.js +41 -12
  145. package/lib/module/web/tools/PointerEventManager.js.map +1 -1
  146. package/lib/module/web/tools/TouchEventManager.js +2 -2
  147. package/lib/module/web/tools/TouchEventManager.js.map +1 -1
  148. package/lib/module/web/utils.js +2 -0
  149. package/lib/module/web/utils.js.map +1 -1
  150. package/lib/typescript/PointerType.d.ts +6 -0
  151. package/lib/typescript/RNGestureHandlerModule.d.ts +2 -13
  152. package/lib/typescript/RNGestureHandlerModule.windows.d.ts +5 -21
  153. package/lib/typescript/components/DrawerLayout.d.ts +11 -0
  154. package/lib/typescript/components/GestureHandlerRootView.android.d.ts +1 -1
  155. package/lib/typescript/components/GestureHandlerRootView.d.ts +1 -1
  156. package/lib/typescript/components/GestureHandlerRootView.web.d.ts +1 -1
  157. package/lib/typescript/getShadowNodeFromRef.d.ts +1 -1
  158. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +1 -1
  159. package/lib/typescript/handlers/PanGestureHandler.d.ts +1 -1
  160. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +6 -1
  161. package/lib/typescript/handlers/gestures/GestureDetector.d.ts +2 -1
  162. package/lib/typescript/handlers/gestures/gesture.d.ts +2 -0
  163. package/lib/typescript/index.d.ts +2 -0
  164. package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +14 -0
  165. package/lib/typescript/web/handlers/GestureHandler.d.ts +4 -1
  166. package/lib/typescript/web/interfaces.d.ts +10 -14
  167. package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +2 -0
  168. package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +7 -0
  169. package/lib/typescript/web/tools/PointerEventManager.d.ts +2 -0
  170. package/lib/typescript/web/utils.d.ts +2 -0
  171. package/package.json +14 -11
  172. package/src/PointerType.ts +6 -0
  173. package/src/RNGestureHandlerModule.ts +4 -49
  174. package/src/RNGestureHandlerModule.windows.ts +18 -100
  175. package/src/components/DrawerLayout.tsx +15 -0
  176. package/src/components/GestureHandlerRootView.android.tsx +13 -5
  177. package/src/components/GestureHandlerRootView.tsx +10 -5
  178. package/src/components/GestureHandlerRootView.web.tsx +10 -5
  179. package/src/getShadowNodeFromRef.ts +28 -6
  180. package/src/handlers/createHandler.tsx +6 -0
  181. package/src/handlers/gestureHandlerCommon.ts +7 -0
  182. package/src/handlers/gestures/GestureDetector.tsx +16 -2
  183. package/src/handlers/gestures/gesture.ts +6 -0
  184. package/src/index.ts +2 -0
  185. package/src/specs/NativeRNGestureHandlerModule.ts +26 -0
  186. package/src/web/handlers/FlingGestureHandler.ts +4 -0
  187. package/src/web/handlers/GestureHandler.ts +20 -2
  188. package/src/web/handlers/LongPressGestureHandler.ts +8 -5
  189. package/src/web/handlers/PanGestureHandler.ts +4 -0
  190. package/src/web/handlers/TapGestureHandler.ts +4 -0
  191. package/src/web/interfaces.ts +12 -17
  192. package/src/web/tools/GestureHandlerDelegate.ts +3 -0
  193. package/src/web/tools/GestureHandlerOrchestrator.ts +2 -2
  194. package/src/web/tools/GestureHandlerWebDelegate.ts +39 -0
  195. package/src/web/tools/NodeManager.ts +5 -1
  196. package/src/web/tools/PointerEventManager.ts +46 -10
  197. package/src/web/tools/TouchEventManager.ts +2 -8
  198. package/src/web/utils.ts +9 -0
  199. package/ios/Handlers/RNPinchHandler.m +0 -95
  200. package/ios/Handlers/RNRotationHandler.m +0 -93
  201. package/ios/RNGestureHandlerModule.h +0 -7
  202. package/lib/commonjs/RNGestureHandlerModule.macos.js +0 -149
  203. package/lib/commonjs/RNGestureHandlerModule.macos.js.map +0 -1
  204. package/lib/module/RNGestureHandlerModule.macos.js +0 -110
  205. package/lib/module/RNGestureHandlerModule.macos.js.map +0 -1
  206. package/lib/typescript/RNGestureHandlerModule.macos.d.ts +0 -47
  207. package/src/RNGestureHandlerModule.macos.ts +0 -133
  208. /package/{ios → apple}/Handlers/RNFlingHandler.h +0 -0
  209. /package/{ios → apple}/Handlers/RNForceTouchHandler.h +0 -0
  210. /package/{ios → apple}/Handlers/RNHoverHandler.h +0 -0
  211. /package/{ios → apple}/Handlers/RNLongPressHandler.h +0 -0
  212. /package/{ios → apple}/Handlers/RNManualHandler.h +0 -0
  213. /package/{ios → apple}/Handlers/RNNativeViewHandler.h +0 -0
  214. /package/{ios → apple}/Handlers/RNPanHandler.h +0 -0
  215. /package/{ios → apple}/Handlers/RNPinchHandler.h +0 -0
  216. /package/{ios → apple}/Handlers/RNRotationHandler.h +0 -0
  217. /package/{ios → apple}/Handlers/RNTapHandler.h +0 -0
  218. /package/{ios → apple}/RNGHTouchEventType.h +0 -0
  219. /package/{ios → apple}/RNGestureHandler.xcodeproj/project.pbxproj +0 -0
  220. /package/{ios → apple}/RNGestureHandler.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
  221. /package/{ios → apple}/RNGestureHandlerActionType.h +0 -0
  222. /package/{ios → apple}/RNGestureHandlerButtonComponentView.h +0 -0
  223. /package/{ios → apple}/RNGestureHandlerButtonComponentView.mm +0 -0
  224. /package/{ios → apple}/RNGestureHandlerButtonManager.h +0 -0
  225. /package/{ios → apple}/RNGestureHandlerDirection.h +0 -0
  226. /package/{ios → apple}/RNGestureHandlerRootViewComponentView.mm +0 -0
  227. /package/{ios → apple}/RNGestureHandlerState.h +0 -0
  228. /package/{ios → apple}/RNGestureHandlerStateManager.h +0 -0
  229. /package/{ios → apple}/RNRootViewGestureRecognizer.h +0 -0
@@ -12,26 +12,31 @@
12
12
  return self;
13
13
  }
14
14
 
15
- + (RNGestureHandlerEventExtraData *)forPosition:(CGPoint)position withAbsolutePosition:(CGPoint)absolutePosition
15
+ + (RNGestureHandlerEventExtraData *)forPosition:(CGPoint)position
16
+ withAbsolutePosition:(CGPoint)absolutePosition
17
+ withPointerType:(NSInteger)pointerType
16
18
  {
17
19
  return [[RNGestureHandlerEventExtraData alloc] initWithData:@{
18
20
  @"x" : @(position.x),
19
21
  @"y" : @(position.y),
20
22
  @"absoluteX" : @(absolutePosition.x),
21
- @"absoluteY" : @(absolutePosition.y)
23
+ @"absoluteY" : @(absolutePosition.y),
24
+ @"pointerType" : @(pointerType)
22
25
  }];
23
26
  }
24
27
 
25
28
  + (RNGestureHandlerEventExtraData *)forPosition:(CGPoint)position
26
29
  withAbsolutePosition:(CGPoint)absolutePosition
27
30
  withNumberOfTouches:(NSUInteger)numberOfTouches
31
+ withPointerType:(NSInteger)pointerType
28
32
  {
29
33
  return [[RNGestureHandlerEventExtraData alloc] initWithData:@{
30
34
  @"x" : @(position.x),
31
35
  @"y" : @(position.y),
32
36
  @"absoluteX" : @(absolutePosition.x),
33
37
  @"absoluteY" : @(absolutePosition.y),
34
- @"numberOfPointers" : @(numberOfTouches)
38
+ @"numberOfPointers" : @(numberOfTouches),
39
+ @"pointerType" : @(pointerType)
35
40
  }];
36
41
  }
37
42
 
@@ -39,6 +44,7 @@
39
44
  withAbsolutePosition:(CGPoint)absolutePosition
40
45
  withNumberOfTouches:(NSUInteger)numberOfTouches
41
46
  withDuration:(NSUInteger)duration
47
+ withPointerType:(NSInteger)pointerType
42
48
  {
43
49
  return [[RNGestureHandlerEventExtraData alloc] initWithData:@{
44
50
  @"x" : @(position.x),
@@ -46,7 +52,8 @@
46
52
  @"absoluteX" : @(absolutePosition.x),
47
53
  @"absoluteY" : @(absolutePosition.y),
48
54
  @"numberOfPointers" : @(numberOfTouches),
49
- @"duration" : @(duration)
55
+ @"duration" : @(duration),
56
+ @"pointerType" : @(pointerType)
50
57
  }];
51
58
  }
52
59
 
@@ -55,6 +62,7 @@
55
62
  withTranslation:(CGPoint)translation
56
63
  withVelocity:(CGPoint)velocity
57
64
  withNumberOfTouches:(NSUInteger)numberOfTouches
65
+ withPointerType:(NSInteger)pointerType
58
66
  {
59
67
  return [[RNGestureHandlerEventExtraData alloc] initWithData:@{
60
68
  @"x" : @(position.x),
@@ -65,7 +73,8 @@
65
73
  @"translationY" : @(translation.y),
66
74
  @"velocityX" : SAFE_VELOCITY(velocity.x),
67
75
  @"velocityY" : SAFE_VELOCITY(velocity.y),
68
- @"numberOfPointers" : @(numberOfTouches)
76
+ @"numberOfPointers" : @(numberOfTouches),
77
+ @"pointerType" : @(pointerType)
69
78
  }];
70
79
  }
71
80
 
@@ -73,6 +82,7 @@
73
82
  forPosition:(CGPoint)position
74
83
  withAbsolutePosition:(CGPoint)absolutePosition
75
84
  withNumberOfTouches:(NSUInteger)numberOfTouches
85
+ withPointerType:(NSInteger)pointerType
76
86
  {
77
87
  return [[RNGestureHandlerEventExtraData alloc] initWithData:@{
78
88
  @"x" : @(position.x),
@@ -80,7 +90,8 @@
80
90
  @"absoluteX" : @(absolutePosition.x),
81
91
  @"absoluteY" : @(absolutePosition.y),
82
92
  @"force" : @(force),
83
- @"numberOfPointers" : @(numberOfTouches)
93
+ @"numberOfPointers" : @(numberOfTouches),
94
+ @"pointerType" : @(pointerType)
84
95
  }];
85
96
  }
86
97
 
@@ -88,13 +99,15 @@
88
99
  withFocalPoint:(CGPoint)focalPoint
89
100
  withVelocity:(CGFloat)velocity
90
101
  withNumberOfTouches:(NSUInteger)numberOfTouches
102
+ withPointerType:(NSInteger)pointerType
91
103
  {
92
104
  return [[RNGestureHandlerEventExtraData alloc] initWithData:@{
93
105
  @"scale" : @(scale),
94
106
  @"focalX" : @(focalPoint.x),
95
107
  @"focalY" : @(focalPoint.y),
96
108
  @"velocity" : SAFE_VELOCITY(velocity),
97
- @"numberOfPointers" : @(numberOfTouches)
109
+ @"numberOfPointers" : @(numberOfTouches),
110
+ @"pointerType" : @(pointerType)
98
111
  }];
99
112
  }
100
113
 
@@ -102,13 +115,15 @@
102
115
  withAnchorPoint:(CGPoint)anchorPoint
103
116
  withVelocity:(CGFloat)velocity
104
117
  withNumberOfTouches:(NSUInteger)numberOfTouches
118
+ withPointerType:(NSInteger)pointerType
105
119
  {
106
120
  return [[RNGestureHandlerEventExtraData alloc] initWithData:@{
107
121
  @"rotation" : @(rotation),
108
122
  @"anchorX" : @(anchorPoint.x),
109
123
  @"anchorY" : @(anchorPoint.y),
110
124
  @"velocity" : SAFE_VELOCITY(velocity),
111
- @"numberOfPointers" : @(numberOfTouches)
125
+ @"numberOfPointers" : @(numberOfTouches),
126
+ @"pointerType" : @(pointerType)
112
127
  }];
113
128
  }
114
129
 
@@ -116,6 +131,7 @@
116
131
  withChangedPointers:(NSArray<NSDictionary *> *)changedPointers
117
132
  withAllPointers:(NSArray<NSDictionary *> *)allPointers
118
133
  withNumberOfTouches:(NSUInteger)numberOfTouches
134
+ withPointerType:(NSInteger)pointerType
119
135
  {
120
136
  if (changedPointers == nil || allPointers == nil) {
121
137
  changedPointers = @[];
@@ -127,13 +143,15 @@
127
143
  @"eventType" : @(eventType),
128
144
  @"changedTouches" : changedPointers,
129
145
  @"allTouches" : allPointers,
130
- @"numberOfTouches" : @(numberOfTouches)
146
+ @"numberOfTouches" : @(numberOfTouches),
147
+ @"pointerType" : @(pointerType)
131
148
  }];
132
149
  }
133
150
 
134
- + (RNGestureHandlerEventExtraData *)forPointerInside:(BOOL)pointerInside
151
+ + (RNGestureHandlerEventExtraData *)forPointerInside:(BOOL)pointerInside withPointerType:(NSInteger)pointerType
135
152
  {
136
- return [[RNGestureHandlerEventExtraData alloc] initWithData:@{@"pointerInside" : @(pointerInside)}];
153
+ return [[RNGestureHandlerEventExtraData alloc]
154
+ initWithData:@{@"pointerInside" : @(pointerInside), @"pointerType" : @(pointerType)}];
137
155
  }
138
156
 
139
157
  @end
@@ -9,8 +9,13 @@
9
9
 
10
10
  @interface RNGestureHandlerManager : NSObject
11
11
 
12
+ #ifdef RCT_NEW_ARCH_ENABLED
13
+ - (nonnull instancetype)initWithModuleRegistry:(nonnull RCTModuleRegistry *)moduleRegistry
14
+ viewRegistry:(nonnull RCTViewRegistry *)viewRegistry;
15
+ #else
12
16
  - (nonnull instancetype)initWithUIManager:(nonnull RCTUIManager *)uiManager
13
- eventDispatcher:(nonnull RCTEventDispatcher *)eventDispatcher;
17
+ eventDispatcher:(nonnull id<RCTEventDispatcherProtocol>)eventDispatcher;
18
+ #endif // RCT_NEW_ARCH_ENABLED
14
19
 
15
20
  - (void)createGestureHandler:(nonnull NSString *)handlerName
16
21
  tag:(nonnull NSNumber *)handlerTag
@@ -26,7 +31,7 @@
26
31
 
27
32
  - (void)dropAllGestureHandlers;
28
33
 
29
- - (void)handleSetJSResponder:(nonnull NSNumber *)viewTag blockNativeResponder:(nonnull NSNumber *)blockNativeResponder;
34
+ - (void)handleSetJSResponder:(nonnull NSNumber *)viewTag blockNativeResponder:(BOOL)blockNativeResponder;
30
35
 
31
36
  - (void)handleClearJSResponder;
32
37
 
@@ -1,7 +1,7 @@
1
1
  #import "RNGestureHandlerManager.h"
2
2
 
3
3
  #import <React/RCTComponent.h>
4
- #import <React/RCTEventDispatcher.h>
4
+ #import <React/RCTEventDispatcherProtocol.h>
5
5
  #import <React/RCTLog.h>
6
6
  #import <React/RCTModalHostViewController.h>
7
7
  #import <React/RCTRootContentView.h>
@@ -49,28 +49,59 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
49
49
 
50
50
  @implementation RNGestureHandlerManager {
51
51
  RNGestureHandlerRegistry *_registry;
52
- RCTUIManager *_uiManager;
53
52
  NSHashTable<RNRootViewGestureRecognizer *> *_rootViewGestureRecognizers;
54
53
  NSMutableDictionary<NSNumber *, NSNumber *> *_attachRetryCounter;
55
- RCTEventDispatcher *_eventDispatcher;
54
+ #ifdef RCT_NEW_ARCH_ENABLED
55
+ RCTModuleRegistry *_moduleRegistry;
56
+ RCTViewRegistry *_viewRegistry;
57
+ #else
58
+ RCTUIManager *_uiManager;
59
+ #endif // RCT_NEW_ARCH_ENABLED
60
+ id<RCTEventDispatcherProtocol> _eventDispatcher;
56
61
  id _reanimatedModule;
57
62
  }
58
63
 
59
- - (instancetype)initWithUIManager:(RCTUIManager *)uiManager eventDispatcher:(RCTEventDispatcher *)eventDispatcher
64
+ #ifdef RCT_NEW_ARCH_ENABLED
65
+ - (instancetype)initWithModuleRegistry:(RCTModuleRegistry *)moduleRegistry viewRegistry:(RCTViewRegistry *)viewRegistry
66
+ {
67
+ if ((self = [super init])) {
68
+ _moduleRegistry = moduleRegistry;
69
+ _viewRegistry = viewRegistry;
70
+ _eventDispatcher = [_moduleRegistry moduleForName:"EventDispatcher"];
71
+ [self initCommonProps];
72
+ }
73
+ return self;
74
+ }
75
+ #else
76
+ - (instancetype)initWithUIManager:(RCTUIManager *)uiManager
77
+ eventDispatcher:(id<RCTEventDispatcherProtocol>)eventDispatcher
60
78
  {
61
79
  if ((self = [super init])) {
62
80
  _uiManager = uiManager;
63
81
  _eventDispatcher = eventDispatcher;
64
- _registry = [RNGestureHandlerRegistry new];
65
- _rootViewGestureRecognizers = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory];
66
- _attachRetryCounter = [[NSMutableDictionary alloc] init];
67
- _reanimatedModule = nil;
82
+ [self initCommonProps];
68
83
  }
69
84
  return self;
70
85
  }
86
+ #endif // RCT_NEW_ARCH_ENABLED
87
+
88
+ - (void)initCommonProps
89
+ {
90
+ _registry = [RNGestureHandlerRegistry new];
91
+ _rootViewGestureRecognizers = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory];
92
+ _attachRetryCounter = [[NSMutableDictionary alloc] init];
93
+ }
71
94
 
72
95
  - (void)createGestureHandler:(NSString *)handlerName tag:(NSNumber *)handlerTag config:(NSDictionary *)config
73
96
  {
97
+ if ([_registry handlerWithTag:handlerTag] != nullptr) {
98
+ NSString *errorMessage = [NSString
99
+ stringWithFormat:
100
+ @"Handler with tag %@ already exists. Please ensure that no Gesture instance is used across multiple GestureDetectors.",
101
+ handlerTag];
102
+ @throw [NSException exceptionWithName:@"HandlerAlreadyRegistered" reason:errorMessage userInfo:nil];
103
+ }
104
+
74
105
  static NSDictionary *map;
75
106
  static dispatch_once_t mapToken;
76
107
  dispatch_once(&mapToken, ^{
@@ -106,7 +137,11 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
106
137
  toViewWithTag:(nonnull NSNumber *)viewTag
107
138
  withActionType:(RNGestureHandlerActionType)actionType
108
139
  {
109
- UIView *view = [_uiManager viewForReactTag:viewTag];
140
+ #ifdef RCT_NEW_ARCH_ENABLED
141
+ RNGHUIView *view = [_viewRegistry viewForReactTag:viewTag];
142
+ #else
143
+ RNGHUIView *view = [_uiManager viewForReactTag:viewTag];
144
+ #endif // RCT_NEW_ARCH_ENABLED
110
145
 
111
146
  #ifdef RCT_NEW_ARCH_ENABLED
112
147
  if (view == nil || view.superview == nil) {
@@ -177,9 +212,9 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
177
212
  [_registry dropAllHandlers];
178
213
  }
179
214
 
180
- - (void)handleSetJSResponder:(NSNumber *)viewTag blockNativeResponder:(NSNumber *)blockNativeResponder
215
+ - (void)handleSetJSResponder:(NSNumber *)viewTag blockNativeResponder:(BOOL)blockNativeResponder
181
216
  {
182
- if ([blockNativeResponder boolValue]) {
217
+ if (blockNativeResponder) {
183
218
  for (RNRootViewGestureRecognizer *recognizer in _rootViewGestureRecognizers) {
184
219
  [recognizer blockOtherRecognizers];
185
220
  }
@@ -198,11 +233,12 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
198
233
 
199
234
  #pragma mark Root Views Management
200
235
 
201
- - (void)registerViewWithGestureRecognizerAttachedIfNeeded:(UIView *)childView
236
+ - (void)registerViewWithGestureRecognizerAttachedIfNeeded:(RNGHUIView *)childView
202
237
  {
203
238
  #ifdef RCT_NEW_ARCH_ENABLED
204
- UIView *touchHandlerView = childView;
239
+ RNGHUIView *touchHandlerView = childView;
205
240
 
241
+ #if !TARGET_OS_OSX
206
242
  if ([[childView reactViewController] isKindOfClass:[RCTFabricModalHostViewController class]]) {
207
243
  touchHandlerView = [childView reactViewController].view;
208
244
  } else {
@@ -211,8 +247,15 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
211
247
  }
212
248
  }
213
249
  #else
214
- UIView *touchHandlerView = nil;
250
+ while (touchHandlerView != nil && ![touchHandlerView isKindOfClass:[RCTSurfaceView class]]) {
251
+ touchHandlerView = touchHandlerView.superview;
252
+ }
253
+ #endif // !TARGET_OS_OSX
254
+
255
+ #else
256
+ RNGHUIView *touchHandlerView = nil;
215
257
 
258
+ #if !TARGET_OS_OSX
216
259
  if ([[childView reactViewController] isKindOfClass:[RCTModalHostViewController class]]) {
217
260
  touchHandlerView = [childView reactViewController].view.subviews[0];
218
261
  } else {
@@ -223,6 +266,15 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
223
266
 
224
267
  touchHandlerView = [[parent performSelector:@selector(touchHandler)] view];
225
268
  }
269
+ #else
270
+ NSView *parent = childView;
271
+ while (parent != nil && ![parent respondsToSelector:@selector(touchHandler)]) {
272
+ parent = parent.superview;
273
+ }
274
+
275
+ touchHandlerView = [[parent performSelector:@selector(touchHandler)] view];
276
+ #endif // !TARGET_OS_OSX
277
+
226
278
  #endif // RCT_NEW_ARCH_ENABLED
227
279
 
228
280
  if (touchHandlerView == nil) {
@@ -240,13 +292,15 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
240
292
  RCTLifecycleLog(@"[GESTURE HANDLER] Initialize gesture handler for view %@", touchHandlerView);
241
293
  RNRootViewGestureRecognizer *recognizer = [RNRootViewGestureRecognizer new];
242
294
  recognizer.delegate = self;
295
+ #if !TARGET_OS_OSX
243
296
  touchHandlerView.userInteractionEnabled = YES;
297
+ #endif
244
298
  [touchHandlerView addGestureRecognizer:recognizer];
245
299
  [_rootViewGestureRecognizers addObject:recognizer];
246
300
  }
247
301
 
248
302
  - (void)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
249
- didActivateInViewWithTouchHandler:(UIView *)viewWithTouchHandler
303
+ didActivateInViewWithTouchHandler:(RNGHUIView *)viewWithTouchHandler
250
304
  {
251
305
  // Cancel touches in RN's root view in order to cancel all in-js recognizers
252
306
 
@@ -259,8 +313,15 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
259
313
  // particular if we have one PanHandler and ScrollView that can work simultaniously then when
260
314
  // the Pan handler activates it would still tigger cancel events.
261
315
  // Once the upstream fix lands the line below along with this comment can be removed
262
- if ([gestureRecognizer.view isKindOfClass:[UIScrollView class]])
316
+ #if TARGET_OS_OSX
317
+ if ([gestureRecognizer.view isKindOfClass:[NSScrollView class]]) {
263
318
  return;
319
+ }
320
+ #else
321
+ if ([gestureRecognizer.view isKindOfClass:[UIScrollView class]]) {
322
+ return;
323
+ }
324
+ #endif
264
325
 
265
326
  UIGestureRecognizer *touchHandler = nil;
266
327
 
@@ -315,7 +376,7 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
315
376
  #ifdef RCT_NEW_ARCH_ENABLED
316
377
  // Send event directly to Reanimated
317
378
  if (_reanimatedModule == nil) {
318
- _reanimatedModule = [_uiManager.bridge moduleForName:@"ReanimatedModule"];
379
+ _reanimatedModule = [_moduleRegistry moduleForName:"ReanimatedModule"];
319
380
  }
320
381
 
321
382
  [_reanimatedModule eventDispatcherWillDispatchEvent:event];
@@ -0,0 +1,19 @@
1
+ #import <React/RCTEventEmitter.h>
2
+ #import <React/RCTUIManager.h>
3
+
4
+ #ifdef RCT_NEW_ARCH_ENABLED
5
+ #import <React/RCTEventDispatcherProtocol.h>
6
+ #import <React/RCTInitializing.h>
7
+ #import <rngesturehandler_codegen/rngesturehandler_codegen.h>
8
+ #else
9
+ #import <React/RCTBridgeModule.h>
10
+ #endif
11
+
12
+ @interface RNGestureHandlerModule : RCTEventEmitter
13
+ #ifdef RCT_NEW_ARCH_ENABLED
14
+ <NativeRNGestureHandlerModuleSpec, RCTJSDispatcherModule, RCTInitializing>
15
+ #else
16
+ <RCTBridgeModule>
17
+ #endif
18
+
19
+ @end
@@ -10,7 +10,6 @@
10
10
  #ifdef RCT_NEW_ARCH_ENABLED
11
11
  #import <React/RCTBridge+Private.h>
12
12
  #import <React/RCTBridge.h>
13
- #import <React/RCTSurfacePresenter.h>
14
13
  #import <React/RCTUtils.h>
15
14
  #import <ReactCommon/CallInvoker.h>
16
15
  #import <ReactCommon/RCTTurboModule.h>
@@ -26,13 +25,15 @@
26
25
  #import "RNGestureHandlerButton.h"
27
26
  #import "RNGestureHandlerStateManager.h"
28
27
 
28
+ #import <React/RCTJSThread.h>
29
+
29
30
  #ifdef RCT_NEW_ARCH_ENABLED
30
31
  using namespace facebook;
31
32
  using namespace react;
32
33
  #endif // RCT_NEW_ARCH_ENABLED
33
34
 
34
35
  #ifdef RCT_NEW_ARCH_ENABLED
35
- @interface RNGestureHandlerModule () <RCTSurfacePresenterObserver, RNGestureHandlerStateManager>
36
+ @interface RNGestureHandlerModule () <RNGestureHandlerStateManager, RCTTurboModule>
36
37
 
37
38
  @end
38
39
  #else
@@ -50,6 +51,12 @@ typedef void (^GestureHandlerOperation)(RNGestureHandlerManager *manager);
50
51
  NSMutableArray<GestureHandlerOperation> *_operations;
51
52
  }
52
53
 
54
+ #ifdef RCT_NEW_ARCH_ENABLED
55
+ @synthesize viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED;
56
+ @synthesize bridge = _bridge;
57
+ @synthesize dispatchToJSThread = _dispatchToJSThread;
58
+ #endif // RCT_NEW_ARCH_ENABLED
59
+
53
60
  RCT_EXPORT_MODULE()
54
61
 
55
62
  + (BOOL)requiresMainQueueSetup
@@ -66,9 +73,7 @@ RCT_EXPORT_MODULE()
66
73
 
67
74
  _manager = nil;
68
75
 
69
- #ifdef RCT_NEW_ARCH_ENABLED
70
- [self.bridge.surfacePresenter removeObserver:self];
71
- #else
76
+ #ifndef RCT_NEW_ARCH_ENABLED
72
77
  [self.bridge.uiManager.observerCoordinator removeObserver:self];
73
78
  #endif // RCT_NEW_ARCH_ENABLED
74
79
  }
@@ -95,8 +100,7 @@ void decorateRuntime(jsi::Runtime &runtime)
95
100
  if (!arguments[0].isObject()) {
96
101
  return jsi::Value::null();
97
102
  }
98
-
99
- auto shadowNode = arguments[0].asObject(runtime).getHostObject<ShadowNodeWrapper>(runtime)->shadowNode;
103
+ auto shadowNode = arguments[0].asObject(runtime).getNativeState<ShadowNode>(runtime);
100
104
  bool isFormsStackingContext = shadowNode->getTraits().check(ShadowNodeTraits::FormsStackingContext);
101
105
 
102
106
  return jsi::Value(isFormsStackingContext);
@@ -105,6 +109,14 @@ void decorateRuntime(jsi::Runtime &runtime)
105
109
  }
106
110
  #endif // RCT_NEW_ARCH_ENABLED
107
111
 
112
+ #ifdef RCT_NEW_ARCH_ENABLED
113
+ - (void)initialize
114
+ {
115
+ _manager = [[RNGestureHandlerManager alloc] initWithModuleRegistry:self.moduleRegistry
116
+ viewRegistry:_viewRegistry_DEPRECATED];
117
+ _operations = [NSMutableArray new];
118
+ }
119
+ #else
108
120
  - (void)setBridge:(RCTBridge *)bridge
109
121
  {
110
122
  [super setBridge:bridge];
@@ -113,65 +125,65 @@ void decorateRuntime(jsi::Runtime &runtime)
113
125
  eventDispatcher:bridge.eventDispatcher];
114
126
  _operations = [NSMutableArray new];
115
127
 
116
- #ifdef RCT_NEW_ARCH_ENABLED
117
- [bridge.surfacePresenter addObserver:self];
118
- #else
119
128
  [bridge.uiManager.observerCoordinator addObserver:self];
120
- #endif // RCT_NEW_ARCH_ENABLED
121
129
  }
130
+ #endif // RCT_NEW_ARCH_ENABLED
122
131
 
123
132
  #ifdef RCT_NEW_ARCH_ENABLED
124
133
  RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
125
134
  {
126
- RCTCxxBridge *cxxBridge = (RCTCxxBridge *)self.bridge;
127
- auto runtime = (jsi::Runtime *)cxxBridge.runtime;
128
- decorateRuntime(*runtime);
135
+ dispatch_block_t block = ^{
136
+ RCTCxxBridge *cxxBridge = (RCTCxxBridge *)[RCTBridge currentBridge];
137
+ auto runtime = (jsi::Runtime *)cxxBridge.runtime;
138
+ decorateRuntime(*runtime);
139
+ };
140
+ if (_dispatchToJSThread) {
141
+ _dispatchToJSThread(block);
142
+ } else {
143
+ [[RCTBridge currentBridge] dispatchBlock:block queue:RCTJSThread];
144
+ }
145
+
129
146
  return @true;
130
147
  }
131
148
  #endif // RCT_NEW_ARCH_ENABLED
132
149
 
133
150
  RCT_EXPORT_METHOD(createGestureHandler
134
- : (nonnull NSString *)handlerName tag
135
- : (nonnull NSNumber *)handlerTag config
151
+ : (nonnull NSString *)handlerName handlerTag
152
+ : (double)handlerTag config
136
153
  : (NSDictionary *)config)
137
154
  {
138
155
  [self addOperationBlock:^(RNGestureHandlerManager *manager) {
139
- [manager createGestureHandler:handlerName tag:handlerTag config:config];
156
+ [manager createGestureHandler:handlerName tag:[NSNumber numberWithDouble:handlerTag] config:config];
140
157
  }];
141
158
  }
142
159
 
143
- RCT_EXPORT_METHOD(attachGestureHandler
144
- : (nonnull NSNumber *)handlerTag toViewWithTag
145
- : (nonnull NSNumber *)viewTag actionType
146
- : (nonnull NSNumber *)actionType)
160
+ RCT_EXPORT_METHOD(attachGestureHandler : (double)handlerTag newView : (double)viewTag actionType : (double)actionType)
147
161
  {
148
162
  [self addOperationBlock:^(RNGestureHandlerManager *manager) {
149
- [manager attachGestureHandler:handlerTag
150
- toViewWithTag:viewTag
151
- withActionType:(RNGestureHandlerActionType)[actionType integerValue]];
163
+ [manager attachGestureHandler:[NSNumber numberWithDouble:handlerTag]
164
+ toViewWithTag:[NSNumber numberWithDouble:viewTag]
165
+ withActionType:(RNGestureHandlerActionType)[[NSNumber numberWithDouble:actionType] integerValue]];
152
166
  }];
153
167
  }
154
168
 
155
- RCT_EXPORT_METHOD(updateGestureHandler : (nonnull NSNumber *)handlerTag config : (NSDictionary *)config)
169
+ RCT_EXPORT_METHOD(updateGestureHandler : (double)handlerTag newConfig : (NSDictionary *)config)
156
170
  {
157
171
  [self addOperationBlock:^(RNGestureHandlerManager *manager) {
158
- [manager updateGestureHandler:handlerTag config:config];
172
+ [manager updateGestureHandler:[NSNumber numberWithDouble:handlerTag] config:config];
159
173
  }];
160
174
  }
161
175
 
162
- RCT_EXPORT_METHOD(dropGestureHandler : (nonnull NSNumber *)handlerTag)
176
+ RCT_EXPORT_METHOD(dropGestureHandler : (double)handlerTag)
163
177
  {
164
178
  [self addOperationBlock:^(RNGestureHandlerManager *manager) {
165
- [manager dropGestureHandler:handlerTag];
179
+ [manager dropGestureHandler:[NSNumber numberWithDouble:handlerTag]];
166
180
  }];
167
181
  }
168
182
 
169
- RCT_EXPORT_METHOD(handleSetJSResponder
170
- : (nonnull NSNumber *)viewTag blockNativeResponder
171
- : (nonnull NSNumber *)blockNativeResponder)
183
+ RCT_EXPORT_METHOD(handleSetJSResponder : (double)viewTag blockNativeResponder : (BOOL)blockNativeResponder)
172
184
  {
173
185
  [self addOperationBlock:^(RNGestureHandlerManager *manager) {
174
- [manager handleSetJSResponder:viewTag blockNativeResponder:blockNativeResponder];
186
+ [manager handleSetJSResponder:[NSNumber numberWithDouble:viewTag] blockNativeResponder:blockNativeResponder];
175
187
  }];
176
188
  }
177
189
 
@@ -194,12 +206,11 @@ RCT_EXPORT_METHOD(flushOperations)
194
206
  NSArray<GestureHandlerOperation> *operations = _operations;
195
207
  _operations = [NSMutableArray new];
196
208
 
197
- [self.bridge.uiManager
198
- addUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary<NSNumber *, UIView *> *viewRegistry) {
199
- for (GestureHandlerOperation operation in operations) {
200
- operation(self->_manager);
201
- }
202
- }];
209
+ [self.viewRegistry_DEPRECATED addUIBlock:^(RCTViewRegistry *viewRegistry) {
210
+ for (GestureHandlerOperation operation in operations) {
211
+ operation(self->_manager);
212
+ }
213
+ }];
203
214
  #endif // RCT_NEW_ARCH_ENABLED
204
215
  }
205
216
 
@@ -209,16 +220,16 @@ RCT_EXPORT_METHOD(flushOperations)
209
220
 
210
221
  if (handler != nil) {
211
222
  if (state == 1) { // FAILED
212
- handler.recognizer.state = UIGestureRecognizerStateFailed;
223
+ handler.recognizer.state = RNGHGestureRecognizerStateFailed;
213
224
  } else if (state == 2) { // BEGAN
214
- handler.recognizer.state = UIGestureRecognizerStatePossible;
225
+ handler.recognizer.state = RNGHGestureRecognizerStatePossible;
215
226
  } else if (state == 3) { // CANCELLED
216
- handler.recognizer.state = UIGestureRecognizerStateCancelled;
227
+ handler.recognizer.state = RNGHGestureRecognizerStateCancelled;
217
228
  } else if (state == 4) { // ACTIVE
218
229
  [handler stopActivationBlocker];
219
- handler.recognizer.state = UIGestureRecognizerStateBegan;
230
+ handler.recognizer.state = RNGHGestureRecognizerStateBegan;
220
231
  } else if (state == 5) { // ENDED
221
- handler.recognizer.state = UIGestureRecognizerStateEnded;
232
+ handler.recognizer.state = RNGHGestureRecognizerStateEnded;
222
233
  }
223
234
  }
224
235
 
@@ -241,27 +252,7 @@ RCT_EXPORT_METHOD(flushOperations)
241
252
  [_operations addObject:operation];
242
253
  }
243
254
 
244
- #pragma mark - RCTSurfacePresenterObserver
245
-
246
- #ifdef RCT_NEW_ARCH_ENABLED
247
-
248
- - (void)didMountComponentsWithRootTag:(NSInteger)rootTag
249
- {
250
- RCTAssertMainQueue();
251
-
252
- if (_operations.count == 0) {
253
- return;
254
- }
255
-
256
- NSArray<GestureHandlerOperation> *operations = _operations;
257
- _operations = [NSMutableArray new];
258
-
259
- for (GestureHandlerOperation operation in operations) {
260
- operation(self->_manager);
261
- }
262
- }
263
-
264
- #else
255
+ #ifndef RCT_NEW_ARCH_ENABLED
265
256
 
266
257
  #pragma mark - RCTUIManagerObserver
267
258
 
@@ -279,11 +270,12 @@ RCT_EXPORT_METHOD(flushOperations)
279
270
  NSArray<GestureHandlerOperation> *operations = _operations;
280
271
  _operations = [NSMutableArray new];
281
272
 
282
- [uiManager addUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary<NSNumber *, UIView *> *viewRegistry) {
283
- for (GestureHandlerOperation operation in operations) {
284
- operation(self->_manager);
285
- }
286
- }];
273
+ [uiManager
274
+ addUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary<NSNumber *, RNGHUIView *> *viewRegistry) {
275
+ for (GestureHandlerOperation operation in operations) {
276
+ operation(self->_manager);
277
+ }
278
+ }];
287
279
  }
288
280
 
289
281
  #endif // RCT_NEW_ARCH_ENABLED
@@ -317,4 +309,12 @@ RCT_EXPORT_METHOD(flushOperations)
317
309
  };
318
310
  }
319
311
 
312
+ #if RCT_NEW_ARCH_ENABLED
313
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
314
+ (const facebook::react::ObjCTurboModule::InitParams &)params
315
+ {
316
+ return std::make_shared<facebook::react::NativeRNGestureHandlerModuleSpecJSI>(params);
317
+ }
318
+ #endif
319
+
320
320
  @end
@@ -1,6 +1,6 @@
1
1
  #import <Foundation/Foundation.h>
2
-
3
2
  #import "RNGHTouchEventType.h"
3
+ #import "RNGHUIKit.h"
4
4
 
5
5
  #define MAX_POINTERS_COUNT 12
6
6
 
@@ -15,10 +15,10 @@
15
15
 
16
16
  - (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler;
17
17
 
18
- - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
19
- - (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
20
- - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
21
- - (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
18
+ - (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event;
19
+ - (void)touchesMoved:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event;
20
+ - (void)touchesEnded:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event;
21
+ - (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event;
22
22
  - (void)reset;
23
23
  - (void)cancelPointers;
24
24