react-native-gesture-handler 2.9.0 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (224) hide show
  1. package/README.md +1 -0
  2. package/RNGestureHandler.podspec +1 -1
  3. package/android/build.gradle +69 -29
  4. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +1 -1
  5. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +2 -0
  6. package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +39 -0
  7. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +8 -2
  8. package/ios/Handlers/RNNativeViewHandler.mm +4 -4
  9. package/ios/RNGestureHandlerButtonComponentView.h +2 -2
  10. package/ios/RNGestureHandlerButtonComponentView.mm +2 -2
  11. package/ios/RNGestureHandlerManager.mm +9 -9
  12. package/ios/RNGestureHandlerModule.mm +16 -16
  13. package/ios/RNGestureHandlerRootViewComponentView.mm +2 -2
  14. package/ios/RNRootViewGestureRecognizer.m +3 -3
  15. package/lib/commonjs/EnableNewWebImplementation.js +35 -0
  16. package/lib/commonjs/EnableNewWebImplementation.js.map +1 -0
  17. package/lib/commonjs/GestureHandlerRootViewContext.js +15 -0
  18. package/lib/commonjs/GestureHandlerRootViewContext.js.map +1 -0
  19. package/lib/commonjs/RNGestureHandlerModule.macos.js +6 -6
  20. package/lib/commonjs/RNGestureHandlerModule.macos.js.map +1 -1
  21. package/lib/commonjs/RNGestureHandlerModule.web.js +6 -6
  22. package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
  23. package/lib/commonjs/RNGestureHandlerModule.windows.js +6 -6
  24. package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -1
  25. package/lib/commonjs/components/GestureComponents.web.js +6 -5
  26. package/lib/commonjs/components/GestureComponents.web.js.map +1 -1
  27. package/lib/commonjs/components/GestureHandlerButton.js +3 -5
  28. package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
  29. package/lib/commonjs/{GestureHandlerRootView.android.js → components/GestureHandlerRootView.android.js} +8 -7
  30. package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -0
  31. package/lib/commonjs/{GestureHandlerRootView.js → components/GestureHandlerRootView.js} +8 -2
  32. package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -0
  33. package/lib/commonjs/{GestureHandlerRootView.web.js → components/GestureHandlerRootView.web.js} +7 -1
  34. package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -0
  35. package/lib/commonjs/components/Swipeable.js +17 -3
  36. package/lib/commonjs/components/Swipeable.js.map +1 -1
  37. package/lib/commonjs/{gestureHandlerRootHOC.js.map → components/gestureHandlerRootHOC.js.map} +1 -1
  38. package/lib/commonjs/handlers/createHandler.js +21 -13
  39. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  40. package/lib/commonjs/handlers/gestureHandlerCommon.js +5 -4
  41. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
  42. package/lib/commonjs/handlers/gestures/GestureDetector.js +19 -9
  43. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
  44. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +22 -19
  45. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -1
  46. package/lib/commonjs/index.js +16 -4
  47. package/lib/commonjs/index.js.map +1 -1
  48. package/lib/commonjs/utils.js +0 -6
  49. package/lib/commonjs/utils.js.map +1 -1
  50. package/lib/commonjs/web/handlers/FlingGestureHandler.js +0 -5
  51. package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
  52. package/lib/commonjs/web/handlers/GestureHandler.js +3 -0
  53. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  54. package/lib/commonjs/web/handlers/ManualGestureHandler.js +0 -5
  55. package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
  56. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +0 -6
  57. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
  58. package/lib/commonjs/web/handlers/PanGestureHandler.js +2 -12
  59. package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
  60. package/lib/commonjs/web/handlers/PinchGestureHandler.js +0 -5
  61. package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
  62. package/lib/commonjs/web/handlers/RotationGestureHandler.js +0 -6
  63. package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
  64. package/lib/commonjs/web/handlers/TapGestureHandler.js +0 -6
  65. package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
  66. package/lib/commonjs/web/tools/CircularBuffer.js +59 -0
  67. package/lib/commonjs/web/tools/CircularBuffer.js.map +1 -0
  68. package/lib/commonjs/web/tools/LeastSquareSolver.js +204 -0
  69. package/lib/commonjs/web/tools/LeastSquareSolver.js.map +1 -0
  70. package/lib/commonjs/web/tools/PointerEventManager.js +27 -0
  71. package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
  72. package/lib/commonjs/web/tools/PointerTracker.js +11 -7
  73. package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
  74. package/lib/commonjs/web/tools/VelocityTracker.js +111 -0
  75. package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -0
  76. package/lib/commonjs/web_hammer/GestureHandler.js +1 -1
  77. package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
  78. package/lib/module/EnableNewWebImplementation.js +22 -0
  79. package/lib/module/EnableNewWebImplementation.js.map +1 -0
  80. package/lib/module/GestureHandlerRootViewContext.js +3 -0
  81. package/lib/module/GestureHandlerRootViewContext.js.map +1 -0
  82. package/lib/module/RNGestureHandlerModule.macos.js +6 -6
  83. package/lib/module/RNGestureHandlerModule.macos.js.map +1 -1
  84. package/lib/module/RNGestureHandlerModule.web.js +6 -6
  85. package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
  86. package/lib/module/RNGestureHandlerModule.windows.js +6 -6
  87. package/lib/module/RNGestureHandlerModule.windows.js.map +1 -1
  88. package/lib/module/components/GestureComponents.web.js +5 -6
  89. package/lib/module/components/GestureComponents.web.js.map +1 -1
  90. package/lib/module/components/GestureHandlerButton.js +1 -4
  91. package/lib/module/components/GestureHandlerButton.js.map +1 -1
  92. package/lib/module/components/GestureHandlerRootView.android.js +14 -0
  93. package/lib/module/components/GestureHandlerRootView.android.js.map +1 -0
  94. package/lib/module/{GestureHandlerRootView.js → components/GestureHandlerRootView.js} +5 -2
  95. package/lib/module/components/GestureHandlerRootView.js.map +1 -0
  96. package/lib/module/components/GestureHandlerRootView.web.js +9 -0
  97. package/lib/module/components/GestureHandlerRootView.web.js.map +1 -0
  98. package/lib/module/components/Swipeable.js +17 -3
  99. package/lib/module/components/Swipeable.js.map +1 -1
  100. package/lib/module/{gestureHandlerRootHOC.js.map → components/gestureHandlerRootHOC.js.map} +1 -1
  101. package/lib/module/handlers/createHandler.js +20 -13
  102. package/lib/module/handlers/createHandler.js.map +1 -1
  103. package/lib/module/handlers/gestureHandlerCommon.js +5 -4
  104. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
  105. package/lib/module/handlers/gestures/GestureDetector.js +18 -10
  106. package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
  107. package/lib/module/handlers/gestures/reanimatedWrapper.js +19 -16
  108. package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
  109. package/lib/module/index.js +4 -4
  110. package/lib/module/index.js.map +1 -1
  111. package/lib/module/utils.js +0 -4
  112. package/lib/module/utils.js.map +1 -1
  113. package/lib/module/web/handlers/FlingGestureHandler.js +0 -5
  114. package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
  115. package/lib/module/web/handlers/GestureHandler.js +3 -0
  116. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  117. package/lib/module/web/handlers/ManualGestureHandler.js +0 -5
  118. package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
  119. package/lib/module/web/handlers/NativeViewGestureHandler.js +0 -6
  120. package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
  121. package/lib/module/web/handlers/PanGestureHandler.js +2 -9
  122. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
  123. package/lib/module/web/handlers/PinchGestureHandler.js +0 -5
  124. package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
  125. package/lib/module/web/handlers/RotationGestureHandler.js +0 -6
  126. package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
  127. package/lib/module/web/handlers/TapGestureHandler.js +0 -6
  128. package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
  129. package/lib/module/web/tools/CircularBuffer.js +50 -0
  130. package/lib/module/web/tools/CircularBuffer.js.map +1 -0
  131. package/lib/module/web/tools/LeastSquareSolver.js +195 -0
  132. package/lib/module/web/tools/LeastSquareSolver.js.map +1 -0
  133. package/lib/module/web/tools/PointerEventManager.js +27 -0
  134. package/lib/module/web/tools/PointerEventManager.js.map +1 -1
  135. package/lib/module/web/tools/PointerTracker.js +8 -7
  136. package/lib/module/web/tools/PointerTracker.js.map +1 -1
  137. package/lib/module/web/tools/VelocityTracker.js +98 -0
  138. package/lib/module/web/tools/VelocityTracker.js.map +1 -0
  139. package/lib/module/web_hammer/GestureHandler.js +1 -1
  140. package/lib/module/web_hammer/GestureHandler.js.map +1 -1
  141. package/lib/typescript/EnableNewWebImplementation.d.ts +3 -0
  142. package/lib/typescript/GestureHandlerRootViewContext.d.ts +3 -0
  143. package/lib/typescript/components/GestureComponents.web.d.ts +1 -1
  144. package/lib/typescript/components/Swipeable.d.ts +12 -1
  145. package/lib/typescript/{gestureHandlerRootHOC.d.ts → components/gestureHandlerRootHOC.d.ts} +1 -1
  146. package/lib/typescript/index.d.ts +4 -4
  147. package/lib/typescript/utils.d.ts +0 -1
  148. package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +0 -1
  149. package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +0 -1
  150. package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +0 -1
  151. package/lib/typescript/web/handlers/PanGestureHandler.d.ts +0 -1
  152. package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +0 -1
  153. package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +0 -1
  154. package/lib/typescript/web/handlers/TapGestureHandler.d.ts +0 -1
  155. package/lib/typescript/web/tools/CircularBuffer.d.ts +11 -0
  156. package/lib/typescript/web/tools/LeastSquareSolver.d.ts +12 -0
  157. package/lib/typescript/web/tools/PointerEventManager.d.ts +2 -0
  158. package/lib/typescript/web/tools/PointerTracker.d.ts +1 -0
  159. package/lib/typescript/web/tools/VelocityTracker.d.ts +13 -0
  160. package/package.json +3 -3
  161. package/src/EnableNewWebImplementation.ts +35 -0
  162. package/src/GestureHandlerRootViewContext.ts +3 -0
  163. package/src/RNGestureHandlerModule.macos.ts +6 -6
  164. package/src/RNGestureHandlerModule.web.ts +6 -6
  165. package/src/RNGestureHandlerModule.windows.ts +6 -6
  166. package/src/components/GestureComponents.web.tsx +5 -6
  167. package/src/components/GestureHandlerButton.tsx +2 -7
  168. package/src/components/GestureHandlerRootView.android.tsx +24 -0
  169. package/src/{GestureHandlerRootView.tsx → components/GestureHandlerRootView.tsx} +7 -2
  170. package/src/{GestureHandlerRootView.web.tsx → components/GestureHandlerRootView.web.tsx} +6 -1
  171. package/src/components/Swipeable.tsx +30 -4
  172. package/src/{gestureHandlerRootHOC.tsx → components/gestureHandlerRootHOC.tsx} +1 -1
  173. package/src/handlers/createHandler.tsx +20 -9
  174. package/src/handlers/gestureHandlerCommon.ts +5 -6
  175. package/src/handlers/gestures/GestureDetector.tsx +19 -9
  176. package/src/handlers/gestures/reanimatedWrapper.ts +21 -20
  177. package/src/index.ts +7 -3
  178. package/src/utils.ts +0 -5
  179. package/src/web/handlers/FlingGestureHandler.ts +0 -5
  180. package/src/web/handlers/GestureHandler.ts +3 -0
  181. package/src/web/handlers/ManualGestureHandler.ts +0 -5
  182. package/src/web/handlers/NativeViewGestureHandler.ts +0 -6
  183. package/src/web/handlers/PanGestureHandler.ts +2 -9
  184. package/src/web/handlers/PinchGestureHandler.ts +0 -5
  185. package/src/web/handlers/RotationGestureHandler.ts +0 -7
  186. package/src/web/handlers/TapGestureHandler.ts +0 -6
  187. package/src/web/tools/CircularBuffer.ts +42 -0
  188. package/src/web/tools/LeastSquareSolver.ts +182 -0
  189. package/src/web/tools/PointerEventManager.ts +29 -0
  190. package/src/web/tools/PointerTracker.ts +7 -7
  191. package/src/web/tools/VelocityTracker.ts +98 -0
  192. package/src/web_hammer/GestureHandler.ts +1 -1
  193. package/lib/commonjs/EnableExperimentalWebImplementation.js +0 -31
  194. package/lib/commonjs/EnableExperimentalWebImplementation.js.map +0 -1
  195. package/lib/commonjs/GestureHandlerRootView.android.js.map +0 -1
  196. package/lib/commonjs/GestureHandlerRootView.js.map +0 -1
  197. package/lib/commonjs/GestureHandlerRootView.web.js.map +0 -1
  198. package/lib/module/EnableExperimentalWebImplementation.js +0 -20
  199. package/lib/module/EnableExperimentalWebImplementation.js.map +0 -1
  200. package/lib/module/GestureHandlerRootView.android.js +0 -14
  201. package/lib/module/GestureHandlerRootView.android.js.map +0 -1
  202. package/lib/module/GestureHandlerRootView.js.map +0 -1
  203. package/lib/module/GestureHandlerRootView.web.js +0 -6
  204. package/lib/module/GestureHandlerRootView.web.js.map +0 -1
  205. package/lib/typescript/EnableExperimentalWebImplementation.d.ts +0 -2
  206. package/src/EnableExperimentalWebImplementation.ts +0 -27
  207. package/src/GestureHandlerRootView.android.tsx +0 -24
  208. /package/lib/commonjs/{gestureHandlerRootHOC.js → components/gestureHandlerRootHOC.js} +0 -0
  209. /package/lib/commonjs/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js +0 -0
  210. /package/lib/commonjs/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js.map +0 -0
  211. /package/lib/commonjs/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js +0 -0
  212. /package/lib/commonjs/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js.map +0 -0
  213. /package/lib/module/{gestureHandlerRootHOC.js → components/gestureHandlerRootHOC.js} +0 -0
  214. /package/lib/module/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js +0 -0
  215. /package/lib/module/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js.map +0 -0
  216. /package/lib/module/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js +0 -0
  217. /package/lib/module/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js.map +0 -0
  218. /package/lib/typescript/{GestureHandlerRootView.android.d.ts → components/GestureHandlerRootView.android.d.ts} +0 -0
  219. /package/lib/typescript/{GestureHandlerRootView.d.ts → components/GestureHandlerRootView.d.ts} +0 -0
  220. /package/lib/typescript/{GestureHandlerRootView.web.d.ts → components/GestureHandlerRootView.web.d.ts} +0 -0
  221. /package/lib/typescript/{fabric → specs}/RNGestureHandlerButtonNativeComponent.d.ts +0 -0
  222. /package/lib/typescript/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.d.ts +0 -0
  223. /package/src/{fabric → specs}/RNGestureHandlerButtonNativeComponent.ts +0 -0
  224. /package/src/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.ts +0 -0
package/README.md CHANGED
@@ -39,6 +39,7 @@ You will need to have an Android or iOS device or emulator connected as well as
39
39
 
40
40
  | version | react-native version |
41
41
  | ------- | -------------------- |
42
+ | 2.10.0+ | 0.64.0+ |
42
43
  | 2.0.0+ | 0.63.0+ |
43
44
  | 1.4.0+ | 0.60.0+ |
44
45
  | 1.1.0+ | 0.57.2+ |
@@ -39,7 +39,7 @@ Pod::Spec.new do |s|
39
39
  'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
40
40
  }
41
41
  s.platforms = { ios: '11.0', tvos: '11.0' }
42
- s.compiler_flags = folly_compiler_flags + ' -DRN_FABRIC_ENABLED'
42
+ s.compiler_flags = folly_compiler_flags + ' -DRCT_NEW_ARCH_ENABLED'
43
43
 
44
44
  s.dependency "React"
45
45
  s.dependency "React-RCTFabric" # This is for fabric component
@@ -1,5 +1,7 @@
1
1
  import groovy.json.JsonSlurper
2
- import java.nio.file.Paths
2
+
3
+ import javax.inject.Inject
4
+ import java.nio.file.Files
3
5
 
4
6
  buildscript {
5
7
  def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['RNGH_kotlinVersion']
@@ -66,6 +68,14 @@ if (project == rootProject) {
66
68
  apply from: "spotless.gradle"
67
69
  }
68
70
 
71
+ def shouldAssertNoMultipleInstances() {
72
+ if (rootProject.hasProperty("disableMultipleInstancesCheck")) {
73
+ return rootProject.property("disableMultipleInstancesCheck") != "true"
74
+ } else {
75
+ return true
76
+ }
77
+ }
78
+
69
79
  // Check whether Reanimated 2.3 or higher is installed alongside Gesture Handler
70
80
  def shouldUseCommonInterfaceFromReanimated() {
71
81
  def reanimated = rootProject.subprojects.find { it.name == 'react-native-reanimated' }
@@ -85,28 +95,6 @@ def reactNativeArchitectures() {
85
95
  return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
86
96
  }
87
97
 
88
- def shouldAssertNoMultipleInstances() {
89
- if (rootProject.hasProperty("disableMultipleInstancesCheck")) {
90
- return rootProject.property("disableMultipleInstancesCheck") != "true"
91
- } else {
92
- return true
93
- }
94
- }
95
-
96
- def noMultipleInstancesAssertion() {
97
- Set<File> files = fileTree(rootDir.parent) {
98
- include "node_modules/**/react-native-gesture-handler/package.json"
99
- exclude "**/.yarn/**"
100
- exclude "**/.pnpm/**"
101
- }.files
102
-
103
- if (files.size() > 1) {
104
- String parsedLocation = files.stream().map({ File file -> "- " + file.toString().replace("/package.json", "") }).collect().join("\n")
105
- String exceptionMessage = "\n[Gesture Handler] Multiple instances of Gesture Handler were detected. Only one instance of react-native-gesture-handler can be installed in a project. You need to resolve the conflict manually. Check out the documentation: https://docs.swmansion.com/react-native-gesture-handler/docs/troubleshooting#multiple-instances-of-gesture-handler-were-detected \n\nConflict between: \n" + parsedLocation + "\n";
106
- throw new Exception(exceptionMessage);
107
- }
108
- }
109
-
110
98
  def REACT_NATIVE_DIR = resolveReactNativeDirectory()
111
99
 
112
100
  def reactProperties = new Properties()
@@ -115,23 +103,75 @@ file("$REACT_NATIVE_DIR/ReactAndroid/gradle.properties").withInputStream { react
115
103
  def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME")
116
104
  def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.startsWith("0.0.0-") ? 1000 : REACT_NATIVE_VERSION.split("\\.")[1].toInteger()
117
105
 
118
- def assertionTask = task assertNoMultipleInstances {
119
- onlyIf { shouldAssertNoMultipleInstances() }
120
- doFirst {
121
- noMultipleInstancesAssertion()
106
+
107
+ abstract class NoMultipleInstancesAssertionTask extends DefaultTask {
108
+ @Inject abstract ObjectFactory getObjectFactory()
109
+
110
+ @Input abstract Property<File> getProjectDirFile()
111
+ @Input abstract Property<File> getRootDirFile()
112
+ @Input abstract Property<Boolean> getShouldCheck()
113
+
114
+ def findGestureHandlerInstancesForPath(String path) {
115
+ return objectFactory.fileTree().from(path)
116
+ .include("**/react-native-gesture-handler/package.json")
117
+ .exclude("**/.yarn/**")
118
+ .exclude({ Files.isSymbolicLink(it.getFile().toPath()) })
119
+ .findAll()
120
+ }
121
+
122
+ @TaskAction
123
+ def check() {
124
+ if (shouldCheck.get()) {
125
+ // Assert there are no multiple installations of Gesture Handler
126
+ Set<File> files
127
+
128
+ if (projectDirFile.get().parent.contains(rootDirFile.get().parent)) {
129
+ // standard app
130
+ files = findGestureHandlerInstancesForPath(rootDirFile.get().parent + "/node_modules")
131
+ } else {
132
+ // monorepo
133
+ files = findGestureHandlerInstancesForPath(rootDirFile.get().parent + "/node_modules")
134
+ files.addAll(
135
+ findGestureHandlerInstancesForPath(projectDirFile.get().parentFile.parent)
136
+ )
137
+ }
138
+
139
+ if (files.size() > 1) {
140
+ String parsedLocation = files.stream().map({
141
+ File file -> "- " + file.toString().replace("/package.json", "")
142
+ }).collect().join("\n")
143
+ String exceptionMessage = "\n[react-native-gesture-handler] Multiple versions of Gesture Handler " +
144
+ "were detected. Only one instance of react-native-gesture-handler can be installed in a " +
145
+ "project. You need to resolve the conflict manually. Check out the documentation: " +
146
+ "https://docs.swmansion.com/react-native-gesture-handler/docs/troubleshooting" +
147
+ "#multiple-instances-of-gesture-handler-were-detected \n\nConflict between: \n" +
148
+ parsedLocation + "\n"
149
+ throw new GradleException(exceptionMessage)
150
+ }
151
+ }
122
152
  }
123
153
  }
124
154
 
125
- tasks.preBuild {
126
- dependsOn assertionTask
155
+ tasks.register('assertNoMultipleInstances', NoMultipleInstancesAssertionTask) {
156
+ shouldCheck = shouldAssertNoMultipleInstances()
157
+ rootDirFile = rootDir
158
+ projectDirFile = projectDir
127
159
  }
128
160
 
161
+ tasks.preBuild {
162
+ dependsOn assertNoMultipleInstances
163
+ }
164
+
129
165
  repositories {
130
166
  mavenCentral()
131
167
  }
132
168
 
133
169
  android {
134
170
  compileSdkVersion safeExtGet("compileSdkVersion", 28)
171
+ def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
172
+ if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
173
+ namespace "com.swmansion.gesturehandler"
174
+ }
135
175
 
136
176
  // Used to override the NDK path/version on internal CI or by allowing
137
177
  // users to customize the NDK path/version from their root project (e.g. for M1 support)
@@ -64,7 +64,7 @@ open class GestureHandler<ConcreteGestureHandlerT : GestureHandler<ConcreteGestu
64
64
  private var shouldCancelWhenOutside = false
65
65
  var numberOfPointers = 0
66
66
  private set
67
- private var orchestrator: GestureHandlerOrchestrator? = null
67
+ protected var orchestrator: GestureHandlerOrchestrator? = null
68
68
  private var onTouchEventListener: OnTouchEventListener? = null
69
69
  private var interactionController: GestureHandlerInteractionController? = null
70
70
 
@@ -50,6 +50,8 @@ class GestureHandlerOrchestrator(
50
50
  return true
51
51
  }
52
52
 
53
+ fun getHandlersForView(view: View) = handlerRegistry.getHandlersForView(view)
54
+
53
55
  private fun scheduleFinishedHandlersCleanup() {
54
56
  if (isHandlingTouch || handlingChangeSemaphore != 0) {
55
57
  finishedHandlersCleanupScheduled = true
@@ -5,6 +5,8 @@ import android.view.MotionEvent
5
5
  import android.view.View
6
6
  import android.view.ViewConfiguration
7
7
  import android.view.ViewGroup
8
+ import android.widget.ScrollView
9
+ import com.facebook.react.views.swiperefresh.ReactSwipeRefreshLayout
8
10
  import com.facebook.react.views.textinput.ReactEditText
9
11
 
10
12
  class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
@@ -72,6 +74,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
72
74
  when (val view = view) {
73
75
  is NativeViewGestureHandlerHook -> this.hook = view
74
76
  is ReactEditText -> this.hook = EditTextHook(this, view)
77
+ is ReactSwipeRefreshLayout -> this.hook = SwipeRefreshLayoutHook(this, view)
75
78
  }
76
79
  }
77
80
 
@@ -208,4 +211,40 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
208
211
 
209
212
  override fun shouldCancelRootViewGestureHandlerIfNecessary() = true
210
213
  }
214
+
215
+ private class SwipeRefreshLayoutHook(
216
+ private val handler: NativeViewGestureHandler,
217
+ private val swipeRefreshLayout: ReactSwipeRefreshLayout
218
+ ) : NativeViewGestureHandlerHook {
219
+ override fun wantsToHandleEventBeforeActivation() = true
220
+
221
+ override fun handleEventBeforeActivation(event: MotionEvent) {
222
+ // RefreshControl from GH is set up in a way that ScrollView wrapped with it should wait for
223
+ // it to fail. This way the RefreshControl is not canceled by the scroll handler.
224
+ // The problem with this approach is that the RefreshControl handler stays active all the time
225
+ // preventing scroll from activating.
226
+ // This is a workaround to prevent it from happening.
227
+
228
+ // First get the ScrollView under the RefreshControl, if there is none, return.
229
+ val scroll = swipeRefreshLayout.getChildAt(0) as? ScrollView ?: return
230
+
231
+ // Then find the first NativeViewGestureHandler attached to it
232
+ val scrollHandler = handler.orchestrator
233
+ ?.getHandlersForView(scroll)
234
+ ?.first {
235
+ it is NativeViewGestureHandler
236
+ }
237
+
238
+ // If handler was found, it's active and the ScrollView is not at the top, fail the RefreshControl
239
+ if (scrollHandler != null && scrollHandler.state == STATE_ACTIVE && scroll.scrollY > 0) {
240
+ handler.fail()
241
+ }
242
+
243
+ // The drawback is that the smooth transition from scrolling to refreshing in a single swipe
244
+ // is impossible this way and two swipes are required:
245
+ // - one to go back to top
246
+ // - one to actually refresh
247
+ // oh well ¯\_(ツ)_/¯
248
+ }
249
+ }
211
250
  }
@@ -229,12 +229,12 @@ class RNGestureHandlerButtonViewManager : ViewGroupManager<ButtonViewGroup>(), R
229
229
  colorDrawable.setCornerRadius(borderRadius)
230
230
  }
231
231
 
232
- val layerDrawable = LayerDrawable(arrayOf(colorDrawable, selectable))
232
+ val layerDrawable = LayerDrawable(if (selectable != null) arrayOf(colorDrawable, selectable) else arrayOf(colorDrawable))
233
233
  background = layerDrawable
234
234
  }
235
235
  }
236
236
 
237
- private fun createSelectableDrawable(): Drawable {
237
+ private fun createSelectableDrawable(): Drawable? {
238
238
  // TODO: remove once support for RN 0.63 is dropped, since 0.64 minSdkVersion is 21
239
239
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
240
240
  context.theme.resolveAttribute(android.R.attr.selectableItemBackground, resolveOutValue, true)
@@ -242,6 +242,12 @@ class RNGestureHandlerButtonViewManager : ViewGroupManager<ButtonViewGroup>(), R
242
242
  return resources.getDrawable(resolveOutValue.resourceId)
243
243
  }
244
244
 
245
+ // Since Android 13, alpha channel in RippleDrawable is clamped between [128, 255]
246
+ // see https://github.com/aosp-mirror/platform_frameworks_base/blob/c1bd0480261460584753508327ca8a0c6fc80758/graphics/java/android/graphics/drawable/RippleDrawable.java#L1012
247
+ if (rippleColor == Color.TRANSPARENT && Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
248
+ return null
249
+ }
250
+
245
251
  val states = arrayOf(intArrayOf(android.R.attr.state_enabled))
246
252
  val rippleRadius = rippleRadius
247
253
  val colorStateList = if (rippleColor != null) {
@@ -13,11 +13,11 @@
13
13
  #import <React/RCTConvert.h>
14
14
  #import <React/UIView+React.h>
15
15
 
16
- #ifdef RN_FABRIC_ENABLED
16
+ #ifdef RCT_NEW_ARCH_ENABLED
17
17
  #import <React/RCTScrollViewComponentView.h>
18
18
  #else
19
19
  #import <React/RCTScrollView.h>
20
- #endif // RN_FABRIC_ENABLED
20
+ #endif // RCT_NEW_ARCH_ENABLED
21
21
 
22
22
  #pragma mark RNDummyGestureRecognizer
23
23
 
@@ -110,7 +110,7 @@
110
110
  // We can restore default scrollview behaviour to delay touches to scrollview's children
111
111
  // because gesture handler system can handle cancellation of scroll recognizer when JS responder
112
112
  // is set
113
- #ifdef RN_FABRIC_ENABLED
113
+ #ifdef RCT_NEW_ARCH_ENABLED
114
114
  if ([view isKindOfClass:[RCTScrollViewComponentView class]]) {
115
115
  UIScrollView *scrollView = ((RCTScrollViewComponentView *)view).scrollView;
116
116
  scrollView.delaysContentTouches = YES;
@@ -123,7 +123,7 @@
123
123
  UIScrollView *scrollView = [view.subviews objectAtIndex:0];
124
124
  scrollView.delaysContentTouches = YES;
125
125
  }
126
- #endif // RN_FABRIC_ENABLED
126
+ #endif // RCT_NEW_ARCH_ENABLED
127
127
  }
128
128
 
129
129
  - (void)handleTouchDown:(UIView *)sender forEvent:(UIEvent *)event
@@ -1,4 +1,4 @@
1
- #ifdef RN_FABRIC_ENABLED
1
+ #ifdef RCT_NEW_ARCH_ENABLED
2
2
 
3
3
  #import <UIKit/UIKit.h>
4
4
 
@@ -14,4 +14,4 @@ NS_ASSUME_NONNULL_BEGIN
14
14
 
15
15
  NS_ASSUME_NONNULL_END
16
16
 
17
- #endif // RN_FABRIC_ENABLED
17
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -1,4 +1,4 @@
1
- #ifdef RN_FABRIC_ENABLED
1
+ #ifdef RCT_NEW_ARCH_ENABLED
2
2
 
3
3
  #import "RNGestureHandlerButtonComponentView.h"
4
4
 
@@ -57,4 +57,4 @@ Class<RCTComponentViewProtocol> RNGestureHandlerButtonCls(void)
57
57
  return RNGestureHandlerButtonComponentView.class;
58
58
  }
59
59
 
60
- #endif // RN_FABRIC_ENABLED
60
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -14,12 +14,12 @@
14
14
  #import "RNGestureHandlerState.h"
15
15
  #import "RNRootViewGestureRecognizer.h"
16
16
 
17
- #ifdef RN_FABRIC_ENABLED
17
+ #ifdef RCT_NEW_ARCH_ENABLED
18
18
  #import <React/RCTSurfaceTouchHandler.h>
19
19
  #import <React/RCTViewComponentView.h>
20
20
  #else
21
21
  #import <React/RCTTouchHandler.h>
22
- #endif // RN_FABRIC_ENABLED
22
+ #endif // RCT_NEW_ARCH_ENABLED
23
23
 
24
24
  #import "Handlers/RNFlingHandler.h"
25
25
  #import "Handlers/RNForceTouchHandler.h"
@@ -99,7 +99,7 @@
99
99
  {
100
100
  UIView *view = [_uiManager viewForReactTag:viewTag];
101
101
 
102
- #ifdef RN_FABRIC_ENABLED
102
+ #ifdef RCT_NEW_ARCH_ENABLED
103
103
  if (view == nil) {
104
104
  // Happens when the view with given tag has been flattened.
105
105
  // We cannot attach gesture handler to a non-existent view.
@@ -117,7 +117,7 @@
117
117
 
118
118
  view.reactTag = viewTag; // necessary for RNReanimated eventHash (e.g. "42onGestureHandlerEvent"), also will be
119
119
  // returned as event.target
120
- #endif // RN_FABRIC_ENABLED
120
+ #endif // RCT_NEW_ARCH_ENABLED
121
121
 
122
122
  [_registry attachHandlerWithTag:handlerTag toView:view withActionType:actionType];
123
123
 
@@ -207,7 +207,7 @@
207
207
  if ([gestureRecognizer.view isKindOfClass:[UIScrollView class]])
208
208
  return;
209
209
 
210
- #ifdef RN_FABRIC_ENABLED
210
+ #ifdef RCT_NEW_ARCH_ENABLED
211
211
  RCTSurfaceTouchHandler *touchHandler = [viewWithTouchHandler performSelector:@selector(touchHandler)];
212
212
  #else
213
213
  RCTTouchHandler *touchHandler = [viewWithTouchHandler performSelector:@selector(touchHandler)];
@@ -249,7 +249,7 @@
249
249
  - (void)sendEventForReanimated:(RNGestureHandlerStateChange *)event
250
250
  {
251
251
  // Delivers the event to Reanimated.
252
- #ifdef RN_FABRIC_ENABLED
252
+ #ifdef RCT_NEW_ARCH_ENABLED
253
253
  // Send event directly to Reanimated
254
254
  if (_reanimatedModule == nil) {
255
255
  _reanimatedModule = [_uiManager.bridge moduleForName:@"ReanimatedModule"];
@@ -260,7 +260,7 @@
260
260
  // In the old architecture, Reanimated overwrites RCTEventDispatcher
261
261
  // with REAEventDispatcher and intercepts all direct events.
262
262
  [self sendEventForDirectEvent:event];
263
- #endif // RN_FABRIC_ENABLED
263
+ #endif // RCT_NEW_ARCH_ENABLED
264
264
  }
265
265
 
266
266
  - (void)sendEventForNativeAnimatedEvent:(RNGestureHandlerStateChange *)event
@@ -275,11 +275,11 @@
275
275
  - (void)sendEventForJSFunctionOldAPI:(RNGestureHandlerStateChange *)event
276
276
  {
277
277
  // Delivers the event to JS (old RNGH API).
278
- #ifdef RN_FABRIC_ENABLED
278
+ #ifdef RCT_NEW_ARCH_ENABLED
279
279
  [self sendEventForDeviceEvent:event];
280
280
  #else
281
281
  [self sendEventForDirectEvent:event];
282
- #endif // RN_FABRIC_ENABLED
282
+ #endif // RCT_NEW_ARCH_ENABLED
283
283
  }
284
284
 
285
285
  - (void)sendEventForJSFunctionNewAPI:(RNGestureHandlerStateChange *)event
@@ -7,7 +7,7 @@
7
7
  #import <React/RCTUIManagerUtils.h>
8
8
  #import <React/RCTViewManager.h>
9
9
 
10
- #ifdef RN_FABRIC_ENABLED
10
+ #ifdef RCT_NEW_ARCH_ENABLED
11
11
  #import <React/RCTBridge+Private.h>
12
12
  #import <React/RCTBridge.h>
13
13
  #import <React/RCTSurfacePresenter.h>
@@ -16,7 +16,7 @@
16
16
  #import <ReactCommon/RCTTurboModule.h>
17
17
 
18
18
  #import <react/renderer/uimanager/primitives.h>
19
- #endif // RN_FABRIC_ENABLED
19
+ #endif // RCT_NEW_ARCH_ENABLED
20
20
 
21
21
  #import "RNGestureHandler.h"
22
22
  #import "RNGestureHandlerDirection.h"
@@ -26,12 +26,12 @@
26
26
  #import "RNGestureHandlerButton.h"
27
27
  #import "RNGestureHandlerStateManager.h"
28
28
 
29
- #ifdef RN_FABRIC_ENABLED
29
+ #ifdef RCT_NEW_ARCH_ENABLED
30
30
  using namespace facebook;
31
31
  using namespace react;
32
- #endif // RN_FABRIC_ENABLED
32
+ #endif // RCT_NEW_ARCH_ENABLED
33
33
 
34
- #ifdef RN_FABRIC_ENABLED
34
+ #ifdef RCT_NEW_ARCH_ENABLED
35
35
  @interface RNGestureHandlerModule () <RCTSurfacePresenterObserver, RNGestureHandlerStateManager>
36
36
 
37
37
  @end
@@ -39,7 +39,7 @@ using namespace react;
39
39
  @interface RNGestureHandlerModule () <RCTUIManagerObserver, RNGestureHandlerStateManager>
40
40
 
41
41
  @end
42
- #endif // RN_FABRIC_ENABLED
42
+ #endif // RCT_NEW_ARCH_ENABLED
43
43
 
44
44
  typedef void (^GestureHandlerOperation)(RNGestureHandlerManager *manager);
45
45
 
@@ -66,11 +66,11 @@ RCT_EXPORT_MODULE()
66
66
 
67
67
  _manager = nil;
68
68
 
69
- #ifdef RN_FABRIC_ENABLED
69
+ #ifdef RCT_NEW_ARCH_ENABLED
70
70
  [self.bridge.surfacePresenter removeObserver:self];
71
71
  #else
72
72
  [self.bridge.uiManager.observerCoordinator removeObserver:self];
73
- #endif // RN_FABRIC_ENABLED
73
+ #endif // RCT_NEW_ARCH_ENABLED
74
74
  }
75
75
 
76
76
  - (dispatch_queue_t)methodQueue
@@ -84,7 +84,7 @@ RCT_EXPORT_MODULE()
84
84
  return RCTGetUIManagerQueue();
85
85
  }
86
86
 
87
- #ifdef RN_FABRIC_ENABLED
87
+ #ifdef RCT_NEW_ARCH_ENABLED
88
88
  void decorateRuntime(jsi::Runtime &runtime)
89
89
  {
90
90
  auto isFormsStackingContext = jsi::Function::createFromHostFunction(
@@ -103,7 +103,7 @@ void decorateRuntime(jsi::Runtime &runtime)
103
103
  });
104
104
  runtime.global().setProperty(runtime, "isFormsStackingContext", std::move(isFormsStackingContext));
105
105
  }
106
- #endif // RN_FABRIC_ENABLED
106
+ #endif // RCT_NEW_ARCH_ENABLED
107
107
 
108
108
  - (void)setBridge:(RCTBridge *)bridge
109
109
  {
@@ -113,14 +113,14 @@ void decorateRuntime(jsi::Runtime &runtime)
113
113
  eventDispatcher:bridge.eventDispatcher];
114
114
  _operations = [NSMutableArray new];
115
115
 
116
- #ifdef RN_FABRIC_ENABLED
116
+ #ifdef RCT_NEW_ARCH_ENABLED
117
117
  [bridge.surfacePresenter addObserver:self];
118
118
  #else
119
119
  [bridge.uiManager.observerCoordinator addObserver:self];
120
- #endif // RN_FABRIC_ENABLED
120
+ #endif // RCT_NEW_ARCH_ENABLED
121
121
  }
122
122
 
123
- #ifdef RN_FABRIC_ENABLED
123
+ #ifdef RCT_NEW_ARCH_ENABLED
124
124
  RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
125
125
  {
126
126
  RCTCxxBridge *cxxBridge = (RCTCxxBridge *)self.bridge;
@@ -128,7 +128,7 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
128
128
  decorateRuntime(*runtime);
129
129
  return @true;
130
130
  }
131
- #endif // RN_FABRIC_ENABLED
131
+ #endif // RCT_NEW_ARCH_ENABLED
132
132
 
133
133
  RCT_EXPORT_METHOD(createGestureHandler
134
134
  : (nonnull NSString *)handlerName tag
@@ -239,7 +239,7 @@ RCT_EXPORT_METHOD(flushOperations)
239
239
 
240
240
  #pragma mark - RCTSurfacePresenterObserver
241
241
 
242
- #ifdef RN_FABRIC_ENABLED
242
+ #ifdef RCT_NEW_ARCH_ENABLED
243
243
 
244
244
  - (void)didMountComponentsWithRootTag:(NSInteger)rootTag
245
245
  {
@@ -282,7 +282,7 @@ RCT_EXPORT_METHOD(flushOperations)
282
282
  }];
283
283
  }
284
284
 
285
- #endif // RN_FABRIC_ENABLED
285
+ #endif // RCT_NEW_ARCH_ENABLED
286
286
 
287
287
  #pragma mark Events
288
288
 
@@ -1,4 +1,4 @@
1
- #ifdef RN_FABRIC_ENABLED
1
+ #ifdef RCT_NEW_ARCH_ENABLED
2
2
 
3
3
  #import <React/RCTFabricComponentsPlugins.h>
4
4
 
@@ -18,4 +18,4 @@ Class<RCTComponentViewProtocol> RNGestureHandlerRootViewCls(void)
18
18
  return nil;
19
19
  }
20
20
 
21
- #endif // RN_FABRIC_ENABLED
21
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -10,11 +10,11 @@
10
10
 
11
11
  #import <UIKit/UIGestureRecognizerSubclass.h>
12
12
 
13
- #ifdef RN_FABRIC_ENABLED
13
+ #ifdef RCT_NEW_ARCH_ENABLED
14
14
  #import <React/RCTSurfaceTouchHandler.h>
15
15
  #else
16
16
  #import <React/RCTTouchHandler.h>
17
- #endif // RN_FABRIC_ENABLED
17
+ #endif // RCT_NEW_ARCH_ENABLED
18
18
 
19
19
  @implementation RNRootViewGestureRecognizer {
20
20
  BOOL _active;
@@ -46,7 +46,7 @@
46
46
  - (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecognizer
47
47
  {
48
48
  return ![preventedGestureRecognizer isKindOfClass:[
49
- #ifdef RN_FABRIC_ENABLED
49
+ #ifdef RCT_NEW_ARCH_ENABLED
50
50
  RCTSurfaceTouchHandler
51
51
  #else
52
52
  RCTTouchHandler
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.enableExperimentalWebImplementation = enableExperimentalWebImplementation;
7
+ exports.enableLegacyWebImplementation = enableLegacyWebImplementation;
8
+ exports.isNewWebImplementationEnabled = isNewWebImplementationEnabled;
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ let useNewWebImplementation = true;
13
+ let getWasCalled = false;
14
+
15
+ function enableExperimentalWebImplementation(_shouldEnable = true) {// NO-OP since the new implementation is now the default
16
+ }
17
+
18
+ function enableLegacyWebImplementation(shouldUseLegacyImplementation = true) {
19
+ if (_reactNative.Platform.OS !== 'web' || useNewWebImplementation === !shouldUseLegacyImplementation) {
20
+ return;
21
+ }
22
+
23
+ if (getWasCalled) {
24
+ console.error('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.');
25
+ return;
26
+ }
27
+
28
+ useNewWebImplementation = !shouldUseLegacyImplementation;
29
+ }
30
+
31
+ function isNewWebImplementationEnabled() {
32
+ getWasCalled = true;
33
+ return useNewWebImplementation;
34
+ }
35
+ //# sourceMappingURL=EnableNewWebImplementation.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,15 @@
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
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ var _default = /*#__PURE__*/_react.default.createContext(false);
13
+
14
+ exports.default = _default;
15
+ //# sourceMappingURL=GestureHandlerRootViewContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["GestureHandlerRootViewContext.ts"],"names":["React","createContext"],"mappings":";;;;;;;AAAA;;;;4BAEeA,eAAMC,aAAN,CAAoB,KAApB,C","sourcesContent":["import React from 'react';\n\nexport default React.createContext(false);\n"]}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = exports.HammerGestures = exports.Gestures = void 0;
7
7
 
8
- var _EnableExperimentalWebImplementation = require("./EnableExperimentalWebImplementation");
8
+ var _EnableNewWebImplementation = require("./EnableNewWebImplementation");
9
9
 
10
10
  var _InteractionManager = _interopRequireDefault(require("./web/tools/InteractionManager"));
11
11
 
@@ -80,7 +80,7 @@ var _default = {
80
80
  },
81
81
 
82
82
  createGestureHandler(handlerName, handlerTag, config) {
83
- if ((0, _EnableExperimentalWebImplementation.isExperimentalWebImplementationEnabled)()) {
83
+ if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
84
84
  if (!(handlerName in Gestures)) {
85
85
  throw new Error(`react-native-gesture-handler: ${handlerName} is not supported on web.`);
86
86
  }
@@ -106,7 +106,7 @@ var _default = {
106
106
  },
107
107
 
108
108
  attachGestureHandler(handlerTag, newView, _actionType, propsRef) {
109
- if ((0, _EnableExperimentalWebImplementation.isExperimentalWebImplementationEnabled)()) {
109
+ if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
110
110
  _NodeManager.default.getHandler(handlerTag).init(newView, propsRef);
111
111
  } else {
112
112
  HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);
@@ -114,7 +114,7 @@ var _default = {
114
114
  },
115
115
 
116
116
  updateGestureHandler(handlerTag, newConfig) {
117
- if ((0, _EnableExperimentalWebImplementation.isExperimentalWebImplementationEnabled)()) {
117
+ if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
118
118
  _NodeManager.default.getHandler(handlerTag).updateGestureConfig(newConfig);
119
119
 
120
120
  _InteractionManager.default.getInstance().configureInteractions(_NodeManager.default.getHandler(handlerTag), newConfig);
@@ -124,7 +124,7 @@ var _default = {
124
124
  },
125
125
 
126
126
  getGestureHandlerNode(handlerTag) {
127
- if ((0, _EnableExperimentalWebImplementation.isExperimentalWebImplementationEnabled)()) {
127
+ if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
128
128
  return _NodeManager.default.getHandler(handlerTag);
129
129
  } else {
130
130
  return HammerNodeManager.getHandler(handlerTag);
@@ -132,7 +132,7 @@ var _default = {
132
132
  },
133
133
 
134
134
  dropGestureHandler(handlerTag) {
135
- if ((0, _EnableExperimentalWebImplementation.isExperimentalWebImplementationEnabled)()) {
135
+ if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
136
136
  _NodeManager.default.dropGestureHandler(handlerTag);
137
137
  } else {
138
138
  HammerNodeManager.dropGestureHandler(handlerTag);