react-native-gesture-handler 2.21.2 → 2.22.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 (202) hide show
  1. package/README.md +1 -3
  2. package/android/build.gradle +10 -0
  3. package/android/package77/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +85 -0
  4. package/android/{src → packageDeprecated/src}/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +2 -3
  5. package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +3 -2
  6. package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerDelegate.java +3 -2
  7. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +16 -0
  8. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +1 -1
  9. package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +45 -8
  10. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +18 -0
  11. package/apple/Handlers/RNFlingHandler.m +0 -1
  12. package/apple/Handlers/RNForceTouchHandler.m +0 -1
  13. package/apple/Handlers/RNLongPressHandler.m +0 -1
  14. package/apple/Handlers/RNManualHandler.m +0 -1
  15. package/apple/Handlers/RNPanHandler.m +0 -3
  16. package/apple/Handlers/RNPinchHandler.m +0 -1
  17. package/apple/Handlers/RNRotationHandler.m +0 -1
  18. package/apple/Handlers/RNTapHandler.m +0 -1
  19. package/apple/RNGestureHandlerButton.h +1 -0
  20. package/apple/RNGestureHandlerButton.mm +51 -0
  21. package/apple/RNGestureHandlerManager.mm +6 -1
  22. package/apple/RNManualActivationRecognizer.m +1 -0
  23. package/lib/commonjs/ActionType.js.map +1 -1
  24. package/lib/commonjs/Directions.js.map +1 -1
  25. package/lib/commonjs/EnableNewWebImplementation.js +14 -1
  26. package/lib/commonjs/EnableNewWebImplementation.js.map +1 -1
  27. package/lib/commonjs/State.js.map +1 -1
  28. package/lib/commonjs/TouchEventType.js.map +1 -1
  29. package/lib/commonjs/components/Pressable/Pressable.js +1 -1
  30. package/lib/commonjs/components/Pressable/Pressable.js.map +1 -1
  31. package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -1
  32. package/lib/commonjs/components/Swipeable.js.map +1 -1
  33. package/lib/commonjs/components/Text.js +61 -0
  34. package/lib/commonjs/components/Text.js.map +1 -0
  35. package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
  36. package/lib/commonjs/getShadowNodeFromRef.js +10 -2
  37. package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
  38. package/lib/commonjs/ghQueueMicrotask.js.map +1 -1
  39. package/lib/commonjs/handlers/createHandler.js +12 -0
  40. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  41. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
  42. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +4 -0
  43. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  44. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +4 -0
  45. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  46. package/lib/commonjs/handlers/gestures/GestureDetector/index.js +3 -0
  47. package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
  48. package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js +48 -0
  49. package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -0
  50. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
  51. package/lib/commonjs/handlers/utils.js +1 -0
  52. package/lib/commonjs/handlers/utils.js.map +1 -1
  53. package/lib/commonjs/index.js +8 -0
  54. package/lib/commonjs/index.js.map +1 -1
  55. package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
  56. package/lib/commonjs/mountRegistry.js +49 -0
  57. package/lib/commonjs/mountRegistry.js.map +1 -0
  58. package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
  59. package/lib/commonjs/web/handlers/FlingGestureHandler.js +0 -4
  60. package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
  61. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  62. package/lib/commonjs/web/handlers/HoverGestureHandler.js +0 -14
  63. package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -1
  64. package/lib/commonjs/web/handlers/LongPressGestureHandler.js +6 -0
  65. package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
  66. package/lib/commonjs/web/handlers/ManualGestureHandler.js +0 -14
  67. package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
  68. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +3 -5
  69. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
  70. package/lib/commonjs/web/handlers/PanGestureHandler.js +0 -4
  71. package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
  72. package/lib/commonjs/web/handlers/PinchGestureHandler.js +0 -10
  73. package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
  74. package/lib/commonjs/web/handlers/RotationGestureHandler.js +0 -14
  75. package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
  76. package/lib/commonjs/web/handlers/TapGestureHandler.js +0 -4
  77. package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
  78. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  79. package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
  80. package/lib/commonjs/web_hammer/PressGestureHandler.js.map +1 -1
  81. package/lib/module/ActionType.js.map +1 -1
  82. package/lib/module/Directions.js.map +1 -1
  83. package/lib/module/EnableNewWebImplementation.js +14 -1
  84. package/lib/module/EnableNewWebImplementation.js.map +1 -1
  85. package/lib/module/State.js.map +1 -1
  86. package/lib/module/TouchEventType.js.map +1 -1
  87. package/lib/module/components/Pressable/Pressable.js +1 -1
  88. package/lib/module/components/Pressable/Pressable.js.map +1 -1
  89. package/lib/module/components/ReanimatedSwipeable.js.map +1 -1
  90. package/lib/module/components/Swipeable.js.map +1 -1
  91. package/lib/module/components/Text.js +44 -0
  92. package/lib/module/components/Text.js.map +1 -0
  93. package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
  94. package/lib/module/getShadowNodeFromRef.js +10 -2
  95. package/lib/module/getShadowNodeFromRef.js.map +1 -1
  96. package/lib/module/ghQueueMicrotask.js.map +1 -1
  97. package/lib/module/handlers/createHandler.js +11 -0
  98. package/lib/module/handlers/createHandler.js.map +1 -1
  99. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
  100. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +3 -0
  101. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  102. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +2 -0
  103. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  104. package/lib/module/handlers/gestures/GestureDetector/index.js +2 -0
  105. package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
  106. package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js +39 -0
  107. package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -0
  108. package/lib/module/handlers/gestures/gesture.js.map +1 -1
  109. package/lib/module/handlers/utils.js +1 -3
  110. package/lib/module/handlers/utils.js.map +1 -1
  111. package/lib/module/index.js +1 -0
  112. package/lib/module/index.js.map +1 -1
  113. package/lib/module/jestUtils/jestUtils.js.map +1 -1
  114. package/lib/module/mountRegistry.js +40 -0
  115. package/lib/module/mountRegistry.js.map +1 -0
  116. package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
  117. package/lib/module/web/handlers/FlingGestureHandler.js +0 -4
  118. package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
  119. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  120. package/lib/module/web/handlers/HoverGestureHandler.js +0 -14
  121. package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
  122. package/lib/module/web/handlers/LongPressGestureHandler.js +6 -0
  123. package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
  124. package/lib/module/web/handlers/ManualGestureHandler.js +0 -14
  125. package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
  126. package/lib/module/web/handlers/NativeViewGestureHandler.js +3 -5
  127. package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
  128. package/lib/module/web/handlers/PanGestureHandler.js +0 -4
  129. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
  130. package/lib/module/web/handlers/PinchGestureHandler.js +0 -10
  131. package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
  132. package/lib/module/web/handlers/RotationGestureHandler.js +0 -14
  133. package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
  134. package/lib/module/web/handlers/TapGestureHandler.js +0 -4
  135. package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
  136. package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  137. package/lib/module/web_hammer/GestureHandler.js.map +1 -1
  138. package/lib/module/web_hammer/PressGestureHandler.js.map +1 -1
  139. package/lib/typescript/ActionType.d.ts +1 -1
  140. package/lib/typescript/Directions.d.ts +2 -2
  141. package/lib/typescript/EnableNewWebImplementation.d.ts +6 -0
  142. package/lib/typescript/State.d.ts +1 -1
  143. package/lib/typescript/TouchEventType.d.ts +1 -1
  144. package/lib/typescript/components/GestureButtonsProps.d.ts +2 -2
  145. package/lib/typescript/components/Text.d.ts +4 -0
  146. package/lib/typescript/components/touchables/GenericTouchable.d.ts +1 -1
  147. package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +2 -2
  148. package/lib/typescript/handlers/gestures/GestureDetector/useMountReactions.d.ts +2 -0
  149. package/lib/typescript/handlers/gestures/gesture.d.ts +1 -1
  150. package/lib/typescript/handlers/utils.d.ts +1 -0
  151. package/lib/typescript/index.d.ts +1 -0
  152. package/lib/typescript/mocks.d.ts +3 -3
  153. package/lib/typescript/mountRegistry.d.ts +17 -0
  154. package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +0 -2
  155. package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +1 -4
  156. package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +1 -0
  157. package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +1 -4
  158. package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +0 -1
  159. package/lib/typescript/web/handlers/PanGestureHandler.d.ts +0 -2
  160. package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +1 -2
  161. package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +1 -3
  162. package/lib/typescript/web/handlers/TapGestureHandler.d.ts +0 -2
  163. package/package.json +18 -17
  164. package/src/ActionType.ts +1 -1
  165. package/src/Directions.ts +2 -2
  166. package/src/EnableNewWebImplementation.ts +18 -0
  167. package/src/State.ts +1 -1
  168. package/src/TouchEventType.ts +2 -1
  169. package/src/components/GestureButtonsProps.ts +4 -2
  170. package/src/components/Pressable/Pressable.tsx +3 -3
  171. package/src/components/ReanimatedSwipeable.tsx +8 -8
  172. package/src/components/Swipeable.tsx +4 -4
  173. package/src/components/Text.tsx +60 -0
  174. package/src/components/touchables/GenericTouchable.tsx +1 -1
  175. package/src/getShadowNodeFromRef.ts +8 -2
  176. package/src/ghQueueMicrotask.ts +2 -2
  177. package/src/handlers/GestureHandlerEventPayload.ts +2 -2
  178. package/src/handlers/createHandler.tsx +14 -1
  179. package/src/handlers/gestureHandlerCommon.ts +3 -3
  180. package/src/handlers/gestures/GestureDetector/attachHandlers.ts +3 -0
  181. package/src/handlers/gestures/GestureDetector/dropHandlers.ts +3 -0
  182. package/src/handlers/gestures/GestureDetector/index.tsx +3 -0
  183. package/src/handlers/gestures/GestureDetector/useMountReactions.ts +51 -0
  184. package/src/handlers/gestures/gesture.ts +3 -3
  185. package/src/handlers/utils.ts +2 -1
  186. package/src/index.ts +1 -0
  187. package/src/jestUtils/jestUtils.ts +10 -12
  188. package/src/mountRegistry.ts +51 -0
  189. package/src/web/detectors/ScaleGestureDetector.ts +1 -1
  190. package/src/web/handlers/FlingGestureHandler.ts +0 -4
  191. package/src/web/handlers/GestureHandler.ts +1 -3
  192. package/src/web/handlers/HoverGestureHandler.ts +1 -9
  193. package/src/web/handlers/LongPressGestureHandler.ts +6 -0
  194. package/src/web/handlers/ManualGestureHandler.ts +1 -9
  195. package/src/web/handlers/NativeViewGestureHandler.ts +5 -5
  196. package/src/web/handlers/PanGestureHandler.ts +0 -4
  197. package/src/web/handlers/PinchGestureHandler.ts +1 -5
  198. package/src/web/handlers/RotationGestureHandler.ts +1 -9
  199. package/src/web/handlers/TapGestureHandler.ts +0 -4
  200. package/src/web/tools/GestureHandlerWebDelegate.ts +4 -4
  201. package/src/web_hammer/GestureHandler.ts +1 -1
  202. package/src/web_hammer/PressGestureHandler.ts +7 -4
package/README.md CHANGED
@@ -37,14 +37,12 @@ You will need to have an Android or iOS device or emulator connected.
37
37
 
38
38
  | version | react-native version |
39
39
  | ------- | -------------------- |
40
+ | 2.21.0+ | 0.74.0+ |
40
41
  | 2.18.0+ | 0.73.0+ |
41
42
  | 2.16.0+ | 0.68.0+ |
42
43
  | 2.14.0+ | 0.67.0+ |
43
44
  | 2.10.0+ | 0.64.0+ |
44
45
  | 2.0.0+ | 0.63.0+ |
45
- | 1.4.0+ | 0.60.0+ |
46
- | 1.1.0+ | 0.57.2+ |
47
- | <1.1.0 | 0.50.0+ |
48
46
 
49
47
  It may be possible to use newer versions of react-native-gesture-handler on React Native with version <= 0.59 by reverse Jetifying.
50
48
  Read more on that here <https://github.com/mikehardy/jetifier#to-reverse-jetify--convert-node_modules-dependencies-to-support-libraries>
@@ -153,6 +153,7 @@ android {
153
153
  exclude "**/libreact_render*.so"
154
154
  exclude "**/libreactnative.so"
155
155
  exclude "**/libjsi.so"
156
+ exclude "**/libc++_shared.so"
156
157
  }
157
158
 
158
159
  sourceSets.main {
@@ -173,6 +174,15 @@ android {
173
174
  // codegen turned off
174
175
  srcDirs += 'paper/src/main/java'
175
176
  }
177
+
178
+ if (REACT_NATIVE_MINOR_VERSION >= 77) {
179
+ // With RN 0.77, ViewManager related functions in the package has different signatures as they
180
+ // are no longer nullable
181
+ srcDirs += 'package77/src/main/java'
182
+ } else {
183
+ // It's safe to delete this block once we drop support for RN 0.76
184
+ srcDirs += 'packageDeprecated/src/main/java'
185
+ }
176
186
  }
177
187
  }
178
188
 
@@ -0,0 +1,85 @@
1
+ package com.swmansion.gesturehandler
2
+
3
+ import com.facebook.react.BaseReactPackage
4
+ import com.facebook.react.ViewManagerOnDemandReactPackage
5
+ import com.facebook.react.bridge.ModuleSpec
6
+ import com.facebook.react.bridge.NativeModule
7
+ import com.facebook.react.bridge.ReactApplicationContext
8
+ import com.facebook.react.module.annotations.ReactModule
9
+ import com.facebook.react.module.annotations.ReactModuleList
10
+ import com.facebook.react.module.model.ReactModuleInfo
11
+ import com.facebook.react.module.model.ReactModuleInfoProvider
12
+ import com.facebook.react.uimanager.ViewManager
13
+ import com.swmansion.gesturehandler.react.RNGestureHandlerButtonViewManager
14
+ import com.swmansion.gesturehandler.react.RNGestureHandlerModule
15
+ import com.swmansion.gesturehandler.react.RNGestureHandlerRootViewManager
16
+
17
+ @ReactModuleList(
18
+ nativeModules = [
19
+ RNGestureHandlerModule::class
20
+ ]
21
+ )
22
+ class RNGestureHandlerPackage : BaseReactPackage(), ViewManagerOnDemandReactPackage {
23
+ private val viewManagers: Map<String, ModuleSpec> by lazy {
24
+ mapOf(
25
+ RNGestureHandlerRootViewManager.REACT_CLASS to ModuleSpec.viewManagerSpec {
26
+ RNGestureHandlerRootViewManager()
27
+ },
28
+ RNGestureHandlerButtonViewManager.REACT_CLASS to ModuleSpec.viewManagerSpec {
29
+ RNGestureHandlerButtonViewManager()
30
+ }
31
+ )
32
+ }
33
+
34
+ override fun createViewManagers(reactContext: ReactApplicationContext) =
35
+ listOf<ViewManager<*, *>>(
36
+ RNGestureHandlerRootViewManager(),
37
+ RNGestureHandlerButtonViewManager()
38
+ )
39
+
40
+ override fun getViewManagerNames(reactContext: ReactApplicationContext) =
41
+ viewManagers.keys.toList()
42
+
43
+ override fun getViewManagers(reactContext: ReactApplicationContext): MutableList<ModuleSpec> =
44
+ viewManagers.values.toMutableList()
45
+
46
+ override fun createViewManager(
47
+ reactContext: ReactApplicationContext,
48
+ viewManagerName: String
49
+ ) = viewManagers[viewManagerName]?.provider?.get() as? ViewManager<*, *>
50
+
51
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
52
+ return if (name == RNGestureHandlerModule.NAME) {
53
+ RNGestureHandlerModule(reactContext)
54
+ } else {
55
+ null
56
+ }
57
+ }
58
+
59
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
60
+ try {
61
+ val reactModuleInfoProviderClass =
62
+ Class.forName("com.swmansion.gesturehandler.RNGestureHandlerPackage$\$ReactModuleInfoProvider")
63
+ return reactModuleInfoProviderClass.getDeclaredConstructor().newInstance() as ReactModuleInfoProvider
64
+ } catch (e: ClassNotFoundException) {
65
+ return ReactModuleInfoProvider {
66
+ val reactModule: ReactModule = RNGestureHandlerModule::class.java.getAnnotation(ReactModule::class.java)!!
67
+
68
+ mutableMapOf(
69
+ RNGestureHandlerModule.NAME to ReactModuleInfo(
70
+ reactModule.name,
71
+ RNGestureHandlerModule::class.java.name,
72
+ reactModule.canOverrideExistingModule,
73
+ reactModule.needsEagerInit,
74
+ reactModule.isCxxModule,
75
+ true
76
+ )
77
+ )
78
+ }
79
+ } catch (e: InstantiationException) {
80
+ throw RuntimeException("No ReactModuleInfoProvider for RNGestureHandlerPackage$\$ReactModuleInfoProvider", e)
81
+ } catch (e: IllegalAccessException) {
82
+ throw RuntimeException("No ReactModuleInfoProvider for RNGestureHandlerPackage$\$ReactModuleInfoProvider", e)
83
+ }
84
+ }
85
+ }
@@ -1,6 +1,6 @@
1
1
  package com.swmansion.gesturehandler
2
2
 
3
- import com.facebook.react.TurboReactPackage
3
+ import com.facebook.react.BaseReactPackage
4
4
  import com.facebook.react.ViewManagerOnDemandReactPackage
5
5
  import com.facebook.react.bridge.ModuleSpec
6
6
  import com.facebook.react.bridge.NativeModule
@@ -19,7 +19,7 @@ import com.swmansion.gesturehandler.react.RNGestureHandlerRootViewManager
19
19
  RNGestureHandlerModule::class
20
20
  ]
21
21
  )
22
- class RNGestureHandlerPackage : TurboReactPackage(), ViewManagerOnDemandReactPackage {
22
+ class RNGestureHandlerPackage : BaseReactPackage(), ViewManagerOnDemandReactPackage {
23
23
  private val viewManagers: Map<String, ModuleSpec> by lazy {
24
24
  mapOf(
25
25
  RNGestureHandlerRootViewManager.REACT_CLASS to ModuleSpec.viewManagerSpec {
@@ -71,7 +71,6 @@ class RNGestureHandlerPackage : TurboReactPackage(), ViewManagerOnDemandReactPac
71
71
  RNGestureHandlerModule::class.java.name,
72
72
  reactModule.canOverrideExistingModule,
73
73
  reactModule.needsEagerInit,
74
- true, // Has constants is hardcoded to return true, so replacing it with `true` changes nothing.
75
74
  reactModule.isCxxModule,
76
75
  true
77
76
  )
@@ -12,10 +12,11 @@ package com.facebook.react.viewmanagers;
12
12
  import android.view.View;
13
13
  import androidx.annotation.Nullable;
14
14
  import com.facebook.react.bridge.ColorPropConverter;
15
+ import com.facebook.react.uimanager.BaseViewManager;
15
16
  import com.facebook.react.uimanager.BaseViewManagerDelegate;
16
- import com.facebook.react.uimanager.BaseViewManagerInterface;
17
+ import com.facebook.react.uimanager.LayoutShadowNode;
17
18
 
18
- public class RNGestureHandlerButtonManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNGestureHandlerButtonManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
19
+ public class RNGestureHandlerButtonManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & RNGestureHandlerButtonManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
19
20
  public RNGestureHandlerButtonManagerDelegate(U viewManager) {
20
21
  super(viewManager);
21
22
  }
@@ -11,10 +11,11 @@ package com.facebook.react.viewmanagers;
11
11
 
12
12
  import android.view.View;
13
13
  import androidx.annotation.Nullable;
14
+ import com.facebook.react.uimanager.BaseViewManager;
14
15
  import com.facebook.react.uimanager.BaseViewManagerDelegate;
15
- import com.facebook.react.uimanager.BaseViewManagerInterface;
16
+ import com.facebook.react.uimanager.LayoutShadowNode;
16
17
 
17
- public class RNGestureHandlerRootViewManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNGestureHandlerRootViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
18
+ public class RNGestureHandlerRootViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & RNGestureHandlerRootViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
18
19
  public RNGestureHandlerRootViewManagerDelegate(U viewManager) {
19
20
  super(viewManager);
20
21
  }
@@ -684,6 +684,22 @@ open class GestureHandler<ConcreteGestureHandlerT : GestureHandler<ConcreteGestu
684
684
  }
685
685
  }
686
686
 
687
+ /*
688
+ * Returns true if the view this handler is attached to is a descendant of the view the other handler
689
+ * is attached to and false otherwise.
690
+ */
691
+ fun isDescendantOf(of: GestureHandler<*>): Boolean {
692
+ var view = this.view?.parent as? View
693
+ while (view != null) {
694
+ if (view == of.view) {
695
+ return true
696
+ }
697
+
698
+ view = view.parent as? View
699
+ }
700
+ return false
701
+ }
702
+
687
703
  // responsible for resetting the state of handler upon activation (may be called more than once
688
704
  // if the handler is waiting for failure of other one)
689
705
  open fun resetProgress() {}
@@ -89,7 +89,7 @@ class GestureHandlerOrchestrator(
89
89
  gestureHandlers.any { shouldHandlerWaitForOther(handler, it) && it.state == GestureHandler.STATE_END }
90
90
 
91
91
  private fun shouldBeCancelledByActiveHandler(handler: GestureHandler<*>) =
92
- gestureHandlers.any { handler.hasCommonPointers(it) && it.state == GestureHandler.STATE_ACTIVE && !canRunSimultaneously(handler, it) }
92
+ gestureHandlers.any { handler.hasCommonPointers(it) && it.state == GestureHandler.STATE_ACTIVE && !canRunSimultaneously(handler, it) && handler.isDescendantOf(it) }
93
93
 
94
94
  private fun tryActivate(handler: GestureHandler<*>) {
95
95
  // If we are waiting for a gesture that has successfully finished, we should cancel handler
@@ -6,9 +6,12 @@ import android.view.View
6
6
  import android.view.ViewConfiguration
7
7
  import android.view.ViewGroup
8
8
  import android.widget.ScrollView
9
+ import com.facebook.react.views.scroll.ReactHorizontalScrollView
9
10
  import com.facebook.react.views.scroll.ReactScrollView
10
11
  import com.facebook.react.views.swiperefresh.ReactSwipeRefreshLayout
12
+ import com.facebook.react.views.text.ReactTextView
11
13
  import com.facebook.react.views.textinput.ReactEditText
14
+ import com.facebook.react.views.view.ReactViewGroup
12
15
  import com.swmansion.gesturehandler.react.RNGestureHandlerButtonViewManager
13
16
  import com.swmansion.gesturehandler.react.isScreenReaderOn
14
17
 
@@ -44,7 +47,11 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
44
47
 
45
48
  override fun shouldRecognizeSimultaneously(handler: GestureHandler<*>): Boolean {
46
49
  // if the gesture is marked by user as simultaneous with other or the hook return true
47
- if (super.shouldRecognizeSimultaneously(handler) || hook.shouldRecognizeSimultaneously(handler)) {
50
+ hook.shouldRecognizeSimultaneously(handler)?.let {
51
+ return@shouldRecognizeSimultaneously it
52
+ }
53
+
54
+ if (super.shouldRecognizeSimultaneously(handler)) {
48
55
  return true
49
56
  }
50
57
 
@@ -79,6 +86,9 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
79
86
  is ReactEditText -> this.hook = EditTextHook(this, view)
80
87
  is ReactSwipeRefreshLayout -> this.hook = SwipeRefreshLayoutHook(this, view)
81
88
  is ReactScrollView -> this.hook = ScrollViewHook()
89
+ is ReactHorizontalScrollView -> this.hook = ScrollViewHook()
90
+ is ReactTextView -> this.hook = TextViewHook()
91
+ is ReactViewGroup -> this.hook = ReactViewGroupHook()
82
92
  }
83
93
  }
84
94
 
@@ -99,8 +109,9 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
99
109
  if (state == STATE_UNDETERMINED && !hook.canBegin(event)) {
100
110
  cancel()
101
111
  } else {
102
- view.onTouchEvent(event)
103
- if ((state == STATE_UNDETERMINED || state == STATE_BEGAN) && view.isPressed) {
112
+ hook.sendTouchEvent(view, event)
113
+
114
+ if ((state == STATE_UNDETERMINED || state == STATE_BEGAN) && hook.canActivate(view)) {
104
115
  activate()
105
116
  }
106
117
 
@@ -116,12 +127,12 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
116
127
  when {
117
128
  shouldActivateOnStart -> {
118
129
  tryIntercept(view, event)
119
- view.onTouchEvent(event)
130
+ hook.sendTouchEvent(view, event)
120
131
  activate()
121
132
  }
122
133
 
123
134
  tryIntercept(view, event) -> {
124
- view.onTouchEvent(event)
135
+ hook.sendTouchEvent(view, event)
125
136
  activate()
126
137
  }
127
138
 
@@ -136,7 +147,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
136
147
  }
137
148
  }
138
149
  } else if (state == STATE_ACTIVE) {
139
- view.onTouchEvent(event)
150
+ hook.sendTouchEvent(view, event)
140
151
  }
141
152
  }
142
153
 
@@ -145,7 +156,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
145
156
  val event = MotionEvent.obtain(time, time, MotionEvent.ACTION_CANCEL, 0f, 0f, 0).apply {
146
157
  action = MotionEvent.ACTION_CANCEL
147
158
  }
148
- view!!.onTouchEvent(event)
159
+ hook.sendTouchEvent(view, event)
149
160
  event.recycle()
150
161
  }
151
162
 
@@ -170,6 +181,11 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
170
181
  */
171
182
  fun canBegin(event: MotionEvent) = true
172
183
 
184
+ /**
185
+ * Checks whether handler can activate. Used by TextViewHook.
186
+ */
187
+ fun canActivate(view: View) = view.isPressed
188
+
173
189
  /**
174
190
  * Called after the gesture transitions to the END state.
175
191
  */
@@ -179,7 +195,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
179
195
  * @return Boolean value signalling whether the gesture can be recognized simultaneously with
180
196
  * other (handler). Returning false doesn't necessarily prevent it from happening.
181
197
  */
182
- fun shouldRecognizeSimultaneously(handler: GestureHandler<*>) = false
198
+ fun shouldRecognizeSimultaneously(handler: GestureHandler<*>): Boolean? = null
183
199
 
184
200
  /**
185
201
  * shouldActivateOnStart and tryIntercept have priority over this method
@@ -199,6 +215,19 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
199
215
  * by this one.
200
216
  */
201
217
  fun shouldCancelRootViewGestureHandlerIfNecessary() = false
218
+
219
+ /**
220
+ * Passes the event down to the underlying view using the correct method.
221
+ */
222
+ fun sendTouchEvent(view: View?, event: MotionEvent) = view?.onTouchEvent(event)
223
+ }
224
+
225
+ private class TextViewHook() : NativeViewGestureHandlerHook {
226
+ override fun shouldRecognizeSimultaneously(handler: GestureHandler<*>) = false
227
+
228
+ // We have to explicitly check for ReactTextView, since its `isPressed` flag is not set to `true`,
229
+ // in contrast to e.g. Touchable
230
+ override fun canActivate(view: View) = view is ReactTextView
202
231
  }
203
232
 
204
233
  private class EditTextHook(
@@ -278,4 +307,12 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
278
307
  private class ScrollViewHook : NativeViewGestureHandlerHook {
279
308
  override fun shouldCancelRootViewGestureHandlerIfNecessary() = true
280
309
  }
310
+
311
+ private class ReactViewGroupHook : NativeViewGestureHandlerHook {
312
+ // There are cases where a native component is wrapped with a `ReactViewGroup` (the component is rendered
313
+ // inside a `<View />` component in JS). In such cases, calling `onTouchEvent` wouldn't work as those are
314
+ // ignored by the wrapper view. Instead `dispatchTouchEvent` can be used, which causes the view to dispatch
315
+ // the event to its children.
316
+ override fun sendTouchEvent(view: View?, event: MotionEvent) = view?.dispatchTouchEvent(event)
317
+ }
281
318
  }
@@ -22,7 +22,9 @@ import android.view.View
22
22
  import android.view.View.OnClickListener
23
23
  import android.view.ViewGroup
24
24
  import android.view.ViewParent
25
+ import android.view.accessibility.AccessibilityNodeInfo
25
26
  import androidx.core.view.children
27
+ import com.facebook.react.R
26
28
  import com.facebook.react.module.annotations.ReactModule
27
29
  import com.facebook.react.uimanager.PixelUtil
28
30
  import com.facebook.react.uimanager.ThemedReactContext
@@ -124,6 +126,8 @@ class RNGestureHandlerButtonViewManager : ViewGroupManager<ButtonViewGroup>(), R
124
126
  }
125
127
 
126
128
  override fun onAfterUpdateTransaction(view: ButtonViewGroup) {
129
+ super.onAfterUpdateTransaction(view)
130
+
127
131
  view.updateBackground()
128
132
  }
129
133
 
@@ -241,6 +245,20 @@ class RNGestureHandlerButtonViewManager : ViewGroupManager<ButtonViewGroup>(), R
241
245
  _backgroundColor = color
242
246
  }
243
247
 
248
+ override fun onInitializeAccessibilityNodeInfo(info: AccessibilityNodeInfo) {
249
+ super.onInitializeAccessibilityNodeInfo(info)
250
+
251
+ // Expose the testID prop as the resource-id name of the view. Black-box E2E/UI testing
252
+ // frameworks, which interact with the UI through the accessibility framework, do not have
253
+ // access to view tags. This allows developers/testers to avoid polluting the
254
+ // content-description with test identifiers.
255
+ val testId = super.getTag(R.id.react_test_id)
256
+
257
+ if (testId is String) {
258
+ info.setViewIdResourceName(testId)
259
+ }
260
+ }
261
+
244
262
  override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
245
263
  if (super.onInterceptTouchEvent(ev)) {
246
264
  return true
@@ -60,7 +60,6 @@
60
60
  _lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view];
61
61
  [super touchesCancelled:touches withEvent:event];
62
62
  [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
63
- [self reset];
64
63
  }
65
64
 
66
65
  - (void)triggerAction
@@ -115,7 +115,6 @@ static const BOOL defaultFeedbackOnActivation = NO;
115
115
  {
116
116
  [super touchesCancelled:touches withEvent:event];
117
117
  [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
118
- [self reset];
119
118
  }
120
119
 
121
120
  - (void)handleForceWithTouches:(NSSet<RNGHUITouch *> *)touches
@@ -108,7 +108,6 @@
108
108
  {
109
109
  [super touchesCancelled:touches withEvent:event];
110
110
  [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
111
- [self reset];
112
111
  }
113
112
 
114
113
  #else
@@ -81,7 +81,6 @@
81
81
  {
82
82
  [super touchesCancelled:touches withEvent:event];
83
83
  [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
84
- [self reset];
85
84
  }
86
85
 
87
86
  #else
@@ -196,12 +196,9 @@
196
196
  - (void)interactionsCancelled:(NSSet *)touches withEvent:(UIEvent *)event
197
197
  {
198
198
  [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
199
-
200
199
  #if !TARGET_OS_TV && !TARGET_OS_OSX
201
200
  [self tryUpdateStylusData:event];
202
201
  #endif
203
-
204
- [self reset];
205
202
  }
206
203
 
207
204
  #if TARGET_OS_OSX
@@ -73,7 +73,6 @@
73
73
  - (void)interactionsCancelled:(NSSet *)touches withEvent:(UIEvent *)event
74
74
  {
75
75
  [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
76
- [self reset];
77
76
  }
78
77
 
79
78
  #if TARGET_OS_OSX
@@ -67,7 +67,6 @@
67
67
  - (void)interactionsCancelled:(NSSet *)touches withEvent:(UIEvent *)event
68
68
  {
69
69
  [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
70
- [self reset];
71
70
  }
72
71
 
73
72
  #if TARGET_OS_OSX
@@ -206,7 +206,6 @@ static const NSTimeInterval defaultMaxDuration = 0.5;
206
206
  {
207
207
  [super touchesCancelled:touches withEvent:event];
208
208
  [self interactionsCancelled:touches withEvent:event];
209
- [self reset];
210
209
  }
211
210
 
212
211
  #endif
@@ -26,6 +26,7 @@
26
26
  * Insets used when hit testing inside this view.
27
27
  */
28
28
  @property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;
29
+ @property (nonatomic, assign) CGFloat borderRadius;
29
30
  @property (nonatomic) BOOL userEnabled;
30
31
 
31
32
  #if TARGET_OS_OSX && RCT_NEW_ARCH_ENABLED
@@ -89,6 +89,57 @@
89
89
  }
90
90
  return inner;
91
91
  }
92
+
93
+ - (void)setBorderRadius:(CGFloat)radius
94
+ {
95
+ if (_borderRadius == radius) {
96
+ return;
97
+ }
98
+
99
+ _borderRadius = radius;
100
+ [self.layer setNeedsDisplay];
101
+ }
102
+
103
+ - (void)displayLayer:(CALayer *)layer
104
+ {
105
+ if (CGSizeEqualToSize(layer.bounds.size, CGSizeZero)) {
106
+ return;
107
+ }
108
+
109
+ const CGFloat radius = MAX(0, _borderRadius);
110
+ const CGSize size = self.bounds.size;
111
+ const CGFloat scaleFactor = RCTZeroIfNaN(MIN(1, size.width / (2 * radius)));
112
+ const CGFloat currentBorderRadius = radius * scaleFactor;
113
+ layer.cornerRadius = currentBorderRadius;
114
+ }
115
+
116
+ - (NSString *)accessibilityLabel
117
+ {
118
+ NSString *label = super.accessibilityLabel;
119
+ if (label) {
120
+ return label;
121
+ }
122
+ return RNGHRecursiveAccessibilityLabel(self);
123
+ }
124
+
125
+ // Vendored from RCTView.m to infer accessibility label from children
126
+ static NSString *RNGHRecursiveAccessibilityLabel(UIView *view)
127
+ {
128
+ NSMutableString *str = [NSMutableString stringWithString:@""];
129
+ for (UIView *subview in view.subviews) {
130
+ NSString *label = subview.accessibilityLabel;
131
+ if (!label) {
132
+ label = RNGHRecursiveAccessibilityLabel(subview);
133
+ }
134
+ if (label && label.length > 0) {
135
+ if (str.length > 0) {
136
+ [str appendString:@" "];
137
+ }
138
+ [str appendString:label];
139
+ }
140
+ }
141
+ return str.length == 0 ? nil : str;
142
+ }
92
143
  #endif
93
144
 
94
145
  #if TARGET_OS_OSX && RCT_NEW_ARCH_ENABLED
@@ -51,6 +51,7 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
51
51
  RNGestureHandlerRegistry *_registry;
52
52
  NSHashTable<RNRootViewGestureRecognizer *> *_rootViewGestureRecognizers;
53
53
  NSMutableDictionary<NSNumber *, NSNumber *> *_attachRetryCounter;
54
+ NSMutableSet *_droppedHandlers;
54
55
  #ifdef RCT_NEW_ARCH_ENABLED
55
56
  RCTModuleRegistry *_moduleRegistry;
56
57
  RCTViewRegistry *_viewRegistry;
@@ -90,6 +91,7 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
90
91
  _registry = [RNGestureHandlerRegistry new];
91
92
  _rootViewGestureRecognizers = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory];
92
93
  _attachRetryCounter = [[NSMutableDictionary alloc] init];
94
+ _droppedHandlers = [NSMutableSet set];
93
95
  }
94
96
 
95
97
  - (void)createGestureHandler:(NSString *)handlerName tag:(NSNumber *)handlerTag config:(NSDictionary *)config
@@ -168,7 +170,9 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
168
170
  [_attachRetryCounter setObject:counter forKey:viewTag];
169
171
 
170
172
  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
171
- [self attachGestureHandler:handlerTag toViewWithTag:viewTag withActionType:actionType];
173
+ if (![_droppedHandlers containsObject:handlerTag]) {
174
+ [self attachGestureHandler:handlerTag toViewWithTag:viewTag withActionType:actionType];
175
+ }
172
176
  });
173
177
  }
174
178
 
@@ -205,6 +209,7 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
205
209
  - (void)dropGestureHandler:(NSNumber *)handlerTag
206
210
  {
207
211
  [_registry dropHandlerWithTag:handlerTag];
212
+ [_droppedHandlers addObject:handlerTag];
208
213
  }
209
214
 
210
215
  - (void)dropAllGestureHandlers
@@ -71,6 +71,7 @@
71
71
  [super touchesCancelled:touches withEvent:event];
72
72
 
73
73
  _activePointers = 0;
74
+ self.state = UIGestureRecognizerStateCancelled;
74
75
  [self reset];
75
76
  }
76
77
 
@@ -1 +1 @@
1
- {"version":3,"sources":["ActionType.ts"],"names":["ActionType","REANIMATED_WORKLET","NATIVE_ANIMATED_EVENT","JS_FUNCTION_OLD_API","JS_FUNCTION_NEW_API"],"mappings":";;;;;;AAAO,MAAMA,UAAU,GAAG;AACxBC,EAAAA,kBAAkB,EAAE,CADI;AAExBC,EAAAA,qBAAqB,EAAE,CAFC;AAGxBC,EAAAA,mBAAmB,EAAE,CAHG;AAIxBC,EAAAA,mBAAmB,EAAE;AAJG,CAAnB,C,CAOP","sourcesContent":["export const ActionType = {\n REANIMATED_WORKLET: 1,\n NATIVE_ANIMATED_EVENT: 2,\n JS_FUNCTION_OLD_API: 3,\n JS_FUNCTION_NEW_API: 4,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type ActionType = typeof ActionType[keyof typeof ActionType];\n"]}
1
+ {"version":3,"sources":["ActionType.ts"],"names":["ActionType","REANIMATED_WORKLET","NATIVE_ANIMATED_EVENT","JS_FUNCTION_OLD_API","JS_FUNCTION_NEW_API"],"mappings":";;;;;;AAAO,MAAMA,UAAU,GAAG;AACxBC,EAAAA,kBAAkB,EAAE,CADI;AAExBC,EAAAA,qBAAqB,EAAE,CAFC;AAGxBC,EAAAA,mBAAmB,EAAE,CAHG;AAIxBC,EAAAA,mBAAmB,EAAE;AAJG,CAAnB,C,CAOP","sourcesContent":["export const ActionType = {\n REANIMATED_WORKLET: 1,\n NATIVE_ANIMATED_EVENT: 2,\n JS_FUNCTION_OLD_API: 3,\n JS_FUNCTION_NEW_API: 4,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type ActionType = (typeof ActionType)[keyof typeof ActionType];\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["Directions.ts"],"names":["RIGHT","LEFT","UP","DOWN","Directions","DiagonalDirections","UP_RIGHT","DOWN_RIGHT","UP_LEFT","DOWN_LEFT"],"mappings":";;;;;;AAAA,MAAMA,KAAK,GAAG,CAAd;AACA,MAAMC,IAAI,GAAG,CAAb;AACA,MAAMC,EAAE,GAAG,CAAX;AACA,MAAMC,IAAI,GAAG,CAAb,C,CAEA;;AACO,MAAMC,UAAU,GAAG;AACxBJ,EAAAA,KAAK,EAAEA,KADiB;AAExBC,EAAAA,IAAI,EAAEA,IAFkB;AAGxBC,EAAAA,EAAE,EAAEA,EAHoB;AAIxBC,EAAAA,IAAI,EAAEA;AAJkB,CAAnB,C,CAOP;;;AACO,MAAME,kBAAkB,GAAG;AAChCC,EAAAA,QAAQ,EAAEJ,EAAE,GAAGF,KADiB;AAEhCO,EAAAA,UAAU,EAAEJ,IAAI,GAAGH,KAFa;AAGhCQ,EAAAA,OAAO,EAAEN,EAAE,GAAGD,IAHkB;AAIhCQ,EAAAA,SAAS,EAAEN,IAAI,GAAGF;AAJc,CAA3B,C,CAOP","sourcesContent":["const RIGHT = 1;\nconst LEFT = 2;\nconst UP = 4;\nconst DOWN = 8;\n\n// Public interface\nexport const Directions = {\n RIGHT: RIGHT,\n LEFT: LEFT,\n UP: UP,\n DOWN: DOWN,\n} as const;\n\n// Internal interface\nexport const DiagonalDirections = {\n UP_RIGHT: UP | RIGHT,\n DOWN_RIGHT: DOWN | RIGHT,\n UP_LEFT: UP | LEFT,\n DOWN_LEFT: DOWN | LEFT,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type Directions = typeof Directions[keyof typeof Directions];\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type DiagonalDirections =\n typeof DiagonalDirections[keyof typeof DiagonalDirections];\n"]}
1
+ {"version":3,"sources":["Directions.ts"],"names":["RIGHT","LEFT","UP","DOWN","Directions","DiagonalDirections","UP_RIGHT","DOWN_RIGHT","UP_LEFT","DOWN_LEFT"],"mappings":";;;;;;AAAA,MAAMA,KAAK,GAAG,CAAd;AACA,MAAMC,IAAI,GAAG,CAAb;AACA,MAAMC,EAAE,GAAG,CAAX;AACA,MAAMC,IAAI,GAAG,CAAb,C,CAEA;;AACO,MAAMC,UAAU,GAAG;AACxBJ,EAAAA,KAAK,EAAEA,KADiB;AAExBC,EAAAA,IAAI,EAAEA,IAFkB;AAGxBC,EAAAA,EAAE,EAAEA,EAHoB;AAIxBC,EAAAA,IAAI,EAAEA;AAJkB,CAAnB,C,CAOP;;;AACO,MAAME,kBAAkB,GAAG;AAChCC,EAAAA,QAAQ,EAAEJ,EAAE,GAAGF,KADiB;AAEhCO,EAAAA,UAAU,EAAEJ,IAAI,GAAGH,KAFa;AAGhCQ,EAAAA,OAAO,EAAEN,EAAE,GAAGD,IAHkB;AAIhCQ,EAAAA,SAAS,EAAEN,IAAI,GAAGF;AAJc,CAA3B,C,CAOP","sourcesContent":["const RIGHT = 1;\nconst LEFT = 2;\nconst UP = 4;\nconst DOWN = 8;\n\n// Public interface\nexport const Directions = {\n RIGHT: RIGHT,\n LEFT: LEFT,\n UP: UP,\n DOWN: DOWN,\n} as const;\n\n// Internal interface\nexport const DiagonalDirections = {\n UP_RIGHT: UP | RIGHT,\n DOWN_RIGHT: DOWN | RIGHT,\n UP_LEFT: UP | LEFT,\n DOWN_LEFT: DOWN | LEFT,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type Directions = (typeof Directions)[keyof typeof Directions];\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type DiagonalDirections =\n (typeof DiagonalDirections)[keyof typeof DiagonalDirections];\n"]}
@@ -9,13 +9,26 @@ exports.isNewWebImplementationEnabled = isNewWebImplementationEnabled;
9
9
 
10
10
  var _reactNative = require("react-native");
11
11
 
12
+ var _utils = require("./utils");
13
+
12
14
  let useNewWebImplementation = true;
13
15
  let getWasCalled = false;
16
+ /**
17
+ * @deprecated new web implementation is enabled by default. This function will be removed in Gesture Handler 3
18
+ */
14
19
 
15
- function enableExperimentalWebImplementation(_shouldEnable = true) {// NO-OP since the new implementation is now the default
20
+ function enableExperimentalWebImplementation(_shouldEnable = true) {
21
+ // NO-OP since the new implementation is now the default
22
+ console.warn((0, _utils.tagMessage)('New web implementation is enabled by default. This function will be removed in Gesture Handler 3.'));
16
23
  }
24
+ /**
25
+ * @deprecated legacy implementation is no longer supported. This function will be removed in Gesture Handler 3
26
+ */
27
+
17
28
 
18
29
  function enableLegacyWebImplementation(shouldUseLegacyImplementation = true) {
30
+ console.warn((0, _utils.tagMessage)('Legacy web implementation is deprecated. This function will be removed in Gesture Handler 3.'));
31
+
19
32
  if (_reactNative.Platform.OS !== 'web' || useNewWebImplementation === !shouldUseLegacyImplementation) {
20
33
  return;
21
34
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["EnableNewWebImplementation.ts"],"names":["useNewWebImplementation","getWasCalled","enableExperimentalWebImplementation","_shouldEnable","enableLegacyWebImplementation","shouldUseLegacyImplementation","Platform","OS","console","error","isNewWebImplementationEnabled"],"mappings":";;;;;;;;;AAAA;;AAEA,IAAIA,uBAAuB,GAAG,IAA9B;AACA,IAAIC,YAAY,GAAG,KAAnB;;AAEO,SAASC,mCAAT,CACLC,aAAa,GAAG,IADX,EAEC,CACN;AACD;;AAEM,SAASC,6BAAT,CACLC,6BAA6B,GAAG,IAD3B,EAEC;AACN,MACEC,sBAASC,EAAT,KAAgB,KAAhB,IACAP,uBAAuB,KAAK,CAACK,6BAF/B,EAGE;AACA;AACD;;AAED,MAAIJ,YAAJ,EAAkB;AAChBO,IAAAA,OAAO,CAACC,KAAR,CACE,mLADF;AAGA;AACD;;AAEDT,EAAAA,uBAAuB,GAAG,CAACK,6BAA3B;AACD;;AAEM,SAASK,6BAAT,GAAkD;AACvDT,EAAAA,YAAY,GAAG,IAAf;AACA,SAAOD,uBAAP;AACD","sourcesContent":["import { Platform } from 'react-native';\n\nlet useNewWebImplementation = true;\nlet getWasCalled = false;\n\nexport function enableExperimentalWebImplementation(\n _shouldEnable = true\n): void {\n // NO-OP since the new implementation is now the default\n}\n\nexport function enableLegacyWebImplementation(\n shouldUseLegacyImplementation = true\n): void {\n if (\n Platform.OS !== 'web' ||\n useNewWebImplementation === !shouldUseLegacyImplementation\n ) {\n return;\n }\n\n if (getWasCalled) {\n console.error(\n 'Some parts of this application have already started using the new gesture handler implementation. No changes will be applied. You can try enabling legacy implementation earlier.'\n );\n return;\n }\n\n useNewWebImplementation = !shouldUseLegacyImplementation;\n}\n\nexport function isNewWebImplementationEnabled(): boolean {\n getWasCalled = true;\n return useNewWebImplementation;\n}\n"]}
1
+ {"version":3,"sources":["EnableNewWebImplementation.ts"],"names":["useNewWebImplementation","getWasCalled","enableExperimentalWebImplementation","_shouldEnable","console","warn","enableLegacyWebImplementation","shouldUseLegacyImplementation","Platform","OS","error","isNewWebImplementationEnabled"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA,IAAIA,uBAAuB,GAAG,IAA9B;AACA,IAAIC,YAAY,GAAG,KAAnB;AAEA;AACA;AACA;;AACO,SAASC,mCAAT,CACLC,aAAa,GAAG,IADX,EAEC;AACN;AACAC,EAAAA,OAAO,CAACC,IAAR,CACE,uBACE,mGADF,CADF;AAKD;AAED;AACA;AACA;;;AACO,SAASC,6BAAT,CACLC,6BAA6B,GAAG,IAD3B,EAEC;AACNH,EAAAA,OAAO,CAACC,IAAR,CACE,uBACE,8FADF,CADF;;AAMA,MACEG,sBAASC,EAAT,KAAgB,KAAhB,IACAT,uBAAuB,KAAK,CAACO,6BAF/B,EAGE;AACA;AACD;;AAED,MAAIN,YAAJ,EAAkB;AAChBG,IAAAA,OAAO,CAACM,KAAR,CACE,mLADF;AAGA;AACD;;AAEDV,EAAAA,uBAAuB,GAAG,CAACO,6BAA3B;AACD;;AAEM,SAASI,6BAAT,GAAkD;AACvDV,EAAAA,YAAY,GAAG,IAAf;AACA,SAAOD,uBAAP;AACD","sourcesContent":["import { Platform } from 'react-native';\nimport { tagMessage } from './utils';\n\nlet useNewWebImplementation = true;\nlet getWasCalled = false;\n\n/**\n * @deprecated new web implementation is enabled by default. This function will be removed in Gesture Handler 3\n */\nexport function enableExperimentalWebImplementation(\n _shouldEnable = true\n): void {\n // NO-OP since the new implementation is now the default\n console.warn(\n tagMessage(\n 'New web implementation is enabled by default. This function will be removed in Gesture Handler 3.'\n )\n );\n}\n\n/**\n * @deprecated legacy implementation is no longer supported. This function will be removed in Gesture Handler 3\n */\nexport function enableLegacyWebImplementation(\n shouldUseLegacyImplementation = true\n): void {\n console.warn(\n tagMessage(\n 'Legacy web implementation is deprecated. This function will be removed in Gesture Handler 3.'\n )\n );\n\n if (\n Platform.OS !== 'web' ||\n useNewWebImplementation === !shouldUseLegacyImplementation\n ) {\n return;\n }\n\n if (getWasCalled) {\n console.error(\n 'Some parts of this application have already started using the new gesture handler implementation. No changes will be applied. You can try enabling legacy implementation earlier.'\n );\n return;\n }\n\n useNewWebImplementation = !shouldUseLegacyImplementation;\n}\n\nexport function isNewWebImplementationEnabled(): boolean {\n getWasCalled = true;\n return useNewWebImplementation;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["State.ts"],"names":["State","UNDETERMINED","FAILED","BEGAN","CANCELLED","ACTIVE","END"],"mappings":";;;;;;AAAA;AAEO,MAAMA,KAAK,GAAG;AACnBC,EAAAA,YAAY,EAAE,CADK;AAEnBC,EAAAA,MAAM,EAAE,CAFW;AAGnBC,EAAAA,KAAK,EAAE,CAHY;AAInBC,EAAAA,SAAS,EAAE,CAJQ;AAKnBC,EAAAA,MAAM,EAAE,CALW;AAMnBC,EAAAA,GAAG,EAAE;AANc,CAAd,C,CASP","sourcesContent":["// TODO use State from RNModule\n\nexport const State = {\n UNDETERMINED: 0,\n FAILED: 1,\n BEGAN: 2,\n CANCELLED: 3,\n ACTIVE: 4,\n END: 5,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type State = typeof State[keyof typeof State];\n"]}
1
+ {"version":3,"sources":["State.ts"],"names":["State","UNDETERMINED","FAILED","BEGAN","CANCELLED","ACTIVE","END"],"mappings":";;;;;;AAAA;AAEO,MAAMA,KAAK,GAAG;AACnBC,EAAAA,YAAY,EAAE,CADK;AAEnBC,EAAAA,MAAM,EAAE,CAFW;AAGnBC,EAAAA,KAAK,EAAE,CAHY;AAInBC,EAAAA,SAAS,EAAE,CAJQ;AAKnBC,EAAAA,MAAM,EAAE,CALW;AAMnBC,EAAAA,GAAG,EAAE;AANc,CAAd,C,CASP","sourcesContent":["// TODO use State from RNModule\n\nexport const State = {\n UNDETERMINED: 0,\n FAILED: 1,\n BEGAN: 2,\n CANCELLED: 3,\n ACTIVE: 4,\n END: 5,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type State = (typeof State)[keyof typeof State];\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["TouchEventType.ts"],"names":["TouchEventType","UNDETERMINED","TOUCHES_DOWN","TOUCHES_MOVE","TOUCHES_UP","TOUCHES_CANCELLED"],"mappings":";;;;;;AAAO,MAAMA,cAAc,GAAG;AAC5BC,EAAAA,YAAY,EAAE,CADc;AAE5BC,EAAAA,YAAY,EAAE,CAFc;AAG5BC,EAAAA,YAAY,EAAE,CAHc;AAI5BC,EAAAA,UAAU,EAAE,CAJgB;AAK5BC,EAAAA,iBAAiB,EAAE;AALS,CAAvB,C,CAQP","sourcesContent":["export const TouchEventType = {\n UNDETERMINED: 0,\n TOUCHES_DOWN: 1,\n TOUCHES_MOVE: 2,\n TOUCHES_UP: 3,\n TOUCHES_CANCELLED: 4,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type TouchEventType = typeof TouchEventType[keyof typeof TouchEventType];\n"]}
1
+ {"version":3,"sources":["TouchEventType.ts"],"names":["TouchEventType","UNDETERMINED","TOUCHES_DOWN","TOUCHES_MOVE","TOUCHES_UP","TOUCHES_CANCELLED"],"mappings":";;;;;;AAAO,MAAMA,cAAc,GAAG;AAC5BC,EAAAA,YAAY,EAAE,CADc;AAE5BC,EAAAA,YAAY,EAAE,CAFc;AAG5BC,EAAAA,YAAY,EAAE,CAHc;AAI5BC,EAAAA,UAAU,EAAE,CAJgB;AAK5BC,EAAAA,iBAAiB,EAAE;AALS,CAAvB,C,CAQP","sourcesContent":["export const TouchEventType = {\n UNDETERMINED: 0,\n TOUCHES_DOWN: 1,\n TOUCHES_MOVE: 2,\n TOUCHES_UP: 3,\n TOUCHES_CANCELLED: 4,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type TouchEventType =\n (typeof TouchEventType)[keyof typeof TouchEventType];\n"]}