react-native-screen-transitions 3.4.0-alpha.6 → 3.4.0-alpha.7

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 (205) hide show
  1. package/README.md +136 -46
  2. package/lib/commonjs/blank-stack/navigators/create-blank-stack-navigator.js +27 -45
  3. package/lib/commonjs/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -1
  4. package/lib/commonjs/component-stack/navigators/create-component-stack-navigator.js +1 -1
  5. package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js +39 -0
  6. package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js.map +1 -0
  7. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js +232 -0
  8. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js.map +1 -0
  9. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +2 -4
  10. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  11. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +4 -3
  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-retry-measurement.js +2 -1
  14. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +1 -1
  15. package/lib/commonjs/shared/components/create-boundary-component/index.js +20 -214
  16. package/lib/commonjs/shared/components/create-boundary-component/index.js.map +1 -1
  17. package/lib/commonjs/shared/components/create-boundary-component/providers/boundary-owner.provider.js +63 -0
  18. package/lib/commonjs/shared/components/create-boundary-component/providers/boundary-owner.provider.js.map +1 -0
  19. package/lib/commonjs/shared/components/create-transition-aware-component.js +29 -7
  20. package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
  21. package/lib/commonjs/shared/components/overlay/variations/float-overlay.js +1 -1
  22. package/lib/commonjs/shared/components/screen-container/index.js +8 -12
  23. package/lib/commonjs/shared/components/screen-container/index.js.map +1 -1
  24. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +4 -4
  25. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
  26. package/lib/commonjs/shared/components/screen-container/layers/content.js +4 -4
  27. package/lib/commonjs/shared/components/screen-container/layers/content.js.map +1 -1
  28. package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js +4 -4
  29. package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
  30. package/lib/commonjs/shared/components/screen-container/layers/surface-container.js +4 -4
  31. package/lib/commonjs/shared/components/screen-container/layers/surface-container.js.map +1 -1
  32. package/lib/commonjs/shared/constants.js +2 -1
  33. package/lib/commonjs/shared/constants.js.map +1 -1
  34. package/lib/commonjs/shared/providers/screen/screen-composer.js +1 -1
  35. package/lib/commonjs/shared/providers/screen/screen-composer.js.map +1 -1
  36. package/lib/commonjs/shared/providers/screen/styles/helpers/build-resolved-style-map.js +144 -0
  37. package/lib/commonjs/shared/providers/screen/styles/helpers/build-resolved-style-map.js.map +1 -0
  38. package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.js +28 -0
  39. package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.js.map +1 -0
  40. package/lib/commonjs/shared/providers/screen/styles/helpers/split-normalized-style-maps.js +39 -0
  41. package/lib/commonjs/shared/providers/screen/styles/helpers/split-normalized-style-maps.js.map +1 -0
  42. package/lib/commonjs/shared/providers/screen/styles/index.js +25 -0
  43. package/lib/commonjs/shared/providers/screen/styles/index.js.map +1 -0
  44. package/lib/commonjs/shared/providers/screen/{styles.provider.js → styles/styles.provider.js} +47 -39
  45. package/lib/commonjs/shared/providers/screen/styles/styles.provider.js.map +1 -0
  46. package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js +1 -1
  47. package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
  48. package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js +21 -10
  49. package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js.map +1 -1
  50. package/lib/commonjs/shared/utils/bounds/zoom/build.js +56 -30
  51. package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
  52. package/lib/module/blank-stack/navigators/create-blank-stack-navigator.js +27 -45
  53. package/lib/module/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -1
  54. package/lib/module/component-stack/navigators/create-component-stack-navigator.js +1 -1
  55. package/lib/module/shared/components/create-boundary-component/components/boundary-target.js +34 -0
  56. package/lib/module/shared/components/create-boundary-component/components/boundary-target.js.map +1 -0
  57. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js +227 -0
  58. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js.map +1 -0
  59. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +2 -4
  60. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  61. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +4 -3
  62. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
  63. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +2 -1
  64. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +1 -1
  65. package/lib/module/shared/components/create-boundary-component/index.js +16 -213
  66. package/lib/module/shared/components/create-boundary-component/index.js.map +1 -1
  67. package/lib/module/shared/components/create-boundary-component/providers/boundary-owner.provider.js +56 -0
  68. package/lib/module/shared/components/create-boundary-component/providers/boundary-owner.provider.js.map +1 -0
  69. package/lib/module/shared/components/create-transition-aware-component.js +30 -8
  70. package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
  71. package/lib/module/shared/components/overlay/variations/float-overlay.js +1 -1
  72. package/lib/module/shared/components/overlay/variations/float-overlay.js.map +1 -1
  73. package/lib/module/shared/components/screen-container/index.js +8 -12
  74. package/lib/module/shared/components/screen-container/index.js.map +1 -1
  75. package/lib/module/shared/components/screen-container/layers/backdrop.js +4 -4
  76. package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
  77. package/lib/module/shared/components/screen-container/layers/content.js +4 -4
  78. package/lib/module/shared/components/screen-container/layers/content.js.map +1 -1
  79. package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js +4 -4
  80. package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
  81. package/lib/module/shared/components/screen-container/layers/surface-container.js +4 -4
  82. package/lib/module/shared/components/screen-container/layers/surface-container.js.map +1 -1
  83. package/lib/module/shared/constants.js +2 -1
  84. package/lib/module/shared/constants.js.map +1 -1
  85. package/lib/module/shared/providers/screen/screen-composer.js +1 -1
  86. package/lib/module/shared/providers/screen/screen-composer.js.map +1 -1
  87. package/lib/module/shared/providers/screen/styles/helpers/build-resolved-style-map.js +139 -0
  88. package/lib/module/shared/providers/screen/styles/helpers/build-resolved-style-map.js.map +1 -0
  89. package/lib/module/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.js +23 -0
  90. package/lib/module/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.js.map +1 -0
  91. package/lib/module/shared/providers/screen/styles/helpers/split-normalized-style-maps.js +34 -0
  92. package/lib/module/shared/providers/screen/styles/helpers/split-normalized-style-maps.js.map +1 -0
  93. package/lib/module/shared/providers/screen/styles/index.js +4 -0
  94. package/lib/module/shared/providers/screen/styles/index.js.map +1 -0
  95. package/lib/module/shared/providers/screen/{styles.provider.js → styles/styles.provider.js} +48 -40
  96. package/lib/module/shared/providers/screen/styles/styles.provider.js.map +1 -0
  97. package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js +2 -2
  98. package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
  99. package/lib/module/shared/utils/bounds/helpers/style-composers.js +21 -10
  100. package/lib/module/shared/utils/bounds/helpers/style-composers.js.map +1 -1
  101. package/lib/module/shared/utils/bounds/zoom/build.js +55 -28
  102. package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
  103. package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts +9 -15
  104. package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts.map +1 -1
  105. package/lib/typescript/blank-stack/types.d.ts +6 -4
  106. package/lib/typescript/blank-stack/types.d.ts.map +1 -1
  107. package/lib/typescript/component-stack/navigators/create-component-stack-navigator.d.ts +1 -1
  108. package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts +209 -0
  109. package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts.map +1 -0
  110. package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts +8 -0
  111. package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts.map +1 -0
  112. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts.map +1 -1
  113. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts +2 -8
  114. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts.map +1 -1
  115. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts +0 -1
  116. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts.map +1 -1
  117. package/lib/typescript/shared/components/create-boundary-component/index.d.ts +216 -12
  118. package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +1 -1
  119. package/lib/typescript/shared/components/create-boundary-component/providers/boundary-owner.provider.d.ts +35 -0
  120. package/lib/typescript/shared/components/create-boundary-component/providers/boundary-owner.provider.d.ts.map +1 -0
  121. package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
  122. package/lib/typescript/shared/components/screen-container/index.d.ts.map +1 -1
  123. package/lib/typescript/shared/components/screen-container/layers/maybe-masked-navigation-container.d.ts.map +1 -1
  124. package/lib/typescript/shared/constants.d.ts +1 -0
  125. package/lib/typescript/shared/constants.d.ts.map +1 -1
  126. package/lib/typescript/shared/index.d.ts +209 -2
  127. package/lib/typescript/shared/index.d.ts.map +1 -1
  128. package/lib/typescript/shared/providers/screen/styles/helpers/build-resolved-style-map.d.ts +11 -0
  129. package/lib/typescript/shared/providers/screen/styles/helpers/build-resolved-style-map.d.ts.map +1 -0
  130. package/lib/typescript/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.d.ts +7 -0
  131. package/lib/typescript/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.d.ts.map +1 -0
  132. package/lib/typescript/shared/providers/screen/styles/helpers/split-normalized-style-maps.d.ts +6 -0
  133. package/lib/typescript/shared/providers/screen/styles/helpers/split-normalized-style-maps.d.ts.map +1 -0
  134. package/lib/typescript/shared/providers/screen/styles/index.d.ts +2 -0
  135. package/lib/typescript/shared/providers/screen/styles/index.d.ts.map +1 -0
  136. package/lib/typescript/shared/providers/screen/{styles.provider.d.ts → styles/styles.provider.d.ts} +3 -5
  137. package/lib/typescript/shared/providers/screen/styles/styles.provider.d.ts.map +1 -0
  138. package/lib/typescript/shared/types/animation.types.d.ts +3 -9
  139. package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
  140. package/lib/typescript/shared/types/index.d.ts +1 -1
  141. package/lib/typescript/shared/types/index.d.ts.map +1 -1
  142. package/lib/typescript/shared/types/screen.types.d.ts +2 -4
  143. package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
  144. package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts +1 -11
  145. package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +1 -1
  146. package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts.map +1 -1
  147. package/lib/typescript/shared/utils/bounds/zoom/build.d.ts +1 -1
  148. package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
  149. package/package.json +1 -1
  150. package/src/blank-stack/navigators/create-blank-stack-navigator.tsx +37 -80
  151. package/src/blank-stack/types.ts +7 -4
  152. package/src/component-stack/navigators/create-component-stack-navigator.tsx +1 -1
  153. package/src/shared/components/create-boundary-component/components/boundary-target.tsx +45 -0
  154. package/src/shared/components/create-boundary-component/create-boundary-component.tsx +282 -0
  155. package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +2 -7
  156. package/src/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.ts +6 -10
  157. package/src/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.ts +3 -2
  158. package/src/shared/components/create-boundary-component/index.tsx +16 -252
  159. package/src/shared/components/create-boundary-component/providers/boundary-owner.provider.tsx +109 -0
  160. package/src/shared/components/create-transition-aware-component.tsx +33 -5
  161. package/src/shared/components/overlay/variations/float-overlay.tsx +1 -1
  162. package/src/shared/components/screen-container/index.tsx +10 -13
  163. package/src/shared/components/screen-container/layers/backdrop.tsx +4 -4
  164. package/src/shared/components/screen-container/layers/content.tsx +4 -4
  165. package/src/shared/components/screen-container/layers/maybe-masked-navigation-container.tsx +6 -4
  166. package/src/shared/components/screen-container/layers/surface-container.tsx +4 -4
  167. package/src/shared/constants.ts +1 -0
  168. package/src/shared/index.ts +0 -1
  169. package/src/shared/providers/screen/screen-composer.tsx +1 -1
  170. package/src/shared/providers/screen/styles/helpers/build-resolved-style-map.ts +185 -0
  171. package/src/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.ts +31 -0
  172. package/src/shared/providers/screen/styles/helpers/split-normalized-style-maps.ts +44 -0
  173. package/src/shared/providers/screen/styles/index.tsx +5 -0
  174. package/src/shared/providers/screen/styles/styles.provider.tsx +173 -0
  175. package/src/shared/types/animation.types.ts +3 -10
  176. package/src/shared/types/index.ts +0 -1
  177. package/src/shared/types/screen.types.ts +2 -4
  178. package/src/shared/utils/bounds/helpers/compute-bounds-styles.ts +2 -1
  179. package/src/shared/utils/bounds/helpers/style-composers.ts +11 -0
  180. package/src/shared/utils/bounds/zoom/build.ts +85 -70
  181. package/lib/commonjs/shared/components/screen-container/deferred-visibility-host.js +0 -45
  182. package/lib/commonjs/shared/components/screen-container/deferred-visibility-host.js.map +0 -1
  183. package/lib/commonjs/shared/hooks/animation/use-associated-style.js +0 -234
  184. package/lib/commonjs/shared/hooks/animation/use-associated-style.js.map +0 -1
  185. package/lib/commonjs/shared/providers/screen/helpers/resolve-interpolated-style-output.js +0 -50
  186. package/lib/commonjs/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +0 -1
  187. package/lib/commonjs/shared/providers/screen/styles.provider.js.map +0 -1
  188. package/lib/module/shared/components/screen-container/deferred-visibility-host.js +0 -40
  189. package/lib/module/shared/components/screen-container/deferred-visibility-host.js.map +0 -1
  190. package/lib/module/shared/hooks/animation/use-associated-style.js +0 -229
  191. package/lib/module/shared/hooks/animation/use-associated-style.js.map +0 -1
  192. package/lib/module/shared/providers/screen/helpers/resolve-interpolated-style-output.js +0 -44
  193. package/lib/module/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +0 -1
  194. package/lib/module/shared/providers/screen/styles.provider.js.map +0 -1
  195. package/lib/typescript/shared/components/screen-container/deferred-visibility-host.d.ts +0 -14
  196. package/lib/typescript/shared/components/screen-container/deferred-visibility-host.d.ts.map +0 -1
  197. package/lib/typescript/shared/hooks/animation/use-associated-style.d.ts +0 -32
  198. package/lib/typescript/shared/hooks/animation/use-associated-style.d.ts.map +0 -1
  199. package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts +0 -14
  200. package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts.map +0 -1
  201. package/lib/typescript/shared/providers/screen/styles.provider.d.ts.map +0 -1
  202. package/src/shared/components/screen-container/deferred-visibility-host.tsx +0 -44
  203. package/src/shared/hooks/animation/use-associated-style.ts +0 -297
  204. package/src/shared/providers/screen/helpers/resolve-interpolated-style-output.ts +0 -61
  205. package/src/shared/providers/screen/styles.provider.tsx +0 -164
@@ -34,17 +34,19 @@ import type { BuildZoomStylesParams, ZoomInterpolatedStyle } from "./types";
34
34
 
35
35
  const IDENTITY_DRAG_SCALE_OUTPUT = [1, 1] as const;
36
36
 
37
- const getSourceBorderRadius = (
38
- resolvedPair: ResolvedTransitionPair,
39
- ): number => {
37
+ /* -------------------------------------------------------------------------- */
38
+ /* LOCAL HELPERS */
39
+ /* -------------------------------------------------------------------------- */
40
+
41
+ function getSourceBorderRadius(resolvedPair: ResolvedTransitionPair): number {
40
42
  "worklet";
41
43
 
42
44
  return typeof resolvedPair.sourceStyles?.borderRadius === "number"
43
45
  ? resolvedPair.sourceStyles.borderRadius
44
46
  : 0;
45
- };
47
+ }
46
48
 
47
- const getZoomContentTarget = ({
49
+ function getZoomContentTarget({
48
50
  explicitTarget,
49
51
  screenLayout,
50
52
  anchor,
@@ -54,7 +56,7 @@ const getZoomContentTarget = ({
54
56
  screenLayout: Layout;
55
57
  anchor: BoundsOptions["anchor"] | undefined;
56
58
  resolvedPair: ResolvedTransitionPair;
57
- }) => {
59
+ }) {
58
60
  "worklet";
59
61
 
60
62
  if (explicitTarget) return explicitTarget;
@@ -90,28 +92,34 @@ const getZoomContentTarget = ({
90
92
  width: screenWidth,
91
93
  height,
92
94
  };
93
- };
95
+ }
96
+
97
+ /* -------------------------------------------------------------------------- */
98
+ /* BUILD ZOOM STYLES */
99
+ /* -------------------------------------------------------------------------- */
94
100
 
95
- export const buildZoomStyles = ({
101
+ export function buildZoomStyles({
96
102
  resolvedTag,
97
103
  zoomOptions,
98
104
  props,
99
- }: BuildZoomStylesParams): ZoomInterpolatedStyle => {
105
+ }: BuildZoomStylesParams): ZoomInterpolatedStyle {
100
106
  "worklet";
101
107
 
102
108
  if (!resolvedTag) return {};
103
109
 
110
+ /* ------------------------------ Shared Setup ------------------------------ */
111
+
104
112
  const explicitTarget = zoomOptions?.target;
105
113
  const debug = zoomOptions?.DEBUG === true;
106
-
107
114
  const focused = props.focused;
108
115
  const progress = props.progress;
116
+ const screenLayout = props.layouts.screen;
117
+ const isEnteringTransition = !props.next;
109
118
  const currentRouteKey = props.current?.route.key;
110
119
  const previousRouteKey = props.previous?.route.key;
111
120
  const nextRouteKey = props.next?.route.key;
112
- const entering = !props.next;
113
- const screenLayout = props.layouts.screen;
114
121
  const resolvedZoomAnchor = getZoomAnchor(explicitTarget);
122
+
115
123
  const zoomComputeParams = {
116
124
  id: resolvedTag,
117
125
  previous: props.previous,
@@ -120,6 +128,7 @@ export const buildZoomStyles = ({
120
128
  progress,
121
129
  dimensions: screenLayout,
122
130
  } as const;
131
+
123
132
  const baseRawOptions = {
124
133
  id: resolvedTag,
125
134
  raw: true,
@@ -130,31 +139,40 @@ export const buildZoomStyles = ({
130
139
  currentScreenKey: currentRouteKey,
131
140
  previousScreenKey: previousRouteKey,
132
141
  nextScreenKey: nextRouteKey,
133
- entering,
142
+ entering: isEnteringTransition,
134
143
  });
135
144
 
136
145
  const sourceBorderRadius = getSourceBorderRadius(resolvedPair);
137
146
  const targetBorderRadius = zoomOptions?.borderRadius ?? sourceBorderRadius;
138
-
139
- const focusedVisibilityStyles = {
147
+ const sourceVisibilityStyle = {
140
148
  [resolvedTag]: VISIBLE_STYLE,
141
149
  } satisfies TransitionInterpolatedStyle;
142
- const focusedContainerStyleId = props.navigationMaskEnabled
150
+ const focusedContentSlot = props.navigationMaskEnabled
143
151
  ? NAVIGATION_MASK_CONTAINER_STYLE_ID
144
152
  : "content";
145
153
 
154
+ /* --------------------------- Missing Source Guard -------------------------- */
155
+
146
156
  // To avoid initial flickering, we'll want to hide if there are no source bounds
147
157
  // But to also avoid scenarios where activeId changes in dst and theres a failed measurement,
148
158
  // we should only hide if entering and there is no source bounds.
149
159
  if (!resolvedPair.sourceBounds && props.active.entering) {
150
160
  return {
151
- [focusedContainerStyleId]: HIDDEN_STYLE,
161
+ [focusedContentSlot]: HIDDEN_STYLE,
152
162
  };
153
163
  }
154
164
 
165
+ /* --------------------------- Gesture / Drag Values ------------------------- */
166
+
155
167
  const normX = props.active.gesture.normX;
156
168
  const normY = props.active.gesture.normY;
157
169
  const initialDirection = props.active.gesture.direction;
170
+ const isHorizontalDismiss =
171
+ initialDirection === "horizontal" ||
172
+ initialDirection === "horizontal-inverted";
173
+ const isVerticalDismiss =
174
+ initialDirection === "vertical" || initialDirection === "vertical-inverted";
175
+
158
176
  const dragX = normalizedToTranslation({
159
177
  normalized: normX,
160
178
  dimension: screenLayout.width,
@@ -165,35 +183,33 @@ export const buildZoomStyles = ({
165
183
  dimension: screenLayout.height,
166
184
  resistance: ZOOM_DRAG_RESISTANCE,
167
185
  });
168
- const dragXScale =
169
- initialDirection === "horizontal" ||
170
- initialDirection === "horizontal-inverted"
171
- ? resolveDirectionalDragScale({
172
- normalized: normX,
173
- dismissDirection:
174
- initialDirection === "horizontal-inverted"
175
- ? "negative"
176
- : "positive",
177
- shrinkMin: ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
178
- growMax: ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
179
- exponent: 2,
180
- })
181
- : IDENTITY_DRAG_SCALE_OUTPUT[0];
182
- const dragYScale =
183
- initialDirection === "vertical" || initialDirection === "vertical-inverted"
184
- ? resolveDirectionalDragScale({
185
- normalized: normY,
186
- dismissDirection:
187
- initialDirection === "vertical-inverted" ? "negative" : "positive",
188
- shrinkMin: ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
189
- growMax: ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
190
- exponent: 2,
191
- })
192
- : IDENTITY_DRAG_SCALE_OUTPUT[1];
186
+
187
+ const dragXScale = isHorizontalDismiss
188
+ ? resolveDirectionalDragScale({
189
+ normalized: normX,
190
+ dismissDirection:
191
+ initialDirection === "horizontal-inverted" ? "negative" : "positive",
192
+ shrinkMin: ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
193
+ growMax: ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
194
+ exponent: 2,
195
+ })
196
+ : IDENTITY_DRAG_SCALE_OUTPUT[0];
197
+ const dragYScale = isVerticalDismiss
198
+ ? resolveDirectionalDragScale({
199
+ normalized: normY,
200
+ dismissDirection:
201
+ initialDirection === "vertical-inverted" ? "negative" : "positive",
202
+ shrinkMin: ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
203
+ growMax: ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
204
+ exponent: 2,
205
+ })
206
+ : IDENTITY_DRAG_SCALE_OUTPUT[1];
193
207
  const dragScale = combineScales(dragXScale, dragYScale);
194
208
 
209
+ /* ----------------------------- Focused Screen ----------------------------- */
210
+
195
211
  if (focused) {
196
- const contentTarget = getZoomContentTarget({
212
+ const focusedContentTarget = getZoomContentTarget({
197
213
  explicitTarget,
198
214
  screenLayout,
199
215
  anchor: ZOOM_SHARED_OPTIONS.anchor,
@@ -206,7 +222,7 @@ export const buildZoomStyles = ({
206
222
  ...baseRawOptions,
207
223
  anchor: resolvedZoomAnchor,
208
224
  method: "content",
209
- target: contentTarget,
225
+ target: focusedContentTarget,
210
226
  },
211
227
  resolvedPair,
212
228
  ) as Record<string, unknown>;
@@ -247,6 +263,7 @@ export const buildZoomStyles = ({
247
263
  const contentScale = toNumber(contentRaw.scale, 1) * dragScale;
248
264
  const maskTranslateX = toNumber(maskRaw.translateX) + dragX - left;
249
265
  const maskTranslateY = toNumber(maskRaw.translateY) + dragY - top;
266
+
250
267
  const focusedContentStyle = {
251
268
  opacity: focusedFade,
252
269
  transform: [
@@ -259,10 +276,10 @@ export const buildZoomStyles = ({
259
276
  };
260
277
 
261
278
  const focusedStyles: ZoomInterpolatedStyle = {
262
- [focusedContainerStyleId]: {
279
+ [focusedContentSlot]: {
263
280
  style: focusedContentStyle,
264
281
  },
265
- ...focusedVisibilityStyles,
282
+ ...sourceVisibilityStyle,
266
283
  };
267
284
 
268
285
  if (props.navigationMaskEnabled) {
@@ -283,14 +300,18 @@ export const buildZoomStyles = ({
283
300
  return focusedStyles;
284
301
  }
285
302
 
303
+ /* ---------------------------- Unfocused Screen ---------------------------- */
304
+
286
305
  const unfocusedFade = props.active?.closing
287
306
  ? interpolate(progress, [1.6, 2], [1, debug ? 1 : 0], "clamp")
288
307
  : interpolate(progress, [1, 1.5], [1, debug ? 1 : 0], "clamp");
289
-
290
308
  const unfocusedScale = interpolate(progress, [1, 2], [1, 0.95], "clamp");
291
309
  const isUnfocusedIdle = props.active.settled === 1;
292
310
  const shouldHideUnfocusedIdle = isUnfocusedIdle && !debug;
293
- const elementTarget =
311
+ const shouldFreezeUnfocusedElement =
312
+ props.active.logicallySettled && !props.active.closing;
313
+
314
+ const unfocusedElementTarget =
294
315
  explicitTarget !== undefined || resolvedPair.destinationBounds
295
316
  ? getZoomContentTarget({
296
317
  explicitTarget,
@@ -307,10 +328,11 @@ export const buildZoomStyles = ({
307
328
  anchor: resolvedZoomAnchor,
308
329
  method: "transform",
309
330
  space: "relative",
310
- target: elementTarget,
331
+ target: unfocusedElementTarget,
311
332
  },
312
333
  resolvedPair,
313
334
  ) as Record<string, unknown>;
335
+
314
336
  const boundTargetCenterX =
315
337
  explicitTarget === "bound" && resolvedPair.destinationBounds
316
338
  ? resolvedPair.destinationBounds.pageX +
@@ -321,16 +343,18 @@ export const buildZoomStyles = ({
321
343
  ? resolvedPair.destinationBounds.pageY +
322
344
  resolvedPair.destinationBounds.height / 2
323
345
  : undefined;
346
+
324
347
  const elementCenterX =
325
348
  boundTargetCenterX ??
326
- (typeof elementTarget === "object"
327
- ? elementTarget.pageX + elementTarget.width / 2
349
+ (typeof unfocusedElementTarget === "object"
350
+ ? unfocusedElementTarget.pageX + unfocusedElementTarget.width / 2
328
351
  : screenLayout.width / 2);
329
352
  const elementCenterY =
330
353
  boundTargetCenterY ??
331
- (typeof elementTarget === "object"
332
- ? elementTarget.pageY + elementTarget.height / 2
354
+ (typeof unfocusedElementTarget === "object"
355
+ ? unfocusedElementTarget.pageY + unfocusedElementTarget.height / 2
333
356
  : screenLayout.height / 2);
357
+
334
358
  const scaleShiftX = computeCenterScaleShift({
335
359
  center: elementCenterX,
336
360
  containerCenter: screenLayout.width / 2,
@@ -341,6 +365,7 @@ export const buildZoomStyles = ({
341
365
  containerCenter: screenLayout.height / 2,
342
366
  scale: dragScale,
343
367
  });
368
+
344
369
  const compensatedGestureX = composeCompensatedTranslation({
345
370
  gesture: dragX,
346
371
  parentScale: unfocusedScale,
@@ -353,12 +378,14 @@ export const buildZoomStyles = ({
353
378
  centerShift: scaleShiftY,
354
379
  epsilon: EPSILON,
355
380
  });
381
+
356
382
  const elementTranslateX =
357
383
  toNumber(elementRaw.translateX) + compensatedGestureX;
358
384
  const elementTranslateY =
359
385
  toNumber(elementRaw.translateY) + compensatedGestureY;
360
386
  const elementScaleX = toNumber(elementRaw.scaleX, 1) * dragScale;
361
387
  const elementScaleY = toNumber(elementRaw.scaleY, 1) * dragScale;
388
+
362
389
  const resolvedElementStyle = shouldHideUnfocusedIdle
363
390
  ? {
364
391
  transform: [
@@ -374,28 +401,16 @@ export const buildZoomStyles = ({
374
401
  : {
375
402
  transform: [
376
403
  {
377
- translateX:
378
- props.active.logicallySettled && !props.active.closing
379
- ? 0
380
- : elementTranslateX,
404
+ translateX: shouldFreezeUnfocusedElement ? 0 : elementTranslateX,
381
405
  },
382
406
  {
383
- translateY:
384
- props.active.logicallySettled && !props.active.closing
385
- ? 0
386
- : elementTranslateY,
407
+ translateY: shouldFreezeUnfocusedElement ? 0 : elementTranslateY,
387
408
  },
388
409
  {
389
- scaleX:
390
- props.active.logicallySettled && !props.active.closing
391
- ? 1
392
- : elementScaleX,
410
+ scaleX: shouldFreezeUnfocusedElement ? 1 : elementScaleX,
393
411
  },
394
412
  {
395
- scaleY:
396
- props.active.logicallySettled && !props.active.closing
397
- ? 1
398
- : elementScaleY,
413
+ scaleY: shouldFreezeUnfocusedElement ? 1 : elementScaleY,
399
414
  },
400
415
  ],
401
416
  opacity: debug ? 0.5 : unfocusedFade,
@@ -413,4 +428,4 @@ export const buildZoomStyles = ({
413
428
  style: resolvedElementStyle,
414
429
  },
415
430
  };
416
- };
431
+ }
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.DeferredVisibilityHost = void 0;
7
- var _react = require("react");
8
- var _reactNative = require("react-native");
9
- var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
10
- var _constants = require("../../constants");
11
- var _styles = require("../../providers/screen/styles.provider");
12
- var _jsxRuntime = require("react/jsx-runtime");
13
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
- /**
15
- * Hides the full screen visual subtree while an interpolator explicitly reports
16
- * that it is not safe to reveal yet.
17
- *
18
- * This sits above backdrop/content/mask/surface so a deferred transition does
19
- * not leak raw first-paint UI from nested layers.
20
- */
21
- const DeferredVisibilityHost = exports.DeferredVisibilityHost = /*#__PURE__*/(0, _react.memo)(({
22
- children,
23
- pointerEvents
24
- }) => {
25
- const {
26
- resolutionMode
27
- } = (0, _styles.useScreenStyles)();
28
- const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
29
- "worklet";
30
-
31
- return resolutionMode.value === "deferred" ? _constants.HIDDEN_STYLE : _constants.VISIBLE_STYLE;
32
- });
33
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
34
- collapsable: false,
35
- style: [styles.host, animatedStyle],
36
- pointerEvents: pointerEvents,
37
- children: children
38
- });
39
- });
40
- const styles = _reactNative.StyleSheet.create({
41
- host: {
42
- flex: 1
43
- }
44
- });
45
- //# sourceMappingURL=deferred-visibility-host.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","require","_reactNative","_reactNativeReanimated","_interopRequireWildcard","_constants","_styles","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DeferredVisibilityHost","exports","memo","children","pointerEvents","resolutionMode","useScreenStyles","animatedStyle","useAnimatedStyle","value","HIDDEN_STYLE","VISIBLE_STYLE","jsx","View","collapsable","style","styles","host","StyleSheet","create","flex"],"sourceRoot":"../../../../../src","sources":["shared/components/screen-container/deferred-visibility-host.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAAyE,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAG,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAOzE;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMkB,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,gBAAG,IAAAE,WAAI,EACzC,CAAC;EAAEC,QAAQ;EAAEC;AAAqB,CAAC,KAAK;EACvC,MAAM;IAAEC;EAAe,CAAC,GAAG,IAAAC,uBAAe,EAAC,CAAC;EAE5C,MAAMC,aAAa,GAAG,IAAAC,uCAAgB,EAAC,MAAM;IAC5C,SAAS;;IACT,OAAOH,cAAc,CAACI,KAAK,KAAK,UAAU,GAAGC,uBAAY,GAAGC,wBAAa;EAC1E,CAAC,CAAC;EAEF,oBACC,IAAA/B,WAAA,CAAAgC,GAAA,EAACpC,sBAAA,CAAAe,OAAQ,CAACsB,IAAI;IACbC,WAAW,EAAE,KAAM;IACnBC,KAAK,EAAE,CAACC,MAAM,CAACC,IAAI,EAAEV,aAAa,CAAE;IACpCH,aAAa,EAAEA,aAAc;IAAAD,QAAA,EAE5BA;EAAQ,CACK,CAAC;AAElB,CACD,CAAC;AAED,MAAMa,MAAM,GAAGE,uBAAU,CAACC,MAAM,CAAC;EAChCF,IAAI,EAAE;IACLG,IAAI,EAAE;EACP;AACD,CAAC,CAAC","ignoreList":[]}
@@ -1,234 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useAssociatedStyles = void 0;
7
- var _reactNativeReanimated = require("react-native-reanimated");
8
- var _constants = require("../../constants");
9
- var _descriptors = require("../../providers/screen/descriptors");
10
- var _styles = require("../../providers/screen/styles.provider");
11
- var _animation = require("../../stores/animation.store");
12
- var _bounds = require("../../stores/bounds");
13
- const TRANSIENT_EMPTY_GRACE_FRAMES = 2;
14
- const IDENTITY_TRANSFORM = [{
15
- translateX: 0
16
- }, {
17
- translateY: 0
18
- }, {
19
- scaleX: 1
20
- }, {
21
- scaleY: 1
22
- }];
23
- const ALWAYS_RESET_STYLE_VALUES = {
24
- zIndex: 0,
25
- elevation: 0
26
- };
27
- const hasAnyKeys = record => {
28
- "worklet";
29
-
30
- for (const _key in record) {
31
- return true;
32
- }
33
- return false;
34
- };
35
- const collectKeyMeta = record => {
36
- "worklet";
37
-
38
- const keys = {};
39
- let hasAny = false;
40
- for (const key in record) {
41
- keys[key] = true;
42
- hasAny = true;
43
- }
44
- return {
45
- keys,
46
- hasAny
47
- };
48
- };
49
- const getGroupTagParts = tag => {
50
- "worklet";
51
-
52
- const separatorIndex = tag.indexOf(":");
53
- if (separatorIndex <= 0 || separatorIndex >= tag.length - 1) {
54
- return null;
55
- }
56
- return {
57
- group: tag.slice(0, separatorIndex),
58
- memberId: tag.slice(separatorIndex + 1)
59
- };
60
- };
61
- const allowPreviousTransitionEvidence = tag => {
62
- "worklet";
63
-
64
- const groupTagParts = getGroupTagParts(tag);
65
- if (!groupTagParts) {
66
- return true;
67
- }
68
-
69
- // For grouped boundaries, only the active member can inherit
70
- // transition evidence from the previous screen.
71
- const activeGroupMemberId = _bounds.BoundStore.getGroupActiveId(groupTagParts.group);
72
- return activeGroupMemberId !== null && activeGroupMemberId === groupTagParts.memberId;
73
- };
74
- const buildUnsetPatch = ({
75
- previousKeys,
76
- currentKeys,
77
- shouldDeferUnset,
78
- resetTransformOnUnset
79
- }) => {
80
- "worklet";
81
-
82
- const unsetPatch = {};
83
- for (const key in previousKeys) {
84
- if (currentKeys[key]) continue;
85
- const shouldAlwaysUnset = key in ALWAYS_RESET_STYLE_VALUES;
86
- if (shouldDeferUnset && !shouldAlwaysUnset) continue;
87
- if (key === "transform" && resetTransformOnUnset) {
88
- unsetPatch.transform = IDENTITY_TRANSFORM;
89
- } else if (key in ALWAYS_RESET_STYLE_VALUES) {
90
- unsetPatch[key] = ALWAYS_RESET_STYLE_VALUES[key];
91
- } else {
92
- unsetPatch[key] = undefined;
93
- }
94
- }
95
- return unsetPatch;
96
- };
97
-
98
- /**
99
- * Resolves the animated style associated with an `id` (styleId/bound tag), while
100
- * guarding against transient glitches during shared-boundary transitions.
101
- *
102
- * Why this exists:
103
- * - During push/pop, links and style maps can be briefly out of sync.
104
- * - Without guards, boundaries can briefly drop back to raw local layout.
105
- * - Cleanup must be deterministic so stale transform keys do not linger.
106
- *
107
- * Local style model (worklet state machine):
108
- *
109
- * transient empty style map -> hold-last-style
110
- * otherwise -> live
111
- *
112
- * - `hold-last-style`: reuse last resolved style through short empty-map gaps.
113
- * - `live`: apply current resolved style directly.
114
- *
115
- * For grouped tags (`group:id`), previous-screen transition evidence is only
116
- * considered for the group's active member to avoid hiding non-active siblings.
117
- */
118
- const useAssociatedStyles = ({
119
- id,
120
- resetTransformOnUnset = false
121
- } = {}) => {
122
- const {
123
- stylesMap,
124
- ancestorStylesMaps
125
- } = (0, _styles.useScreenStyles)();
126
- const {
127
- previousScreenKey,
128
- currentScreenKey,
129
- hasConfiguredInterpolator
130
- } = (0, _descriptors.useDescriptorDerivations)();
131
- const isAnimating = _animation.AnimationStore.getValue(currentScreenKey, "animating");
132
- const isClosing = _animation.AnimationStore.getValue(currentScreenKey, "closing");
133
- const previousAppliedKeys = (0, _reactNativeReanimated.useSharedValue)({});
134
- const emptyGraceFrameCount = (0, _reactNativeReanimated.useSharedValue)(0);
135
- const lastResolvedBase = (0, _reactNativeReanimated.useSharedValue)(null);
136
- const associatedStyles = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
137
- "worklet";
138
-
139
- if (!id) {
140
- return _constants.NO_STYLES;
141
- }
142
-
143
- // Check local slot first, then fall back to parent
144
- const ownSlot = stylesMap.value[id];
145
- const ancestorSlot = ancestorStylesMaps.find(ancestorMap => ancestorMap.value[id])?.value[id];
146
- const slot = ownSlot || ancestorSlot;
147
- const base = slot?.style || _constants.NO_STYLES;
148
- const {
149
- keys: currentKeys,
150
- hasAny: hasCurrentKeys
151
- } = collectKeyMeta(base);
152
- const hasPreviousKeys = hasAnyKeys(previousAppliedKeys.value);
153
- const isTransitioning = isAnimating.get() !== 0 || isClosing.get() !== 0;
154
- const canUsePreviousTransitionEvidence = resetTransformOnUnset && allowPreviousTransitionEvidence(id);
155
- const hasActiveLink = resetTransformOnUnset && canUsePreviousTransitionEvidence && (_bounds.BoundStore.hasPendingLink(id) || _bounds.BoundStore.hasSourceLink(id, currentScreenKey) || _bounds.BoundStore.hasDestinationLink(id, currentScreenKey));
156
- const hasPreviousTransitionEvidence = canUsePreviousTransitionEvidence && !!previousScreenKey && (!!_bounds.BoundStore.getSnapshot(id, previousScreenKey) || _bounds.BoundStore.hasBoundaryPresence(id, previousScreenKey));
157
- const shouldProtectInFlightStyles = resetTransformOnUnset && (hasActiveLink || hasPreviousTransitionEvidence);
158
- if (hasCurrentKeys) {
159
- lastResolvedBase.value = base;
160
- }
161
- const hasPersistedResolvedStyle = !!lastResolvedBase.value;
162
- const isTransientEmptyGap = hasConfiguredInterpolator && shouldProtectInFlightStyles && !isTransitioning && !hasCurrentKeys && (hasPreviousKeys || hasPersistedResolvedStyle);
163
-
164
- // Keep styles stable for a couple of frames to absorb
165
- // transient empty-map gaps on slower devices.
166
- if (isTransientEmptyGap) {
167
- emptyGraceFrameCount.value = emptyGraceFrameCount.value + 1;
168
- } else {
169
- emptyGraceFrameCount.value = 0;
170
- }
171
- const isWithinGapGrace = isTransientEmptyGap && emptyGraceFrameCount.value <= TRANSIENT_EMPTY_GRACE_FRAMES;
172
- const shouldDelayUnset = resetTransformOnUnset && shouldProtectInFlightStyles && (isTransitioning || isWithinGapGrace);
173
-
174
- /**
175
- * Associated-style state machine:
176
- * - hold-last-style: transient empty frame; reuse last resolved style.
177
- * - live: apply current resolved style normally.
178
- */
179
- let mode = "live";
180
- if (shouldDelayUnset && !hasCurrentKeys && hasPersistedResolvedStyle) {
181
- mode = "hold-last-style";
182
- }
183
- const resolvedBase = mode === "hold-last-style" ? lastResolvedBase.value : base;
184
- const unsetPatch = buildUnsetPatch({
185
- previousKeys: previousAppliedKeys.value,
186
- currentKeys,
187
- shouldDeferUnset: shouldDelayUnset,
188
- resetTransformOnUnset
189
- });
190
- if (shouldDelayUnset) {
191
- previousAppliedKeys.value = {
192
- ...previousAppliedKeys.value,
193
- ...currentKeys
194
- };
195
- } else {
196
- previousAppliedKeys.value = currentKeys;
197
-
198
- // Drop cached style when fully idle so future transitions
199
- // start from a clean state.
200
- if (!hasCurrentKeys && !shouldProtectInFlightStyles && !isTransitioning) {
201
- lastResolvedBase.value = null;
202
- }
203
- }
204
- const mergedBase = {
205
- ...unsetPatch,
206
- ...resolvedBase
207
- };
208
- let opacity = 1;
209
- if ("opacity" in mergedBase) {
210
- opacity = mergedBase.opacity;
211
- }
212
- if ("opacity" in mergedBase) {
213
- return mergedBase;
214
- }
215
- return {
216
- ...mergedBase,
217
- opacity
218
- };
219
- });
220
- const associatedProps = (0, _reactNativeReanimated.useAnimatedProps)(() => {
221
- "worklet";
222
-
223
- if (!id) return _constants.NO_PROPS;
224
- const ownSlot = stylesMap.value[id];
225
- const ancestorSlot = ancestorStylesMaps.find(ancestorMap => ancestorMap.value[id])?.value[id];
226
- return (ownSlot || ancestorSlot)?.props ?? _constants.NO_PROPS;
227
- });
228
- return {
229
- associatedStyles,
230
- associatedProps
231
- };
232
- };
233
- exports.useAssociatedStyles = useAssociatedStyles;
234
- //# sourceMappingURL=use-associated-style.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNativeReanimated","require","_constants","_descriptors","_styles","_animation","_bounds","TRANSIENT_EMPTY_GRACE_FRAMES","IDENTITY_TRANSFORM","translateX","translateY","scaleX","scaleY","ALWAYS_RESET_STYLE_VALUES","zIndex","elevation","hasAnyKeys","record","_key","collectKeyMeta","keys","hasAny","key","getGroupTagParts","tag","separatorIndex","indexOf","length","group","slice","memberId","allowPreviousTransitionEvidence","groupTagParts","activeGroupMemberId","BoundStore","getGroupActiveId","buildUnsetPatch","previousKeys","currentKeys","shouldDeferUnset","resetTransformOnUnset","unsetPatch","shouldAlwaysUnset","transform","undefined","useAssociatedStyles","id","stylesMap","ancestorStylesMaps","useScreenStyles","previousScreenKey","currentScreenKey","hasConfiguredInterpolator","useDescriptorDerivations","isAnimating","AnimationStore","getValue","isClosing","previousAppliedKeys","useSharedValue","emptyGraceFrameCount","lastResolvedBase","associatedStyles","useAnimatedStyle","NO_STYLES","ownSlot","value","ancestorSlot","find","ancestorMap","slot","base","style","hasCurrentKeys","hasPreviousKeys","isTransitioning","get","canUsePreviousTransitionEvidence","hasActiveLink","hasPendingLink","hasSourceLink","hasDestinationLink","hasPreviousTransitionEvidence","getSnapshot","hasBoundaryPresence","shouldProtectInFlightStyles","hasPersistedResolvedStyle","isTransientEmptyGap","isWithinGapGrace","shouldDelayUnset","mode","resolvedBase","mergedBase","opacity","associatedProps","useAnimatedProps","NO_PROPS","props","exports"],"sourceRoot":"../../../../../src","sources":["shared/hooks/animation/use-associated-style.ts"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAMA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAQA,MAAMM,4BAA4B,GAAG,CAAC;AACtC,MAAMC,kBAAkB,GAAG,CAC1B;EAAEC,UAAU,EAAE;AAAE,CAAC,EACjB;EAAEC,UAAU,EAAE;AAAE,CAAC,EACjB;EAAEC,MAAM,EAAE;AAAE,CAAC,EACb;EAAEC,MAAM,EA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