react-native-screen-transitions 4.0.0-alpha.3 → 4.0.0-alpha.5

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 (138) hide show
  1. package/lib/commonjs/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js +27 -15
  2. package/lib/commonjs/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
  3. package/lib/commonjs/components/boundary/hooks/lifecycles/use-initial-source-measurement.js +3 -1
  4. package/lib/commonjs/components/boundary/hooks/lifecycles/use-initial-source-measurement.js.map +1 -1
  5. package/lib/commonjs/components/boundary/hooks/lifecycles/use-refresh-boundary.js +3 -5
  6. package/lib/commonjs/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -1
  7. package/lib/commonjs/components/boundary/hooks/use-boundary-measurement.js +5 -4
  8. package/lib/commonjs/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
  9. package/lib/commonjs/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +4 -15
  10. package/lib/commonjs/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
  11. package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js +22 -24
  12. package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js.map +1 -1
  13. package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +3 -36
  14. package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
  15. package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js +1 -1
  16. package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js.map +1 -1
  17. package/lib/commonjs/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js +1 -1
  18. package/lib/commonjs/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -1
  19. package/lib/commonjs/components/boundary/utils/destination-signals.js +8 -4
  20. package/lib/commonjs/components/boundary/utils/destination-signals.js.map +1 -1
  21. package/lib/commonjs/components/boundary/utils/refresh-signals.js +2 -4
  22. package/lib/commonjs/components/boundary/utils/refresh-signals.js.map +1 -1
  23. package/lib/commonjs/providers/screen/descriptors/descriptors.provider.js +3 -7
  24. package/lib/commonjs/providers/screen/descriptors/descriptors.provider.js.map +1 -1
  25. package/lib/commonjs/providers/screen/descriptors/helpers/derive-descriptor-derivations.js +1 -3
  26. package/lib/commonjs/providers/screen/descriptors/helpers/derive-descriptor-derivations.js.map +1 -1
  27. package/lib/commonjs/providers/screen/descriptors/helpers/get-ancestor-keys.js +3 -20
  28. package/lib/commonjs/providers/screen/descriptors/helpers/get-ancestor-keys.js.map +1 -1
  29. package/lib/commonjs/providers/screen/styles/helpers/resolve-interpolator-style-handoff.js +15 -14
  30. package/lib/commonjs/providers/screen/styles/helpers/resolve-interpolator-style-handoff.js.map +1 -1
  31. package/lib/commonjs/providers/screen/styles/hooks/use-interpolated-style-maps.js +17 -17
  32. package/lib/commonjs/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
  33. package/lib/commonjs/stores/bounds/internals/entries.js +27 -0
  34. package/lib/commonjs/stores/bounds/internals/entries.js.map +1 -1
  35. package/lib/commonjs/stores/bounds/internals/links.js +25 -0
  36. package/lib/commonjs/stores/bounds/internals/links.js.map +1 -1
  37. package/lib/commonjs/stores/bounds/internals/resolver.js +2 -12
  38. package/lib/commonjs/stores/bounds/internals/resolver.js.map +1 -1
  39. package/lib/commonjs/utils/bounds/helpers/create-link-accessor.js +2 -2
  40. package/lib/commonjs/utils/bounds/helpers/create-link-accessor.js.map +1 -1
  41. package/lib/module/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js +30 -18
  42. package/lib/module/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
  43. package/lib/module/components/boundary/hooks/lifecycles/use-initial-source-measurement.js +3 -1
  44. package/lib/module/components/boundary/hooks/lifecycles/use-initial-source-measurement.js.map +1 -1
  45. package/lib/module/components/boundary/hooks/lifecycles/use-refresh-boundary.js +3 -5
  46. package/lib/module/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -1
  47. package/lib/module/components/boundary/hooks/use-boundary-measurement.js +5 -4
  48. package/lib/module/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
  49. package/lib/module/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +4 -15
  50. package/lib/module/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
  51. package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js +22 -24
  52. package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js.map +1 -1
  53. package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +3 -36
  54. package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
  55. package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js +2 -2
  56. package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js.map +1 -1
  57. package/lib/module/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js +1 -1
  58. package/lib/module/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -1
  59. package/lib/module/components/boundary/utils/destination-signals.js +8 -4
  60. package/lib/module/components/boundary/utils/destination-signals.js.map +1 -1
  61. package/lib/module/components/boundary/utils/refresh-signals.js +2 -4
  62. package/lib/module/components/boundary/utils/refresh-signals.js.map +1 -1
  63. package/lib/module/providers/screen/descriptors/descriptors.provider.js +4 -8
  64. package/lib/module/providers/screen/descriptors/descriptors.provider.js.map +1 -1
  65. package/lib/module/providers/screen/descriptors/helpers/derive-descriptor-derivations.js +1 -3
  66. package/lib/module/providers/screen/descriptors/helpers/derive-descriptor-derivations.js.map +1 -1
  67. package/lib/module/providers/screen/descriptors/helpers/get-ancestor-keys.js +3 -19
  68. package/lib/module/providers/screen/descriptors/helpers/get-ancestor-keys.js.map +1 -1
  69. package/lib/module/providers/screen/styles/helpers/resolve-interpolator-style-handoff.js +15 -14
  70. package/lib/module/providers/screen/styles/helpers/resolve-interpolator-style-handoff.js.map +1 -1
  71. package/lib/module/providers/screen/styles/hooks/use-interpolated-style-maps.js +17 -17
  72. package/lib/module/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
  73. package/lib/module/stores/bounds/internals/entries.js +27 -1
  74. package/lib/module/stores/bounds/internals/entries.js.map +1 -1
  75. package/lib/module/stores/bounds/internals/links.js +25 -2
  76. package/lib/module/stores/bounds/internals/links.js.map +1 -1
  77. package/lib/module/stores/bounds/internals/resolver.js +3 -13
  78. package/lib/module/stores/bounds/internals/resolver.js.map +1 -1
  79. package/lib/module/utils/bounds/helpers/create-link-accessor.js +3 -3
  80. package/lib/module/utils/bounds/helpers/create-link-accessor.js.map +1 -1
  81. package/lib/typescript/components/boundary/hooks/lifecycles/use-initial-destination-measurement.d.ts.map +1 -1
  82. package/lib/typescript/components/boundary/hooks/lifecycles/use-initial-source-measurement.d.ts.map +1 -1
  83. package/lib/typescript/components/boundary/hooks/lifecycles/use-refresh-boundary.d.ts.map +1 -1
  84. package/lib/typescript/components/boundary/hooks/use-boundary-measurement.d.ts.map +1 -1
  85. package/lib/typescript/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.d.ts.map +1 -1
  86. package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.d.ts +1 -5
  87. package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.d.ts.map +1 -1
  88. package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts.map +1 -1
  89. package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.d.ts.map +1 -1
  90. package/lib/typescript/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts +0 -2
  91. package/lib/typescript/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts.map +1 -1
  92. package/lib/typescript/components/boundary/utils/destination-signals.d.ts +2 -3
  93. package/lib/typescript/components/boundary/utils/destination-signals.d.ts.map +1 -1
  94. package/lib/typescript/components/boundary/utils/refresh-signals.d.ts +0 -2
  95. package/lib/typescript/components/boundary/utils/refresh-signals.d.ts.map +1 -1
  96. package/lib/typescript/providers/screen/descriptors/descriptors.provider.d.ts.map +1 -1
  97. package/lib/typescript/providers/screen/descriptors/helpers/derive-descriptor-derivations.d.ts +1 -3
  98. package/lib/typescript/providers/screen/descriptors/helpers/derive-descriptor-derivations.d.ts.map +1 -1
  99. package/lib/typescript/providers/screen/descriptors/helpers/get-ancestor-keys.d.ts +0 -8
  100. package/lib/typescript/providers/screen/descriptors/helpers/get-ancestor-keys.d.ts.map +1 -1
  101. package/lib/typescript/providers/screen/styles/helpers/resolve-interpolator-style-handoff.d.ts +1 -3
  102. package/lib/typescript/providers/screen/styles/helpers/resolve-interpolator-style-handoff.d.ts.map +1 -1
  103. package/lib/typescript/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts +4 -4
  104. package/lib/typescript/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts.map +1 -1
  105. package/lib/typescript/stores/bounds/internals/entries.d.ts +2 -1
  106. package/lib/typescript/stores/bounds/internals/entries.d.ts.map +1 -1
  107. package/lib/typescript/stores/bounds/internals/links.d.ts +3 -1
  108. package/lib/typescript/stores/bounds/internals/links.d.ts.map +1 -1
  109. package/lib/typescript/stores/bounds/internals/resolver.d.ts.map +1 -1
  110. package/lib/typescript/utils/bounds/helpers/create-link-accessor.d.ts.map +1 -1
  111. package/package.json +1 -1
  112. package/src/components/boundary/hooks/lifecycles/use-initial-destination-measurement.ts +67 -24
  113. package/src/components/boundary/hooks/lifecycles/use-initial-source-measurement.ts +6 -1
  114. package/src/components/boundary/hooks/lifecycles/use-refresh-boundary.ts +8 -9
  115. package/src/components/boundary/hooks/use-boundary-measurement.ts +5 -4
  116. package/src/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.tsx +4 -20
  117. package/src/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.ts +27 -37
  118. package/src/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.ts +10 -57
  119. package/src/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.ts +1 -8
  120. package/src/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.ts +0 -3
  121. package/src/components/boundary/utils/destination-signals.ts +8 -8
  122. package/src/components/boundary/utils/refresh-signals.ts +2 -10
  123. package/src/providers/screen/descriptors/descriptors.provider.tsx +4 -11
  124. package/src/providers/screen/descriptors/helpers/derive-descriptor-derivations.ts +0 -4
  125. package/src/providers/screen/descriptors/helpers/get-ancestor-keys.ts +3 -30
  126. package/src/providers/screen/styles/helpers/resolve-interpolator-style-handoff.ts +16 -16
  127. package/src/providers/screen/styles/hooks/use-interpolated-style-maps.tsx +21 -24
  128. package/src/stores/bounds/internals/entries.ts +38 -1
  129. package/src/stores/bounds/internals/links.ts +36 -0
  130. package/src/stores/bounds/internals/resolver.ts +7 -21
  131. package/src/utils/bounds/helpers/create-link-accessor.ts +9 -3
  132. package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.js +0 -18
  133. package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.js.map +0 -1
  134. package/lib/module/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.js +0 -13
  135. package/lib/module/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.js.map +0 -1
  136. package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.d.ts +0 -3
  137. package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.d.ts.map +0 -1
  138. package/src/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.ts +0 -16
@@ -31,8 +31,6 @@ export const getRefreshBoundarySignal = (params: {
31
31
  currentScreenKey: string;
32
32
  sourcePairKey?: ScreenPairKey;
33
33
  destinationPairKey?: ScreenPairKey;
34
- ancestorDestinationPairKey?: ScreenPairKey;
35
- nextScreenKey?: string;
36
34
  linkId: string;
37
35
  group?: string;
38
36
  shouldRefresh: boolean;
@@ -45,8 +43,6 @@ export const getRefreshBoundarySignal = (params: {
45
43
  currentScreenKey,
46
44
  sourcePairKey,
47
45
  destinationPairKey,
48
- ancestorDestinationPairKey,
49
- nextScreenKey,
50
46
  linkId,
51
47
  group,
52
48
  shouldRefresh,
@@ -79,9 +75,7 @@ export const getRefreshBoundarySignal = (params: {
79
75
  );
80
76
  }
81
77
 
82
- const refreshDestinationPairKey =
83
- destinationPairKey ??
84
- (nextScreenKey ? undefined : ancestorDestinationPairKey);
78
+ const refreshDestinationPairKey = destinationPairKey;
85
79
 
86
80
  if (!refreshDestinationPairKey) {
87
81
  return null;
@@ -114,9 +108,7 @@ export const getRefreshBoundarySignal = (params: {
114
108
  );
115
109
  }
116
110
 
117
- const refreshDestinationPairKey =
118
- destinationPairKey ??
119
- (nextScreenKey ? undefined : ancestorDestinationPairKey);
111
+ const refreshDestinationPairKey = destinationPairKey;
120
112
 
121
113
  if (!refreshDestinationPairKey) return null;
122
114
 
@@ -6,7 +6,7 @@ import type { BaseStackDescriptor } from "../../../types/stack.types";
6
6
  import createProvider from "../../../utils/create-provider";
7
7
  import type { DescriptorDerivations } from "./helpers/derive-descriptor-derivations";
8
8
  import { deriveDescriptorDerivations } from "./helpers/derive-descriptor-derivations";
9
- import { getAncestorKeyState } from "./helpers/get-ancestor-keys";
9
+ import { getAncestorKeys } from "./helpers/get-ancestor-keys";
10
10
 
11
11
  /**
12
12
  * Base descriptor interface - minimal contract for all stack types.
@@ -84,8 +84,8 @@ export const { DescriptorsProvider, useDescriptorsStore } = createProvider(
84
84
  [resolvedPrevious, resolvedCurrent, resolvedNext],
85
85
  );
86
86
 
87
- const { ancestorKeys, ancestorDestinationPairKey } = useMemo(
88
- () => getAncestorKeyState(resolvedCurrent),
87
+ const ancestorKeys = useMemo(
88
+ () => getAncestorKeys(resolvedCurrent),
89
89
  [resolvedCurrent],
90
90
  );
91
91
 
@@ -96,15 +96,8 @@ export const { DescriptorsProvider, useDescriptorsStore } = createProvider(
96
96
  current: resolvedCurrent,
97
97
  next: resolvedNext,
98
98
  ancestorKeys,
99
- ancestorDestinationPairKey,
100
99
  }),
101
- [
102
- resolvedPrevious,
103
- resolvedCurrent,
104
- resolvedNext,
105
- ancestorKeys,
106
- ancestorDestinationPairKey,
107
- ],
100
+ [resolvedPrevious, resolvedCurrent, resolvedNext, ancestorKeys],
108
101
  );
109
102
 
110
103
  return {
@@ -8,7 +8,6 @@ export interface DescriptorDerivations {
8
8
  nextScreenKey?: string;
9
9
  sourcePairKey?: ScreenPairKey;
10
10
  destinationPairKey?: ScreenPairKey;
11
- ancestorDestinationPairKey?: ScreenPairKey;
12
11
  parentScreenKey?: string;
13
12
  isFirstKey: boolean;
14
13
  isTopMostScreen: boolean;
@@ -21,7 +20,6 @@ interface Params {
21
20
  current: BaseStackDescriptor;
22
21
  next?: BaseStackDescriptor;
23
22
  ancestorKeys: string[];
24
- ancestorDestinationPairKey?: ScreenPairKey;
25
23
  }
26
24
 
27
25
  export function deriveDescriptorDerivations({
@@ -29,7 +27,6 @@ export function deriveDescriptorDerivations({
29
27
  current,
30
28
  next,
31
29
  ancestorKeys,
32
- ancestorDestinationPairKey,
33
30
  }: Params): DescriptorDerivations {
34
31
  const previousScreenKey = previous?.route.key;
35
32
  const currentScreenKey = current.route.key;
@@ -56,7 +53,6 @@ export function deriveDescriptorDerivations({
56
53
  nextScreenKey,
57
54
  sourcePairKey,
58
55
  destinationPairKey,
59
- ancestorDestinationPairKey,
60
56
  parentScreenKey: ancestorKeys[0],
61
57
  isFirstKey,
62
58
  isTopMostScreen,
@@ -1,26 +1,14 @@
1
- import { createScreenPairKey } from "../../../../stores/bounds/helpers/link-pairs.helpers";
2
- import type { ScreenPairKey } from "../../../../stores/bounds/types";
3
1
  import type { BaseStackDescriptor } from "../../../../types/stack.types";
4
2
 
5
- export interface AncestorKeyState {
6
- ancestorKeys: string[];
7
- ancestorDestinationPairKey?: ScreenPairKey;
8
- }
9
-
10
3
  /**
11
4
  * Builds nested navigator ancestor keys from immediate parent to root.
12
- * The nearest ancestor destination pair lets child routes attach measurements
13
- * to the transition owned by the parent stack.
14
5
  */
15
- export function getAncestorKeyState(
16
- current: BaseStackDescriptor,
17
- ): AncestorKeyState {
6
+ export function getAncestorKeys(current: BaseStackDescriptor): string[] {
18
7
  const ancestors: string[] = [];
19
- let ancestorDestinationPairKey: ScreenPairKey | undefined;
20
8
  const nav = current.navigation as any;
21
9
 
22
10
  if (typeof nav?.getParent !== "function") {
23
- return { ancestorKeys: ancestors };
11
+ return ancestors;
24
12
  }
25
13
 
26
14
  let parent = nav.getParent();
@@ -31,25 +19,10 @@ export function getAncestorKeyState(
31
19
  const focusedRoute = state.routes[state.index];
32
20
  if (focusedRoute?.key) {
33
21
  ancestors.push(focusedRoute.key);
34
-
35
- const previousRoute = state.routes[state.index - 1];
36
- if (!ancestorDestinationPairKey && previousRoute?.key) {
37
- ancestorDestinationPairKey = createScreenPairKey(
38
- previousRoute.key,
39
- focusedRoute.key,
40
- );
41
- }
42
22
  }
43
23
  }
44
24
  parent = parent.getParent();
45
25
  }
46
26
 
47
- return {
48
- ancestorKeys: ancestors,
49
- ancestorDestinationPairKey,
50
- };
51
- }
52
-
53
- export function getAncestorKeys(current: BaseStackDescriptor): string[] {
54
- return getAncestorKeyState(current).ancestorKeys;
27
+ return ancestors;
55
28
  }
@@ -81,18 +81,18 @@ const mergeSlots = (
81
81
  return merged;
82
82
  };
83
83
 
84
- const composeFrozenAndLiveStyles = (
85
- frozen: NormalizedTransitionInterpolatedStyle,
86
- live: NormalizedTransitionInterpolatedStyle,
84
+ const composeCurrentAndNextStyles = (
85
+ current: NormalizedTransitionInterpolatedStyle,
86
+ next: NormalizedTransitionInterpolatedStyle,
87
87
  ) => {
88
88
  "worklet";
89
- const composed: NormalizedTransitionInterpolatedStyle = { ...frozen };
89
+ const composed: NormalizedTransitionInterpolatedStyle = { ...current };
90
90
 
91
- for (const slotId in live) {
92
- const liveSlot = live[slotId];
91
+ for (const slotId in next) {
92
+ const nextSlot = next[slotId];
93
93
 
94
- if (liveSlot) {
95
- composed[slotId] = mergeSlots(frozen[slotId], liveSlot);
94
+ if (nextSlot) {
95
+ composed[slotId] = mergeSlots(current[slotId], nextSlot);
96
96
  }
97
97
  }
98
98
 
@@ -103,36 +103,36 @@ export const resolveInterpolatorStyleHandoff = ({
103
103
  currentOwnsInterpolator,
104
104
  currentStylesMap,
105
105
  nextStylesMap,
106
- frozenCurrentStylesMap,
107
106
  }: {
108
107
  currentOwnsInterpolator: boolean;
109
108
  currentStylesMap: NormalizedTransitionInterpolatedStyle | undefined;
110
109
  nextStylesMap: NormalizedTransitionInterpolatedStyle | undefined;
111
- frozenCurrentStylesMap: NormalizedTransitionInterpolatedStyle;
112
110
  }): {
113
111
  localStylesMaps: LocalStyleLayers;
114
- nextFrozenCurrentStylesMap: NormalizedTransitionInterpolatedStyle;
115
112
  } => {
116
113
  "worklet";
117
114
 
118
115
  if (currentOwnsInterpolator) {
119
116
  return {
120
117
  localStylesMaps: currentStylesMap ? [currentStylesMap] : [],
121
- nextFrozenCurrentStylesMap: currentStylesMap ?? frozenCurrentStylesMap,
122
118
  };
123
119
  }
124
120
 
125
121
  if (!nextStylesMap) {
126
122
  return {
127
- localStylesMaps: frozenCurrentStylesMap ? [frozenCurrentStylesMap] : [],
128
- nextFrozenCurrentStylesMap: frozenCurrentStylesMap,
123
+ localStylesMaps: currentStylesMap ? [currentStylesMap] : [],
124
+ };
125
+ }
126
+
127
+ if (!currentStylesMap) {
128
+ return {
129
+ localStylesMaps: [nextStylesMap],
129
130
  };
130
131
  }
131
132
 
132
133
  return {
133
134
  localStylesMaps: [
134
- composeFrozenAndLiveStyles(frozenCurrentStylesMap, nextStylesMap),
135
+ composeCurrentAndNextStyles(currentStylesMap, nextStylesMap),
135
136
  ],
136
- nextFrozenCurrentStylesMap: frozenCurrentStylesMap,
137
137
  };
138
138
  };
@@ -125,10 +125,10 @@ const runInterpolator = ({
125
125
  * normal interpolator selection once the gesture-driven close is no longer in
126
126
  * play.
127
127
  *
128
- * At an ownership handoff, the last current-owner styles are frozen. The next
129
- * owner replaces matching scalar keys and composes its live transforms after
130
- * the frozen transforms. The previous interpolator is not evaluated again until
131
- * it regains ownership.
128
+ * At an ownership handoff, the current interpolator remains live but is
129
+ * evaluated without the next-screen relationship. The next owner replaces
130
+ * matching scalar keys and composes its live transforms after the current
131
+ * screen's self-owned transforms.
132
132
  */
133
133
  export const useInterpolatedStylesMap = ({
134
134
  enabled,
@@ -177,8 +177,6 @@ export const useInterpolatedStylesMap = ({
177
177
 
178
178
  const isGesturingDuringCloseAnimation = useSharedValue(false);
179
179
  const initialDestinationStylesReady = useSharedValue(0);
180
- const frozenCurrentStylesMap =
181
- useSharedValue<NormalizedTransitionInterpolatedStyle>(NO_STYLES);
182
180
  const shouldPrepareInitialDestinationStyles =
183
181
  enabled && !!destinationPairKey && !nextScreenKey && !!currentInterpolator;
184
182
 
@@ -261,17 +259,21 @@ export const useInterpolatedStylesMap = ({
261
259
  ? "current"
262
260
  : "next";
263
261
 
264
- const selectedFrame = selectInterpolatorFrame(props, isInGestureMode);
265
-
266
- const currentResult = currentOwnsInterpolator
267
- ? runInterpolator({
268
- interpolator: currentInterpolator,
269
- props,
270
- selectedFrame,
271
- bounds: boundsAccessor,
272
- transition,
273
- })
274
- : undefined;
262
+ // Once the next interpolator owns the relationship, the current
263
+ // interpolator remains responsible only for its own live presentation.
264
+ // This preserves snap-point transforms without letting current-screen
265
+ // unfocus rules compete with the next screen's outgoing transition.
266
+ const currentSelectedFrame = selectInterpolatorFrame(
267
+ props,
268
+ isInGestureMode || !!nextInterpolator,
269
+ );
270
+ const currentResult = runInterpolator({
271
+ interpolator: currentInterpolator,
272
+ props,
273
+ selectedFrame: currentSelectedFrame,
274
+ bounds: boundsAccessor,
275
+ transition,
276
+ });
275
277
 
276
278
  const initialDestinationStyleGate = resolveInitialDestinationStyleGate({
277
279
  shouldPrepareStyles: shouldPrepareInitialDestinationStyles,
@@ -295,22 +297,18 @@ export const useInterpolatedStylesMap = ({
295
297
  currentOwnsInterpolator: true,
296
298
  currentStylesMap: currentResult?.stylesMap,
297
299
  nextStylesMap: undefined,
298
- frozenCurrentStylesMap: frozenCurrentStylesMap.get(),
299
300
  });
300
301
 
301
- if (handoff.nextFrozenCurrentStylesMap !== frozenCurrentStylesMap.get()) {
302
- frozenCurrentStylesMap.set(handoff.nextFrozenCurrentStylesMap);
303
- }
304
-
305
302
  return handoff.localStylesMaps.length
306
303
  ? handoff.localStylesMaps
307
304
  : NO_STYLE_LAYERS;
308
305
  }
309
306
 
307
+ const nextSelectedFrame = selectInterpolatorFrame(props, false);
310
308
  const nextResult = runInterpolator({
311
309
  interpolator: nextInterpolator,
312
310
  props,
313
- selectedFrame,
311
+ selectedFrame: nextSelectedFrame,
314
312
  bounds: boundsAccessor,
315
313
  transition,
316
314
  });
@@ -326,7 +324,6 @@ export const useInterpolatedStylesMap = ({
326
324
  currentOwnsInterpolator: false,
327
325
  currentStylesMap: currentResult?.stylesMap,
328
326
  nextStylesMap: nextResult?.stylesMap,
329
- frozenCurrentStylesMap: frozenCurrentStylesMap.get(),
330
327
  });
331
328
 
332
329
  return handoff.localStylesMaps.length
@@ -62,6 +62,43 @@ function getEntry(tag: TagID, key: ScreenKey): Entry | null {
62
62
  return boundaryRegistry.get()[tag]?.screens[key] ?? null;
63
63
  }
64
64
 
65
+ function getMatchingSourceScreenKey(
66
+ tag: TagID,
67
+ destinationScreenKey: ScreenKey,
68
+ preferredScreenKey?: ScreenKey,
69
+ excludedScreenKeys?: readonly ScreenKey[],
70
+ ): ScreenKey | null {
71
+ "worklet";
72
+ const screens = boundaryRegistry.get()[tag]?.screens;
73
+ if (!screens) return null;
74
+ const isExcluded = (screenKey: ScreenKey) => {
75
+ "worklet";
76
+ for (let index = 0; index < (excludedScreenKeys?.length ?? 0); index++) {
77
+ if (excludedScreenKeys?.[index] === screenKey) {
78
+ return true;
79
+ }
80
+ }
81
+ return false;
82
+ };
83
+ if (
84
+ preferredScreenKey &&
85
+ preferredScreenKey !== destinationScreenKey &&
86
+ !isExcluded(preferredScreenKey) &&
87
+ screens[preferredScreenKey]
88
+ ) {
89
+ return preferredScreenKey;
90
+ }
91
+
92
+ let latestScreenKey: ScreenKey | null = null;
93
+ for (const screenKey in screens) {
94
+ if (screenKey !== destinationScreenKey && !isExcluded(screenKey)) {
95
+ latestScreenKey = screenKey;
96
+ }
97
+ }
98
+
99
+ return latestScreenKey;
100
+ }
101
+
65
102
  function setEntry(tag: TagID, screenKey: ScreenKey, patch: EntryPatch) {
66
103
  "worklet";
67
104
  boundaryRegistry.modify(<T extends BoundaryEntriesState>(state: T): T => {
@@ -90,4 +127,4 @@ function removeEntry(tag: TagID, screenKey: ScreenKey) {
90
127
  });
91
128
  }
92
129
 
93
- export { getEntry, removeEntry, setEntry };
130
+ export { getEntry, getMatchingSourceScreenKey, removeEntry, setEntry };
@@ -4,12 +4,14 @@ import {
4
4
  ensurePairGroups,
5
5
  ensurePairLinks,
6
6
  ensurePairSourceRequests,
7
+ getDestinationScreenKeyFromPairKey,
7
8
  getGroupKeyFromTag,
8
9
  getLinkKeyFromTag,
9
10
  getActiveGroupId as getPairActiveGroupId,
10
11
  getDestination as getPairDestination,
11
12
  getLink as getPairLink,
12
13
  getSource as getPairSource,
14
+ getSourceScreenKeyFromPairKey,
13
15
  } from "../helpers/link-pairs.helpers";
14
16
  import type {
15
17
  BoundaryRuntimeFlags,
@@ -402,6 +404,38 @@ function getResolvedLink(
402
404
  };
403
405
  }
404
406
 
407
+ function getPairKeyForSource(
408
+ tag: TagID,
409
+ screenKey: ScreenKey,
410
+ ): ScreenPairKey | null {
411
+ "worklet";
412
+ const state = pairs.get();
413
+ const linkKey = getLinkKeyFromTag(tag);
414
+ for (const pairKey in state) {
415
+ if (getSourceScreenKeyFromPairKey(pairKey) !== screenKey) continue;
416
+ if (
417
+ getResolvedLink(pairKey, tag).link?.destination ||
418
+ state[pairKey]?.sourceRequests?.[linkKey]
419
+ ) {
420
+ return pairKey;
421
+ }
422
+ }
423
+ return null;
424
+ }
425
+
426
+ function getPairKeyForDestination(
427
+ tag: TagID,
428
+ screenKey: ScreenKey,
429
+ ): ScreenPairKey | null {
430
+ "worklet";
431
+ const state = pairs.get();
432
+ for (const pairKey in state) {
433
+ if (getDestinationScreenKeyFromPairKey(pairKey) !== screenKey) continue;
434
+ if (getResolvedLink(pairKey, tag).link) return pairKey;
435
+ }
436
+ return null;
437
+ }
438
+
405
439
  function getSource(
406
440
  pairKey: ScreenPairKey,
407
441
  tag: TagID,
@@ -422,6 +456,8 @@ export {
422
456
  getActiveGroupId,
423
457
  getDestination,
424
458
  getLink,
459
+ getPairKeyForDestination,
460
+ getPairKeyForSource,
425
461
  getResolvedLink,
426
462
  getSource,
427
463
  requestSourceMeasure,
@@ -1,35 +1,21 @@
1
- import { createScreenPairKey } from "../helpers/link-pairs.helpers";
2
1
  import type {
3
2
  ResolvedTransitionPair,
4
3
  ResolveTransitionContext,
5
- ScreenPairKey,
6
4
  TagID,
7
5
  } from "../types";
8
- import { getResolvedLink } from "./links";
9
-
10
- function resolvePairKey(
11
- context: ResolveTransitionContext,
12
- ): ScreenPairKey | null {
13
- "worklet";
14
-
15
- if (context.entering) {
16
- if (!context.previousScreenKey || !context.currentScreenKey) return null;
17
- return createScreenPairKey(
18
- context.previousScreenKey,
19
- context.currentScreenKey,
20
- );
21
- }
22
-
23
- if (!context.currentScreenKey || !context.nextScreenKey) return null;
24
- return createScreenPairKey(context.currentScreenKey, context.nextScreenKey);
25
- }
6
+ import { getPairKeyForDestination, getResolvedLink } from "./links";
26
7
 
27
8
  function resolveTransitionPair(
28
9
  tag: TagID,
29
10
  context: ResolveTransitionContext,
30
11
  ): ResolvedTransitionPair {
31
12
  "worklet";
32
- const pairKey = resolvePairKey(context);
13
+ const destinationScreenKey = context.entering
14
+ ? context.currentScreenKey
15
+ : context.nextScreenKey;
16
+ const pairKey = destinationScreenKey
17
+ ? getPairKeyForDestination(tag, destinationScreenKey)
18
+ : null;
33
19
  const matchedLink = pairKey ? getResolvedLink(pairKey, tag).link : null;
34
20
 
35
21
  return {
@@ -1,10 +1,12 @@
1
- import { getResolvedLink } from "../../../stores/bounds/internals/links";
1
+ import {
2
+ getPairKeyForDestination,
3
+ getResolvedLink,
4
+ } from "../../../stores/bounds/internals/links";
2
5
  import type {
3
6
  BoundsInterpolationProps,
4
7
  BoundsLink,
5
8
  } from "../../../types/bounds.types";
6
9
  import type { BoundId } from "../types/options";
7
- import { resolveBoundsPairKey } from "./resolve-bounds-pair-key";
8
10
 
9
11
  type GetProps = () => BoundsInterpolationProps;
10
12
 
@@ -19,7 +21,11 @@ export const createLinkAccessor = (getProps: GetProps): LinkAccessor => {
19
21
  "worklet";
20
22
  const props = getProps();
21
23
  const stringTag = String(tag);
22
- const pairKey = resolveBoundsPairKey(props);
24
+ const destinationScreenKey =
25
+ props.next?.route.key ?? props.current?.route.key;
26
+ const pairKey = destinationScreenKey
27
+ ? getPairKeyForDestination(stringTag, destinationScreenKey)
28
+ : null;
23
29
  if (!pairKey) return null;
24
30
 
25
31
  const resolved = getResolvedLink(pairKey, stringTag);
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.hasLocalSlot = void 0;
7
- const hasLocalSlot = (localStylesMaps, slotId) => {
8
- "worklet";
9
-
10
- for (let index = 0; index < localStylesMaps.length; index++) {
11
- if (localStylesMaps[index]?.[slotId] !== undefined) {
12
- return true;
13
- }
14
- }
15
- return false;
16
- };
17
- exports.hasLocalSlot = hasLocalSlot;
18
- //# sourceMappingURL=has-local-slot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["hasLocalSlot","localStylesMaps","slotId","index","length","undefined","exports"],"sourceRoot":"../../../../../../../../src","sources":["components/boundary/portal/components/boundary-portal/helpers/has-local-slot.ts"],"mappings":";;;;;;AAEO,MAAMA,YAAY,GAAGA,CAC3BC,eAAiC,EACjCC,MAAc,KACV;EACJ,SAAS;;EAET,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGF,eAAe,CAACG,MAAM,EAAED,KAAK,EAAE,EAAE;IAC5D,IAAIF,eAAe,CAACE,KAAK,CAAC,GAAGD,MAAM,CAAC,KAAKG,SAAS,EAAE;MACnD,OAAO,IAAI;IACZ;EACD;EAEA,OAAO,KAAK;AACb,CAAC;AAACC,OAAA,CAAAN,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- export const hasLocalSlot = (localStylesMaps, slotId) => {
4
- "worklet";
5
-
6
- for (let index = 0; index < localStylesMaps.length; index++) {
7
- if (localStylesMaps[index]?.[slotId] !== undefined) {
8
- return true;
9
- }
10
- }
11
- return false;
12
- };
13
- //# sourceMappingURL=has-local-slot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["hasLocalSlot","localStylesMaps","slotId","index","length","undefined"],"sourceRoot":"../../../../../../../../src","sources":["components/boundary/portal/components/boundary-portal/helpers/has-local-slot.ts"],"mappings":";;AAEA,OAAO,MAAMA,YAAY,GAAGA,CAC3BC,eAAiC,EACjCC,MAAc,KACV;EACJ,SAAS;;EAET,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGF,eAAe,CAACG,MAAM,EAAED,KAAK,EAAE,EAAE;IAC5D,IAAIF,eAAe,CAACE,KAAK,CAAC,GAAGD,MAAM,CAAC,KAAKG,SAAS,EAAE;MACnD,OAAO,IAAI;IACZ;EACD;EAEA,OAAO,KAAK;AACb,CAAC","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import type { LocalStyleLayers } from "../../../../../../providers/screen/styles/helpers/resolve-slot-styles";
2
- export declare const hasLocalSlot: (localStylesMaps: LocalStyleLayers, slotId: string) => boolean;
3
- //# sourceMappingURL=has-local-slot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"has-local-slot.d.ts","sourceRoot":"","sources":["../../../../../../../../src/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uEAAuE,CAAC;AAE9G,eAAO,MAAM,YAAY,GACxB,iBAAiB,gBAAgB,EACjC,QAAQ,MAAM,YAWd,CAAC"}
@@ -1,16 +0,0 @@
1
- import type { LocalStyleLayers } from "../../../../../../providers/screen/styles/helpers/resolve-slot-styles";
2
-
3
- export const hasLocalSlot = (
4
- localStylesMaps: LocalStyleLayers,
5
- slotId: string,
6
- ) => {
7
- "worklet";
8
-
9
- for (let index = 0; index < localStylesMaps.length; index++) {
10
- if (localStylesMaps[index]?.[slotId] !== undefined) {
11
- return true;
12
- }
13
- }
14
-
15
- return false;
16
- };