react-native-screen-transitions 3.4.0-alpha.7 → 3.4.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js +6 -4
  2. package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js.map +1 -1
  3. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js +20 -59
  4. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
  5. package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +1 -1
  6. package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
  7. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +53 -41
  8. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  9. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -1
  10. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
  11. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +4 -23
  12. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
  13. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +84 -2
  14. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
  15. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js +67 -0
  16. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js.map +1 -0
  17. package/lib/commonjs/shared/components/create-boundary-component/index.js +10 -5
  18. package/lib/commonjs/shared/components/create-boundary-component/index.js.map +1 -1
  19. package/lib/commonjs/shared/components/create-transition-aware-component.js +8 -32
  20. package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
  21. package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js +11 -9
  22. package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
  23. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +7 -5
  24. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
  25. package/lib/commonjs/shared/components/screen-lifecycle/index.js +3 -1
  26. package/lib/commonjs/shared/components/screen-lifecycle/index.js.map +1 -1
  27. package/lib/commonjs/shared/constants.js +16 -1
  28. package/lib/commonjs/shared/constants.js.map +1 -1
  29. package/lib/commonjs/shared/hooks/reanimated/use-animated-debounce.js +43 -0
  30. package/lib/commonjs/shared/hooks/reanimated/use-animated-debounce.js.map +1 -0
  31. package/lib/commonjs/shared/index.js +6 -0
  32. package/lib/commonjs/shared/index.js.map +1 -1
  33. package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js +7 -0
  34. package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
  35. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js +23 -1
  36. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
  37. package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js +3 -0
  38. package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
  39. package/lib/commonjs/shared/providers/screen/styles/styles.provider.js +1 -11
  40. package/lib/commonjs/shared/providers/screen/styles/styles.provider.js.map +1 -1
  41. package/lib/commonjs/shared/stores/animation.store.js +9 -3
  42. package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
  43. package/lib/commonjs/shared/stores/bounds/internals/registry.js +18 -2
  44. package/lib/commonjs/shared/stores/bounds/internals/registry.js.map +1 -1
  45. package/lib/commonjs/shared/stores/bounds/internals/resolver.js +7 -48
  46. package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
  47. package/lib/commonjs/shared/utils/animation/animate-to-progress.js +10 -0
  48. package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
  49. package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js +5 -11
  50. package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
  51. package/lib/commonjs/shared/utils/bounds/zoom/build.js +108 -28
  52. package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
  53. package/lib/commonjs/shared/utils/bounds/zoom/config.js +3 -1
  54. package/lib/commonjs/shared/utils/bounds/zoom/config.js.map +1 -1
  55. package/lib/module/shared/components/create-boundary-component/components/boundary-target.js +6 -4
  56. package/lib/module/shared/components/create-boundary-component/components/boundary-target.js.map +1 -1
  57. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js +21 -60
  58. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
  59. package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +1 -1
  60. package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
  61. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +51 -39
  62. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  63. package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -1
  64. package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
  65. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +4 -23
  66. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
  67. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +86 -4
  68. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
  69. package/lib/module/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js +62 -0
  70. package/lib/module/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js.map +1 -0
  71. package/lib/module/shared/components/create-boundary-component/index.js +10 -5
  72. package/lib/module/shared/components/create-boundary-component/index.js.map +1 -1
  73. package/lib/module/shared/components/create-transition-aware-component.js +10 -34
  74. package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
  75. package/lib/module/shared/components/screen-container/hooks/use-content-layout.js +11 -9
  76. package/lib/module/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
  77. package/lib/module/shared/components/screen-container/layers/backdrop.js +7 -5
  78. package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
  79. package/lib/module/shared/components/screen-lifecycle/index.js +3 -1
  80. package/lib/module/shared/components/screen-lifecycle/index.js.map +1 -1
  81. package/lib/module/shared/constants.js +15 -0
  82. package/lib/module/shared/constants.js.map +1 -1
  83. package/lib/module/shared/hooks/reanimated/use-animated-debounce.js +39 -0
  84. package/lib/module/shared/hooks/reanimated/use-animated-debounce.js.map +1 -0
  85. package/lib/module/shared/index.js +1 -1
  86. package/lib/module/shared/index.js.map +1 -1
  87. package/lib/module/shared/providers/gestures/handlers/use-handlers.js +7 -0
  88. package/lib/module/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
  89. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js +23 -1
  90. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
  91. package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js +3 -0
  92. package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
  93. package/lib/module/shared/providers/screen/styles/styles.provider.js +1 -11
  94. package/lib/module/shared/providers/screen/styles/styles.provider.js.map +1 -1
  95. package/lib/module/shared/stores/animation.store.js +9 -3
  96. package/lib/module/shared/stores/animation.store.js.map +1 -1
  97. package/lib/module/shared/stores/bounds/internals/registry.js +18 -2
  98. package/lib/module/shared/stores/bounds/internals/registry.js.map +1 -1
  99. package/lib/module/shared/stores/bounds/internals/resolver.js +7 -48
  100. package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
  101. package/lib/module/shared/utils/animation/animate-to-progress.js +10 -0
  102. package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
  103. package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js +5 -11
  104. package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
  105. package/lib/module/shared/utils/bounds/zoom/build.js +110 -30
  106. package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
  107. package/lib/module/shared/utils/bounds/zoom/config.js +2 -0
  108. package/lib/module/shared/utils/bounds/zoom/config.js.map +1 -1
  109. package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts.map +1 -1
  110. package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts.map +1 -1
  111. package/lib/typescript/shared/components/create-boundary-component/helpers/resolve-pending-source-key.d.ts.map +1 -1
  112. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts +16 -11
  113. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts.map +1 -1
  114. package/lib/typescript/shared/components/create-boundary-component/hooks/use-auto-source-measurement.d.ts +3 -1
  115. package/lib/typescript/shared/components/create-boundary-component/hooks/use-auto-source-measurement.d.ts.map +1 -1
  116. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts +1 -2
  117. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts.map +1 -1
  118. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts +6 -1
  119. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts.map +1 -1
  120. package/lib/typescript/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.d.ts +12 -0
  121. package/lib/typescript/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.d.ts.map +1 -0
  122. package/lib/typescript/shared/components/create-boundary-component/index.d.ts +10 -4
  123. package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +1 -1
  124. package/lib/typescript/shared/components/create-boundary-component/types.d.ts +1 -1
  125. package/lib/typescript/shared/components/create-boundary-component/types.d.ts.map +1 -1
  126. package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
  127. package/lib/typescript/shared/components/screen-container/hooks/use-content-layout.d.ts.map +1 -1
  128. package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts.map +1 -1
  129. package/lib/typescript/shared/components/screen-lifecycle/index.d.ts.map +1 -1
  130. package/lib/typescript/shared/constants.d.ts +33 -0
  131. package/lib/typescript/shared/constants.d.ts.map +1 -1
  132. package/lib/typescript/shared/hooks/reanimated/use-animated-debounce.d.ts +13 -0
  133. package/lib/typescript/shared/hooks/reanimated/use-animated-debounce.d.ts.map +1 -0
  134. package/lib/typescript/shared/index.d.ts +2 -2
  135. package/lib/typescript/shared/index.d.ts.map +1 -1
  136. package/lib/typescript/shared/providers/gestures/handlers/use-handlers.d.ts.map +1 -1
  137. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts +3 -0
  138. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts.map +1 -1
  139. package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts +3 -0
  140. package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts.map +1 -1
  141. package/lib/typescript/shared/providers/screen/styles/styles.provider.d.ts.map +1 -1
  142. package/lib/typescript/shared/stores/animation.store.d.ts +5 -2
  143. package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
  144. package/lib/typescript/shared/stores/bounds/internals/registry.d.ts.map +1 -1
  145. package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
  146. package/lib/typescript/shared/stores/bounds/types.d.ts +0 -2
  147. package/lib/typescript/shared/stores/bounds/types.d.ts.map +1 -1
  148. package/lib/typescript/shared/types/animation.types.d.ts +11 -0
  149. package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
  150. package/lib/typescript/shared/types/bounds.types.d.ts +34 -1
  151. package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
  152. package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts +2 -1
  153. package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
  154. package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +1 -1
  155. package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
  156. package/lib/typescript/shared/utils/bounds/zoom/config.d.ts +2 -0
  157. package/lib/typescript/shared/utils/bounds/zoom/config.d.ts.map +1 -1
  158. package/package.json +1 -1
  159. package/src/shared/components/create-boundary-component/components/boundary-target.tsx +6 -4
  160. package/src/shared/components/create-boundary-component/create-boundary-component.tsx +26 -59
  161. package/src/shared/components/create-boundary-component/helpers/resolve-pending-source-key.ts +5 -1
  162. package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +68 -54
  163. package/src/shared/components/create-boundary-component/hooks/use-auto-source-measurement.ts +19 -3
  164. package/src/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.ts +5 -34
  165. package/src/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.ts +165 -6
  166. package/src/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.ts +107 -0
  167. package/src/shared/components/create-boundary-component/index.tsx +10 -5
  168. package/src/shared/components/create-boundary-component/types.ts +1 -2
  169. package/src/shared/components/create-transition-aware-component.tsx +10 -47
  170. package/src/shared/components/screen-container/hooks/use-content-layout.ts +10 -17
  171. package/src/shared/components/screen-container/layers/backdrop.tsx +6 -9
  172. package/src/shared/components/screen-lifecycle/index.tsx +1 -4
  173. package/src/shared/constants.ts +11 -0
  174. package/src/shared/hooks/reanimated/use-animated-debounce.ts +56 -0
  175. package/src/shared/index.ts +1 -0
  176. package/src/shared/providers/gestures/handlers/use-handlers.ts +9 -0
  177. package/src/shared/providers/screen/animation/helpers/hydrate-transition-state.ts +27 -1
  178. package/src/shared/providers/screen/animation/helpers/use-build-transition-state.ts +6 -0
  179. package/src/shared/providers/screen/styles/styles.provider.tsx +1 -12
  180. package/src/shared/stores/animation.store.ts +11 -2
  181. package/src/shared/stores/bounds/internals/registry.ts +24 -3
  182. package/src/shared/stores/bounds/internals/resolver.ts +6 -75
  183. package/src/shared/stores/bounds/types.ts +0 -2
  184. package/src/shared/types/animation.types.ts +13 -0
  185. package/src/shared/types/bounds.types.ts +34 -1
  186. package/src/shared/utils/animation/animate-to-progress.ts +11 -1
  187. package/src/shared/utils/bounds/helpers/compute-bounds-styles.ts +1 -11
  188. package/src/shared/utils/bounds/zoom/build.ts +158 -45
  189. package/src/shared/utils/bounds/zoom/config.ts +2 -0
  190. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +0 -54
  191. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +0 -1
  192. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +0 -122
  193. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +0 -1
  194. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +0 -72
  195. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +0 -1
  196. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +0 -66
  197. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +0 -1
  198. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +0 -58
  199. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +0 -1
  200. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +0 -53
  201. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +0 -1
  202. package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +0 -49
  203. package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +0 -1
  204. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +0 -118
  205. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +0 -1
  206. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +0 -67
  207. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +0 -1
  208. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +0 -61
  209. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +0 -1
  210. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +0 -53
  211. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +0 -1
  212. package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +0 -48
  213. package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +0 -1
  214. package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts +0 -11
  215. package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts.map +0 -1
  216. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts +0 -17
  217. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts.map +0 -1
  218. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts +0 -11
  219. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts.map +0 -1
  220. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts +0 -10
  221. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts.map +0 -1
  222. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts +0 -11
  223. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts.map +0 -1
  224. package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts +0 -10
  225. package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts.map +0 -1
  226. package/src/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.ts +0 -58
  227. package/src/shared/components/create-boundary-component/hooks/use-group-active-measurement.ts +0 -162
  228. package/src/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.ts +0 -82
  229. package/src/shared/components/create-boundary-component/hooks/use-initial-layout-handler.ts +0 -92
  230. package/src/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.ts +0 -87
  231. package/src/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.ts +0 -49
@@ -1,4 +1,4 @@
1
- import { interpolate } from "react-native-reanimated";
1
+ import { interpolate, makeMutable } from "react-native-reanimated";
2
2
  import {
3
3
  EPSILON,
4
4
  HIDDEN_STYLE,
@@ -17,6 +17,8 @@ import type { BoundsOptions } from "../types/options";
17
17
  import {
18
18
  getZoomAnchor,
19
19
  toNumber,
20
+ ZOOM_BACKGROUND_SCALE,
21
+ ZOOM_DRAG_DIRECTIONAL_SCALE_EXPONENT,
20
22
  ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
21
23
  ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
22
24
  ZOOM_DRAG_RESISTANCE,
@@ -33,6 +35,8 @@ import {
33
35
  import type { BuildZoomStylesParams, ZoomInterpolatedStyle } from "./types";
34
36
 
35
37
  const IDENTITY_DRAG_SCALE_OUTPUT = [1, 1] as const;
38
+ const UNFOCUSED_ENTER_FADE_END = 1.6;
39
+ const presentedZoomTagByRoute = makeMutable<Record<string, string>>({});
36
40
 
37
41
  /* -------------------------------------------------------------------------- */
38
42
  /* LOCAL HELPERS */
@@ -94,6 +98,84 @@ function getZoomContentTarget({
94
98
  };
95
99
  }
96
100
 
101
+ function resolveDragScaleTuple(
102
+ value:
103
+ | readonly [shrinkMin: number, growMax: number, exponent?: number]
104
+ | undefined,
105
+ ) {
106
+ "worklet";
107
+
108
+ return {
109
+ shrinkMin: value?.[0] ?? ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
110
+ growMax: value?.[1] ?? ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
111
+ exponent: value?.[2] ?? ZOOM_DRAG_DIRECTIONAL_SCALE_EXPONENT,
112
+ };
113
+ }
114
+
115
+ function resolveBackgroundScale(value: number | undefined) {
116
+ "worklet";
117
+
118
+ return value ?? ZOOM_BACKGROUND_SCALE;
119
+ }
120
+
121
+ function resolveEffectiveZoomTag(params: {
122
+ resolvedTag: string;
123
+ activeRouteKey?: string;
124
+ entering: boolean;
125
+ animating: boolean;
126
+ activeProgress: number;
127
+ livePairReady: boolean;
128
+ }) {
129
+ "worklet";
130
+
131
+ const {
132
+ resolvedTag,
133
+ activeRouteKey,
134
+ entering,
135
+ animating,
136
+ activeProgress,
137
+ livePairReady,
138
+ } = params;
139
+
140
+ // Only grouped ids need retarget stabilization. Plain ids should keep their
141
+ // normal behavior with no route-level caching.
142
+ if (!activeRouteKey || !resolvedTag.includes(":")) {
143
+ return resolvedTag;
144
+ }
145
+
146
+ const cachedTag = presentedZoomTagByRoute.value[activeRouteKey];
147
+ const isFreshOpenFrame = entering && activeProgress <= 0.05;
148
+ const shouldFreezeDuringEnter = entering && animating && !isFreshOpenFrame;
149
+
150
+ if (!cachedTag || isFreshOpenFrame) {
151
+ presentedZoomTagByRoute.modify((state) => ({
152
+ ...state,
153
+ [activeRouteKey]: resolvedTag,
154
+ }));
155
+ return resolvedTag;
156
+ }
157
+
158
+ if (shouldFreezeDuringEnter) {
159
+ return cachedTag;
160
+ }
161
+
162
+ // After the enter animation, grouped retargeting can still briefly point at a
163
+ // new active id before that tag has usable bounds. Keep presenting the last
164
+ // good tag until the next one is transition-ready.
165
+ if (cachedTag !== resolvedTag && !livePairReady) {
166
+ return cachedTag;
167
+ }
168
+
169
+ if (cachedTag !== resolvedTag) {
170
+ presentedZoomTagByRoute.modify((state) => ({
171
+ ...state,
172
+ [activeRouteKey]: resolvedTag,
173
+ }));
174
+ }
175
+
176
+ return resolvedTag;
177
+ }
178
+
97
179
  /* -------------------------------------------------------------------------- */
98
180
  /* BUILD ZOOM STYLES */
99
181
  /* -------------------------------------------------------------------------- */
@@ -110,18 +192,32 @@ export function buildZoomStyles({
110
192
  /* ------------------------------ Shared Setup ------------------------------ */
111
193
 
112
194
  const explicitTarget = zoomOptions?.target;
113
- const debug = zoomOptions?.DEBUG === true;
114
195
  const focused = props.focused;
115
196
  const progress = props.progress;
116
197
  const screenLayout = props.layouts.screen;
117
198
  const isEnteringTransition = !props.next;
199
+ const activeRouteKey = props.active.route.key;
118
200
  const currentRouteKey = props.current?.route.key;
119
201
  const previousRouteKey = props.previous?.route.key;
120
202
  const nextRouteKey = props.next?.route.key;
121
203
  const resolvedZoomAnchor = getZoomAnchor(explicitTarget);
204
+ const liveResolvedPair = BoundStore.resolveTransitionPair(resolvedTag, {
205
+ currentScreenKey: currentRouteKey,
206
+ previousScreenKey: previousRouteKey,
207
+ nextScreenKey: nextRouteKey,
208
+ entering: isEnteringTransition,
209
+ });
210
+ const effectiveTag = resolveEffectiveZoomTag({
211
+ resolvedTag,
212
+ activeRouteKey,
213
+ entering: !!props.active.entering,
214
+ animating: !!props.active.animating,
215
+ activeProgress: props.active.progress,
216
+ livePairReady: !!liveResolvedPair.sourceBounds,
217
+ });
122
218
 
123
219
  const zoomComputeParams = {
124
- id: resolvedTag,
220
+ id: effectiveTag,
125
221
  previous: props.previous,
126
222
  current: props.current,
127
223
  next: props.next,
@@ -130,22 +226,25 @@ export function buildZoomStyles({
130
226
  } as const;
131
227
 
132
228
  const baseRawOptions = {
133
- id: resolvedTag,
229
+ id: effectiveTag,
134
230
  raw: true,
135
231
  scaleMode: ZOOM_SHARED_OPTIONS.scaleMode,
136
232
  } as const;
137
233
 
138
- const resolvedPair = BoundStore.resolveTransitionPair(resolvedTag, {
139
- currentScreenKey: currentRouteKey,
140
- previousScreenKey: previousRouteKey,
141
- nextScreenKey: nextRouteKey,
142
- entering: isEnteringTransition,
143
- });
234
+ const resolvedPair =
235
+ effectiveTag === resolvedTag
236
+ ? liveResolvedPair
237
+ : BoundStore.resolveTransitionPair(effectiveTag, {
238
+ currentScreenKey: currentRouteKey,
239
+ previousScreenKey: previousRouteKey,
240
+ nextScreenKey: nextRouteKey,
241
+ entering: isEnteringTransition,
242
+ });
144
243
 
145
244
  const sourceBorderRadius = getSourceBorderRadius(resolvedPair);
146
245
  const targetBorderRadius = zoomOptions?.borderRadius ?? sourceBorderRadius;
147
246
  const sourceVisibilityStyle = {
148
- [resolvedTag]: VISIBLE_STYLE,
247
+ [effectiveTag]: VISIBLE_STYLE,
149
248
  } satisfies TransitionInterpolatedStyle;
150
249
  const focusedContentSlot = props.navigationMaskEnabled
151
250
  ? NAVIGATION_MASK_CONTAINER_STYLE_ID
@@ -153,10 +252,11 @@ export function buildZoomStyles({
153
252
 
154
253
  /* --------------------------- Missing Source Guard -------------------------- */
155
254
 
156
- // To avoid initial flickering, we'll want to hide if there are no source bounds
157
- // But to also avoid scenarios where activeId changes in dst and theres a failed measurement,
158
- // we should only hide if entering and there is no source bounds.
159
- if (!resolvedPair.sourceBounds && props.active.entering) {
255
+ // Only the focused entering route should be hidden when source bounds are
256
+ // missing. During grouped retargeting, the unfocused/source route can still be
257
+ // styled by the destination interpolator while the new active member is warming
258
+ // up; hiding there blanks the wrong screen.
259
+ if (focused && !resolvedPair.sourceBounds && props.active.entering) {
160
260
  return {
161
261
  [focusedContentSlot]: HIDDEN_STYLE,
162
262
  };
@@ -183,15 +283,22 @@ export function buildZoomStyles({
183
283
  dimension: screenLayout.height,
184
284
  resistance: ZOOM_DRAG_RESISTANCE,
185
285
  });
286
+ const horizontalDragScale = resolveDragScaleTuple(
287
+ zoomOptions?.horizontalDragScale,
288
+ );
289
+ const verticalDragScale = resolveDragScaleTuple(
290
+ zoomOptions?.verticalDragScale,
291
+ );
292
+ const backgroundScale = resolveBackgroundScale(zoomOptions?.backgroundScale);
186
293
 
187
294
  const dragXScale = isHorizontalDismiss
188
295
  ? resolveDirectionalDragScale({
189
296
  normalized: normX,
190
297
  dismissDirection:
191
298
  initialDirection === "horizontal-inverted" ? "negative" : "positive",
192
- shrinkMin: ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
193
- growMax: ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
194
- exponent: 2,
299
+ shrinkMin: horizontalDragScale.shrinkMin,
300
+ growMax: horizontalDragScale.growMax,
301
+ exponent: horizontalDragScale.exponent,
195
302
  })
196
303
  : IDENTITY_DRAG_SCALE_OUTPUT[0];
197
304
  const dragYScale = isVerticalDismiss
@@ -199,9 +306,9 @@ export function buildZoomStyles({
199
306
  normalized: normY,
200
307
  dismissDirection:
201
308
  initialDirection === "vertical-inverted" ? "negative" : "positive",
202
- shrinkMin: ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
203
- growMax: ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
204
- exponent: 2,
309
+ shrinkMin: verticalDragScale.shrinkMin,
310
+ growMax: verticalDragScale.growMax,
311
+ exponent: verticalDragScale.exponent,
205
312
  })
206
313
  : IDENTITY_DRAG_SCALE_OUTPUT[1];
207
314
  const dragScale = combineScales(dragXScale, dragYScale);
@@ -240,8 +347,8 @@ export function buildZoomStyles({
240
347
  ) as Record<string, unknown>;
241
348
 
242
349
  const focusedFade = props.active?.closing
243
- ? interpolate(progress, [0.6, 1], [0, debug ? 0.5 : 1], "clamp")
244
- : interpolate(progress, [0, 0.5], [0, debug ? 0.5 : 1], "clamp");
350
+ ? interpolate(progress, [0.6, 1], [0, 1], "clamp")
351
+ : interpolate(progress, [0, 0.5], [0, 1], "clamp");
245
352
 
246
353
  /**
247
354
  * This is also how swiftui handles their navigation zoom.
@@ -303,23 +410,29 @@ export function buildZoomStyles({
303
410
  /* ---------------------------- Unfocused Screen ---------------------------- */
304
411
 
305
412
  const unfocusedFade = props.active?.closing
306
- ? interpolate(progress, [1.6, 2], [1, debug ? 1 : 0], "clamp")
307
- : interpolate(progress, [1, 1.5], [1, debug ? 1 : 0], "clamp");
308
- const unfocusedScale = interpolate(progress, [1, 2], [1, 0.95], "clamp");
413
+ ? interpolate(progress, [1.9, 2], [1, 0], "clamp")
414
+ : interpolate(progress, [1, 2], [1, 0], "clamp");
415
+ const unfocusedScale = interpolate(
416
+ progress,
417
+ [1, 2],
418
+ [1, backgroundScale],
419
+ "clamp",
420
+ );
309
421
  const isUnfocusedIdle = props.active.settled === 1;
310
- const shouldHideUnfocusedIdle = isUnfocusedIdle && !debug;
311
- const shouldFreezeUnfocusedElement =
312
- props.active.logicallySettled && !props.active.closing;
313
-
314
- const unfocusedElementTarget =
315
- explicitTarget !== undefined || resolvedPair.destinationBounds
316
- ? getZoomContentTarget({
317
- explicitTarget,
318
- screenLayout,
319
- anchor: ZOOM_SHARED_OPTIONS.anchor,
320
- resolvedPair,
321
- })
322
- : ("fullscreen" as const);
422
+ const shouldHideUnfocusedIdle = isUnfocusedIdle;
423
+ const didSourceComponentVisiblyHide =
424
+ !props.active.closing && unfocusedFade <= EPSILON;
425
+
426
+ const shouldResetUnfocusedElement =
427
+ !props.active.closing &&
428
+ (props.active.logicallySettled || didSourceComponentVisiblyHide);
429
+
430
+ const unfocusedElementTarget = getZoomContentTarget({
431
+ explicitTarget,
432
+ screenLayout,
433
+ anchor: ZOOM_SHARED_OPTIONS.anchor,
434
+ resolvedPair,
435
+ });
323
436
 
324
437
  const elementRaw = computeBoundStyles(
325
438
  zoomComputeParams,
@@ -401,19 +514,19 @@ export function buildZoomStyles({
401
514
  : {
402
515
  transform: [
403
516
  {
404
- translateX: shouldFreezeUnfocusedElement ? 0 : elementTranslateX,
517
+ translateX: shouldResetUnfocusedElement ? 0 : elementTranslateX,
405
518
  },
406
519
  {
407
- translateY: shouldFreezeUnfocusedElement ? 0 : elementTranslateY,
520
+ translateY: shouldResetUnfocusedElement ? 0 : elementTranslateY,
408
521
  },
409
522
  {
410
- scaleX: shouldFreezeUnfocusedElement ? 1 : elementScaleX,
523
+ scaleX: shouldResetUnfocusedElement ? 1 : elementScaleX,
411
524
  },
412
525
  {
413
- scaleY: shouldFreezeUnfocusedElement ? 1 : elementScaleY,
526
+ scaleY: shouldResetUnfocusedElement ? 1 : elementScaleY,
414
527
  },
415
528
  ],
416
- opacity: debug ? 0.5 : unfocusedFade,
529
+ opacity: unfocusedFade,
417
530
  zIndex: 9999,
418
531
  elevation: 9999,
419
532
  };
@@ -424,7 +537,7 @@ export function buildZoomStyles({
424
537
  transform: [{ scale: unfocusedScale }],
425
538
  },
426
539
  },
427
- [resolvedTag]: {
540
+ [effectiveTag]: {
428
541
  style: resolvedElementStyle,
429
542
  },
430
543
  };
@@ -8,6 +8,8 @@ export const ZOOM_SHARED_OPTIONS = Object.freeze({
8
8
  export const ZOOM_DRAG_RESISTANCE = 0.4;
9
9
  export const ZOOM_DRAG_DIRECTIONAL_SCALE_MIN = 0.25;
10
10
  export const ZOOM_DRAG_DIRECTIONAL_SCALE_MAX = 1.06;
11
+ export const ZOOM_DRAG_DIRECTIONAL_SCALE_EXPONENT = 2;
12
+ export const ZOOM_BACKGROUND_SCALE = 0.9375;
11
13
 
12
14
  export const ZOOM_MASK_OUTSET = Object.freeze({
13
15
  top: 0,
@@ -1,54 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useDeferredMeasurementTrigger = void 0;
7
- var _react = require("react");
8
- var _reactNativeReanimated = require("react-native-reanimated");
9
- const useDeferredMeasurementTrigger = params => {
10
- const {
11
- enabled,
12
- isAnimating,
13
- canFlush,
14
- onFlush
15
- } = params;
16
- const hasPendingMeasurement = (0, _reactNativeReanimated.useSharedValue)(false);
17
- const clearPendingMeasurement = (0, _react.useCallback)(() => {
18
- "worklet";
19
-
20
- hasPendingMeasurement.value = false;
21
- }, [hasPendingMeasurement]);
22
- const queueOrFlushMeasurement = (0, _react.useCallback)(() => {
23
- "worklet";
24
-
25
- if (!enabled) return;
26
- if (isAnimating.value) {
27
- hasPendingMeasurement.value = true;
28
- return;
29
- }
30
- hasPendingMeasurement.value = false;
31
- onFlush();
32
- }, [enabled, isAnimating, hasPendingMeasurement, onFlush]);
33
- (0, _reactNativeReanimated.useAnimatedReaction)(() => {
34
- "worklet";
35
-
36
- if (!enabled) return false;
37
- if (!hasPendingMeasurement.value) return false;
38
- if (isAnimating.value) return false;
39
- return canFlush ? canFlush() : true;
40
- }, (shouldFlush, previousShouldFlush) => {
41
- "worklet";
42
-
43
- if (!enabled) return;
44
- if (!shouldFlush || shouldFlush === previousShouldFlush) return;
45
- hasPendingMeasurement.value = false;
46
- onFlush();
47
- }, [enabled, isAnimating, hasPendingMeasurement, canFlush, onFlush]);
48
- return {
49
- clearPendingMeasurement,
50
- queueOrFlushMeasurement
51
- };
52
- };
53
- exports.useDeferredMeasurementTrigger = useDeferredMeasurementTrigger;
54
- //# sourceMappingURL=use-deferred-measurement-trigger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","require","_reactNativeReanimated","useDeferredMeasurementTrigger","params","enabled","isAnimating","canFlush","onFlush","hasPendingMeasurement","useSharedValue","clearPendingMeasurement","useCallback","value","queueOrFlushMeasurement","useAnimatedReaction","shouldFlush","previousShouldFlush","exports"],"sourceRoot":"../../../../../../src","sources":["shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAMO,MAAME,6BAA6B,GAAIC,MAK7C,IAAK;EACL,MAAM;IAAEC,OAAO;IAAEC,WAAW;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGJ,MAAM;EAC1D,MAAMK,qBAAqB,GAAG,IAAAC,qCAAc,EAAC,KAAK,CAAC;EAEnD,MAAMC,uBAAuB,GAAG,IAAAC,kBAAW,EAAC,MAAM;IACjD,SAAS;;IACTH,qBAAqB,CAACI,KAAK,GAAG,KAAK;EACpC,CAAC,EAAE,CAACJ,qBAAqB,CAAC,CAAC;EAE3B,MAAMK,uBAAuB,GAAG,IAAAF,kBAAW,EAAC,MAAM;IACjD,SAAS;;IACT,IAAI,CAACP,OAAO,EAAE;IAEd,IAAIC,WAAW,CAACO,KAAK,EAAE;MACtBJ,qBAAqB,CAACI,KAAK,GAAG,IAAI;MAClC;IACD;IAEAJ,qBAAqB,CAACI,KAAK,GAAG,KAAK;IACnCL,OAAO,CAAC,CAAC;EACV,CAAC,EAAE,CAACH,OAAO,EAAEC,WAAW,EAAEG,qBAAqB,EAAED,OAAO,CAAC,CAAC;EAE1D,IAAAO,0CAAmB,EAClB,MAAM;IACL,SAAS;;IACT,IAAI,CAACV,OAAO,EAAE,OAAO,KAAK;IAC1B,IAAI,CAACI,qBAAqB,CAACI,KAAK,EAAE,OAAO,KAAK;IAC9C,IAAIP,WAAW,CAACO,KAAK,EAAE,OAAO,KAAK;IACnC,OAAON,QAAQ,GAAGA,QAAQ,CAAC,CAAC,GAAG,IAAI;EACpC,CAAC,EACD,CAACS,WAAW,EAAEC,mBAAmB,KAAK;IACrC,SAAS;;IACT,IAAI,CAACZ,OAAO,EAAE;IACd,IAAI,CAACW,WAAW,IAAIA,WAAW,KAAKC,mBAAmB,EAAE;IAEzDR,qBAAqB,CAACI,KAAK,GAAG,KAAK;IACnCL,OAAO,CAAC,CAAC;EACV,CAAC,EACD,CAACH,OAAO,EAAEC,WAAW,EAAEG,qBAAqB,EAAEF,QAAQ,EAAEC,OAAO,CAChE,CAAC;EAED,OAAO;IACNG,uBAAuB;IACvBG;EACD,CAAC;AACF,CAAC;AAACI,OAAA,CAAAf,6BAAA,GAAAA,6BAAA","ignoreList":[]}
@@ -1,122 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useGroupActiveMeasurement = void 0;
7
- var _reactNativeReanimated = require("react-native-reanimated");
8
- var _constants = require("../../../constants");
9
- var _animation = require("../../../stores/animation.store");
10
- var _bounds = require("../../../stores/bounds");
11
- var _gesture = require("../../../stores/gesture.store");
12
- var _measurementRules = require("./helpers/measurement-rules");
13
- var _useDeferredMeasurementTrigger = require("./use-deferred-measurement-trigger");
14
- /**
15
- * Watches the group's active id in the BoundStore.
16
- * When this boundary becomes the active member of its group,
17
- * re-measures itself and updates the link destination with fresh bounds.
18
- * This handles the case where a boundary scrolled into view after initial mount
19
- * (e.g., paging ScrollView in a detail screen).
20
- */
21
- const useGroupActiveMeasurement = params => {
22
- const {
23
- enabled,
24
- group,
25
- id,
26
- currentScreenKey,
27
- shouldUpdateDestination,
28
- maybeMeasureAndStore
29
- } = params;
30
- const idStr = String(id);
31
- const allGroups = _bounds.BoundStore.getGroups();
32
- const progress = _animation.AnimationStore.getValue(currentScreenKey, "progress");
33
- const animating = _animation.AnimationStore.getValue(currentScreenKey, "animating");
34
- const entering = _animation.AnimationStore.getValue(currentScreenKey, "entering");
35
- const closing = _animation.AnimationStore.getValue(currentScreenKey, "closing");
36
- const dragging = _gesture.GestureStore.getValue(currentScreenKey, "dragging");
37
- const dismissing = _gesture.GestureStore.getValue(currentScreenKey, "dismissing");
38
- const hasSettledOpenOnce = (0, _reactNativeReanimated.useSharedValue)(false);
39
- (0, _reactNativeReanimated.useAnimatedReaction)(() => {
40
- "worklet";
41
-
42
- if (!enabled || !shouldUpdateDestination) return false;
43
- return progress.value >= 1 - _constants.EPSILON && animating.value === 0 && entering.value === 0 && closing.value === 0 && dragging.value === 0 && dismissing.value === 0;
44
- }, isSettledOpen => {
45
- "worklet";
46
-
47
- if (isSettledOpen) {
48
- hasSettledOpenOnce.value = true;
49
- }
50
- }, [enabled, shouldUpdateDestination, progress, animating, entering, closing, dragging, dismissing, hasSettledOpenOnce]);
51
- const isRefreshBlocked = (0, _reactNativeReanimated.useDerivedValue)(() => {
52
- "worklet";
53
-
54
- if (!enabled || !shouldUpdateDestination) return 0;
55
- if (!hasSettledOpenOnce.value) return 1;
56
- if (progress.value < 1 - _constants.EPSILON) return 1;
57
- if (animating.value !== 0) return 1;
58
- if (entering.value !== 0) return 1;
59
- if (closing.value !== 0) return 1;
60
- if (dragging.value !== 0) return 1;
61
- if (dismissing.value !== 0) return 1;
62
- return 0;
63
- });
64
- const {
65
- clearPendingMeasurement,
66
- queueOrFlushMeasurement
67
- } = (0, _useDeferredMeasurementTrigger.useDeferredMeasurementTrigger)({
68
- enabled,
69
- /**
70
- * The reason to do extra guard checks for isAnimating is because a user may mid animation drag, causing
71
- * the src component to be wrongly measured. This in turns leads to faulty src measurements being used, giving us a weird teleport
72
- * animation rather than a smooth 'SET' transition when dst is actually dismissing.
73
- */
74
- isAnimating: isRefreshBlocked,
75
- canFlush: () => {
76
- "worklet";
77
-
78
- return (0, _measurementRules.canFlushGroupActiveMeasurement)({
79
- enabled,
80
- isEligible: !!group && shouldUpdateDestination,
81
- memberId: idStr,
82
- activeId: group ? allGroups.value[group]?.activeId ?? null : null
83
- }) && hasSettledOpenOnce.value;
84
- },
85
- onFlush: () => {
86
- "worklet";
87
-
88
- maybeMeasureAndStore({
89
- intent: "refresh-destination"
90
- });
91
- }
92
- });
93
- (0, _reactNativeReanimated.useAnimatedReaction)(() => {
94
- "worklet";
95
-
96
- if (!enabled) return null;
97
- if (!group) return null;
98
- return allGroups.value[group]?.activeId ?? null;
99
- }, (activeId, previousActiveId) => {
100
- "worklet";
101
-
102
- const action = (0, _measurementRules.resolveGroupActiveMeasurementAction)({
103
- enabled,
104
- isEligible: !!group && shouldUpdateDestination,
105
- memberId: idStr,
106
- activeId,
107
- previousActiveId
108
- });
109
- if (action === "clear-pending") {
110
- clearPendingMeasurement();
111
- return;
112
- }
113
- if (action === "queue-or-flush") {
114
- if (!hasSettledOpenOnce.value) {
115
- return;
116
- }
117
- queueOrFlushMeasurement();
118
- }
119
- }, [enabled, group, idStr, currentScreenKey, shouldUpdateDestination, hasSettledOpenOnce, clearPendingMeasurement, queueOrFlushMeasurement]);
120
- };
121
- exports.useGroupActiveMeasurement = useGroupActiveMeasurement;
122
- //# sourceMappingURL=use-group-active-measurement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNativeReanimated","require","_constants","_animation","_bounds","_gesture","_measurementRules","_useDeferredMeasurementTrigger","useGroupActiveMeasurement","params","enabled","group","id","currentScreenKey","shouldUpdateDestination","maybeMeasureAndStore","idStr","String","allGroups","BoundStore","getGroups","progress","AnimationStore","getValue","animating","entering","closing","dragging","GestureStore","dismissing","hasSettledOpenOnce","useSharedValue","useAnimatedReaction","value","EPSILON","isSettledOpen","isRefreshBlocked","useDerivedValue","clearPendingMeasurement","queueOrFlushMeasurement","useDeferredMeasurementTrigger","isAnimating","canFlush","canFlushGroupActiveMeasurement","isEligible","memberId","activeId","onFlush","intent","previousActiveId","action","resolveGroupActiveMeasurementAction","exports"],"sourceRoot":"../../../../../../src","sources":["shared/components/create-boundary-component/hooks/use-group-active-measurement.ts"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAEA,IAAAK,iBAAA,GAAAL,OAAA;AAIA,IAAAM,8BAAA,GAAAN,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMO,yBAAyB,GAAIC,MAOzC,IAAK;EACL,MAAM;IACLC,OAAO;IACPC,KAAK;IACLC,EAAE;IACFC,gBAAgB;IAChBC,uBAAuB;IACvBC;EACD,CAAC,GAAGN,MAAM;EACV,MAAMO,KAAK,GAAGC,MAAM,CAACL,EAAE,CAAC;EAExB,MAAMM,SAAS,GAAGC,kBAAU,CAACC,SAAS,CAAC,CAAC;EACxC,MAAMC,QAAQ,GAAGC,yBAAc,CAACC,QAAQ,CAACV,gBAAgB,EAAE,UAAU,CAAC;EACtE,MAAMW,SA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ACtB,KAAK,CAAC,EAAEmC,QAAQ,IAAI,IAAI;EAChD,CAAC,EACD,CAACA,QAAQ,EAAEG,gBAAgB,KAAK;IAC/B,SAAS;;IACT,MAAMC,MAAM,GAAG,IAAAC,qDAAmC,EAAC;MAClDzC,OAAO;MACPkC,UAAU,EAAE,CAAC,CAACjC,KAAK,IAAIG,uBAAuB;MAC9C+B,QAAQ,EAAE7B,KAAK;MACf8B,QAAQ;MACRG;IACD,CAAC,CAAC;IAEF,IAAIC,MAAM,KAAK,eAAe,EAAE;MAC/BZ,uBAAuB,CAAC,CAAC;MACzB;IACD;IAEA,IAAIY,MAAM,KAAK,gBAAgB,EAAE;MAChC,IAAI,CAACpB,kBAAkB,CAACG,KAAK,EAAE;QAC9B;MACD;MACAM,uBAAuB,CAAC,CAAC;IAC1B;EACD,CAAC,EACD,CACC7B,OAAO,EACPC,KAAK,EACLK,KAAK,EACLH,gBAAgB,EAChBC,uBAAuB,EACvBgB,kBAAkB,EAClBQ,uBAAuB,EACvBC,uBAAuB,CAEzB,CAAC;AACF,CAAC;AAACa,OAAA,CAAA5C,yBAAA,GAAAA,yBAAA","ignoreList":[]}
@@ -1,72 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useGroupActiveSourceMeasurement = void 0;
7
- var _reactNativeReanimated = require("react-native-reanimated");
8
- var _bounds = require("../../../stores/bounds");
9
- var _measurementRules = require("./helpers/measurement-rules");
10
- var _useDeferredMeasurementTrigger = require("./use-deferred-measurement-trigger");
11
- const useGroupActiveSourceMeasurement = params => {
12
- const {
13
- enabled,
14
- group,
15
- id,
16
- hasNextScreen,
17
- isAnimating,
18
- maybeMeasureAndStore
19
- } = params;
20
- const idStr = String(id);
21
- const allGroups = _bounds.BoundStore.getGroups();
22
- const {
23
- clearPendingMeasurement,
24
- queueOrFlushMeasurement
25
- } = (0, _useDeferredMeasurementTrigger.useDeferredMeasurementTrigger)({
26
- enabled,
27
- isAnimating,
28
- canFlush: () => {
29
- "worklet";
30
-
31
- return (0, _measurementRules.canFlushGroupActiveMeasurement)({
32
- enabled,
33
- isEligible: !!group && hasNextScreen,
34
- memberId: idStr,
35
- activeId: group ? allGroups.value[group]?.activeId ?? null : null
36
- });
37
- },
38
- onFlush: () => {
39
- "worklet";
40
-
41
- maybeMeasureAndStore({
42
- intent: "refresh-source"
43
- });
44
- }
45
- });
46
- (0, _reactNativeReanimated.useAnimatedReaction)(() => {
47
- "worklet";
48
-
49
- if (!enabled) return null;
50
- if (!group) return null;
51
- return allGroups.value[group]?.activeId ?? null;
52
- }, (activeId, previousActiveId) => {
53
- "worklet";
54
-
55
- const action = (0, _measurementRules.resolveGroupActiveMeasurementAction)({
56
- enabled,
57
- isEligible: !!group && hasNextScreen,
58
- memberId: idStr,
59
- activeId,
60
- previousActiveId
61
- });
62
- if (action === "clear-pending") {
63
- clearPendingMeasurement();
64
- return;
65
- }
66
- if (action === "queue-or-flush") {
67
- queueOrFlushMeasurement();
68
- }
69
- }, [enabled, group, idStr, hasNextScreen, clearPendingMeasurement, queueOrFlushMeasurement]);
70
- };
71
- exports.useGroupActiveSourceMeasurement = useGroupActiveSourceMeasurement;
72
- //# sourceMappingURL=use-group-active-source-measurement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNativeReanimated","require","_bounds","_measurementRules","_useDeferredMeasurementTrigger","useGroupActiveSourceMeasurement","params","enabled","group","id","hasNextScreen","isAnimating","maybeMeasureAndStore","idStr","String","allGroups","BoundStore","getGroups","clearPendingMeasurement","queueOrFlushMeasurement","useDeferredMeasurementTrigger","canFlush","canFlushGroupActiveMeasurement","isEligible","memberId","activeId","value","onFlush","intent","useAnimatedReaction","previousActiveId","action","resolveGroupActiveMeasurementAction","exports"],"sourceRoot":"../../../../../../src","sources":["shared/components/create-boundary-component/hooks/use-group-active-source-measurement.ts"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,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IE,aAAa;MACpCc,QAAQ,EAAEX,KAAK;MACfY,QAAQ;MACRK;IACD,CAAC,CAAC;IAEF,IAAIC,MAAM,KAAK,eAAe,EAAE;MAC/Bb,uBAAuB,CAAC,CAAC;MACzB;IACD;IAEA,IAAIa,MAAM,KAAK,gBAAgB,EAAE;MAChCZ,uBAAuB,CAAC,CAAC;IAC1B;EACD,CAAC,EACD,CACCZ,OAAO,EACPC,KAAK,EACLK,KAAK,EACLH,aAAa,EACbQ,uBAAuB,EACvBC,uBAAuB,CAEzB,CAAC;AACF,CAAC;AAACc,OAAA,CAAA5B,+BAAA,GAAAA,+BAAA","ignoreList":[]}
@@ -1,66 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useInitialLayoutHandler = void 0;
7
- var _react = require("react");
8
- var _reactNativeReanimated = require("react-native-reanimated");
9
- var _animation = require("../../../stores/animation.store");
10
- var _bounds = require("../../../stores/bounds");
11
- var _resolvePendingSourceKey = require("../helpers/resolve-pending-source-key");
12
- var _measurementRules = require("./helpers/measurement-rules");
13
- const useInitialLayoutHandler = params => {
14
- const {
15
- enabled,
16
- sharedBoundTag,
17
- currentScreenKey,
18
- ancestorKeys,
19
- expectedSourceScreenKey,
20
- maybeMeasureAndStore
21
- } = params;
22
- const isAnimating = _animation.AnimationStore.getValue(currentScreenKey, "animating");
23
- const ancestorAnimations = ancestorKeys.map(key => _animation.AnimationStore.getValue(key, "animating"));
24
- const hasMeasuredOnLayout = (0, _reactNativeReanimated.useSharedValue)(false);
25
- const handleInitialLayout = (0, _react.useCallback)(() => {
26
- "worklet";
27
-
28
- if (!enabled) return;
29
- if (!sharedBoundTag || hasMeasuredOnLayout.get()) return;
30
- let isAnyAnimating = isAnimating.get();
31
- for (let i = 0; i < ancestorAnimations.length; i++) {
32
- if (ancestorAnimations[i].get()) {
33
- isAnyAnimating = 1;
34
- break;
35
- }
36
- }
37
- let hasPendingLinkFromSource = false;
38
- if (isAnyAnimating) {
39
- const resolvedSourceKey = (0, _resolvePendingSourceKey.resolvePendingSourceKey)(sharedBoundTag, expectedSourceScreenKey);
40
- if (resolvedSourceKey && _bounds.BoundStore.hasPendingLinkFromSource(sharedBoundTag, resolvedSourceKey)) {
41
- hasPendingLinkFromSource = true;
42
- }
43
- }
44
- const intent = (0, _measurementRules.resolveInitialLayoutMeasurementIntent)({
45
- enabled,
46
- hasSharedBoundTag: !!sharedBoundTag,
47
- hasMeasuredOnLayout: hasMeasuredOnLayout.get(),
48
- isAnyAnimating: !!isAnyAnimating,
49
- hasPendingLinkFromSource
50
- });
51
- if (!intent) return;
52
- maybeMeasureAndStore({
53
- intent
54
- });
55
- hasMeasuredOnLayout.set(true);
56
- }, [enabled, sharedBoundTag, hasMeasuredOnLayout, isAnimating, ancestorAnimations, maybeMeasureAndStore, expectedSourceScreenKey]);
57
-
58
- // Try to capture destination bounds during layout phase as soon as the
59
- // boundary mounts; guards in handleInitialLayout keep this idempotent.
60
- (0, _react.useLayoutEffect)(() => {
61
- if (!enabled) return;
62
- (0, _reactNativeReanimated.runOnUI)(handleInitialLayout)();
63
- }, [enabled, handleInitialLayout]);
64
- };
65
- exports.useInitialLayoutHandler = useInitialLayoutHandler;
66
- //# sourceMappingURL=use-initial-layout-handler.js.map