react-native-screen-transitions 3.6.0-alpha.3 → 3.6.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 (177) hide show
  1. package/lib/commonjs/shared/components/screen-container/layers/content.js +1 -11
  2. package/lib/commonjs/shared/components/screen-container/layers/content.js.map +1 -1
  3. package/lib/commonjs/shared/constants.js +2 -1
  4. package/lib/commonjs/shared/constants.js.map +1 -1
  5. package/lib/commonjs/shared/hooks/navigation/use-stack.js.map +1 -1
  6. package/lib/commonjs/shared/providers/screen/animation/helpers/build-screen-transition-options.js +1 -1
  7. package/lib/commonjs/shared/providers/screen/animation/helpers/build-screen-transition-options.js.map +1 -1
  8. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js +10 -3
  9. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js.map +1 -1
  10. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.js +2 -2
  11. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.js.map +1 -1
  12. package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js +7 -2
  13. package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
  14. package/lib/commonjs/shared/providers/screen/animation/helpers/selected-interpolator-options.js +1 -1
  15. package/lib/commonjs/shared/providers/screen/animation/helpers/selected-interpolator-options.js.map +1 -1
  16. package/lib/commonjs/shared/providers/screen/animation/helpers/stack-progress.js +25 -0
  17. package/lib/commonjs/shared/providers/screen/animation/helpers/stack-progress.js.map +1 -0
  18. package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js +1 -0
  19. package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
  20. package/lib/commonjs/shared/providers/screen/gestures/shared/policy.js +13 -4
  21. package/lib/commonjs/shared/providers/screen/gestures/shared/policy.js.map +1 -1
  22. package/lib/commonjs/shared/providers/screen/options/helpers.js +9 -4
  23. package/lib/commonjs/shared/providers/screen/options/helpers.js.map +1 -1
  24. package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js +94 -13
  25. package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js.map +1 -1
  26. package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.js +4 -1
  27. package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.js.map +1 -1
  28. package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/types.js +4 -0
  29. package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +85 -28
  30. package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
  31. package/lib/commonjs/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js +5 -4
  32. package/lib/commonjs/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js.map +1 -1
  33. package/lib/commonjs/shared/providers/screen/styles/styles.provider.js +2 -2
  34. package/lib/commonjs/shared/providers/screen/styles/styles.provider.js.map +1 -1
  35. package/lib/commonjs/shared/providers/stack/direct.provider.js +1 -3
  36. package/lib/commonjs/shared/providers/stack/direct.provider.js.map +1 -1
  37. package/lib/commonjs/shared/providers/stack/helpers/use-stack-derived.js +2 -12
  38. package/lib/commonjs/shared/providers/stack/helpers/use-stack-derived.js.map +1 -1
  39. package/lib/commonjs/shared/providers/stack/managed.provider.js +1 -3
  40. package/lib/commonjs/shared/providers/stack/managed.provider.js.map +1 -1
  41. package/lib/commonjs/shared/stores/animation.store.js +5 -3
  42. package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
  43. package/lib/commonjs/shared/stores/bounds/internals/links.js +18 -3
  44. package/lib/commonjs/shared/stores/bounds/internals/links.js.map +1 -1
  45. package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js +0 -2
  46. package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
  47. package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js +5 -2
  48. package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
  49. package/lib/module/shared/components/screen-container/layers/content.js +3 -13
  50. package/lib/module/shared/components/screen-container/layers/content.js.map +1 -1
  51. package/lib/module/shared/constants.js +1 -0
  52. package/lib/module/shared/constants.js.map +1 -1
  53. package/lib/module/shared/hooks/navigation/use-stack.js.map +1 -1
  54. package/lib/module/shared/providers/screen/animation/helpers/build-screen-transition-options.js +1 -1
  55. package/lib/module/shared/providers/screen/animation/helpers/build-screen-transition-options.js.map +1 -1
  56. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js +10 -3
  57. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js.map +1 -1
  58. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.js +2 -2
  59. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.js.map +1 -1
  60. package/lib/module/shared/providers/screen/animation/helpers/pipeline.js +7 -2
  61. package/lib/module/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
  62. package/lib/module/shared/providers/screen/animation/helpers/selected-interpolator-options.js +1 -1
  63. package/lib/module/shared/providers/screen/animation/helpers/selected-interpolator-options.js.map +1 -1
  64. package/lib/module/shared/providers/screen/animation/helpers/stack-progress.js +20 -0
  65. package/lib/module/shared/providers/screen/animation/helpers/stack-progress.js.map +1 -0
  66. package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js +1 -0
  67. package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
  68. package/lib/module/shared/providers/screen/gestures/shared/policy.js +14 -5
  69. package/lib/module/shared/providers/screen/gestures/shared/policy.js.map +1 -1
  70. package/lib/module/shared/providers/screen/options/helpers.js +10 -5
  71. package/lib/module/shared/providers/screen/options/helpers.js.map +1 -1
  72. package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js +95 -14
  73. package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js.map +1 -1
  74. package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.js +4 -1
  75. package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.js.map +1 -1
  76. package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/types.js +2 -0
  77. package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +84 -28
  78. package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
  79. package/lib/module/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js +5 -4
  80. package/lib/module/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js.map +1 -1
  81. package/lib/module/shared/providers/screen/styles/styles.provider.js +2 -2
  82. package/lib/module/shared/providers/screen/styles/styles.provider.js.map +1 -1
  83. package/lib/module/shared/providers/stack/direct.provider.js +1 -3
  84. package/lib/module/shared/providers/stack/direct.provider.js.map +1 -1
  85. package/lib/module/shared/providers/stack/helpers/use-stack-derived.js +2 -12
  86. package/lib/module/shared/providers/stack/helpers/use-stack-derived.js.map +1 -1
  87. package/lib/module/shared/providers/stack/managed.provider.js +1 -3
  88. package/lib/module/shared/providers/stack/managed.provider.js.map +1 -1
  89. package/lib/module/shared/stores/animation.store.js +5 -3
  90. package/lib/module/shared/stores/animation.store.js.map +1 -1
  91. package/lib/module/shared/stores/bounds/internals/links.js +18 -3
  92. package/lib/module/shared/stores/bounds/internals/links.js.map +1 -1
  93. package/lib/module/shared/types/animation.types.js +2 -1
  94. package/lib/module/shared/types/animation.types.js.map +1 -1
  95. package/lib/module/shared/utils/bounds/navigation/reveal/build.js +0 -2
  96. package/lib/module/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
  97. package/lib/module/shared/utils/bounds/navigation/zoom/build.js +5 -2
  98. package/lib/module/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
  99. package/lib/typescript/shared/components/screen-container/layers/content.d.ts.map +1 -1
  100. package/lib/typescript/shared/constants.d.ts +2 -1
  101. package/lib/typescript/shared/constants.d.ts.map +1 -1
  102. package/lib/typescript/shared/hooks/navigation/use-stack.d.ts +0 -1
  103. package/lib/typescript/shared/hooks/navigation/use-stack.d.ts.map +1 -1
  104. package/lib/typescript/shared/index.d.ts +12 -12
  105. package/lib/typescript/shared/providers/screen/animation/helpers/build-screen-transition-options.d.ts.map +1 -1
  106. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/index.d.ts +2 -2
  107. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/index.d.ts.map +1 -1
  108. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.d.ts +1 -1
  109. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.d.ts.map +1 -1
  110. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/types.d.ts +1 -0
  111. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/types.d.ts.map +1 -1
  112. package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts.map +1 -1
  113. package/lib/typescript/shared/providers/screen/animation/helpers/selected-interpolator-options.d.ts.map +1 -1
  114. package/lib/typescript/shared/providers/screen/animation/helpers/stack-progress.d.ts +3 -0
  115. package/lib/typescript/shared/providers/screen/animation/helpers/stack-progress.d.ts.map +1 -0
  116. package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts +1 -0
  117. package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts.map +1 -1
  118. package/lib/typescript/shared/providers/screen/gestures/shared/policy.d.ts +4 -4
  119. package/lib/typescript/shared/providers/screen/gestures/shared/policy.d.ts.map +1 -1
  120. package/lib/typescript/shared/providers/screen/options/helpers.d.ts.map +1 -1
  121. package/lib/typescript/shared/providers/screen/options/types.d.ts +1 -1
  122. package/lib/typescript/shared/providers/screen/options/types.d.ts.map +1 -1
  123. package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/index.d.ts +4 -4
  124. package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/index.d.ts.map +1 -1
  125. package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.d.ts.map +1 -1
  126. package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/types.d.ts +2 -0
  127. package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/types.d.ts.map +1 -1
  128. package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts +6 -6
  129. package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts.map +1 -1
  130. package/lib/typescript/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.d.ts +3 -2
  131. package/lib/typescript/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.d.ts.map +1 -1
  132. package/lib/typescript/shared/providers/stack/direct.provider.d.ts.map +1 -1
  133. package/lib/typescript/shared/providers/stack/helpers/use-stack-derived.d.ts +5 -5
  134. package/lib/typescript/shared/providers/stack/helpers/use-stack-derived.d.ts.map +1 -1
  135. package/lib/typescript/shared/providers/stack/managed.provider.d.ts.map +1 -1
  136. package/lib/typescript/shared/stores/animation.store.d.ts +4 -3
  137. package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
  138. package/lib/typescript/shared/stores/bounds/internals/links.d.ts.map +1 -1
  139. package/lib/typescript/shared/types/animation.types.d.ts +4 -3
  140. package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
  141. package/lib/typescript/shared/types/index.d.ts +1 -1
  142. package/lib/typescript/shared/types/index.d.ts.map +1 -1
  143. package/lib/typescript/shared/types/screen.types.d.ts +9 -12
  144. package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
  145. package/lib/typescript/shared/utils/bounds/navigation/reveal/build.d.ts.map +1 -1
  146. package/lib/typescript/shared/utils/bounds/navigation/zoom/build.d.ts.map +1 -1
  147. package/package.json +1 -1
  148. package/src/shared/components/screen-container/layers/content.tsx +2 -21
  149. package/src/shared/constants.ts +6 -1
  150. package/src/shared/hooks/navigation/use-stack.tsx +0 -1
  151. package/src/shared/providers/screen/animation/helpers/build-screen-transition-options.ts +1 -2
  152. package/src/shared/providers/screen/animation/helpers/hydrate-transition-state/index.ts +16 -8
  153. package/src/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.ts +2 -1
  154. package/src/shared/providers/screen/animation/helpers/hydrate-transition-state/types.ts +1 -0
  155. package/src/shared/providers/screen/animation/helpers/pipeline.ts +19 -5
  156. package/src/shared/providers/screen/animation/helpers/selected-interpolator-options.ts +0 -3
  157. package/src/shared/providers/screen/animation/helpers/stack-progress.ts +29 -0
  158. package/src/shared/providers/screen/animation/helpers/use-build-transition-state.ts +2 -0
  159. package/src/shared/providers/screen/gestures/shared/policy.ts +20 -7
  160. package/src/shared/providers/screen/options/helpers.ts +17 -13
  161. package/src/shared/providers/screen/options/types.ts +1 -1
  162. package/src/shared/providers/screen/styles/helpers/resolve-slot-styles/index.ts +140 -19
  163. package/src/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.ts +5 -1
  164. package/src/shared/providers/screen/styles/helpers/resolve-slot-styles/types.ts +4 -0
  165. package/src/shared/providers/screen/styles/hooks/use-interpolated-style-maps.tsx +132 -44
  166. package/src/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.tsx +7 -5
  167. package/src/shared/providers/screen/styles/styles.provider.tsx +2 -2
  168. package/src/shared/providers/stack/direct.provider.tsx +2 -12
  169. package/src/shared/providers/stack/helpers/use-stack-derived.ts +6 -15
  170. package/src/shared/providers/stack/managed.provider.tsx +1 -5
  171. package/src/shared/stores/animation.store.ts +6 -3
  172. package/src/shared/stores/bounds/internals/links.ts +27 -3
  173. package/src/shared/types/animation.types.ts +7 -3
  174. package/src/shared/types/index.ts +1 -0
  175. package/src/shared/types/screen.types.ts +9 -12
  176. package/src/shared/utils/bounds/navigation/reveal/build.ts +0 -2
  177. package/src/shared/utils/bounds/navigation/zoom/build.ts +6 -2
@@ -3,11 +3,13 @@ import { NO_STYLES } from "../../../../constants";
3
3
  import { SystemStore } from "../../../../stores/system.store";
4
4
  import type {
5
5
  NormalizedTransitionInterpolatedStyle,
6
+ ScreenStyleInterpolator,
6
7
  TransitionInterpolatedStyle,
7
8
  } from "../../../../types/animation.types";
8
9
  import { logger } from "../../../../utils/logger";
9
10
  import { useScreenAnimationContext } from "../../animation";
10
11
  import { useBuildBoundsAccessor } from "../../animation/helpers/accessors/use-build-bounds-accessor";
12
+ import type { ScreenInterpolatorFrame } from "../../animation/helpers/pipeline";
11
13
  import { syncSelectedInterpolatorOptions } from "../../animation/helpers/selected-interpolator-options";
12
14
  import { useDescriptorDerivations } from "../../descriptors";
13
15
  import {
@@ -16,10 +18,93 @@ import {
16
18
  } from "../../options";
17
19
  import { normalizeSlots } from "../helpers/normalize-slots";
18
20
  import { preserveAnimatedPropsOnly } from "../helpers/preserve-animated-props-only";
21
+ import type { LocalStyleLayers } from "../helpers/resolve-slot-styles";
19
22
  import { stripInterpolatorOptions } from "../helpers/strip-interpolator-options";
20
23
 
24
+ const NO_STYLE_LAYERS: LocalStyleLayers = [];
25
+
26
+ type InterpolatorResult = {
27
+ stylesMap: NormalizedTransitionInterpolatedStyle;
28
+ rawStyleMap: TransitionInterpolatedStyle | undefined;
29
+ };
30
+
31
+ type RunInterpolatorParams = {
32
+ interpolator: ScreenStyleInterpolator | undefined;
33
+ props: ScreenInterpolatorFrame;
34
+ progress: ScreenInterpolatorFrame["progress"];
35
+ next: ScreenInterpolatorFrame["next"];
36
+ bounds: Parameters<ScreenStyleInterpolator>[0]["bounds"];
37
+ shouldDeferStyleBuckets: boolean;
38
+ };
39
+
40
+ const normalizeRawStyleMap = (
41
+ rawStyleMap: TransitionInterpolatedStyle | undefined,
42
+ shouldDeferStyleBuckets: boolean,
43
+ ) => {
44
+ "worklet";
45
+
46
+ if (!rawStyleMap) {
47
+ return NO_STYLES;
48
+ }
49
+
50
+ const stylesMap = normalizeSlots(stripInterpolatorOptions(rawStyleMap));
51
+
52
+ return shouldDeferStyleBuckets
53
+ ? preserveAnimatedPropsOnly(stylesMap)
54
+ : stylesMap;
55
+ };
56
+
57
+ const runInterpolator = ({
58
+ interpolator,
59
+ props,
60
+ progress,
61
+ next,
62
+ bounds,
63
+ shouldDeferStyleBuckets,
64
+ }: RunInterpolatorParams): InterpolatorResult | undefined => {
65
+ "worklet";
66
+
67
+ if (!interpolator) {
68
+ return undefined;
69
+ }
70
+
71
+ try {
72
+ const raw = interpolator({
73
+ ...props,
74
+ progress,
75
+ next,
76
+ bounds,
77
+ });
78
+
79
+ const rawStyleMap: TransitionInterpolatedStyle | undefined =
80
+ typeof raw === "object" && raw != null ? raw : undefined;
81
+
82
+ return {
83
+ rawStyleMap,
84
+ stylesMap: normalizeRawStyleMap(rawStyleMap, shouldDeferStyleBuckets),
85
+ };
86
+ } catch (_) {
87
+ if (__DEV__) {
88
+ logger.warn("screenStyleInterpolator must be a worklet");
89
+ }
90
+
91
+ return undefined;
92
+ }
93
+ };
94
+
95
+ const appendLayer = (
96
+ layers: LocalStyleLayers,
97
+ result: InterpolatorResult | undefined,
98
+ ) => {
99
+ "worklet";
100
+
101
+ if (result) {
102
+ layers.push(result.stylesMap);
103
+ }
104
+ };
105
+
21
106
  /**
22
- * Builds the raw interpolated styles map for the current screen pass.
107
+ * Builds the raw interpolated style layers for the current screen pass.
23
108
  *
24
109
  * This hook exists to stabilize style ownership during rapid navigation,
25
110
  * especially when an interactive close gesture overlaps with a new navigation
@@ -39,9 +124,9 @@ import { stripInterpolatorOptions } from "../helpers/strip-interpolator-options"
39
124
  * hidden window so animated props and runtime options stay warm, but defer style
40
125
  * buckets so measurement sees the final untransformed layout.
41
126
  *
42
- * The result stays as a single slot map. Resolution happens downstream, where
43
- * slot ids determine whether a slot may inherit from ancestors or must remain
44
- * local to the owning screen container.
127
+ * The result is ordered from lowest to highest priority. Resolution happens
128
+ * downstream, where slot ids determine whether slots inherit from ancestors and
129
+ * where higher owner layers override lower owner layers per key.
45
130
  */
46
131
  export const useInterpolatedStylesMap = () => {
47
132
  const { currentScreenKey } = useDescriptorDerivations();
@@ -61,7 +146,7 @@ export const useInterpolatedStylesMap = () => {
61
146
 
62
147
  const isGesturingDuringCloseAnimation = useSharedValue(false);
63
148
 
64
- return useDerivedValue<NormalizedTransitionInterpolatedStyle>(() => {
149
+ return useDerivedValue<LocalStyleLayers>(() => {
65
150
  "worklet";
66
151
  screenInterpolatorPropsRevision.get();
67
152
  const props = screenInterpolatorProps.get();
@@ -99,16 +184,6 @@ export const useInterpolatedStylesMap = () => {
99
184
 
100
185
  const interpolatorOptionsOwner =
101
186
  isInGestureMode || !nextInterpolator ? "current" : "next";
102
- const interpolator =
103
- interpolatorOptionsOwner === "current"
104
- ? currentInterpolator
105
- : nextInterpolator;
106
-
107
- if (!interpolator) {
108
- syncSelectedInterpolatorOptions(selectedInterpolatorOptions, "current");
109
- syncScreenOptionsOverrides(undefined, screenOptions);
110
- return NO_STYLES;
111
- }
112
187
 
113
188
  let effectiveProgress = progress;
114
189
  let effectiveNext = next;
@@ -118,42 +193,55 @@ export const useInterpolatedStylesMap = () => {
118
193
  effectiveNext = undefined;
119
194
  }
120
195
 
121
- try {
122
- const raw = interpolator({
123
- ...props,
124
- progress: effectiveProgress,
125
- next: effectiveNext,
126
- bounds: boundsAccessor,
127
- });
128
-
129
- const rawStyleMap: TransitionInterpolatedStyle | undefined =
130
- typeof raw === "object" && raw != null ? raw : undefined;
196
+ const currentResult = runInterpolator({
197
+ interpolator: currentInterpolator,
198
+ props,
199
+ progress: effectiveProgress,
200
+ next: effectiveNext,
201
+ bounds: boundsAccessor,
202
+ shouldDeferStyleBuckets,
203
+ });
131
204
 
205
+ if (interpolatorOptionsOwner === "current") {
132
206
  syncSelectedInterpolatorOptions(
133
207
  selectedInterpolatorOptions,
134
- interpolatorOptionsOwner,
135
- rawStyleMap?.options,
136
- );
137
- syncScreenOptionsOverrides(
138
- interpolatorOptionsOwner === "current" ? rawStyleMap : undefined,
139
- screenOptions,
208
+ "current",
209
+ currentResult?.rawStyleMap?.options,
140
210
  );
211
+ syncScreenOptionsOverrides(currentResult?.rawStyleMap, screenOptions);
141
212
 
142
- const stylesMap = !rawStyleMap
143
- ? NO_STYLES
144
- : normalizeSlots(stripInterpolatorOptions(rawStyleMap));
145
-
146
- return shouldDeferStyleBuckets
147
- ? preserveAnimatedPropsOnly(stylesMap)
148
- : stylesMap;
149
- } catch (_) {
150
- if (__DEV__) {
151
- logger.warn("screenStyleInterpolator must be a worklet");
213
+ if (!currentResult) {
214
+ return NO_STYLE_LAYERS;
152
215
  }
153
216
 
154
- syncSelectedInterpolatorOptions(selectedInterpolatorOptions, "current");
155
- syncScreenOptionsOverrides(undefined, screenOptions);
156
- return NO_STYLES;
217
+ return [currentResult.stylesMap];
157
218
  }
219
+
220
+ const nextResult = runInterpolator({
221
+ interpolator: nextInterpolator,
222
+ props,
223
+ progress: effectiveProgress,
224
+ next: effectiveNext,
225
+ bounds: boundsAccessor,
226
+ shouldDeferStyleBuckets,
227
+ });
228
+
229
+ syncSelectedInterpolatorOptions(
230
+ selectedInterpolatorOptions,
231
+ "next",
232
+ nextResult?.rawStyleMap?.options,
233
+ );
234
+ syncScreenOptionsOverrides(undefined, screenOptions);
235
+
236
+ const layers: LocalStyleLayers = [];
237
+
238
+ appendLayer(layers, currentResult);
239
+ appendLayer(layers, nextResult);
240
+
241
+ if (layers.length === 0) {
242
+ return NO_STYLE_LAYERS;
243
+ }
244
+
245
+ return layers;
158
246
  });
159
247
  };
@@ -7,18 +7,19 @@ import { NO_STYLES } from "../../../../constants";
7
7
  import type { NormalizedTransitionInterpolatedStyle } from "../../../../types/animation.types";
8
8
  import { useScreenAnimationContext } from "../../animation";
9
9
  import {
10
+ type LocalStyleLayers,
10
11
  type ResettableStyleStatesBySlot,
11
12
  resolveSlotStyles,
12
13
  reuseEqualResolvedSlots,
13
14
  } from "../helpers/resolve-slot-styles";
14
15
 
15
16
  interface UseResolvedStylesMapParams {
16
- currentStylesMap: SharedValue<NormalizedTransitionInterpolatedStyle>;
17
+ localStylesMaps: SharedValue<LocalStyleLayers>;
17
18
  ancestorStylesMap?: SharedValue<NormalizedTransitionInterpolatedStyle>;
18
19
  }
19
20
 
20
21
  export const useResolvedStylesMap = ({
21
- currentStylesMap,
22
+ localStylesMaps,
22
23
  ancestorStylesMap,
23
24
  }: UseResolvedStylesMapParams) => {
24
25
  const { screenInterpolatorProps, screenInterpolatorPropsRevision } =
@@ -34,13 +35,14 @@ export const useResolvedStylesMap = ({
34
35
  screenInterpolatorPropsRevision.get();
35
36
 
36
37
  const props = screenInterpolatorProps.get();
37
- // Keep missing local slots alive while another route drives this screen.
38
- // Custom ids and keys from slots that still exist are still reset.
38
+ // Keep missing local slots alive only when another route drives this screen
39
+ // and no active local style layer is available. Once a current/next layer
40
+ // runs, omitted local slots and dropped keys are intentional reset signals.
39
41
  const deferLocalSlotResets = !props.focused && !props.current.closing;
40
42
 
41
43
  const { resolvedStylesMap, nextPreviousStyleStatesBySlot } =
42
44
  resolveSlotStyles({
43
- currentStylesMap: currentStylesMap.get(),
45
+ localStylesMaps: localStylesMaps.get(),
44
46
  ancestorStylesMap: ancestorStylesMap?.get() ?? NO_STYLES,
45
47
  previousStyleStatesBySlot: previousStyleStatesBySlot.get(),
46
48
  deferLocalSlotResets,
@@ -26,10 +26,10 @@ export const {
26
26
  })<Props, ScreenStylesContextValue>(({ children, isFloatingOverlay }) => {
27
27
  const parentContext = useContext(ScreenStylesContext);
28
28
 
29
- const rawStylesMap = useInterpolatedStylesMap();
29
+ const rawStylesMaps = useInterpolatedStylesMap();
30
30
 
31
31
  const stylesMap = useResolvedStylesMap({
32
- currentStylesMap: rawStylesMap,
32
+ localStylesMaps: rawStylesMaps,
33
33
  ancestorStylesMap: parentContext?.stylesMap,
34
34
  });
35
35
 
@@ -79,8 +79,7 @@ function useDirectStackValue(
79
79
  };
80
80
  }, [state.routes, state.preloadedRoutes, preloadedDescriptors, descriptors]);
81
81
 
82
- const { stackProgress, optimisticFocusedIndex } =
83
- useStackDerived(animationMaps);
82
+ const { optimisticFocusedIndex } = useStackDerived(animationMaps);
84
83
 
85
84
  const focusedIndex = state.index;
86
85
 
@@ -91,18 +90,9 @@ function useDirectStackValue(
91
90
  routeKeys,
92
91
  routes: allRoutes,
93
92
  scenes,
94
- stackProgress,
95
93
  optimisticFocusedIndex,
96
94
  }),
97
- [
98
- flags,
99
- navigatorKey,
100
- routeKeys,
101
- allRoutes,
102
- scenes,
103
- stackProgress,
104
- optimisticFocusedIndex,
105
- ],
95
+ [flags, navigatorKey, routeKeys, allRoutes, scenes, optimisticFocusedIndex],
106
96
  );
107
97
 
108
98
  // DirectStack context value
@@ -1,9 +1,9 @@
1
1
  import { type DerivedValue, useDerivedValue } from "react-native-reanimated";
2
2
  import type { AnimationStoreMap } from "../../../stores/animation.store";
3
3
 
4
+ type StackDerivedAnimationMap = Pick<AnimationStoreMap, "closing">;
5
+
4
6
  export interface StackDerived {
5
- /** Sum of all individual screen progress values. */
6
- stackProgress: DerivedValue<number>;
7
7
  /**
8
8
  * Focused index that accounts for closing screens.
9
9
  * Counts consecutive closing screens from the top so that
@@ -13,21 +13,12 @@ export interface StackDerived {
13
13
  }
14
14
 
15
15
  /**
16
- * Derives aggregated stack progress and an optimistic focused index
17
- * from animation store maps. Shared between managed and direct providers.
16
+ * Derives an optimistic focused index from animation store maps.
17
+ * Shared between managed and direct providers.
18
18
  */
19
19
  export function useStackDerived(
20
- animationMaps: AnimationStoreMap[],
20
+ animationMaps: StackDerivedAnimationMap[],
21
21
  ): StackDerived {
22
- const stackProgress = useDerivedValue(() => {
23
- "worklet";
24
- let total = 0;
25
- for (let i = 0; i < animationMaps.length; i++) {
26
- total += animationMaps[i].progress.get();
27
- }
28
- return total;
29
- });
30
-
31
22
  const optimisticFocusedIndex = useDerivedValue(() => {
32
23
  "worklet";
33
24
  const lastIndex = animationMaps.length - 1;
@@ -39,5 +30,5 @@ export function useStackDerived(
39
30
  return lastIndex - closingFromTop;
40
31
  });
41
32
 
42
- return { stackProgress, optimisticFocusedIndex };
33
+ return { optimisticFocusedIndex };
43
34
  }
@@ -47,9 +47,7 @@ function useManagedStackValue<
47
47
  const navigatorKey = props.state.key;
48
48
 
49
49
  const processed = useProcessedRoutes(state.routes, state.descriptors);
50
- const { stackProgress, optimisticFocusedIndex } = useStackDerived(
51
- processed.animationMaps,
52
- );
50
+ const { optimisticFocusedIndex } = useStackDerived(processed.animationMaps);
53
51
  const closingRouteMap = useClosingRouteMap(
54
52
  processed.routeKeys,
55
53
  processed.animationMaps,
@@ -65,7 +63,6 @@ function useManagedStackValue<
65
63
  routeKeys: processed.routeKeys,
66
64
  routes: state.routes as Route<string>[],
67
65
  scenes: processed.scenes as BaseStackScene[],
68
- stackProgress,
69
66
  optimisticFocusedIndex,
70
67
  }),
71
68
  [
@@ -74,7 +71,6 @@ function useManagedStackValue<
74
71
  processed.routeKeys,
75
72
  state.routes,
76
73
  processed.scenes,
77
- stackProgress,
78
74
  optimisticFocusedIndex,
79
75
  ],
80
76
  );
@@ -7,6 +7,7 @@ import { createStore } from "../utils/create-store";
7
7
 
8
8
  export type AnimationStoreMap = {
9
9
  progress: SharedValue<number>;
10
+ effectiveProgress: SharedValue<number>;
10
11
  willAnimate: SharedValue<number>;
11
12
  progressAnimating: SharedValue<number>;
12
13
  closing: SharedValue<number>;
@@ -16,6 +17,7 @@ export type AnimationStoreMap = {
16
17
  function createAnimationBag(): AnimationStoreMap {
17
18
  return {
18
19
  progress: makeMutable(0),
20
+ effectiveProgress: makeMutable(0),
19
21
  willAnimate: makeMutable(0),
20
22
  closing: makeMutable(0),
21
23
  progressAnimating: makeMutable(0),
@@ -24,14 +26,15 @@ function createAnimationBag(): AnimationStoreMap {
24
26
  }
25
27
 
26
28
  /**
27
- * Route-keyed screen transition state for the public animation lifecycle. These
28
- * shared values track the current progress, whether a transition is about to
29
- * begin, and whether a screen is entering, closing, or actively animating.
29
+ * Route-keyed screen transition state for the public animation lifecycle.
30
+ * `progress` tracks committed transition progress; `effectiveProgress` tracks
31
+ * the hydrated progress after live gesture policy is applied.
30
32
  */
31
33
  export const AnimationStore = createStore<AnimationStoreMap>({
32
34
  createBag: createAnimationBag,
33
35
  disposeBag: (bag) => {
34
36
  cancelAnimation(bag.progress);
37
+ cancelAnimation(bag.effectiveProgress);
35
38
  cancelAnimation(bag.willAnimate);
36
39
  cancelAnimation(bag.progressAnimating);
37
40
  cancelAnimation(bag.closing);
@@ -216,6 +216,20 @@ const isCompletedLink = (link: TagLink | null): link is TagLink => {
216
216
  return !!link?.destination;
217
217
  };
218
218
 
219
+ const getPendingSourceLink = (
220
+ state: LinkPairsState,
221
+ pairKey: ScreenPairKey,
222
+ linkKey: LinkKey,
223
+ ): TagLink | null => {
224
+ "worklet";
225
+ const sourceScreenKey = getSourceScreenKeyFromPairKey(pairKey);
226
+ const pendingPairKey = createPendingPairKey(sourceScreenKey);
227
+
228
+ if (pendingPairKey === pairKey) return null;
229
+
230
+ return getPairLink(state, pendingPairKey, linkKey);
231
+ };
232
+
219
233
  function getResolvedLink(
220
234
  pairKey: ScreenPairKey,
221
235
  tag: TagID,
@@ -226,12 +240,22 @@ function getResolvedLink(
226
240
  const group = getGroupKeyFromTag(tag);
227
241
  const requestedLink = getPairLink(state, pairKey, linkKey);
228
242
 
243
+ // Press-triggered zoom captures the source before navigation under a pending
244
+ // source<> pair. If the destination screen has no Boundary.View, nothing
245
+ // promotes that source into source<>destination, but zoom can still animate to
246
+ // its default top target from the pending source bounds.
247
+ const fallbackPendingLink = requestedLink
248
+ ? null
249
+ : getPendingSourceLink(state, pairKey, linkKey);
250
+
251
+ const link = requestedLink ?? fallbackPendingLink;
252
+
229
253
  // Group active ids can update before the new member has a full source/destination
230
254
  // link, so unresolved grouped links fall back to the initial id's measurements.
231
- if (!group || isCompletedLink(requestedLink)) {
255
+ if (!group || isCompletedLink(link)) {
232
256
  return {
233
257
  tag,
234
- link: requestedLink,
258
+ link,
235
259
  };
236
260
  }
237
261
 
@@ -248,7 +272,7 @@ function getResolvedLink(
248
272
 
249
273
  return {
250
274
  tag,
251
- link: requestedLink,
275
+ link,
252
276
  };
253
277
  }
254
278
 
@@ -25,7 +25,7 @@ export type ScreenTransitionOptions = Pick<
25
25
  ScreenTransitionConfig,
26
26
  | "navigationMaskEnabled"
27
27
  | "gestureEnabled"
28
- | "experimental_allowDisabledGestureTracking"
28
+ | "gestureTracking"
29
29
  | "gestureDirection"
30
30
  | "gestureSensitivity"
31
31
  | "gestureVelocityImpact"
@@ -287,13 +287,17 @@ export type TransitionSlotStyle = AnimatedViewStyle | TransitionSlotDefinition;
287
287
  * Runtime options returned by `screenStyleInterpolator`.
288
288
  *
289
289
  * These values are not style slots. They are derived per frame and consumed by
290
- * the transition runtime.
290
+ * the transition runtime. Structural options that change the React tree, such
291
+ * as `navigationMaskEnabled`, must be configured statically on the screen.
291
292
  *
292
293
  * If `gestureSensitivity` is derived from the current gesture, prefer
293
294
  * `active.gesture.raw` so the sensitivity calculation does not feed back into
294
295
  * itself.
295
296
  */
296
- export type TransitionInterpolatorOptions = ScreenTransitionOptions;
297
+ export type TransitionInterpolatorOptions = Omit<
298
+ ScreenTransitionOptions,
299
+ "navigationMaskEnabled" | "gestureTracking"
300
+ >;
297
301
 
298
302
  /**
299
303
  * Internal normalized slot format.
@@ -33,6 +33,7 @@ export type {
33
33
  } from "./gesture.types";
34
34
  export type { OverlayProps } from "./overlay.types";
35
35
  export type {
36
+ GestureTracking,
36
37
  Layout,
37
38
  ScreenKey,
38
39
  ScreenTransitionConfig,
@@ -33,6 +33,7 @@ export type ScreenKey = string;
33
33
  export type SheetScrollGestureBehavior =
34
34
  | "expand-and-collapse"
35
35
  | "collapse-only";
36
+ export type GestureTracking = "auto" | "never" | "always";
36
37
 
37
38
  /**
38
39
  * A single snap point value. Either a fraction of screen height (0–1) or
@@ -130,21 +131,17 @@ export type ScreenTransitionConfig = {
130
131
  gestureEnabled?: boolean;
131
132
 
132
133
  /**
133
- * Allows screens with `gestureEnabled={false}` to still activate gestures for
134
- * live gesture values while preventing gesture dismissal.
134
+ * Controls whether the screen tracks live gesture values.
135
135
  *
136
- * This is a v3 compatibility bridge for the next gesture behavior. Direction
137
- * ownership/claims participate while this is enabled so nested screens can
138
- * intentionally shadow parent gestures for resistance-style animations.
136
+ * - `"auto"` tracks gestures when dismissal is enabled, or when snap points
137
+ * can move without dismissal.
138
+ * - `"never"` disables gesture tracking for the screen.
139
+ * - `"always"` keeps tracking live gesture values even when
140
+ * `gestureEnabled` is `false`, without allowing dismiss.
139
141
  *
140
- * Screens with `snapPoints` already keep gesture tracking when
141
- * `gestureEnabled={false}`; this flag mainly affects disabled non-snap
142
- * gestures.
143
- *
144
- * @experimental This API may change in future versions.
145
- * @default false
142
+ * @default "auto"
146
143
  */
147
- experimental_allowDisabledGestureTracking?: boolean;
144
+ gestureTracking?: GestureTracking;
148
145
 
149
146
  /**
150
147
  * The direction(s) of the screen gesture used to dismiss the screen.
@@ -328,7 +328,6 @@ export function buildRevealStyles({
328
328
 
329
329
  return {
330
330
  options: {
331
- navigationMaskEnabled: true,
332
331
  gestureProgressMode,
333
332
  gestureSensitivity,
334
333
  gestureReleaseVelocityScale,
@@ -424,7 +423,6 @@ export function buildRevealStyles({
424
423
 
425
424
  return {
426
425
  options: {
427
- navigationMaskEnabled: true,
428
426
  gestureProgressMode,
429
427
  },
430
428
  content: {
@@ -416,6 +416,10 @@ export function buildZoomStyles({
416
416
  Math.abs(unfocusedContentScale),
417
417
  EPSILON,
418
418
  );
419
+ // A naturally settled close can leave this as the last emitted style frame,
420
+ // so drop temporary stacking here instead of waiting for a later reset pass.
421
+ const shouldElevateUnfocusedElement =
422
+ !props.active.closing || !props.active.logicallySettled;
419
423
 
420
424
  const scaleShiftX = computeCenterScaleShift({
421
425
  center: elementCenterX,
@@ -480,8 +484,8 @@ export function buildZoomStyles({
480
484
  },
481
485
  ],
482
486
  opacity: zoomOptions?.debug ? 1 : unfocusedFade,
483
- zIndex: 9999,
484
- elevation: 9999,
487
+ zIndex: shouldElevateUnfocusedElement ? 9999 : 0,
488
+ elevation: shouldElevateUnfocusedElement ? 9999 : 0,
485
489
  };
486
490
 
487
491
  return {