react-native-gesture-handler 2.21.2 → 2.22.0-rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. package/README.md +1 -3
  2. package/android/build.gradle +10 -0
  3. package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +3 -2
  4. package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerDelegate.java +3 -2
  5. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +16 -0
  6. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +1 -1
  7. package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +45 -8
  8. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +18 -0
  9. package/apple/Handlers/RNFlingHandler.m +0 -1
  10. package/apple/Handlers/RNForceTouchHandler.m +0 -1
  11. package/apple/Handlers/RNLongPressHandler.m +0 -1
  12. package/apple/Handlers/RNManualHandler.m +0 -1
  13. package/apple/Handlers/RNPanHandler.m +0 -3
  14. package/apple/Handlers/RNPinchHandler.m +0 -1
  15. package/apple/Handlers/RNRotationHandler.m +0 -1
  16. package/apple/Handlers/RNTapHandler.m +0 -1
  17. package/apple/RNGestureHandlerButton.h +1 -0
  18. package/apple/RNGestureHandlerButton.mm +51 -0
  19. package/apple/RNGestureHandlerManager.mm +6 -1
  20. package/apple/RNManualActivationRecognizer.m +1 -0
  21. package/lib/commonjs/ActionType.js.map +1 -1
  22. package/lib/commonjs/Directions.js.map +1 -1
  23. package/lib/commonjs/EnableNewWebImplementation.js +14 -1
  24. package/lib/commonjs/EnableNewWebImplementation.js.map +1 -1
  25. package/lib/commonjs/State.js.map +1 -1
  26. package/lib/commonjs/TouchEventType.js.map +1 -1
  27. package/lib/commonjs/components/Pressable/Pressable.js +1 -1
  28. package/lib/commonjs/components/Pressable/Pressable.js.map +1 -1
  29. package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -1
  30. package/lib/commonjs/components/Swipeable.js.map +1 -1
  31. package/lib/commonjs/components/Text.js +61 -0
  32. package/lib/commonjs/components/Text.js.map +1 -0
  33. package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
  34. package/lib/commonjs/getShadowNodeFromRef.js +10 -2
  35. package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
  36. package/lib/commonjs/ghQueueMicrotask.js.map +1 -1
  37. package/lib/commonjs/handlers/createHandler.js +12 -0
  38. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  39. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
  40. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +4 -0
  41. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  42. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +4 -0
  43. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  44. package/lib/commonjs/handlers/gestures/GestureDetector/index.js +3 -0
  45. package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
  46. package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js +48 -0
  47. package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -0
  48. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
  49. package/lib/commonjs/handlers/utils.js +1 -0
  50. package/lib/commonjs/handlers/utils.js.map +1 -1
  51. package/lib/commonjs/index.js +8 -0
  52. package/lib/commonjs/index.js.map +1 -1
  53. package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
  54. package/lib/commonjs/mountRegistry.js +49 -0
  55. package/lib/commonjs/mountRegistry.js.map +1 -0
  56. package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
  57. package/lib/commonjs/web/handlers/FlingGestureHandler.js +0 -4
  58. package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
  59. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  60. package/lib/commonjs/web/handlers/HoverGestureHandler.js +0 -14
  61. package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -1
  62. package/lib/commonjs/web/handlers/ManualGestureHandler.js +0 -14
  63. package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
  64. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +3 -5
  65. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
  66. package/lib/commonjs/web/handlers/PanGestureHandler.js +0 -4
  67. package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
  68. package/lib/commonjs/web/handlers/PinchGestureHandler.js +0 -10
  69. package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
  70. package/lib/commonjs/web/handlers/RotationGestureHandler.js +0 -14
  71. package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
  72. package/lib/commonjs/web/handlers/TapGestureHandler.js +0 -4
  73. package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
  74. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  75. package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
  76. package/lib/commonjs/web_hammer/PressGestureHandler.js.map +1 -1
  77. package/lib/module/ActionType.js.map +1 -1
  78. package/lib/module/Directions.js.map +1 -1
  79. package/lib/module/EnableNewWebImplementation.js +14 -1
  80. package/lib/module/EnableNewWebImplementation.js.map +1 -1
  81. package/lib/module/State.js.map +1 -1
  82. package/lib/module/TouchEventType.js.map +1 -1
  83. package/lib/module/components/Pressable/Pressable.js +1 -1
  84. package/lib/module/components/Pressable/Pressable.js.map +1 -1
  85. package/lib/module/components/ReanimatedSwipeable.js.map +1 -1
  86. package/lib/module/components/Swipeable.js.map +1 -1
  87. package/lib/module/components/Text.js +44 -0
  88. package/lib/module/components/Text.js.map +1 -0
  89. package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
  90. package/lib/module/getShadowNodeFromRef.js +10 -2
  91. package/lib/module/getShadowNodeFromRef.js.map +1 -1
  92. package/lib/module/ghQueueMicrotask.js.map +1 -1
  93. package/lib/module/handlers/createHandler.js +11 -0
  94. package/lib/module/handlers/createHandler.js.map +1 -1
  95. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
  96. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +3 -0
  97. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  98. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +2 -0
  99. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  100. package/lib/module/handlers/gestures/GestureDetector/index.js +2 -0
  101. package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
  102. package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js +39 -0
  103. package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -0
  104. package/lib/module/handlers/gestures/gesture.js.map +1 -1
  105. package/lib/module/handlers/utils.js +1 -3
  106. package/lib/module/handlers/utils.js.map +1 -1
  107. package/lib/module/index.js +1 -0
  108. package/lib/module/index.js.map +1 -1
  109. package/lib/module/jestUtils/jestUtils.js.map +1 -1
  110. package/lib/module/mountRegistry.js +40 -0
  111. package/lib/module/mountRegistry.js.map +1 -0
  112. package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
  113. package/lib/module/web/handlers/FlingGestureHandler.js +0 -4
  114. package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
  115. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  116. package/lib/module/web/handlers/HoverGestureHandler.js +0 -14
  117. package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
  118. package/lib/module/web/handlers/ManualGestureHandler.js +0 -14
  119. package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
  120. package/lib/module/web/handlers/NativeViewGestureHandler.js +3 -5
  121. package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
  122. package/lib/module/web/handlers/PanGestureHandler.js +0 -4
  123. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
  124. package/lib/module/web/handlers/PinchGestureHandler.js +0 -10
  125. package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
  126. package/lib/module/web/handlers/RotationGestureHandler.js +0 -14
  127. package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
  128. package/lib/module/web/handlers/TapGestureHandler.js +0 -4
  129. package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
  130. package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  131. package/lib/module/web_hammer/GestureHandler.js.map +1 -1
  132. package/lib/module/web_hammer/PressGestureHandler.js.map +1 -1
  133. package/lib/typescript/ActionType.d.ts +1 -1
  134. package/lib/typescript/Directions.d.ts +2 -2
  135. package/lib/typescript/EnableNewWebImplementation.d.ts +6 -0
  136. package/lib/typescript/State.d.ts +1 -1
  137. package/lib/typescript/TouchEventType.d.ts +1 -1
  138. package/lib/typescript/components/GestureButtonsProps.d.ts +2 -2
  139. package/lib/typescript/components/Text.d.ts +4 -0
  140. package/lib/typescript/components/touchables/GenericTouchable.d.ts +1 -1
  141. package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +2 -2
  142. package/lib/typescript/handlers/gestures/GestureDetector/useMountReactions.d.ts +2 -0
  143. package/lib/typescript/handlers/gestures/gesture.d.ts +1 -1
  144. package/lib/typescript/handlers/utils.d.ts +1 -0
  145. package/lib/typescript/index.d.ts +1 -0
  146. package/lib/typescript/mocks.d.ts +3 -3
  147. package/lib/typescript/mountRegistry.d.ts +17 -0
  148. package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +0 -2
  149. package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +1 -4
  150. package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +1 -4
  151. package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +0 -1
  152. package/lib/typescript/web/handlers/PanGestureHandler.d.ts +0 -2
  153. package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +1 -2
  154. package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +1 -3
  155. package/lib/typescript/web/handlers/TapGestureHandler.d.ts +0 -2
  156. package/package.json +16 -17
  157. package/src/ActionType.ts +1 -1
  158. package/src/Directions.ts +2 -2
  159. package/src/EnableNewWebImplementation.ts +18 -0
  160. package/src/State.ts +1 -1
  161. package/src/TouchEventType.ts +2 -1
  162. package/src/components/GestureButtonsProps.ts +4 -2
  163. package/src/components/Pressable/Pressable.tsx +3 -3
  164. package/src/components/ReanimatedSwipeable.tsx +8 -8
  165. package/src/components/Swipeable.tsx +4 -4
  166. package/src/components/Text.tsx +60 -0
  167. package/src/components/touchables/GenericTouchable.tsx +1 -1
  168. package/src/getShadowNodeFromRef.ts +8 -2
  169. package/src/ghQueueMicrotask.ts +2 -2
  170. package/src/handlers/GestureHandlerEventPayload.ts +2 -2
  171. package/src/handlers/createHandler.tsx +14 -1
  172. package/src/handlers/gestureHandlerCommon.ts +3 -3
  173. package/src/handlers/gestures/GestureDetector/attachHandlers.ts +3 -0
  174. package/src/handlers/gestures/GestureDetector/dropHandlers.ts +3 -0
  175. package/src/handlers/gestures/GestureDetector/index.tsx +3 -0
  176. package/src/handlers/gestures/GestureDetector/useMountReactions.ts +51 -0
  177. package/src/handlers/gestures/gesture.ts +3 -3
  178. package/src/handlers/utils.ts +2 -1
  179. package/src/index.ts +1 -0
  180. package/src/jestUtils/jestUtils.ts +10 -12
  181. package/src/mountRegistry.ts +51 -0
  182. package/src/web/detectors/ScaleGestureDetector.ts +1 -1
  183. package/src/web/handlers/FlingGestureHandler.ts +0 -4
  184. package/src/web/handlers/GestureHandler.ts +1 -3
  185. package/src/web/handlers/HoverGestureHandler.ts +1 -9
  186. package/src/web/handlers/ManualGestureHandler.ts +1 -9
  187. package/src/web/handlers/NativeViewGestureHandler.ts +5 -5
  188. package/src/web/handlers/PanGestureHandler.ts +0 -4
  189. package/src/web/handlers/PinchGestureHandler.ts +1 -5
  190. package/src/web/handlers/RotationGestureHandler.ts +1 -9
  191. package/src/web/handlers/TapGestureHandler.ts +0 -4
  192. package/src/web/tools/GestureHandlerWebDelegate.ts +4 -4
  193. package/src/web_hammer/GestureHandler.ts +1 -1
  194. package/src/web_hammer/PressGestureHandler.ts +7 -4
  195. package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +0 -86
@@ -8,9 +8,17 @@ export function getShadowNodeFromRef(ref) {
8
8
  // Load findHostInstance_DEPRECATED lazily because it may not be available before render
9
9
  if (findHostInstance_DEPRECATED === undefined) {
10
10
  try {
11
+ var _ReactFabric$default;
12
+
13
+ // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment
14
+ const ReactFabric = require('react-native/Libraries/Renderer/shims/ReactFabric'); // Since RN 0.77 ReactFabric exports findHostInstance_DEPRECATED in default object so we're trying to
15
+ // access it first, then fallback on named export
11
16
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
12
- findHostInstance_DEPRECATED = // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access
13
- require('react-native/Libraries/Renderer/shims/ReactFabric').findHostInstance_DEPRECATED;
17
+
18
+
19
+ findHostInstance_DEPRECATED = // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
20
+ (ReactFabric === null || ReactFabric === void 0 ? void 0 : (_ReactFabric$default = ReactFabric.default) === null || _ReactFabric$default === void 0 ? void 0 : _ReactFabric$default.findHostInstance_DEPRECATED) || ( // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
21
+ ReactFabric === null || ReactFabric === void 0 ? void 0 : ReactFabric.findHostInstance_DEPRECATED);
14
22
  } catch (e) {
15
23
  findHostInstance_DEPRECATED = _ref => null;
16
24
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["getShadowNodeFromRef.ts"],"names":["findHostInstance_DEPRECATED","getInternalInstanceHandleFromPublicInstance","getShadowNodeFromRef","ref","undefined","require","e","_ref","_internalInstanceHandle","stateNode","node"],"mappings":"AAAA;AACA;AACA;AACA;AACA,IAAIA,2BAAJ;AACA,IAAIC,2CAAJ;AAIA,OAAO,SAASC,oBAAT,CAA8BC,GAA9B,EAA4C;AACjD;AACA,MAAIH,2BAA2B,KAAKI,SAApC,EAA+C;AAC7C,QAAI;AACF;AACAJ,MAAAA,2BAA2B,GACzB;AACAK,MAAAA,OAAO,CAAC,mDAAD,CAAP,CAA6DL,2BAF/D;AAGD,KALD,CAKE,OAAOM,CAAP,EAAU;AACVN,MAAAA,2BAA2B,GAAIO,IAAD,IAAmB,IAAjD;AACD;AACF,GAXgD,CAajD;;;AACA,MAAIN,2CAA2C,KAAKG,SAApD,EAA+D;AAC7D,QAAI;AAAA;;AACF;AACAH,MAAAA,2CAA2C,GACzC;AADyC,+BAEzCI,OAAO,CAAC,wFAAD,CAAP,CACGJ,2CAHsC,yEAIzC;AACEE,MAAAA,GAAD,IAAcA,GAAG,CAACK,uBALrB;AAMD,KARD,CAQE,OAAOF,CAAP,EAAU;AACVL,MAAAA,2CAA2C,GAAIE,GAAD,IAC5C;AACAA,MAAAA,GAAG,CAACK,uBAFN;AAGD;AACF,GA5BgD,CA8BjD;;;AACA,SAAOP,2CAA2C,CAChDD,2BAA2B,CAACG,GAAD,CADqB,CAA3C,CAELM,SAFK,CAEKC,IAFZ;AAGD","sourcesContent":["// Used by GestureDetector (unsupported on web at the moment) to check whether the\n// attached view may get flattened on Fabric. This implementation causes errors\n// on web due to the static resolution of `require` statements by webpack breaking\n// the conditional importing. Solved by making .web file.\nlet findHostInstance_DEPRECATED: (ref: unknown) => void;\nlet getInternalInstanceHandleFromPublicInstance: (ref: unknown) => {\n stateNode: { node: unknown };\n};\n\nexport function getShadowNodeFromRef(ref: unknown) {\n // Load findHostInstance_DEPRECATED lazily because it may not be available before render\n if (findHostInstance_DEPRECATED === undefined) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n findHostInstance_DEPRECATED =\n // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access\n require('react-native/Libraries/Renderer/shims/ReactFabric').findHostInstance_DEPRECATED;\n } catch (e) {\n findHostInstance_DEPRECATED = (_ref: unknown) => null;\n }\n }\n\n // Load findHostInstance_DEPRECATED lazily because it may not be available before render\n if (getInternalInstanceHandleFromPublicInstance === undefined) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n getInternalInstanceHandleFromPublicInstance =\n // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access\n require('react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')\n .getInternalInstanceHandleFromPublicInstance ??\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n ((ref: any) => ref._internalInstanceHandle);\n } catch (e) {\n getInternalInstanceHandleFromPublicInstance = (ref: any) =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n ref._internalInstanceHandle;\n }\n }\n\n // @ts-ignore Fabric\n return getInternalInstanceHandleFromPublicInstance(\n findHostInstance_DEPRECATED(ref)\n ).stateNode.node;\n}\n"]}
1
+ {"version":3,"sources":["getShadowNodeFromRef.ts"],"names":["findHostInstance_DEPRECATED","getInternalInstanceHandleFromPublicInstance","getShadowNodeFromRef","ref","undefined","ReactFabric","require","default","e","_ref","_internalInstanceHandle","stateNode","node"],"mappings":"AAAA;AACA;AACA;AACA;AACA,IAAIA,2BAAJ;AACA,IAAIC,2CAAJ;AAIA,OAAO,SAASC,oBAAT,CAA8BC,GAA9B,EAA4C;AACjD;AACA,MAAIH,2BAA2B,KAAKI,SAApC,EAA+C;AAC7C,QAAI;AAAA;;AACF;AACA,YAAMC,WAAW,GAAGC,OAAO,CAAC,mDAAD,CAA3B,CAFE,CAGF;AACA;AACA;;;AACAN,MAAAA,2BAA2B,GACzB;AACA,OAAAK,WAAW,SAAX,IAAAA,WAAW,WAAX,oCAAAA,WAAW,CAAEE,OAAb,8EAAsBP,2BAAtB,OACA;AACAK,MAAAA,WAFA,aAEAA,WAFA,uBAEAA,WAAW,CAAEL,2BAFb,CAFF;AAKD,KAXD,CAWE,OAAOQ,CAAP,EAAU;AACVR,MAAAA,2BAA2B,GAAIS,IAAD,IAAmB,IAAjD;AACD;AACF,GAjBgD,CAmBjD;;;AACA,MAAIR,2CAA2C,KAAKG,SAApD,EAA+D;AAC7D,QAAI;AAAA;;AACF;AACAH,MAAAA,2CAA2C,GACzC;AADyC,+BAEzCK,OAAO,CAAC,wFAAD,CAAP,CACGL,2CAHsC,yEAIzC;AACEE,MAAAA,GAAD,IAAcA,GAAG,CAACO,uBALrB;AAMD,KARD,CAQE,OAAOF,CAAP,EAAU;AACVP,MAAAA,2CAA2C,GAAIE,GAAD,IAC5C;AACAA,MAAAA,GAAG,CAACO,uBAFN;AAGD;AACF,GAlCgD,CAoCjD;;;AACA,SAAOT,2CAA2C,CAChDD,2BAA2B,CAACG,GAAD,CADqB,CAA3C,CAELQ,SAFK,CAEKC,IAFZ;AAGD","sourcesContent":["// Used by GestureDetector (unsupported on web at the moment) to check whether the\n// attached view may get flattened on Fabric. This implementation causes errors\n// on web due to the static resolution of `require` statements by webpack breaking\n// the conditional importing. Solved by making .web file.\nlet findHostInstance_DEPRECATED: (ref: unknown) => void;\nlet getInternalInstanceHandleFromPublicInstance: (ref: unknown) => {\n stateNode: { node: unknown };\n};\n\nexport function getShadowNodeFromRef(ref: unknown) {\n // Load findHostInstance_DEPRECATED lazily because it may not be available before render\n if (findHostInstance_DEPRECATED === undefined) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment\n const ReactFabric = require('react-native/Libraries/Renderer/shims/ReactFabric');\n // Since RN 0.77 ReactFabric exports findHostInstance_DEPRECATED in default object so we're trying to\n // access it first, then fallback on named export\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n findHostInstance_DEPRECATED =\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ReactFabric?.default?.findHostInstance_DEPRECATED ||\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ReactFabric?.findHostInstance_DEPRECATED;\n } catch (e) {\n findHostInstance_DEPRECATED = (_ref: unknown) => null;\n }\n }\n\n // Load findHostInstance_DEPRECATED lazily because it may not be available before render\n if (getInternalInstanceHandleFromPublicInstance === undefined) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n getInternalInstanceHandleFromPublicInstance =\n // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access\n require('react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')\n .getInternalInstanceHandleFromPublicInstance ??\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n ((ref: any) => ref._internalInstanceHandle);\n } catch (e) {\n getInternalInstanceHandleFromPublicInstance = (ref: any) =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n ref._internalInstanceHandle;\n }\n }\n\n // @ts-ignore Fabric\n return getInternalInstanceHandleFromPublicInstance(\n findHostInstance_DEPRECATED(ref)\n ).stateNode.node;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["ghQueueMicrotask.ts"],"names":["ghQueueMicrotask","setImmediate","bind","requestAnimationFrame","queueMicrotask"],"mappings":"AAAA;AACA;AACA,OAAO,MAAMA,gBAAgB,GAC3B,OAAOC,YAAP,KAAwB,UAAxB,GACIA,YAAY,CAACC,IAAb,CAAkB,IAAlB,CADJ,GAEI,OAAOC,qBAAP,KAAiC,UAAjC,GACAA,qBAAqB,CAACD,IAAtB,CAA2B,IAA3B,CADA,GAEAE,cAAc,CAACF,IAAf,CAAoB,IAApB,CALC","sourcesContent":["// We check for typeof requestAnimationFrame because of SSR\n// Functions are bound to null to avoid issues with scope when using Metro inline requires.\nexport const ghQueueMicrotask =\n typeof setImmediate === 'function'\n ? setImmediate.bind(null)\n : typeof requestAnimationFrame === 'function'\n ? requestAnimationFrame.bind(null)\n : queueMicrotask.bind(null);\n"]}
1
+ {"version":3,"sources":["ghQueueMicrotask.ts"],"names":["ghQueueMicrotask","setImmediate","bind","requestAnimationFrame","queueMicrotask"],"mappings":"AAAA;AACA;AACA,OAAO,MAAMA,gBAAgB,GAC3B,OAAOC,YAAP,KAAwB,UAAxB,GACIA,YAAY,CAACC,IAAb,CAAkB,IAAlB,CADJ,GAEI,OAAOC,qBAAP,KAAiC,UAAjC,GACEA,qBAAqB,CAACD,IAAtB,CAA2B,IAA3B,CADF,GAEEE,cAAc,CAACF,IAAf,CAAoB,IAApB,CALD","sourcesContent":["// We check for typeof requestAnimationFrame because of SSR\n// Functions are bound to null to avoid issues with scope when using Metro inline requires.\nexport const ghQueueMicrotask =\n typeof setImmediate === 'function'\n ? setImmediate.bind(null)\n : typeof requestAnimationFrame === 'function'\n ? requestAnimationFrame.bind(null)\n : queueMicrotask.bind(null);\n"]}
@@ -16,6 +16,7 @@ import { ActionType } from '../ActionType';
16
16
  import { PressabilityDebugView } from './PressabilityDebugView';
17
17
  import GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';
18
18
  import { ghQueueMicrotask } from '../ghQueueMicrotask';
19
+ import { MountRegistry } from '../mountRegistry';
19
20
  const UIManagerAny = UIManager;
20
21
  customDirectEventTypes.topGestureHandlerEvent = {
21
22
  registrationName: 'onGestureHandlerEvent'
@@ -235,6 +236,9 @@ export default function createHandler({
235
236
  }
236
237
 
237
238
  scheduleFlushOperations();
239
+ ghQueueMicrotask(() => {
240
+ MountRegistry.gestureHandlerWillMount(this);
241
+ });
238
242
  });
239
243
 
240
244
  _defineProperty(this, "updateGestureHandler", newConfig => {
@@ -286,6 +290,11 @@ export default function createHandler({
286
290
  }
287
291
 
288
292
  this.createGestureHandler(filterConfig(transformProps ? transformProps(this.props) : this.props, [...allowedProps, ...customNativeProps], config));
293
+
294
+ if (!this.viewNode) {
295
+ throw new Error(`[Gesture Handler] Failed to obtain view for ${Handler.displayName}. Note that old API doesn't support functional components.`);
296
+ }
297
+
289
298
  this.attachGestureHandler(findNodeHandle(this.viewNode)); // TODO(TS) - check if this can be null
290
299
  }
291
300
 
@@ -313,6 +322,8 @@ export default function createHandler({
313
322
  // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
314
323
  delete handlerIDToTag[handlerID];
315
324
  }
325
+
326
+ MountRegistry.gestureHandlerWillUnmount(this);
316
327
  }
317
328
 
318
329
  update(remainingTries) {
@@ -1 +1 @@
1
- {"version":3,"sources":["createHandler.tsx"],"names":["React","Platform","UIManager","DeviceEventEmitter","customDirectEventTypes","RNGestureHandlerModule","State","handlerIDToTag","registerOldGestureHandler","getNextHandlerTag","filterConfig","scheduleFlushOperations","findNodeHandle","deepEqual","isFabric","isJestEnv","tagMessage","ActionType","PressabilityDebugView","GestureHandlerRootViewContext","ghQueueMicrotask","UIManagerAny","topGestureHandlerEvent","registrationName","customGHEventsConfigFabricAndroid","topOnGestureHandlerEvent","topOnGestureHandlerStateChange","customGHEventsConfig","onGestureHandlerEvent","onGestureHandlerStateChange","OS","genericDirectEventTypes","UIManagerConstants","getViewManagerConfig","getConstants","setJSResponder","oldSetJSResponder","clearJSResponder","oldClearJSResponder","tag","blockNativeResponder","handleSetJSResponder","handleClearJSResponder","allowTouches","DEV_ON_ANDROID","__DEV__","addListener","hasUnresolvedRefs","props","extract","refs","Array","isArray","current","some","r","stateToPropMappings","UNDETERMINED","undefined","BEGAN","FAILED","CANCELLED","ACTIVE","END","UNRESOLVED_REFS_RETRY_LIMIT","createHandler","name","allowedProps","config","transformProps","customNativeProps","Handler","Component","constructor","event","nativeEvent","handlerTag","onGestureEvent","onHandlerStateChange","state","stateEventName","eventHandler","node","viewNode","child","Children","only","children","ref","newConfig","createGestureHandler","newViewTag","viewTag","attachGestureHandler","JS_FUNCTION_OLD_API","propsRef","onGestureStateChange","actionType","isGestureHandlerWorklet","isStateChangeHandlerWorklet","isReanimatedHandler","REANIMATED_WORKLET","NATIVE_ANIMATED_EVENT","updateGestureHandler","createRef","isMountedRef","id","Error","componentDidMount","inspectorToggleListener","setState","_","update","componentDidUpdate","componentWillUnmount","remove","dropGestureHandler","handlerID","remainingTries","setNativeProps","updates","mergedProps","render","context","gestureEventHandler","gestureStateEventHandler","events","e","grandChildren","type","displayName","toArray","push","hitSlop","cloneElement","refHandler","collapsable","handlerType","enabled","testID"],"mappings":";;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,QADF,EAEEC,SAFF,EAGEC,kBAHF,QAKO,cALP;AAMA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,OAAOC,sBAAP,MAAmC,2BAAnC;AACA,SAASC,KAAT,QAAsB,UAAtB;AACA,SAASC,cAAT,EAAyBC,yBAAzB,QAA0D,oBAA1D;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AAOA,SAASC,YAAT,EAAuBC,uBAAvB,QAAsD,SAAtD;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AAEA,SAASC,SAAT,EAAoBC,QAApB,EAA8BC,SAA9B,EAAyCC,UAAzC,QAA2D,UAA3D;AACA,SAASC,UAAT,QAA2B,eAA3B;AACA,SAASC,qBAAT,QAAsC,yBAAtC;AACA,OAAOC,6BAAP,MAA0C,kCAA1C;AACA,SAASC,gBAAT,QAAiC,qBAAjC;AAEA,MAAMC,YAAY,GAAGnB,SAArB;AAEAE,sBAAsB,CAACkB,sBAAvB,GAAgD;AAC9CC,EAAAA,gBAAgB,EAAE;AAD4B,CAAhD;AAIA,MAAMC,iCAAiC,GAAG;AACxCC,EAAAA,wBAAwB,EAAE;AAAEF,IAAAA,gBAAgB,EAAE;AAApB,GADc;AAExCG,EAAAA,8BAA8B,EAAE;AAC9BH,IAAAA,gBAAgB,EAAE;AADY;AAFQ,CAA1C;AAOA,MAAMI,oBAAoB,GAAG;AAC3BC,EAAAA,qBAAqB,EAAE;AAAEL,IAAAA,gBAA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AA,MAAM,wBAAE,KAAK3F,KAAL,CAAW2F,MAAb,mEAAuBvD,KAAK,CAACpC,KAAN,CAAY2F,MAV3C;AAWE,WAAGb;AAXL,OAFK,EAeLE,aAfK,CAAP;AAiBD;;AA5WD;;AAPwE,kBAIpEzD,OAJoE,iBAQnDL,IARmD;;AAAA,kBAIpEK,OAJoE,iBASnDpD,6BATmD;;AAqX1E,SAAOoD,OAAP;AACD","sourcesContent":["import * as React from 'react';\nimport {\n Platform,\n UIManager,\n DeviceEventEmitter,\n EmitterSubscription,\n} from 'react-native';\nimport { customDirectEventTypes } from './customDirectEventTypes';\nimport RNGestureHandlerModule from '../RNGestureHandlerModule';\nimport { State } from '../State';\nimport { handlerIDToTag, registerOldGestureHandler } from './handlersRegistry';\nimport { getNextHandlerTag } from './getNextHandlerTag';\n\nimport {\n BaseGestureHandlerProps,\n GestureEvent,\n HandlerStateChangeEvent,\n} from './gestureHandlerCommon';\nimport { filterConfig, scheduleFlushOperations } from './utils';\nimport findNodeHandle from '../findNodeHandle';\nimport { ValueOf } from '../typeUtils';\nimport { deepEqual, isFabric, isJestEnv, tagMessage } from '../utils';\nimport { ActionType } from '../ActionType';\nimport { PressabilityDebugView } from './PressabilityDebugView';\nimport GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';\nimport { ghQueueMicrotask } from '../ghQueueMicrotask';\n\nconst UIManagerAny = UIManager as any;\n\ncustomDirectEventTypes.topGestureHandlerEvent = {\n registrationName: 'onGestureHandlerEvent',\n};\n\nconst customGHEventsConfigFabricAndroid = {\n topOnGestureHandlerEvent: { registrationName: 'onGestureHandlerEvent' },\n topOnGestureHandlerStateChange: {\n registrationName: 'onGestureHandlerStateChange',\n },\n};\n\nconst customGHEventsConfig = {\n onGestureHandlerEvent: { registrationName: 'onGestureHandlerEvent' },\n onGestureHandlerStateChange: {\n registrationName: 'onGestureHandlerStateChange',\n },\n\n // When using React Native Gesture Handler for Animated.event with useNativeDriver: true\n // on Android with Fabric enabled, the native part still sends the native events to JS\n // but prefixed with \"top\". We cannot simply rename the events above so they are prefixed\n // with \"top\" instead of \"on\" because in such case Animated.events would not be registered.\n // That's why we need to register another pair of event names.\n // The incoming events will be queued but never handled.\n // Without this piece of code below, you'll get the following JS error:\n // Unsupported top level event type \"topOnGestureHandlerEvent\" dispatched\n ...(isFabric() &&\n Platform.OS === 'android' &&\n customGHEventsConfigFabricAndroid),\n};\n\n// Add gesture specific events to genericDirectEventTypes object exported from UIManager\n// native module.\n// Once new event types are registered with react it is possible to dispatch these\n// events to all kind of native views.\nUIManagerAny.genericDirectEventTypes = {\n ...UIManagerAny.genericDirectEventTypes,\n ...customGHEventsConfig,\n};\n// In newer versions of RN the `genericDirectEventTypes` is located in the object\n// returned by UIManager.getViewManagerConfig('getConstants') or in older RN UIManager.getConstants(), we need to add it there as well to make\n// it compatible with RN 61+\nconst UIManagerConstants =\n UIManagerAny.getViewManagerConfig?.('getConstants') ??\n UIManagerAny.getConstants?.();\n\nif (UIManagerConstants) {\n UIManagerConstants.genericDirectEventTypes = {\n ...UIManagerConstants.genericDirectEventTypes,\n ...customGHEventsConfig,\n };\n}\n\n// Wrap JS responder calls and notify gesture handler manager\nconst {\n setJSResponder: oldSetJSResponder = () => {\n // no-op\n },\n clearJSResponder: oldClearJSResponder = () => {\n // no-op\n },\n} = UIManagerAny;\nUIManagerAny.setJSResponder = (tag: number, blockNativeResponder: boolean) => {\n RNGestureHandlerModule.handleSetJSResponder(tag, blockNativeResponder);\n oldSetJSResponder(tag, blockNativeResponder);\n};\nUIManagerAny.clearJSResponder = () => {\n RNGestureHandlerModule.handleClearJSResponder();\n oldClearJSResponder();\n};\n\nlet allowTouches = true;\nconst DEV_ON_ANDROID = __DEV__ && Platform.OS === 'android';\n// Toggled inspector blocks touch events in order to allow inspecting on Android\n// This needs to be a global variable in order to set initial state for `allowTouches` property in Handler component\nif (DEV_ON_ANDROID) {\n DeviceEventEmitter.addListener('toggleElementInspector', () => {\n allowTouches = !allowTouches;\n });\n}\n\ntype HandlerProps<T extends Record<string, unknown>> = Readonly<\n React.PropsWithChildren<BaseGestureHandlerProps<T>>\n>;\nfunction hasUnresolvedRefs<T extends Record<string, unknown>>(\n props: HandlerProps<T>\n) {\n // TODO(TS) - add type for extract arg\n const extract = (refs: any | any[]) => {\n if (!Array.isArray(refs)) {\n return refs && refs.current === null;\n }\n return refs.some((r) => r && r.current === null);\n };\n return extract(props['simultaneousHandlers']) || extract(props['waitFor']);\n}\n\nconst stateToPropMappings = {\n [State.UNDETERMINED]: undefined,\n [State.BEGAN]: 'onBegan',\n [State.FAILED]: 'onFailed',\n [State.CANCELLED]: 'onCancelled',\n [State.ACTIVE]: 'onActivated',\n [State.END]: 'onEnded',\n} as const;\n\ntype CreateHandlerArgs<HandlerPropsT extends Record<string, unknown>> =\n Readonly<{\n name: string;\n allowedProps: Readonly<Extract<keyof HandlerPropsT, string>[]>;\n config: Readonly<Record<string, unknown>>;\n transformProps?: (props: HandlerPropsT) => HandlerPropsT;\n customNativeProps?: Readonly<string[]>;\n }>;\n\n// TODO(TS) fix event types\ntype InternalEventHandlers = {\n onGestureHandlerEvent?: (event: any) => void;\n onGestureHandlerStateChange?: (event: any) => void;\n};\n\ntype AttachGestureHandlerWeb = (\n handlerTag: number,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n newView: any,\n _actionType: ActionType,\n propsRef: React.RefObject<unknown>\n) => void;\n\nconst UNRESOLVED_REFS_RETRY_LIMIT = 1;\n\n// TODO(TS) - make sure that BaseGestureHandlerProps doesn't need other generic parameter to work with custom properties.\nexport default function createHandler<\n T extends BaseGestureHandlerProps<U>,\n U extends Record<string, unknown>\n>({\n name,\n allowedProps = [],\n config = {},\n transformProps,\n customNativeProps = [],\n}: CreateHandlerArgs<T>): React.ComponentType<T & React.RefAttributes<any>> {\n interface HandlerState {\n allowTouches: boolean;\n }\n class Handler extends React.Component<\n T & InternalEventHandlers,\n HandlerState\n > {\n static displayName = name;\n static contextType = GestureHandlerRootViewContext;\n\n private handlerTag: number;\n private config: Record<string, unknown>;\n private propsRef: React.MutableRefObject<unknown>;\n private isMountedRef: React.MutableRefObject<boolean | null>;\n private viewNode: any;\n private viewTag?: number;\n private inspectorToggleListener?: EmitterSubscription;\n\n constructor(props: T & InternalEventHandlers) {\n super(props);\n this.handlerTag = getNextHandlerTag();\n this.config = {};\n this.propsRef = React.createRef();\n this.isMountedRef = React.createRef();\n this.state = { allowTouches };\n if (props.id) {\n if (handlerIDToTag[props.id] !== undefined) {\n throw new Error(`Handler with ID \"${props.id}\" already registered`);\n }\n handlerIDToTag[props.id] = this.handlerTag;\n }\n }\n\n componentDidMount() {\n const props: HandlerProps<U> = this.props;\n this.isMountedRef.current = true;\n\n if (DEV_ON_ANDROID) {\n this.inspectorToggleListener = DeviceEventEmitter.addListener(\n 'toggleElementInspector',\n () => {\n this.setState((_) => ({ allowTouches }));\n this.update(UNRESOLVED_REFS_RETRY_LIMIT);\n }\n );\n }\n if (hasUnresolvedRefs(props)) {\n // If there are unresolved refs (e.g. \".current\" has not yet been set)\n // passed as `simultaneousHandlers` or `waitFor`, we enqueue a call to\n // _update method that will try to update native handler props using\n // queueMicrotask. This makes it so update() function gets called after all\n // react components are mounted and we expect the missing ref object to\n // be resolved by then.\n ghQueueMicrotask(() => {\n this.update(UNRESOLVED_REFS_RETRY_LIMIT);\n });\n }\n\n this.createGestureHandler(\n filterConfig(\n transformProps ? transformProps(this.props) : this.props,\n [...allowedProps, ...customNativeProps],\n config\n )\n );\n\n this.attachGestureHandler(findNodeHandle(this.viewNode) as number); // TODO(TS) - check if this can be null\n }\n\n componentDidUpdate() {\n const viewTag = findNodeHandle(this.viewNode);\n if (this.viewTag !== viewTag) {\n this.attachGestureHandler(viewTag as number); // TODO(TS) - check interaction between _viewTag & findNodeHandle\n }\n this.update(UNRESOLVED_REFS_RETRY_LIMIT);\n }\n\n componentWillUnmount() {\n this.inspectorToggleListener?.remove();\n this.isMountedRef.current = false;\n RNGestureHandlerModule.dropGestureHandler(this.handlerTag);\n scheduleFlushOperations();\n // We can't use this.props.id directly due to TS generic type narrowing bug, see https://github.com/microsoft/TypeScript/issues/13995 for more context\n const handlerID: string | undefined = this.props.id;\n if (handlerID) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete handlerIDToTag[handlerID];\n }\n }\n\n private onGestureHandlerEvent = (event: GestureEvent<U>) => {\n if (event.nativeEvent.handlerTag === this.handlerTag) {\n if (typeof this.props.onGestureEvent === 'function') {\n this.props.onGestureEvent?.(event);\n }\n } else {\n this.props.onGestureHandlerEvent?.(event);\n }\n };\n\n // TODO(TS) - make sure this is right type for event\n private onGestureHandlerStateChange = (\n event: HandlerStateChangeEvent<U>\n ) => {\n if (event.nativeEvent.handlerTag === this.handlerTag) {\n if (typeof this.props.onHandlerStateChange === 'function') {\n this.props.onHandlerStateChange?.(event);\n }\n\n const state: ValueOf<typeof State> = event.nativeEvent.state;\n const stateEventName = stateToPropMappings[state];\n const eventHandler = stateEventName && this.props[stateEventName];\n if (eventHandler && typeof eventHandler === 'function') {\n eventHandler(event);\n }\n } else {\n this.props.onGestureHandlerStateChange?.(event);\n }\n };\n\n private refHandler = (node: any) => {\n this.viewNode = node;\n\n const child = React.Children.only(this.props.children);\n // TODO(TS) fix ref type\n const { ref }: any = child;\n if (ref !== null) {\n if (typeof ref === 'function') {\n ref(node);\n } else {\n ref.current = node;\n }\n }\n };\n\n private createGestureHandler = (\n newConfig: Readonly<Record<string, unknown>>\n ) => {\n this.config = newConfig;\n\n RNGestureHandlerModule.createGestureHandler(\n name,\n this.handlerTag,\n newConfig\n );\n };\n\n private attachGestureHandler = (newViewTag: number) => {\n this.viewTag = newViewTag;\n\n if (Platform.OS === 'web') {\n // Typecast due to dynamic resolution, attachGestureHandler should have web version signature in this branch\n (\n RNGestureHandlerModule.attachGestureHandler as AttachGestureHandlerWeb\n )(\n this.handlerTag,\n newViewTag,\n ActionType.JS_FUNCTION_OLD_API, // ignored on web\n this.propsRef\n );\n } else {\n registerOldGestureHandler(this.handlerTag, {\n onGestureEvent: this.onGestureHandlerEvent,\n onGestureStateChange: this.onGestureHandlerStateChange,\n });\n\n const actionType = (() => {\n const onGestureEvent = this.props?.onGestureEvent;\n const isGestureHandlerWorklet =\n onGestureEvent &&\n ('current' in onGestureEvent ||\n 'workletEventHandler' in onGestureEvent);\n const onHandlerStateChange = this.props?.onHandlerStateChange;\n const isStateChangeHandlerWorklet =\n onHandlerStateChange &&\n ('current' in onHandlerStateChange ||\n 'workletEventHandler' in onHandlerStateChange);\n const isReanimatedHandler =\n isGestureHandlerWorklet || isStateChangeHandlerWorklet;\n if (isReanimatedHandler) {\n // Reanimated worklet\n return ActionType.REANIMATED_WORKLET;\n } else if (onGestureEvent && '__isNative' in onGestureEvent) {\n // Animated.event with useNativeDriver: true\n return ActionType.NATIVE_ANIMATED_EVENT;\n } else {\n // JS callback or Animated.event with useNativeDriver: false\n return ActionType.JS_FUNCTION_OLD_API;\n }\n })();\n\n RNGestureHandlerModule.attachGestureHandler(\n this.handlerTag,\n newViewTag,\n actionType\n );\n }\n\n scheduleFlushOperations();\n };\n\n private updateGestureHandler = (\n newConfig: Readonly<Record<string, unknown>>\n ) => {\n this.config = newConfig;\n\n RNGestureHandlerModule.updateGestureHandler(this.handlerTag, newConfig);\n scheduleFlushOperations();\n };\n\n private update(remainingTries: number) {\n if (!this.isMountedRef.current) {\n return;\n }\n\n const props: HandlerProps<U> = this.props;\n\n // When ref is set via a function i.e. `ref={(r) => refObject.current = r}` instead of\n // `ref={refObject}` it's possible that it won't be resolved in time. Seems like trying\n // again is easy enough fix.\n if (hasUnresolvedRefs(props) && remainingTries > 0) {\n ghQueueMicrotask(() => {\n this.update(remainingTries - 1);\n });\n } else {\n const newConfig = filterConfig(\n transformProps ? transformProps(this.props) : this.props,\n [...allowedProps, ...customNativeProps],\n config\n );\n if (!deepEqual(this.config, newConfig)) {\n this.updateGestureHandler(newConfig);\n }\n }\n }\n\n setNativeProps(updates: any) {\n const mergedProps = { ...this.props, ...updates };\n const newConfig = filterConfig(\n transformProps ? transformProps(mergedProps) : mergedProps,\n [...allowedProps, ...customNativeProps],\n config\n );\n this.updateGestureHandler(newConfig);\n }\n\n render() {\n if (__DEV__ && !this.context && !isJestEnv() && Platform.OS !== 'web') {\n throw new Error(\n name +\n ' must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.'\n );\n }\n\n let gestureEventHandler = this.onGestureHandlerEvent;\n // Another instance of https://github.com/microsoft/TypeScript/issues/13995\n type OnGestureEventHandlers = {\n onGestureEvent?: BaseGestureHandlerProps<U>['onGestureEvent'];\n onGestureHandlerEvent?: InternalEventHandlers['onGestureHandlerEvent'];\n };\n const { onGestureEvent, onGestureHandlerEvent }: OnGestureEventHandlers =\n this.props;\n if (onGestureEvent && typeof onGestureEvent !== 'function') {\n // If it's not a method it should be an native Animated.event\n // object. We set it directly as the handler for the view\n // In this case nested handlers are not going to be supported\n if (onGestureHandlerEvent) {\n throw new Error(\n 'Nesting touch handlers with native animated driver is not supported yet'\n );\n }\n gestureEventHandler = onGestureEvent;\n } else {\n if (\n onGestureHandlerEvent &&\n typeof onGestureHandlerEvent !== 'function'\n ) {\n throw new Error(\n 'Nesting touch handlers with native animated driver is not supported yet'\n );\n }\n }\n\n let gestureStateEventHandler = this.onGestureHandlerStateChange;\n // Another instance of https://github.com/microsoft/TypeScript/issues/13995\n type OnGestureStateChangeHandlers = {\n onHandlerStateChange?: BaseGestureHandlerProps<U>['onHandlerStateChange'];\n onGestureHandlerStateChange?: InternalEventHandlers['onGestureHandlerStateChange'];\n };\n const {\n onHandlerStateChange,\n onGestureHandlerStateChange,\n }: OnGestureStateChangeHandlers = this.props;\n if (onHandlerStateChange && typeof onHandlerStateChange !== 'function') {\n // If it's not a method it should be an native Animated.event\n // object. We set it directly as the handler for the view\n // In this case nested handlers are not going to be supported\n if (onGestureHandlerStateChange) {\n throw new Error(\n 'Nesting touch handlers with native animated driver is not supported yet'\n );\n }\n gestureStateEventHandler = onHandlerStateChange;\n } else {\n if (\n onGestureHandlerStateChange &&\n typeof onGestureHandlerStateChange !== 'function'\n ) {\n throw new Error(\n 'Nesting touch handlers with native animated driver is not supported yet'\n );\n }\n }\n const events = {\n onGestureHandlerEvent: this.state.allowTouches\n ? gestureEventHandler\n : undefined,\n onGestureHandlerStateChange: this.state.allowTouches\n ? gestureStateEventHandler\n : undefined,\n };\n\n this.propsRef.current = events;\n\n let child: any = null;\n try {\n child = React.Children.only(this.props.children);\n } catch (e) {\n throw new Error(\n tagMessage(\n `${name} got more than one view as a child. If you want the gesture to work on multiple views, wrap them with a common parent and attach the gesture to that view.`\n )\n );\n }\n\n let grandChildren = child.props.children;\n if (\n __DEV__ &&\n child.type &&\n (child.type === 'RNGestureHandlerButton' ||\n child.type.name === 'View' ||\n child.type.displayName === 'View')\n ) {\n grandChildren = React.Children.toArray(grandChildren);\n grandChildren.push(\n <PressabilityDebugView\n key=\"pressabilityDebugView\"\n color=\"mediumspringgreen\"\n hitSlop={child.props.hitSlop}\n />\n );\n }\n\n return React.cloneElement(\n child,\n {\n ref: this.refHandler,\n collapsable: false,\n ...(isJestEnv()\n ? {\n handlerType: name,\n handlerTag: this.handlerTag,\n enabled: this.props.enabled,\n }\n : {}),\n testID: this.props.testID ?? child.props.testID,\n ...events,\n },\n grandChildren\n );\n }\n }\n return Handler;\n}\n"]}
1
+ {"version":3,"sources":["createHandler.tsx"],"names":["React","Platform","UIManager","DeviceEventEmitter","customDirectEventTypes","RNGestureHandlerModule","State","handlerIDToTag","registerOldGestureHandler","getNextHandlerTag","filterConfig","scheduleFlushOperations","findNodeHandle","deepEqual","isFabric","isJestEnv","tagMessage","ActionType","PressabilityDebugView","GestureHandlerRootViewContext","ghQueueMicrotask","MountRegistry","UIManagerAny","topGestureHandlerEvent","registrationName","customGHEventsConfigFabricAndroid","topOnGestureHandlerEvent","topOnGestureHandlerStateChange","customGHEventsConfig","onGestureHandlerEvent","onGestureHandlerStateChange","OS","genericDirectEventTypes","UIManagerConstants","getViewManagerConfig","getConstants","setJSResponder","oldSetJSResponder","clearJSResponder","oldClearJSResponder","tag","blockNativeResponder","handleSetJSResponder","handleClearJSResponder","allowTouches","DEV_ON_ANDROID","__DEV__","addListener","hasUnresolvedRefs","props","extract","refs","Array","isArray","current","some","r","stateToPropMappings","UNDETERMINED","undefined","BEGAN","FAILED","CANCELLED","ACTIVE","END","UNRESOLVED_REFS_RETRY_LIMIT","createHandler","name","allowedProps","config","transformProps","customNativeProps","Handler","Component","constructor","event","nativeEvent","handlerTag","onGestureEvent","onHandlerStateChange","state","stateEventName","eventHandler","node","viewNode","child","Children","only","children","ref","newConfig","createGestureHandler","newViewTag","viewTag","attachGestureHandler","JS_FUNCTION_OLD_API","propsRef","onGestureStateChange","actionType","isGestureHandlerWorklet","isStateChangeHandlerWorklet","isReanimatedHandler","REANIMATED_WORKLET","NATIVE_ANIMATED_EVENT","gestureHandlerWillMount","updateGestureHandler","createRef","isMountedRef","id","Error","componentDidMount","inspectorToggleListener","setState","_","update","displayName","componentDidUpdate","componentWillUnmount","remove","dropGestureHandler","handlerID","gestureHandlerWillUnmount","remainingTries","setNativeProps","updates","mergedProps","render","context","gestureEventHandler","gestureStateEventHandler","events","e","grandChildren","type","toArray","push","hitSlop","cloneElement","refHandler","collapsable","handlerType","enabled","testID"],"mappings":";;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,QADF,EAEEC,SAFF,EAGEC,kBAHF,QAKO,cALP;AAMA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,OAAOC,sBAAP,MAAmC,2BAAnC;AACA,SAASC,KAAT,QAAsB,UAAtB;AACA,SAASC,cAAT,EAAyBC,yBAAzB,QAA0D,oBAA1D;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AAOA,SAASC,YAAT,EAAuBC,uBAAvB,QAAsD,SAAtD;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AAEA,SAASC,S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AEmD,IAAK,4JADA,CADN,CAAN;AAKD;;AAED,UAAIiE,aAAa,GAAG/C,KAAK,CAACpC,KAAN,CAAYuC,QAAhC;;AACA,UACE1C,OAAO,IACPuC,KAAK,CAACgD,IADN,KAEChD,KAAK,CAACgD,IAAN,KAAe,wBAAf,IACChD,KAAK,CAACgD,IAAN,CAAWlE,IAAX,KAAoB,MADrB,IAECkB,KAAK,CAACgD,IAAN,CAAWlB,WAAX,KAA2B,MAJ7B,CADF,EAME;AACAiB,QAAAA,aAAa,GAAGpI,KAAK,CAACsF,QAAN,CAAegD,OAAf,CAAuBF,aAAvB,CAAhB;AACAA,QAAAA,aAAa,CAACG,IAAd,eACE,oBAAC,qBAAD;AACE,UAAA,GAAG,EAAC,uBADN;AAEE,UAAA,KAAK,EAAC,mBAFR;AAGE,UAAA,OAAO,EAAElD,KAAK,CAACpC,KAAN,CAAYuF;AAHvB,UADF;AAOD;;AAED,0BAAOxI,KAAK,CAACyI,YAAN,CACLpD,KADK,EAEL;AACEI,QAAAA,GAAG,EAAE,KAAKiD,UADZ;AAEEC,QAAAA,WAAW,EAAE,KAFf;AAGE,YAAI5H,SAAS,KACT;AACE6H,UAAAA,WAAW,EAAEzE,IADf;AAEEU,UAAAA,UAAU,EAAE,KAAKA,UAFnB;AAGEgE,UAAAA,OAAO,EAAE,KAAK5F,KAAL,CAAW4F;AAHtB,SADS,GAMT,EANJ,CAHF;AAUEC,QAAAA,MAAM,wBAAE,KAAK7F,KAAL,CAAW6F,MAAb,mEAAuBzD,KAAK,CAACpC,KAAN,CAAY6F,MAV3C;AAWE,WAAGZ;AAXL,OAFK,EAeLE,aAfK,CAAP;AAiBD;;AAxXD;;AAPwE,kBAIpE5D,OAJoE,iBAQnDL,IARmD;;AAAA,kBAIpEK,OAJoE,iBASnDrD,6BATmD;;AAiY1E,SAAOqD,OAAP;AACD","sourcesContent":["import * as React from 'react';\nimport {\n Platform,\n UIManager,\n DeviceEventEmitter,\n EmitterSubscription,\n} from 'react-native';\nimport { customDirectEventTypes } from './customDirectEventTypes';\nimport RNGestureHandlerModule from '../RNGestureHandlerModule';\nimport { State } from '../State';\nimport { handlerIDToTag, registerOldGestureHandler } from './handlersRegistry';\nimport { getNextHandlerTag } from './getNextHandlerTag';\n\nimport {\n BaseGestureHandlerProps,\n GestureEvent,\n HandlerStateChangeEvent,\n} from './gestureHandlerCommon';\nimport { filterConfig, scheduleFlushOperations } from './utils';\nimport findNodeHandle from '../findNodeHandle';\nimport { ValueOf } from '../typeUtils';\nimport { deepEqual, isFabric, isJestEnv, tagMessage } from '../utils';\nimport { ActionType } from '../ActionType';\nimport { PressabilityDebugView } from './PressabilityDebugView';\nimport GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';\nimport { ghQueueMicrotask } from '../ghQueueMicrotask';\nimport { MountRegistry } from '../mountRegistry';\n\nconst UIManagerAny = UIManager as any;\n\ncustomDirectEventTypes.topGestureHandlerEvent = {\n registrationName: 'onGestureHandlerEvent',\n};\n\nconst customGHEventsConfigFabricAndroid = {\n topOnGestureHandlerEvent: { registrationName: 'onGestureHandlerEvent' },\n topOnGestureHandlerStateChange: {\n registrationName: 'onGestureHandlerStateChange',\n },\n};\n\nconst customGHEventsConfig = {\n onGestureHandlerEvent: { registrationName: 'onGestureHandlerEvent' },\n onGestureHandlerStateChange: {\n registrationName: 'onGestureHandlerStateChange',\n },\n\n // When using React Native Gesture Handler for Animated.event with useNativeDriver: true\n // on Android with Fabric enabled, the native part still sends the native events to JS\n // but prefixed with \"top\". We cannot simply rename the events above so they are prefixed\n // with \"top\" instead of \"on\" because in such case Animated.events would not be registered.\n // That's why we need to register another pair of event names.\n // The incoming events will be queued but never handled.\n // Without this piece of code below, you'll get the following JS error:\n // Unsupported top level event type \"topOnGestureHandlerEvent\" dispatched\n ...(isFabric() &&\n Platform.OS === 'android' &&\n customGHEventsConfigFabricAndroid),\n};\n\n// Add gesture specific events to genericDirectEventTypes object exported from UIManager\n// native module.\n// Once new event types are registered with react it is possible to dispatch these\n// events to all kind of native views.\nUIManagerAny.genericDirectEventTypes = {\n ...UIManagerAny.genericDirectEventTypes,\n ...customGHEventsConfig,\n};\n// In newer versions of RN the `genericDirectEventTypes` is located in the object\n// returned by UIManager.getViewManagerConfig('getConstants') or in older RN UIManager.getConstants(), we need to add it there as well to make\n// it compatible with RN 61+\nconst UIManagerConstants =\n UIManagerAny.getViewManagerConfig?.('getConstants') ??\n UIManagerAny.getConstants?.();\n\nif (UIManagerConstants) {\n UIManagerConstants.genericDirectEventTypes = {\n ...UIManagerConstants.genericDirectEventTypes,\n ...customGHEventsConfig,\n };\n}\n\n// Wrap JS responder calls and notify gesture handler manager\nconst {\n setJSResponder: oldSetJSResponder = () => {\n // no-op\n },\n clearJSResponder: oldClearJSResponder = () => {\n // no-op\n },\n} = UIManagerAny;\nUIManagerAny.setJSResponder = (tag: number, blockNativeResponder: boolean) => {\n RNGestureHandlerModule.handleSetJSResponder(tag, blockNativeResponder);\n oldSetJSResponder(tag, blockNativeResponder);\n};\nUIManagerAny.clearJSResponder = () => {\n RNGestureHandlerModule.handleClearJSResponder();\n oldClearJSResponder();\n};\n\nlet allowTouches = true;\nconst DEV_ON_ANDROID = __DEV__ && Platform.OS === 'android';\n// Toggled inspector blocks touch events in order to allow inspecting on Android\n// This needs to be a global variable in order to set initial state for `allowTouches` property in Handler component\nif (DEV_ON_ANDROID) {\n DeviceEventEmitter.addListener('toggleElementInspector', () => {\n allowTouches = !allowTouches;\n });\n}\n\ntype HandlerProps<T extends Record<string, unknown>> = Readonly<\n React.PropsWithChildren<BaseGestureHandlerProps<T>>\n>;\nfunction hasUnresolvedRefs<T extends Record<string, unknown>>(\n props: HandlerProps<T>\n) {\n // TODO(TS) - add type for extract arg\n const extract = (refs: any | any[]) => {\n if (!Array.isArray(refs)) {\n return refs && refs.current === null;\n }\n return refs.some((r) => r && r.current === null);\n };\n return extract(props['simultaneousHandlers']) || extract(props['waitFor']);\n}\n\nconst stateToPropMappings = {\n [State.UNDETERMINED]: undefined,\n [State.BEGAN]: 'onBegan',\n [State.FAILED]: 'onFailed',\n [State.CANCELLED]: 'onCancelled',\n [State.ACTIVE]: 'onActivated',\n [State.END]: 'onEnded',\n} as const;\n\ntype CreateHandlerArgs<HandlerPropsT extends Record<string, unknown>> =\n Readonly<{\n name: string;\n allowedProps: Readonly<Extract<keyof HandlerPropsT, string>[]>;\n config: Readonly<Record<string, unknown>>;\n transformProps?: (props: HandlerPropsT) => HandlerPropsT;\n customNativeProps?: Readonly<string[]>;\n }>;\n\n// TODO(TS) fix event types\ntype InternalEventHandlers = {\n onGestureHandlerEvent?: (event: any) => void;\n onGestureHandlerStateChange?: (event: any) => void;\n};\n\ntype AttachGestureHandlerWeb = (\n handlerTag: number,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n newView: any,\n _actionType: ActionType,\n propsRef: React.RefObject<unknown>\n) => void;\n\nconst UNRESOLVED_REFS_RETRY_LIMIT = 1;\n\n// TODO(TS) - make sure that BaseGestureHandlerProps doesn't need other generic parameter to work with custom properties.\nexport default function createHandler<\n T extends BaseGestureHandlerProps<U>,\n U extends Record<string, unknown>,\n>({\n name,\n allowedProps = [],\n config = {},\n transformProps,\n customNativeProps = [],\n}: CreateHandlerArgs<T>): React.ComponentType<T & React.RefAttributes<any>> {\n interface HandlerState {\n allowTouches: boolean;\n }\n class Handler extends React.Component<\n T & InternalEventHandlers,\n HandlerState\n > {\n static displayName = name;\n static contextType = GestureHandlerRootViewContext;\n\n private handlerTag: number;\n private config: Record<string, unknown>;\n private propsRef: React.MutableRefObject<unknown>;\n private isMountedRef: React.MutableRefObject<boolean | null>;\n private viewNode: any;\n private viewTag?: number;\n private inspectorToggleListener?: EmitterSubscription;\n\n constructor(props: T & InternalEventHandlers) {\n super(props);\n this.handlerTag = getNextHandlerTag();\n this.config = {};\n this.propsRef = React.createRef();\n this.isMountedRef = React.createRef();\n this.state = { allowTouches };\n if (props.id) {\n if (handlerIDToTag[props.id] !== undefined) {\n throw new Error(`Handler with ID \"${props.id}\" already registered`);\n }\n handlerIDToTag[props.id] = this.handlerTag;\n }\n }\n\n componentDidMount() {\n const props: HandlerProps<U> = this.props;\n this.isMountedRef.current = true;\n\n if (DEV_ON_ANDROID) {\n this.inspectorToggleListener = DeviceEventEmitter.addListener(\n 'toggleElementInspector',\n () => {\n this.setState((_) => ({ allowTouches }));\n this.update(UNRESOLVED_REFS_RETRY_LIMIT);\n }\n );\n }\n if (hasUnresolvedRefs(props)) {\n // If there are unresolved refs (e.g. \".current\" has not yet been set)\n // passed as `simultaneousHandlers` or `waitFor`, we enqueue a call to\n // _update method that will try to update native handler props using\n // queueMicrotask. This makes it so update() function gets called after all\n // react components are mounted and we expect the missing ref object to\n // be resolved by then.\n ghQueueMicrotask(() => {\n this.update(UNRESOLVED_REFS_RETRY_LIMIT);\n });\n }\n\n this.createGestureHandler(\n filterConfig(\n transformProps ? transformProps(this.props) : this.props,\n [...allowedProps, ...customNativeProps],\n config\n )\n );\n\n if (!this.viewNode) {\n throw new Error(\n `[Gesture Handler] Failed to obtain view for ${Handler.displayName}. Note that old API doesn't support functional components.`\n );\n }\n\n this.attachGestureHandler(findNodeHandle(this.viewNode) as number); // TODO(TS) - check if this can be null\n }\n\n componentDidUpdate() {\n const viewTag = findNodeHandle(this.viewNode);\n if (this.viewTag !== viewTag) {\n this.attachGestureHandler(viewTag as number); // TODO(TS) - check interaction between _viewTag & findNodeHandle\n }\n this.update(UNRESOLVED_REFS_RETRY_LIMIT);\n }\n\n componentWillUnmount() {\n this.inspectorToggleListener?.remove();\n this.isMountedRef.current = false;\n RNGestureHandlerModule.dropGestureHandler(this.handlerTag);\n scheduleFlushOperations();\n // We can't use this.props.id directly due to TS generic type narrowing bug, see https://github.com/microsoft/TypeScript/issues/13995 for more context\n const handlerID: string | undefined = this.props.id;\n if (handlerID) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete handlerIDToTag[handlerID];\n }\n\n MountRegistry.gestureHandlerWillUnmount(this);\n }\n\n private onGestureHandlerEvent = (event: GestureEvent<U>) => {\n if (event.nativeEvent.handlerTag === this.handlerTag) {\n if (typeof this.props.onGestureEvent === 'function') {\n this.props.onGestureEvent?.(event);\n }\n } else {\n this.props.onGestureHandlerEvent?.(event);\n }\n };\n\n // TODO(TS) - make sure this is right type for event\n private onGestureHandlerStateChange = (\n event: HandlerStateChangeEvent<U>\n ) => {\n if (event.nativeEvent.handlerTag === this.handlerTag) {\n if (typeof this.props.onHandlerStateChange === 'function') {\n this.props.onHandlerStateChange?.(event);\n }\n\n const state: ValueOf<typeof State> = event.nativeEvent.state;\n const stateEventName = stateToPropMappings[state];\n const eventHandler = stateEventName && this.props[stateEventName];\n if (eventHandler && typeof eventHandler === 'function') {\n eventHandler(event);\n }\n } else {\n this.props.onGestureHandlerStateChange?.(event);\n }\n };\n\n private refHandler = (node: any) => {\n this.viewNode = node;\n\n const child = React.Children.only(this.props.children);\n // TODO(TS) fix ref type\n const { ref }: any = child;\n if (ref !== null) {\n if (typeof ref === 'function') {\n ref(node);\n } else {\n ref.current = node;\n }\n }\n };\n\n private createGestureHandler = (\n newConfig: Readonly<Record<string, unknown>>\n ) => {\n this.config = newConfig;\n\n RNGestureHandlerModule.createGestureHandler(\n name,\n this.handlerTag,\n newConfig\n );\n };\n\n private attachGestureHandler = (newViewTag: number) => {\n this.viewTag = newViewTag;\n\n if (Platform.OS === 'web') {\n // Typecast due to dynamic resolution, attachGestureHandler should have web version signature in this branch\n (\n RNGestureHandlerModule.attachGestureHandler as AttachGestureHandlerWeb\n )(\n this.handlerTag,\n newViewTag,\n ActionType.JS_FUNCTION_OLD_API, // ignored on web\n this.propsRef\n );\n } else {\n registerOldGestureHandler(this.handlerTag, {\n onGestureEvent: this.onGestureHandlerEvent,\n onGestureStateChange: this.onGestureHandlerStateChange,\n });\n\n const actionType = (() => {\n const onGestureEvent = this.props?.onGestureEvent;\n const isGestureHandlerWorklet =\n onGestureEvent &&\n ('current' in onGestureEvent ||\n 'workletEventHandler' in onGestureEvent);\n const onHandlerStateChange = this.props?.onHandlerStateChange;\n const isStateChangeHandlerWorklet =\n onHandlerStateChange &&\n ('current' in onHandlerStateChange ||\n 'workletEventHandler' in onHandlerStateChange);\n const isReanimatedHandler =\n isGestureHandlerWorklet || isStateChangeHandlerWorklet;\n if (isReanimatedHandler) {\n // Reanimated worklet\n return ActionType.REANIMATED_WORKLET;\n } else if (onGestureEvent && '__isNative' in onGestureEvent) {\n // Animated.event with useNativeDriver: true\n return ActionType.NATIVE_ANIMATED_EVENT;\n } else {\n // JS callback or Animated.event with useNativeDriver: false\n return ActionType.JS_FUNCTION_OLD_API;\n }\n })();\n\n RNGestureHandlerModule.attachGestureHandler(\n this.handlerTag,\n newViewTag,\n actionType\n );\n }\n\n scheduleFlushOperations();\n\n ghQueueMicrotask(() => {\n MountRegistry.gestureHandlerWillMount(this);\n });\n };\n\n private updateGestureHandler = (\n newConfig: Readonly<Record<string, unknown>>\n ) => {\n this.config = newConfig;\n\n RNGestureHandlerModule.updateGestureHandler(this.handlerTag, newConfig);\n scheduleFlushOperations();\n };\n\n private update(remainingTries: number) {\n if (!this.isMountedRef.current) {\n return;\n }\n\n const props: HandlerProps<U> = this.props;\n\n // When ref is set via a function i.e. `ref={(r) => refObject.current = r}` instead of\n // `ref={refObject}` it's possible that it won't be resolved in time. Seems like trying\n // again is easy enough fix.\n if (hasUnresolvedRefs(props) && remainingTries > 0) {\n ghQueueMicrotask(() => {\n this.update(remainingTries - 1);\n });\n } else {\n const newConfig = filterConfig(\n transformProps ? transformProps(this.props) : this.props,\n [...allowedProps, ...customNativeProps],\n config\n );\n if (!deepEqual(this.config, newConfig)) {\n this.updateGestureHandler(newConfig);\n }\n }\n }\n\n setNativeProps(updates: any) {\n const mergedProps = { ...this.props, ...updates };\n const newConfig = filterConfig(\n transformProps ? transformProps(mergedProps) : mergedProps,\n [...allowedProps, ...customNativeProps],\n config\n );\n this.updateGestureHandler(newConfig);\n }\n\n render() {\n if (__DEV__ && !this.context && !isJestEnv() && Platform.OS !== 'web') {\n throw new Error(\n name +\n ' must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.'\n );\n }\n\n let gestureEventHandler = this.onGestureHandlerEvent;\n // Another instance of https://github.com/microsoft/TypeScript/issues/13995\n type OnGestureEventHandlers = {\n onGestureEvent?: BaseGestureHandlerProps<U>['onGestureEvent'];\n onGestureHandlerEvent?: InternalEventHandlers['onGestureHandlerEvent'];\n };\n const { onGestureEvent, onGestureHandlerEvent }: OnGestureEventHandlers =\n this.props;\n if (onGestureEvent && typeof onGestureEvent !== 'function') {\n // If it's not a method it should be an native Animated.event\n // object. We set it directly as the handler for the view\n // In this case nested handlers are not going to be supported\n if (onGestureHandlerEvent) {\n throw new Error(\n 'Nesting touch handlers with native animated driver is not supported yet'\n );\n }\n gestureEventHandler = onGestureEvent;\n } else {\n if (\n onGestureHandlerEvent &&\n typeof onGestureHandlerEvent !== 'function'\n ) {\n throw new Error(\n 'Nesting touch handlers with native animated driver is not supported yet'\n );\n }\n }\n\n let gestureStateEventHandler = this.onGestureHandlerStateChange;\n // Another instance of https://github.com/microsoft/TypeScript/issues/13995\n type OnGestureStateChangeHandlers = {\n onHandlerStateChange?: BaseGestureHandlerProps<U>['onHandlerStateChange'];\n onGestureHandlerStateChange?: InternalEventHandlers['onGestureHandlerStateChange'];\n };\n const {\n onHandlerStateChange,\n onGestureHandlerStateChange,\n }: OnGestureStateChangeHandlers = this.props;\n if (onHandlerStateChange && typeof onHandlerStateChange !== 'function') {\n // If it's not a method it should be an native Animated.event\n // object. We set it directly as the handler for the view\n // In this case nested handlers are not going to be supported\n if (onGestureHandlerStateChange) {\n throw new Error(\n 'Nesting touch handlers with native animated driver is not supported yet'\n );\n }\n gestureStateEventHandler = onHandlerStateChange;\n } else {\n if (\n onGestureHandlerStateChange &&\n typeof onGestureHandlerStateChange !== 'function'\n ) {\n throw new Error(\n 'Nesting touch handlers with native animated driver is not supported yet'\n );\n }\n }\n const events = {\n onGestureHandlerEvent: this.state.allowTouches\n ? gestureEventHandler\n : undefined,\n onGestureHandlerStateChange: this.state.allowTouches\n ? gestureStateEventHandler\n : undefined,\n };\n\n this.propsRef.current = events;\n\n let child: any = null;\n try {\n child = React.Children.only(this.props.children);\n } catch (e) {\n throw new Error(\n tagMessage(\n `${name} got more than one view as a child. If you want the gesture to work on multiple views, wrap them with a common parent and attach the gesture to that view.`\n )\n );\n }\n\n let grandChildren = child.props.children;\n if (\n __DEV__ &&\n child.type &&\n (child.type === 'RNGestureHandlerButton' ||\n child.type.name === 'View' ||\n child.type.displayName === 'View')\n ) {\n grandChildren = React.Children.toArray(grandChildren);\n grandChildren.push(\n <PressabilityDebugView\n key=\"pressabilityDebugView\"\n color=\"mediumspringgreen\"\n hitSlop={child.props.hitSlop}\n />\n );\n }\n\n return React.cloneElement(\n child,\n {\n ref: this.refHandler,\n collapsable: false,\n ...(isJestEnv()\n ? {\n handlerType: name,\n handlerTag: this.handlerTag,\n enabled: this.props.enabled,\n }\n : {}),\n testID: this.props.testID ?? child.props.testID,\n ...events,\n },\n grandChildren\n );\n }\n }\n return Handler;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["gestureHandlerCommon.ts"],"names":["commonProps","componentInteractionProps","baseGestureHandlerProps","baseGestureHandlerWithDetectorProps","MouseButton"],"mappings":"AAAA;AACA;AACA;AACA;AAQA,MAAMA,WAAW,GAAG,CAClB,IADkB,EAElB,SAFkB,EAGlB,yBAHkB,EAIlB,SAJkB,EAKlB,sBALkB,EAMlB,YANkB,EAOlB,cAPkB,EAQlB,aARkB,EASlB,mBATkB,EAUlB,aAVkB,CAApB;AAaA,MAAMC,yBAAyB,GAAG,CAChC,SADgC,EAEhC,sBAFgC,EAGhC,gBAHgC,CAAlC;AAMA,OAAO,MAAMC,uBAAuB,GAAG,CACrC,GAAGF,WADkC,EAErC,GAAGC,yBAFkC,EAGrC,SAHqC,EAIrC,UAJqC,EAKrC,aALqC,EAMrC,aANqC,EAOrC,SAPqC,EAQrC,gBARqC,EASrC,sBATqC,CAAhC;AAYP,OAAO,MAAME,mCAAmC,GAAG,CACjD,GAAGH,WAD8C,EAEjD,kBAFiD,EAGjD,kBAHiD,CAA5C;AAsEP,WAAYI,WAAZ;;WAAYA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,KAAAA,W","sourcesContent":["// Previous types exported gesture handlers as classes which creates an interface and variable, both named the same as class.\n// Without those types, we'd introduce breaking change, forcing users to prefix every handler type specification with typeof\n// e.g. React.createRef<TapGestureHandler> -> React.createRef<typeof TapGestureHandler>.\n// See https://www.typescriptlang.org/docs/handbook/classes.html#constructor-functions for reference.\nimport * as React from 'react';\n\nimport { State } from '../State';\nimport { TouchEventType } from '../TouchEventType';\nimport { ValueOf } from '../typeUtils';\nimport { PointerType } from '../PointerType';\n\nconst commonProps = [\n 'id',\n 'enabled',\n 'shouldCancelWhenOutside',\n 'hitSlop',\n 'cancelsTouchesInView',\n 'userSelect',\n 'activeCursor',\n 'mouseButton',\n 'enableContextMenu',\n 'touchAction',\n] as const;\n\nconst componentInteractionProps = [\n 'waitFor',\n 'simultaneousHandlers',\n 'blocksHandlers',\n] as const;\n\nexport const baseGestureHandlerProps = [\n ...commonProps,\n ...componentInteractionProps,\n 'onBegan',\n 'onFailed',\n 'onCancelled',\n 'onActivated',\n 'onEnded',\n 'onGestureEvent',\n 'onHandlerStateChange',\n] as const;\n\nexport const baseGestureHandlerWithDetectorProps = [\n ...commonProps,\n 'needsPointerData',\n 'manualActivation',\n];\n\nexport interface GestureEventPayload {\n handlerTag: number;\n numberOfPointers: number;\n state: ValueOf<typeof State>;\n pointerType: PointerType;\n}\nexport interface HandlerStateChangeEventPayload extends GestureEventPayload {\n oldState: ValueOf<typeof State>;\n}\n\nexport type HitSlop =\n | number\n | null\n | undefined\n | Partial<\n Record<\n 'left' | 'right' | 'top' | 'bottom' | 'vertical' | 'horizontal',\n number\n >\n >\n | Record<'width' | 'left', number>\n | Record<'width' | 'right', number>\n | Record<'height' | 'top', number>\n | Record<'height' | 'bottom', number>;\n\nexport type UserSelect = 'none' | 'auto' | 'text';\nexport type ActiveCursor =\n | 'auto'\n | 'default'\n | 'none'\n | 'context-menu'\n | 'help'\n | 'pointer'\n | 'progress'\n | 'wait'\n | 'cell'\n | 'crosshair'\n | 'text'\n | 'vertical-text'\n | 'alias'\n | 'copy'\n | 'move'\n | 'no-drop'\n | 'not-allowed'\n | 'grab'\n | 'grabbing'\n | 'e-resize'\n | 'n-resize'\n | 'ne-resize'\n | 'nw-resize'\n | 's-resize'\n | 'se-resize'\n | 'sw-resize'\n | 'w-resize'\n | 'ew-resize'\n | 'ns-resize'\n | 'nesw-resize'\n | 'nwse-resize'\n | 'col-resize'\n | 'row-resize'\n | 'all-scroll'\n | 'zoom-in'\n | 'zoom-out';\n\nexport enum MouseButton {\n LEFT = 1,\n RIGHT = 2,\n MIDDLE = 4,\n BUTTON_4 = 8,\n BUTTON_5 = 16,\n ALL = 31,\n}\n\nexport type TouchAction =\n | 'auto'\n | 'none'\n | 'pan-x'\n | 'pan-left'\n | 'pan-right'\n | 'pan-y'\n | 'pan-up'\n | 'pan-down'\n | 'pinch-zoom'\n | 'manipulation'\n | 'inherit'\n | 'initial'\n | 'revert'\n | 'revert-layer'\n | 'unset';\n\n// TODO(TS) events in handlers\n\nexport interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {\n nativeEvent: Readonly<GestureEventPayload & ExtraEventPayloadT>;\n}\nexport interface HandlerStateChangeEvent<\n ExtraEventPayloadT = Record<string, unknown>\n> {\n nativeEvent: Readonly<HandlerStateChangeEventPayload & ExtraEventPayloadT>;\n}\n\nexport type TouchData = {\n id: number;\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n};\n\nexport type GestureTouchEvent = {\n handlerTag: number;\n numberOfTouches: number;\n state: ValueOf<typeof State>;\n eventType: TouchEventType;\n allTouches: TouchData[];\n changedTouches: TouchData[];\n pointerType: PointerType;\n};\n\nexport type GestureUpdateEvent<GestureEventPayloadT = Record<string, unknown>> =\n GestureEventPayload & GestureEventPayloadT;\n\nexport type GestureStateChangeEvent<\n GestureStateChangeEventPayloadT = Record<string, unknown>\n> = HandlerStateChangeEventPayload & GestureStateChangeEventPayloadT;\n\nexport type CommonGestureConfig = {\n enabled?: boolean;\n shouldCancelWhenOutside?: boolean;\n hitSlop?: HitSlop;\n userSelect?: UserSelect;\n activeCursor?: ActiveCursor;\n mouseButton?: MouseButton;\n enableContextMenu?: boolean;\n touchAction?: TouchAction;\n};\n\n// Events payloads are types instead of interfaces due to TS limitation.\n// See https://github.com/microsoft/TypeScript/issues/15300 for more info.\nexport type BaseGestureHandlerProps<\n ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>\n> = CommonGestureConfig & {\n id?: string;\n waitFor?: React.Ref<unknown> | React.Ref<unknown>[];\n simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[];\n blocksHandlers?: React.Ref<unknown> | React.Ref<unknown>[];\n testID?: string;\n cancelsTouchesInView?: boolean;\n // TODO(TS) - fix event types\n onBegan?: (event: HandlerStateChangeEvent) => void;\n onFailed?: (event: HandlerStateChangeEvent) => void;\n onCancelled?: (event: HandlerStateChangeEvent) => void;\n onActivated?: (event: HandlerStateChangeEvent) => void;\n onEnded?: (event: HandlerStateChangeEvent) => void;\n\n // TODO(TS) consider using NativeSyntheticEvent\n onGestureEvent?: (event: GestureEvent<ExtraEventPayloadT>) => void;\n onHandlerStateChange?: (\n event: HandlerStateChangeEvent<ExtraEventPayloadT>\n ) => void;\n // Implicit `children` prop has been removed in @types/react^18.0.0\n children?: React.ReactNode;\n};\n"]}
1
+ {"version":3,"sources":["gestureHandlerCommon.ts"],"names":["commonProps","componentInteractionProps","baseGestureHandlerProps","baseGestureHandlerWithDetectorProps","MouseButton"],"mappings":"AAAA;AACA;AACA;AACA;AAQA,MAAMA,WAAW,GAAG,CAClB,IADkB,EAElB,SAFkB,EAGlB,yBAHkB,EAIlB,SAJkB,EAKlB,sBALkB,EAMlB,YANkB,EAOlB,cAPkB,EAQlB,aARkB,EASlB,mBATkB,EAUlB,aAVkB,CAApB;AAaA,MAAMC,yBAAyB,GAAG,CAChC,SADgC,EAEhC,sBAFgC,EAGhC,gBAHgC,CAAlC;AAMA,OAAO,MAAMC,uBAAuB,GAAG,CACrC,GAAGF,WADkC,EAErC,GAAGC,yBAFkC,EAGrC,SAHqC,EAIrC,UAJqC,EAKrC,aALqC,EAMrC,aANqC,EAOrC,SAPqC,EAQrC,gBARqC,EASrC,sBATqC,CAAhC;AAYP,OAAO,MAAME,mCAAmC,GAAG,CACjD,GAAGH,WAD8C,EAEjD,kBAFiD,EAGjD,kBAHiD,CAA5C;AAsEP,WAAYI,WAAZ;;WAAYA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,KAAAA,W","sourcesContent":["// Previous types exported gesture handlers as classes which creates an interface and variable, both named the same as class.\n// Without those types, we'd introduce breaking change, forcing users to prefix every handler type specification with typeof\n// e.g. React.createRef<TapGestureHandler> -> React.createRef<typeof TapGestureHandler>.\n// See https://www.typescriptlang.org/docs/handbook/classes.html#constructor-functions for reference.\nimport * as React from 'react';\n\nimport { State } from '../State';\nimport { TouchEventType } from '../TouchEventType';\nimport { ValueOf } from '../typeUtils';\nimport { PointerType } from '../PointerType';\n\nconst commonProps = [\n 'id',\n 'enabled',\n 'shouldCancelWhenOutside',\n 'hitSlop',\n 'cancelsTouchesInView',\n 'userSelect',\n 'activeCursor',\n 'mouseButton',\n 'enableContextMenu',\n 'touchAction',\n] as const;\n\nconst componentInteractionProps = [\n 'waitFor',\n 'simultaneousHandlers',\n 'blocksHandlers',\n] as const;\n\nexport const baseGestureHandlerProps = [\n ...commonProps,\n ...componentInteractionProps,\n 'onBegan',\n 'onFailed',\n 'onCancelled',\n 'onActivated',\n 'onEnded',\n 'onGestureEvent',\n 'onHandlerStateChange',\n] as const;\n\nexport const baseGestureHandlerWithDetectorProps = [\n ...commonProps,\n 'needsPointerData',\n 'manualActivation',\n];\n\nexport interface GestureEventPayload {\n handlerTag: number;\n numberOfPointers: number;\n state: ValueOf<typeof State>;\n pointerType: PointerType;\n}\nexport interface HandlerStateChangeEventPayload extends GestureEventPayload {\n oldState: ValueOf<typeof State>;\n}\n\nexport type HitSlop =\n | number\n | null\n | undefined\n | Partial<\n Record<\n 'left' | 'right' | 'top' | 'bottom' | 'vertical' | 'horizontal',\n number\n >\n >\n | Record<'width' | 'left', number>\n | Record<'width' | 'right', number>\n | Record<'height' | 'top', number>\n | Record<'height' | 'bottom', number>;\n\nexport type UserSelect = 'none' | 'auto' | 'text';\nexport type ActiveCursor =\n | 'auto'\n | 'default'\n | 'none'\n | 'context-menu'\n | 'help'\n | 'pointer'\n | 'progress'\n | 'wait'\n | 'cell'\n | 'crosshair'\n | 'text'\n | 'vertical-text'\n | 'alias'\n | 'copy'\n | 'move'\n | 'no-drop'\n | 'not-allowed'\n | 'grab'\n | 'grabbing'\n | 'e-resize'\n | 'n-resize'\n | 'ne-resize'\n | 'nw-resize'\n | 's-resize'\n | 'se-resize'\n | 'sw-resize'\n | 'w-resize'\n | 'ew-resize'\n | 'ns-resize'\n | 'nesw-resize'\n | 'nwse-resize'\n | 'col-resize'\n | 'row-resize'\n | 'all-scroll'\n | 'zoom-in'\n | 'zoom-out';\n\nexport enum MouseButton {\n LEFT = 1,\n RIGHT = 2,\n MIDDLE = 4,\n BUTTON_4 = 8,\n BUTTON_5 = 16,\n ALL = 31,\n}\n\nexport type TouchAction =\n | 'auto'\n | 'none'\n | 'pan-x'\n | 'pan-left'\n | 'pan-right'\n | 'pan-y'\n | 'pan-up'\n | 'pan-down'\n | 'pinch-zoom'\n | 'manipulation'\n | 'inherit'\n | 'initial'\n | 'revert'\n | 'revert-layer'\n | 'unset';\n\n// TODO(TS) events in handlers\n\nexport interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {\n nativeEvent: Readonly<GestureEventPayload & ExtraEventPayloadT>;\n}\nexport interface HandlerStateChangeEvent<\n ExtraEventPayloadT = Record<string, unknown>,\n> {\n nativeEvent: Readonly<HandlerStateChangeEventPayload & ExtraEventPayloadT>;\n}\n\nexport type TouchData = {\n id: number;\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n};\n\nexport type GestureTouchEvent = {\n handlerTag: number;\n numberOfTouches: number;\n state: ValueOf<typeof State>;\n eventType: TouchEventType;\n allTouches: TouchData[];\n changedTouches: TouchData[];\n pointerType: PointerType;\n};\n\nexport type GestureUpdateEvent<GestureEventPayloadT = Record<string, unknown>> =\n GestureEventPayload & GestureEventPayloadT;\n\nexport type GestureStateChangeEvent<\n GestureStateChangeEventPayloadT = Record<string, unknown>,\n> = HandlerStateChangeEventPayload & GestureStateChangeEventPayloadT;\n\nexport type CommonGestureConfig = {\n enabled?: boolean;\n shouldCancelWhenOutside?: boolean;\n hitSlop?: HitSlop;\n userSelect?: UserSelect;\n activeCursor?: ActiveCursor;\n mouseButton?: MouseButton;\n enableContextMenu?: boolean;\n touchAction?: TouchAction;\n};\n\n// Events payloads are types instead of interfaces due to TS limitation.\n// See https://github.com/microsoft/TypeScript/issues/15300 for more info.\nexport type BaseGestureHandlerProps<\n ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>,\n> = CommonGestureConfig & {\n id?: string;\n waitFor?: React.Ref<unknown> | React.Ref<unknown>[];\n simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[];\n blocksHandlers?: React.Ref<unknown> | React.Ref<unknown>[];\n testID?: string;\n cancelsTouchesInView?: boolean;\n // TODO(TS) - fix event types\n onBegan?: (event: HandlerStateChangeEvent) => void;\n onFailed?: (event: HandlerStateChangeEvent) => void;\n onCancelled?: (event: HandlerStateChangeEvent) => void;\n onActivated?: (event: HandlerStateChangeEvent) => void;\n onEnded?: (event: HandlerStateChangeEvent) => void;\n\n // TODO(TS) consider using NativeSyntheticEvent\n onGestureEvent?: (event: GestureEvent<ExtraEventPayloadT>) => void;\n onHandlerStateChange?: (\n event: HandlerStateChangeEvent<ExtraEventPayloadT>\n ) => void;\n // Implicit `children` prop has been removed in @types/react^18.0.0\n children?: React.ReactNode;\n};\n"]}
@@ -5,6 +5,7 @@ import { ActionType } from '../../../ActionType';
5
5
  import { Platform } from 'react-native';
6
6
  import { ghQueueMicrotask } from '../../../ghQueueMicrotask';
7
7
  import { extractGestureRelations, checkGestureCallbacksForWorklets, ALLOWED_PROPS } from './utils';
8
+ import { MountRegistry } from '../../../mountRegistry';
8
9
  export function attachHandlers({
9
10
  preparedGesture,
10
11
  gestureConfig,
@@ -52,6 +53,8 @@ export function attachHandlers({
52
53
  } else {
53
54
  RNGestureHandlerModule.attachGestureHandler(gesture.handlerTag, viewTag, actionType);
54
55
  }
56
+
57
+ MountRegistry.gestureWillMount(gesture);
55
58
  }
56
59
 
57
60
  preparedGesture.attachedGestures = gesturesToAttach;
@@ -1 +1 @@
1
- {"version":3,"sources":["attachHandlers.ts"],"names":["registerHandler","RNGestureHandlerModule","filterConfig","scheduleFlushOperations","ActionType","Platform","ghQueueMicrotask","extractGestureRelations","checkGestureCallbacksForWorklets","ALLOWED_PROPS","attachHandlers","preparedGesture","gestureConfig","gesturesToAttach","viewTag","webEventHandlersRef","initialize","isMounted","prepare","handler","createGestureHandler","handlerName","handlerTag","config","testId","updateGestureHandler","gesture","actionType","shouldUseReanimated","REANIMATED_WORKLET","JS_FUNCTION_NEW_API","OS","attachGestureHandler","JS_FUNCTION_OLD_API","attachedGestures","animatedHandlers","isAnimatedGesture","g","value","filter","map","handlers"],"mappings":"AAE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ADE,EAEVd,aAFU,EAGVF,uBAAuB,CAACY,OAAD,CAHb,CAFd;AAQD;;AAEDhB,IAAAA,uBAAuB;AACxB,GAhBe,CAAhB;;AAkBA,OAAK,MAAMuB,OAAX,IAAsBb,gBAAtB,EAAwC;AACtC,UAAMc,UAAU,GAAGD,OAAO,CAACE,mBAAR,GACfxB,UAAU,CAACyB,kBADI,GAEfzB,UAAU,CAAC0B,mBAFf;;AAIA,QAAIzB,QAAQ,CAAC0B,EAAT,KAAgB,KAApB,EAA2B;AAEvB9B,MAAAA,sBAAsB,CAAC+B,oBADzB,CAGEN,OAAO,CAACJ,UAHV,EAIER,OAJF,EAKEV,UAAU,CAAC6B,mBALb,EAKkC;AAChClB,MAAAA,mBANF;AAQD,KATD,MASO;AACLd,MAAAA,sBAAsB,CAAC+B,oBAAvB,CACEN,OAAO,CAACJ,UADV,EAEER,OAFF,EAGEa,UAHF;AAKD;AACF;;AAEDhB,EAAAA,eAAe,CAACuB,gBAAhB,GAAmCrB,gBAAnC;;AAEA,MAAIF,eAAe,CAACwB,gBAApB,EAAsC;AACpC,UAAMC,iBAAiB,GAAIC,CAAD,IAAoBA,CAAC,CAACT,mBAAhD;;AAEAjB,IAAAA,eAAe,CAACwB,gBAAhB,CAAiCG,KAAjC,GAAyCzB,gBAAgB,CACtD0B,MADsC,CAC/BH,iBAD+B,EAEtCI,GAFsC,CAEjCH,CAAD,IAAOA,CAAC,CAACI,QAFyB,CAAzC;AAKD;AACF","sourcesContent":["import React from 'react';\nimport { GestureType, HandlerCallbacks } from '../gesture';\nimport { registerHandler } from '../../handlersRegistry';\nimport RNGestureHandlerModule from '../../../RNGestureHandlerModule';\nimport { filterConfig, scheduleFlushOperations } from '../../utils';\nimport { ComposedGesture } from '../gestureComposition';\nimport { ActionType } from '../../../ActionType';\nimport { Platform } from 'react-native';\nimport type RNGestureHandlerModuleWeb from '../../../RNGestureHandlerModule.web';\nimport { ghQueueMicrotask } from '../../../ghQueueMicrotask';\nimport { AttachedGestureState, WebEventHandler } from './types';\nimport {\n extractGestureRelations,\n checkGestureCallbacksForWorklets,\n ALLOWED_PROPS,\n} from './utils';\n\ninterface AttachHandlersConfig {\n preparedGesture: AttachedGestureState;\n gestureConfig: ComposedGesture | GestureType;\n gesturesToAttach: GestureType[];\n viewTag: number;\n webEventHandlersRef: React.RefObject<WebEventHandler>;\n}\n\nexport function attachHandlers({\n preparedGesture,\n gestureConfig,\n gesturesToAttach,\n viewTag,\n webEventHandlersRef,\n}: AttachHandlersConfig) {\n gestureConfig.initialize();\n\n // Use queueMicrotask to extract handlerTags, because all refs should be initialized\n // when it's ran\n ghQueueMicrotask(() => {\n if (!preparedGesture.isMounted) {\n return;\n }\n gestureConfig.prepare();\n });\n\n for (const handler of gesturesToAttach) {\n checkGestureCallbacksForWorklets(handler);\n RNGestureHandlerModule.createGestureHandler(\n handler.handlerName,\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS)\n );\n\n registerHandler(handler.handlerTag, handler, handler.config.testId);\n }\n\n // Use queueMicrotask to extract handlerTags, because all refs should be initialized\n // when it's ran\n ghQueueMicrotask(() => {\n if (!preparedGesture.isMounted) {\n return;\n }\n for (const handler of gesturesToAttach) {\n RNGestureHandlerModule.updateGestureHandler(\n handler.handlerTag,\n filterConfig(\n handler.config,\n ALLOWED_PROPS,\n extractGestureRelations(handler)\n )\n );\n }\n\n scheduleFlushOperations();\n });\n\n for (const gesture of gesturesToAttach) {\n const actionType = gesture.shouldUseReanimated\n ? ActionType.REANIMATED_WORKLET\n : ActionType.JS_FUNCTION_NEW_API;\n\n if (Platform.OS === 'web') {\n (\n RNGestureHandlerModule.attachGestureHandler as typeof RNGestureHandlerModuleWeb.attachGestureHandler\n )(\n gesture.handlerTag,\n viewTag,\n ActionType.JS_FUNCTION_OLD_API, // Ignored on web\n webEventHandlersRef\n );\n } else {\n RNGestureHandlerModule.attachGestureHandler(\n gesture.handlerTag,\n viewTag,\n actionType\n );\n }\n }\n\n preparedGesture.attachedGestures = gesturesToAttach;\n\n if (preparedGesture.animatedHandlers) {\n const isAnimatedGesture = (g: GestureType) => g.shouldUseReanimated;\n\n preparedGesture.animatedHandlers.value = gesturesToAttach\n .filter(isAnimatedGesture)\n .map((g) => g.handlers) as unknown as HandlerCallbacks<\n Record<string, unknown>\n >[];\n }\n}\n"]}
1
+ {"version":3,"sources":["attachHandlers.ts"],"names":["registerHandler","RNGestureHandlerModule","filterConfig","scheduleFlushOperations","ActionType","Platform","ghQueueMicrotask","extractGestureRelations","checkGestureCallbacksForWorklets","ALLOWED_PROPS","MountRegistry","attachHandlers","preparedGesture","gestureConfig","gesturesToAttach","viewTag","webEventHandlersRef","initialize","isMounted","prepare","handler","createGestureHandler","handlerName","handlerTag","config","testId","updateGestureHandler","gesture","actionType","shouldUseReanimated","REANIMATED_WORKLET","JS_FUNCTION_NEW_API","OS","attachGestureHandler","JS_FUNCTION_OLD_API","gestureWillMount","attachedGestures","animatedHandlers","isAnimatedGesture","g","value","filter","map","handlers"],"mappings":"AAEA,SAASA,eAAT,QAAgC,wBAAhC;AACA,OAAOC,sBAAP,MAAmC,iCAAnC;AACA,SAASC,YAAT,EAAuBC,uBAAvB,QAAsD,aAAtD;AAEA,SAASC,UAAT,QAA2B,qBAA3B;AACA,SAASC,QAAT,QAAyB,cAAzB;AAEA,SAASC,gBAAT,QAAiC,2BAAjC;AAEA,SACEC,uBADF,EAEEC,gCAFF,EAGEC,aAHF,QAIO,SAJP;AAKA,SAASC,aAAT,QAA8B,wBAA9B;AAUA,OAAO,SAASC,cAAT,CAAwB;AAC7BC,EAAAA,eAD6B;AAE7BC,EAAAA,aAF6B;AAG7BC,EAAAA,gBAH6B;AAI7BC,EAAAA,OAJ6B;AAK7BC,EAAAA;AAL6B,CAAxB,EAMkB;AACvBH,EAAAA,aAAa,CAACI,UAAd,GADuB,CAGvB;AACA;;AACAX,EAAAA,gBAAgB,CAAC,MAAM;AACrB,QAAI,CAACM,eAAe,CAACM,SAArB,EAAgC;AAC9B;A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,IAAAA,aAAa,CAACyB,gBAAd,CAA+BR,OAA/B;AACD;;AAEDf,EAAAA,eAAe,CAACwB,gBAAhB,GAAmCtB,gBAAnC;;AAEA,MAAIF,eAAe,CAACyB,gBAApB,EAAsC;AACpC,UAAMC,iBAAiB,GAAIC,CAAD,IAAoBA,CAAC,CAACV,mBAAhD;;AAEAjB,IAAAA,eAAe,CAACyB,gBAAhB,CAAiCG,KAAjC,GAAyC1B,gBAAgB,CACtD2B,MADsC,CAC/BH,iBAD+B,EAEtCI,GAFsC,CAEjCH,CAAD,IAAOA,CAAC,CAACI,QAFyB,CAAzC;AAKD;AACF","sourcesContent":["import React from 'react';\nimport { GestureType, HandlerCallbacks } from '../gesture';\nimport { registerHandler } from '../../handlersRegistry';\nimport RNGestureHandlerModule from '../../../RNGestureHandlerModule';\nimport { filterConfig, scheduleFlushOperations } from '../../utils';\nimport { ComposedGesture } from '../gestureComposition';\nimport { ActionType } from '../../../ActionType';\nimport { Platform } from 'react-native';\nimport type RNGestureHandlerModuleWeb from '../../../RNGestureHandlerModule.web';\nimport { ghQueueMicrotask } from '../../../ghQueueMicrotask';\nimport { AttachedGestureState, WebEventHandler } from './types';\nimport {\n extractGestureRelations,\n checkGestureCallbacksForWorklets,\n ALLOWED_PROPS,\n} from './utils';\nimport { MountRegistry } from '../../../mountRegistry';\n\ninterface AttachHandlersConfig {\n preparedGesture: AttachedGestureState;\n gestureConfig: ComposedGesture | GestureType;\n gesturesToAttach: GestureType[];\n viewTag: number;\n webEventHandlersRef: React.RefObject<WebEventHandler>;\n}\n\nexport function attachHandlers({\n preparedGesture,\n gestureConfig,\n gesturesToAttach,\n viewTag,\n webEventHandlersRef,\n}: AttachHandlersConfig) {\n gestureConfig.initialize();\n\n // Use queueMicrotask to extract handlerTags, because all refs should be initialized\n // when it's ran\n ghQueueMicrotask(() => {\n if (!preparedGesture.isMounted) {\n return;\n }\n gestureConfig.prepare();\n });\n\n for (const handler of gesturesToAttach) {\n checkGestureCallbacksForWorklets(handler);\n RNGestureHandlerModule.createGestureHandler(\n handler.handlerName,\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS)\n );\n\n registerHandler(handler.handlerTag, handler, handler.config.testId);\n }\n\n // Use queueMicrotask to extract handlerTags, because all refs should be initialized\n // when it's ran\n ghQueueMicrotask(() => {\n if (!preparedGesture.isMounted) {\n return;\n }\n for (const handler of gesturesToAttach) {\n RNGestureHandlerModule.updateGestureHandler(\n handler.handlerTag,\n filterConfig(\n handler.config,\n ALLOWED_PROPS,\n extractGestureRelations(handler)\n )\n );\n }\n\n scheduleFlushOperations();\n });\n\n for (const gesture of gesturesToAttach) {\n const actionType = gesture.shouldUseReanimated\n ? ActionType.REANIMATED_WORKLET\n : ActionType.JS_FUNCTION_NEW_API;\n\n if (Platform.OS === 'web') {\n (\n RNGestureHandlerModule.attachGestureHandler as typeof RNGestureHandlerModuleWeb.attachGestureHandler\n )(\n gesture.handlerTag,\n viewTag,\n ActionType.JS_FUNCTION_OLD_API, // Ignored on web\n webEventHandlersRef\n );\n } else {\n RNGestureHandlerModule.attachGestureHandler(\n gesture.handlerTag,\n viewTag,\n actionType\n );\n }\n\n MountRegistry.gestureWillMount(gesture);\n }\n\n preparedGesture.attachedGestures = gesturesToAttach;\n\n if (preparedGesture.animatedHandlers) {\n const isAnimatedGesture = (g: GestureType) => g.shouldUseReanimated;\n\n preparedGesture.animatedHandlers.value = gesturesToAttach\n .filter(isAnimatedGesture)\n .map((g) => g.handlers) as unknown as HandlerCallbacks<\n Record<string, unknown>\n >[];\n }\n}\n"]}
@@ -1,10 +1,12 @@
1
1
  import { unregisterHandler } from '../../handlersRegistry';
2
2
  import RNGestureHandlerModule from '../../../RNGestureHandlerModule';
3
3
  import { scheduleFlushOperations } from '../../utils';
4
+ import { MountRegistry } from '../../../mountRegistry';
4
5
  export function dropHandlers(preparedGesture) {
5
6
  for (const handler of preparedGesture.attachedGestures) {
6
7
  RNGestureHandlerModule.dropGestureHandler(handler.handlerTag);
7
8
  unregisterHandler(handler.handlerTag, handler.config.testId);
9
+ MountRegistry.gestureWillUnmount(handler);
8
10
  }
9
11
 
10
12
  scheduleFlushOperations();
@@ -1 +1 @@
1
- {"version":3,"sources":["dropHandlers.ts"],"names":["unregisterHandler","RNGestureHandlerModule","scheduleFlushOperations","dropHandlers","preparedGesture","handler","attachedGestures","dropGestureHandler","handlerTag","config","testId"],"mappings":"AAAA,SAASA,iBAAT,QAAkC,wBAAlC;AACA,OAAOC,sBAAP,MAAmC,iCAAnC;AACA,SAASC,uBAAT,QAAwC,aAAxC;AAGA,OAAO,SAASC,YAAT,CAAsBC,eAAtB,EAA6D;AAClE,OAAK,MAAMC,OAAX,IAAsBD,eAAe,CAACE,gBAAtC,EAAwD;AACtDL,IAAAA,sBAAsB,CAACM,kBAAvB,CAA0CF,OAAO,CAACG,UAAlD;AAEAR,IAAAA,iBAAiB,CAACK,OAAO,CAACG,UAAT,EAAqBH,OAAO,CAACI,MAAR,CAAeC,MAApC,CAAjB;AACD;;AAEDR,EAAAA,uBAAuB;AACxB","sourcesContent":["import { unregisterHandler } from '../../handlersRegistry';\nimport RNGestureHandlerModule from '../../../RNGestureHandlerModule';\nimport { scheduleFlushOperations } from '../../utils';\nimport { AttachedGestureState } from './types';\n\nexport function dropHandlers(preparedGesture: AttachedGestureState) {\n for (const handler of preparedGesture.attachedGestures) {\n RNGestureHandlerModule.dropGestureHandler(handler.handlerTag);\n\n unregisterHandler(handler.handlerTag, handler.config.testId);\n }\n\n scheduleFlushOperations();\n}\n"]}
1
+ {"version":3,"sources":["dropHandlers.ts"],"names":["unregisterHandler","RNGestureHandlerModule","scheduleFlushOperations","MountRegistry","dropHandlers","preparedGesture","handler","attachedGestures","dropGestureHandler","handlerTag","config","testId","gestureWillUnmount"],"mappings":"AAAA,SAASA,iBAAT,QAAkC,wBAAlC;AACA,OAAOC,sBAAP,MAAmC,iCAAnC;AACA,SAASC,uBAAT,QAAwC,aAAxC;AAEA,SAASC,aAAT,QAA8B,wBAA9B;AAEA,OAAO,SAASC,YAAT,CAAsBC,eAAtB,EAA6D;AAClE,OAAK,MAAMC,OAAX,IAAsBD,eAAe,CAACE,gBAAtC,EAAwD;AACtDN,IAAAA,sBAAsB,CAACO,kBAAvB,CAA0CF,OAAO,CAACG,UAAlD;AAEAT,IAAAA,iBAAiB,CAACM,OAAO,CAACG,UAAT,EAAqBH,OAAO,CAACI,MAAR,CAAeC,MAApC,CAAjB;AAEAR,IAAAA,aAAa,CAACS,kBAAd,CAAiCN,OAAjC;AACD;;AAEDJ,EAAAA,uBAAuB;AACxB","sourcesContent":["import { unregisterHandler } from '../../handlersRegistry';\nimport RNGestureHandlerModule from '../../../RNGestureHandlerModule';\nimport { scheduleFlushOperations } from '../../utils';\nimport { AttachedGestureState } from './types';\nimport { MountRegistry } from '../../../mountRegistry';\n\nexport function dropHandlers(preparedGesture: AttachedGestureState) {\n for (const handler of preparedGesture.attachedGestures) {\n RNGestureHandlerModule.dropGestureHandler(handler.handlerTag);\n\n unregisterHandler(handler.handlerTag, handler.config.testId);\n\n MountRegistry.gestureWillUnmount(handler);\n }\n\n scheduleFlushOperations();\n}\n"]}
@@ -12,6 +12,7 @@ import { useWebEventHandlers } from './utils';
12
12
  import { Wrap, AnimatedWrap } from './Wrap';
13
13
  import { useDetectorUpdater } from './useDetectorUpdater';
14
14
  import { useViewRefHandler } from './useViewRefHandler';
15
+ import { useMountReactions } from './useMountReactions';
15
16
 
16
17
  function propagateDetectorConfig(props, gesture) {
17
18
  const keysToPropagate = ['userSelect', 'enableContextMenu', 'touchAction'];
@@ -101,6 +102,7 @@ export const GestureDetector = props => {
101
102
  updateAttachedGestures();
102
103
  }
103
104
  }, [props]);
105
+ useMountReactions(updateAttachedGestures, preparedGesture);
104
106
 
105
107
  if (shouldUseReanimated) {
106
108
  return /*#__PURE__*/React.createElement(AnimatedWrap, {
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","useContext","useEffect","useLayoutEffect","useMemo","useRef","Platform","findNodeHandle","isJestEnv","GestureHandlerRootViewContext","useAnimatedGesture","attachHandlers","needsToReattach","dropHandlers","useWebEventHandlers","Wrap","AnimatedWrap","useDetectorUpdater","useViewRefHandler","propagateDetectorConfig","props","gesture","keysToPropagate","key","value","undefined","g","toGestureArray","config","GestureDetector","rootViewContext","__DEV__","OS","Error","gestureConfig","gesturesToAttach","shouldUseReanimated","some","webEventHandlersRef","state","firstRender","viewRef","previousViewTag","forceRebuildReanimatedEvent","current","preparedGesture","attachedGestures","animatedEventHandler","animatedHandlers","isMounted","updateAttachedGestures","refHandler","needsToRebuildReanimatedEvent","viewTag","children"],"mappings":"AAAA;AACA,OAAOA,KAAP,IACEC,UADF,EAEEC,SAFF,EAGEC,eAHF,EAIEC,OAJF,EAKEC,MALF,QAMO,OANP;AAOA,SAASC,QAAT,QAAyB,cAAzB;AACA,OAAOC,cAAP,MAA2B,yBAA3B;AAIA,SAASC,SAAT,QAA0B,gBAA1B;AAEA,OAAOC,6BAAP,MAA0C,wCAA1C;AAEA,SAASC,kBAAT,QAAmC,sBAAnC;AACA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,mBAAT,QAAoC,SAApC;AACA,SAASC,IAAT,EAAeC,YAAf,QAAmC,QAAnC;AACA,SAASC,kBAAT,QAAmC,sBAAnC;AACA,SAASC,iBAAT,QAAkC,qBAAlC;;AAEA,SAASC,uBAAT,CACEC,KADF,EAEEC,OAFF,EAGE;AACA,QAAMC,eAA+C,GAAG,CACtD,YADsD,EAEtD,mBAFsD,EAGtD,aAHsD,CAAxD;;AAMA,OAAK,MAAMC,GAAX,IAAkBD,eAAlB,EAAmC;AACjC,UAAME,KAAK,GAAGJ,KAAK,CAACG,GAAD,CAAnB;;AACA,QAAIC,KAAK,KAAKC,SAAd,EAAyB;AACvB;AACD;;AAED,SAAK,MAAMC,CAAX,IAAgBL,OAAO,CAACM,c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,wBACE,oBAAC,YAAD;AACE,MAAA,GAAG,EAAEe,UADP;AAEE,MAAA,qBAAqB,EAAEN,eAAe,CAACE;AAFzC,OAGG3B,KAAK,CAACkC,QAHT,CADF;AAOD,GARD,MAQO;AACL,wBAAO,oBAAC,IAAD;AAAM,MAAA,GAAG,EAAEH;AAAX,OAAwB/B,KAAK,CAACkC,QAA9B,CAAP;AACD;AACF,CA9FM","sourcesContent":["/* eslint-disable react/no-unused-prop-types */\nimport React, {\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n} from 'react';\nimport { Platform } from 'react-native';\nimport findNodeHandle from '../../../findNodeHandle';\nimport { GestureType } from '../gesture';\nimport { UserSelect, TouchAction } from '../../gestureHandlerCommon';\nimport { ComposedGesture } from '../gestureComposition';\nimport { isJestEnv } from '../../../utils';\n\nimport GestureHandlerRootViewContext from '../../../GestureHandlerRootViewContext';\nimport { AttachedGestureState, GestureDetectorState } from './types';\nimport { useAnimatedGesture } from './useAnimatedGesture';\nimport { attachHandlers } from './attachHandlers';\nimport { needsToReattach } from './needsToReattach';\nimport { dropHandlers } from './dropHandlers';\nimport { useWebEventHandlers } from './utils';\nimport { Wrap, AnimatedWrap } from './Wrap';\nimport { useDetectorUpdater } from './useDetectorUpdater';\nimport { useViewRefHandler } from './useViewRefHandler';\n\nfunction propagateDetectorConfig(\n props: GestureDetectorProps,\n gesture: ComposedGesture | GestureType\n) {\n const keysToPropagate: (keyof GestureDetectorProps)[] = [\n 'userSelect',\n 'enableContextMenu',\n 'touchAction',\n ];\n\n for (const key of keysToPropagate) {\n const value = props[key];\n if (value === undefined) {\n continue;\n }\n\n for (const g of gesture.toGestureArray()) {\n const config = g.config as { [key: string]: unknown };\n config[key] = value;\n }\n }\n}\n\ninterface GestureDetectorProps {\n children?: React.ReactNode;\n /**\n * A gesture object containing the configuration and callbacks.\n * Can be any of:\n * - base gestures (`Tap`, `Pan`, ...)\n * - `ComposedGesture` (`Race`, `Simultaneous`, `Exclusive`)\n */\n gesture: ComposedGesture | GestureType;\n /**\n * #### Web only\n * This parameter allows to specify which `userSelect` property should be applied to underlying view.\n * Possible values are `\"none\" | \"auto\" | \"text\"`. Default value is set to `\"none\"`.\n */\n userSelect?: UserSelect;\n /**\n * #### Web only\n * Specifies whether context menu should be enabled after clicking on underlying view with right mouse button.\n * Default value is set to `false`.\n */\n enableContextMenu?: boolean;\n /**\n * #### Web only\n * This parameter allows to specify which `touchAction` property should be applied to underlying view.\n * Supports all CSS touch-action values (e.g. `\"none\"`, `\"pan-y\"`). Default value is set to `\"none\"`.\n */\n touchAction?: TouchAction;\n}\n\n/**\n * `GestureDetector` is responsible for creating and updating native gesture handlers based on the config of provided gesture.\n *\n * ### Props\n * - `gesture`\n * - `userSelect` (**Web only**)\n * - `enableContextMenu` (**Web only**)\n * - `touchAction` (**Web only**)\n *\n * ### Remarks\n * - Gesture Detector will use first native view in its subtree to recognize gestures, however if this view is used only to group its children it may get automatically collapsed.\n * - Using the same instance of a gesture across multiple Gesture Detectors is not possible.\n *\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/gesture-detector\n */\nexport const GestureDetector = (props: GestureDetectorProps) => {\n const rootViewContext = useContext(GestureHandlerRootViewContext);\n if (__DEV__ && !rootViewContext && !isJestEnv() && Platform.OS !== 'web') {\n throw new Error(\n 'GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.'\n );\n }\n\n // Gesture config should be wrapped with useMemo to prevent unnecessary re-renders\n const gestureConfig = props.gesture;\n propagateDetectorConfig(props, gestureConfig);\n\n const gesturesToAttach = useMemo(\n () => gestureConfig.toGestureArray(),\n [gestureConfig]\n );\n const shouldUseReanimated = gesturesToAttach.some(\n (g) => g.shouldUseReanimated\n );\n\n const webEventHandlersRef = useWebEventHandlers();\n // Store state in ref to prevent unnecessary renders\n const state = useRef<GestureDetectorState>({\n firstRender: true,\n viewRef: null,\n previousViewTag: -1,\n forceRebuildReanimatedEvent: false,\n }).current;\n\n const preparedGesture = React.useRef<AttachedGestureState>({\n attachedGestures: [],\n animatedEventHandler: null,\n animatedHandlers: null,\n shouldUseReanimated: shouldUseReanimated,\n isMounted: false,\n }).current;\n\n const updateAttachedGestures = useDetectorUpdater(\n state,\n preparedGesture,\n gesturesToAttach,\n gestureConfig,\n webEventHandlersRef\n );\n\n const refHandler = useViewRefHandler(state, updateAttachedGestures);\n\n // Reanimated event should be rebuilt only when gestures are reattached, otherwise\n // config update will be enough as all necessary items are stored in shared values anyway\n const needsToRebuildReanimatedEvent =\n state.firstRender ||\n state.forceRebuildReanimatedEvent ||\n needsToReattach(preparedGesture, gesturesToAttach);\n state.forceRebuildReanimatedEvent = false;\n\n useAnimatedGesture(preparedGesture, needsToRebuildReanimatedEvent);\n\n useLayoutEffect(() => {\n const viewTag = findNodeHandle(state.viewRef) as number;\n preparedGesture.isMounted = true;\n\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesturesToAttach,\n webEventHandlersRef,\n viewTag,\n });\n\n return () => {\n preparedGesture.isMounted = false;\n dropHandlers(preparedGesture);\n };\n }, []);\n\n useEffect(() => {\n if (state.firstRender) {\n state.firstRender = false;\n } else {\n updateAttachedGestures();\n }\n }, [props]);\n\n if (shouldUseReanimated) {\n return (\n <AnimatedWrap\n ref={refHandler}\n onGestureHandlerEvent={preparedGesture.animatedEventHandler}>\n {props.children}\n </AnimatedWrap>\n );\n } else {\n return <Wrap ref={refHandler}>{props.children}</Wrap>;\n }\n};\n"]}
1
+ {"version":3,"sources":["index.tsx"],"names":["React","useContext","useEffect","useLayoutEffect","useMemo","useRef","Platform","findNodeHandle","isJestEnv","GestureHandlerRootViewContext","useAnimatedGesture","attachHandlers","needsToReattach","dropHandlers","useWebEventHandlers","Wrap","AnimatedWrap","useDetectorUpdater","useViewRefHandler","useMountReactions","propagateDetectorConfig","props","gesture","keysToPropagate","key","value","undefined","g","toGestureArray","config","GestureDetector","rootViewContext","__DEV__","OS","Error","gestureConfig","gesturesToAttach","shouldUseReanimated","some","webEventHandlersRef","state","firstRender","viewRef","previousViewTag","forceRebuildReanimatedEvent","current","preparedGesture","attachedGestures","animatedEventHandler","animatedHandlers","isMounted","updateAttachedGestures","refHandler","needsToRebuildReanimatedEvent","viewTag","children"],"mappings":"AAAA;AACA,OAAOA,KAAP,IACEC,UADF,EAEEC,SAFF,EAGEC,eAHF,EAIEC,OAJF,EAKEC,MALF,QAMO,OANP;AAOA,SAASC,QAAT,QAAyB,cAAzB;AACA,OAAOC,cAAP,MAA2B,yBAA3B;AAIA,SAASC,SAAT,QAA0B,gBAA1B;AAEA,OAAOC,6BAAP,MAA0C,wCAA1C;AAEA,SAASC,kBAAT,QAAmC,sBAAnC;AACA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,mBAAT,QAAoC,SAApC;AACA,SAASC,IAAT,EAAeC,YAAf,QAAmC,QAAnC;AACA,SAASC,kBAAT,QAAmC,sBAAnC;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,iBAAT,QAAkC,qBAAlC;;AAEA,SAASC,uBAAT,CACEC,KADF,EAEEC,OAFF,EAGE;AACA,QAAMC,eAA+C,GAAG,CACtD,YADsD,EAEtD,mBAFsD,EAGtD,aAHsD,CAAxD;;AAMA,OAAK,MAAMC,GAAX,IAAkBD,eAAlB,EAAmC;AACjC,UAAME,KAAK,GAAGJ,KAAK,CAACG,GAAD,CAAnB;;AACA,QAAIC,KAAK,KAAKC,SAAd,EAAyB;AACvB;AACD;;AAED,SAAK,MAAMC,CAAX,IAAgBL,OAAO,CAACM,cAAR,EAAhB,EAA0C;AACxC,YAAMC,MAAM,GAAGF,CAAC,CAACE,MAAjB;AACAA,MAAAA,MAAM,CAACL,GAAD,CAAN,GAAcC,KAAd;AACD;AACF;AACF;;AA+BD;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AACkC,QAHT,CADF;AAOD,GARD,MAQO;AACL,wBAAO,oBAAC,IAAD;AAAM,MAAA,GAAG,EAAEH;AAAX,OAAwB/B,KAAK,CAACkC,QAA9B,CAAP;AACD;AACF,CAhGM","sourcesContent":["/* eslint-disable react/no-unused-prop-types */\nimport React, {\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n} from 'react';\nimport { Platform } from 'react-native';\nimport findNodeHandle from '../../../findNodeHandle';\nimport { GestureType } from '../gesture';\nimport { UserSelect, TouchAction } from '../../gestureHandlerCommon';\nimport { ComposedGesture } from '../gestureComposition';\nimport { isJestEnv } from '../../../utils';\n\nimport GestureHandlerRootViewContext from '../../../GestureHandlerRootViewContext';\nimport { AttachedGestureState, GestureDetectorState } from './types';\nimport { useAnimatedGesture } from './useAnimatedGesture';\nimport { attachHandlers } from './attachHandlers';\nimport { needsToReattach } from './needsToReattach';\nimport { dropHandlers } from './dropHandlers';\nimport { useWebEventHandlers } from './utils';\nimport { Wrap, AnimatedWrap } from './Wrap';\nimport { useDetectorUpdater } from './useDetectorUpdater';\nimport { useViewRefHandler } from './useViewRefHandler';\nimport { useMountReactions } from './useMountReactions';\n\nfunction propagateDetectorConfig(\n props: GestureDetectorProps,\n gesture: ComposedGesture | GestureType\n) {\n const keysToPropagate: (keyof GestureDetectorProps)[] = [\n 'userSelect',\n 'enableContextMenu',\n 'touchAction',\n ];\n\n for (const key of keysToPropagate) {\n const value = props[key];\n if (value === undefined) {\n continue;\n }\n\n for (const g of gesture.toGestureArray()) {\n const config = g.config as { [key: string]: unknown };\n config[key] = value;\n }\n }\n}\n\ninterface GestureDetectorProps {\n children?: React.ReactNode;\n /**\n * A gesture object containing the configuration and callbacks.\n * Can be any of:\n * - base gestures (`Tap`, `Pan`, ...)\n * - `ComposedGesture` (`Race`, `Simultaneous`, `Exclusive`)\n */\n gesture: ComposedGesture | GestureType;\n /**\n * #### Web only\n * This parameter allows to specify which `userSelect` property should be applied to underlying view.\n * Possible values are `\"none\" | \"auto\" | \"text\"`. Default value is set to `\"none\"`.\n */\n userSelect?: UserSelect;\n /**\n * #### Web only\n * Specifies whether context menu should be enabled after clicking on underlying view with right mouse button.\n * Default value is set to `false`.\n */\n enableContextMenu?: boolean;\n /**\n * #### Web only\n * This parameter allows to specify which `touchAction` property should be applied to underlying view.\n * Supports all CSS touch-action values (e.g. `\"none\"`, `\"pan-y\"`). Default value is set to `\"none\"`.\n */\n touchAction?: TouchAction;\n}\n\n/**\n * `GestureDetector` is responsible for creating and updating native gesture handlers based on the config of provided gesture.\n *\n * ### Props\n * - `gesture`\n * - `userSelect` (**Web only**)\n * - `enableContextMenu` (**Web only**)\n * - `touchAction` (**Web only**)\n *\n * ### Remarks\n * - Gesture Detector will use first native view in its subtree to recognize gestures, however if this view is used only to group its children it may get automatically collapsed.\n * - Using the same instance of a gesture across multiple Gesture Detectors is not possible.\n *\n * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/gesture-detector\n */\nexport const GestureDetector = (props: GestureDetectorProps) => {\n const rootViewContext = useContext(GestureHandlerRootViewContext);\n if (__DEV__ && !rootViewContext && !isJestEnv() && Platform.OS !== 'web') {\n throw new Error(\n 'GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.'\n );\n }\n\n // Gesture config should be wrapped with useMemo to prevent unnecessary re-renders\n const gestureConfig = props.gesture;\n propagateDetectorConfig(props, gestureConfig);\n\n const gesturesToAttach = useMemo(\n () => gestureConfig.toGestureArray(),\n [gestureConfig]\n );\n const shouldUseReanimated = gesturesToAttach.some(\n (g) => g.shouldUseReanimated\n );\n\n const webEventHandlersRef = useWebEventHandlers();\n // Store state in ref to prevent unnecessary renders\n const state = useRef<GestureDetectorState>({\n firstRender: true,\n viewRef: null,\n previousViewTag: -1,\n forceRebuildReanimatedEvent: false,\n }).current;\n\n const preparedGesture = React.useRef<AttachedGestureState>({\n attachedGestures: [],\n animatedEventHandler: null,\n animatedHandlers: null,\n shouldUseReanimated: shouldUseReanimated,\n isMounted: false,\n }).current;\n\n const updateAttachedGestures = useDetectorUpdater(\n state,\n preparedGesture,\n gesturesToAttach,\n gestureConfig,\n webEventHandlersRef\n );\n\n const refHandler = useViewRefHandler(state, updateAttachedGestures);\n\n // Reanimated event should be rebuilt only when gestures are reattached, otherwise\n // config update will be enough as all necessary items are stored in shared values anyway\n const needsToRebuildReanimatedEvent =\n state.firstRender ||\n state.forceRebuildReanimatedEvent ||\n needsToReattach(preparedGesture, gesturesToAttach);\n state.forceRebuildReanimatedEvent = false;\n\n useAnimatedGesture(preparedGesture, needsToRebuildReanimatedEvent);\n\n useLayoutEffect(() => {\n const viewTag = findNodeHandle(state.viewRef) as number;\n preparedGesture.isMounted = true;\n\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesturesToAttach,\n webEventHandlersRef,\n viewTag,\n });\n\n return () => {\n preparedGesture.isMounted = false;\n dropHandlers(preparedGesture);\n };\n }, []);\n\n useEffect(() => {\n if (state.firstRender) {\n state.firstRender = false;\n } else {\n updateAttachedGestures();\n }\n }, [props]);\n\n useMountReactions(updateAttachedGestures, preparedGesture);\n\n if (shouldUseReanimated) {\n return (\n <AnimatedWrap\n ref={refHandler}\n onGestureHandlerEvent={preparedGesture.animatedEventHandler}>\n {props.children}\n </AnimatedWrap>\n );\n } else {\n return <Wrap ref={refHandler}>{props.children}</Wrap>;\n }\n};\n"]}
@@ -0,0 +1,39 @@
1
+ import { transformIntoHandlerTags } from '../../utils';
2
+ import { MountRegistry } from '../../../mountRegistry';
3
+ import { useEffect } from 'react';
4
+
5
+ function shouldUpdateDetector(relation, gesture) {
6
+ if (relation === undefined) {
7
+ return false;
8
+ }
9
+
10
+ for (const tag of transformIntoHandlerTags(relation)) {
11
+ if (tag === gesture.handlerTag) {
12
+ return true;
13
+ }
14
+ }
15
+
16
+ return false;
17
+ }
18
+
19
+ export function useMountReactions(updateDetector, state) {
20
+ useEffect(() => {
21
+ return MountRegistry.addMountListener(gesture => {
22
+ // At this point the ref in the gesture config should be updated, so we can check if one of the gestures
23
+ // set in a relation with the gesture got mounted. If so, we need to update the detector to propagate
24
+ // the changes to the native side.
25
+ for (const attachedGesture of state.attachedGestures) {
26
+ const blocksHandlers = attachedGesture.config.blocksHandlers;
27
+ const requireToFail = attachedGesture.config.requireToFail;
28
+ const simultaneousWith = attachedGesture.config.simultaneousWith;
29
+
30
+ if (shouldUpdateDetector(blocksHandlers, gesture) || shouldUpdateDetector(requireToFail, gesture) || shouldUpdateDetector(simultaneousWith, gesture)) {
31
+ updateDetector(); // We can safely return here, if any other gestures should be updated, they will be by the above call
32
+
33
+ return;
34
+ }
35
+ }
36
+ });
37
+ }, [updateDetector, state]);
38
+ }
39
+ //# sourceMappingURL=useMountReactions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useMountReactions.ts"],"names":["transformIntoHandlerTags","MountRegistry","useEffect","shouldUpdateDetector","relation","gesture","undefined","tag","handlerTag","useMountReactions","updateDetector","state","addMountListener","attachedGesture","attachedGestures","blocksHandlers","config","requireToFail","simultaneousWith"],"mappings":"AAAA,SAASA,wBAAT,QAAyC,aAAzC;AACA,SAASC,aAAT,QAA8B,wBAA9B;AAEA,SAASC,SAAT,QAA0B,OAA1B;;AAGA,SAASC,oBAAT,CACEC,QADF,EAEEC,OAFF,EAGE;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1B,WAAO,KAAP;AACD;;AAED,OAAK,MAAMC,GAAX,IAAkBP,wBAAwB,CAACI,QAAD,CAA1C,EAAsD;AACpD,QAAIG,GAAG,KAAKF,OAAO,CAACG,UAApB,EAAgC;AAC9B,aAAO,IAAP;AACD;AACF;;AAED,SAAO,KAAP;AACD;;AAED,OAAO,SAASC,iBAAT,CACLC,cADK,EAELC,KAFK,EAGL;AACAT,EAAAA,SAAS,CAAC,MAAM;AACd,WAAOD,aAAa,CAACW,gBAAd,CAAgCP,OAAD,IAAa;AACjD;AACA;AACA;AACA,WAAK,MAAMQ,eAAX,IAA8BF,KAAK,CAACG,gBAApC,EAAsD;AACpD,cAAMC,cAAc,GAAGF,eAAe,CAACG,MAAhB,CAAuBD,cAA9C;AACA,cAAME,aAAa,GAAGJ,eAAe,CAACG,MAAhB,CAAuBC,aAA7C;AACA,cAAMC,gBAAgB,GAAGL,eAAe,CAACG,MAAhB,CAAuBE,gBAAhD;;AAEA,YACEf,oBAAoB,CAACY,cAAD,EAAiBV,OAAjB,CAApB,IACAF,oBAAoB,CAACc,aAAD,EAAgBZ,OAAhB,CADpB,IAEAF,oBAAoB,CAACe,gBAAD,EAAmBb,OAAnB,CAHtB,EAIE;AACAK,UAAAA,cAAc,GADd,CAGA;;AACA;AACD;AACF;AACF,KApBM,CAAP;AAqBD,GAtBQ,EAsBN,CAACA,cAAD,EAAiBC,KAAjB,CAtBM,CAAT;AAuBD","sourcesContent":["import { transformIntoHandlerTags } from '../../utils';\nimport { MountRegistry } from '../../../mountRegistry';\nimport { AttachedGestureState } from './types';\nimport { useEffect } from 'react';\nimport { GestureRef } from '../gesture';\n\nfunction shouldUpdateDetector(\n relation: GestureRef[] | undefined,\n gesture: { handlerTag: number }\n) {\n if (relation === undefined) {\n return false;\n }\n\n for (const tag of transformIntoHandlerTags(relation)) {\n if (tag === gesture.handlerTag) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function useMountReactions(\n updateDetector: () => void,\n state: AttachedGestureState\n) {\n useEffect(() => {\n return MountRegistry.addMountListener((gesture) => {\n // At this point the ref in the gesture config should be updated, so we can check if one of the gestures\n // set in a relation with the gesture got mounted. If so, we need to update the detector to propagate\n // the changes to the native side.\n for (const attachedGesture of state.attachedGestures) {\n const blocksHandlers = attachedGesture.config.blocksHandlers;\n const requireToFail = attachedGesture.config.requireToFail;\n const simultaneousWith = attachedGesture.config.simultaneousWith;\n\n if (\n shouldUpdateDetector(blocksHandlers, gesture) ||\n shouldUpdateDetector(requireToFail, gesture) ||\n shouldUpdateDetector(simultaneousWith, gesture)\n ) {\n updateDetector();\n\n // We can safely return here, if any other gestures should be updated, they will be by the above call\n return;\n }\n }\n });\n }, [updateDetector, state]);\n}\n"]}