react-native-screen-transitions 3.7.0-alpha.0 → 3.7.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.
- package/lib/commonjs/shared/adapters/with-screen-transitions/index.js +0 -6
- package/lib/commonjs/shared/adapters/with-screen-transitions/index.js.map +1 -1
- package/lib/commonjs/shared/adapters/with-screen-transitions/options.js +22 -68
- package/lib/commonjs/shared/adapters/with-screen-transitions/options.js.map +1 -1
- package/lib/commonjs/shared/adapters/with-screen-transitions/stack-layout.js +1 -1
- package/lib/commonjs/shared/adapters/with-screen-transitions/stack-layout.js.map +1 -1
- package/lib/commonjs/shared/index.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js +7 -28
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js +2 -14
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.js +5 -7
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.js +1 -5
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.js +12 -1
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.js +2 -7
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.js +4 -4
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js +4 -4
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/config.js +2 -1
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/config.js.map +1 -1
- package/lib/module/shared/adapters/with-screen-transitions/index.js +0 -1
- package/lib/module/shared/adapters/with-screen-transitions/index.js.map +1 -1
- package/lib/module/shared/adapters/with-screen-transitions/options.js +21 -67
- package/lib/module/shared/adapters/with-screen-transitions/options.js.map +1 -1
- package/lib/module/shared/adapters/with-screen-transitions/stack-layout.js +2 -2
- package/lib/module/shared/adapters/with-screen-transitions/stack-layout.js.map +1 -1
- package/lib/module/shared/index.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js +7 -28
- package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js +3 -15
- package/lib/module/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js.map +1 -1
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.js +6 -8
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.js.map +1 -1
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.js +2 -6
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.js.map +1 -1
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.js +9 -0
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.js.map +1 -1
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.js +2 -7
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.js.map +1 -1
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.js +4 -4
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/reveal/build.js +5 -5
- package/lib/module/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/reveal/config.js +1 -0
- package/lib/module/shared/utils/bounds/navigation/reveal/config.js.map +1 -1
- package/lib/typescript/shared/adapters/with-screen-transitions/index.d.ts +1 -2
- package/lib/typescript/shared/adapters/with-screen-transitions/index.d.ts.map +1 -1
- package/lib/typescript/shared/adapters/with-screen-transitions/options.d.ts +3 -10
- package/lib/typescript/shared/adapters/with-screen-transitions/options.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +1 -1
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/index.d.ts +1 -2
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.d.ts +2 -0
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.d.ts.map +1 -1
- package/lib/typescript/shared/types/bounds.types.d.ts +19 -0
- package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/reveal/build.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/reveal/config.d.ts +1 -0
- package/lib/typescript/shared/utils/bounds/navigation/reveal/config.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/shared/adapters/with-screen-transitions/index.tsx +1 -6
- package/src/shared/adapters/with-screen-transitions/options.ts +38 -109
- package/src/shared/adapters/with-screen-transitions/stack-layout.tsx +5 -5
- package/src/shared/index.ts +1 -5
- package/src/shared/providers/screen/styles/helpers/resolve-slot-styles/index.ts +12 -53
- package/src/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.tsx +3 -16
- package/src/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.ts +9 -12
- package/src/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.ts +2 -10
- package/src/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.ts +19 -0
- package/src/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.ts +2 -12
- package/src/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.ts +4 -4
- package/src/shared/types/bounds.types.ts +19 -0
- package/src/shared/utils/bounds/navigation/reveal/build.ts +10 -6
- package/src/shared/utils/bounds/navigation/reveal/config.ts +1 -0
package/src/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
areDescriptorsEqual,
|
|
14
14
|
areRouteChildStateMapsEqual,
|
|
15
15
|
getRouteChildState,
|
|
16
|
+
routeKeyListsAreEqual,
|
|
16
17
|
setsAreEqual,
|
|
17
18
|
} from "./helpers";
|
|
18
19
|
import type {
|
|
@@ -34,13 +35,6 @@ type BuildManagedStackStateParams<
|
|
|
34
35
|
previousState?: LocalRoutesState<TDescriptor>;
|
|
35
36
|
};
|
|
36
37
|
|
|
37
|
-
const areRouteKeysEqual = (a: string[], b: string[]): boolean => {
|
|
38
|
-
if (a === b) return true;
|
|
39
|
-
if (a.length !== b.length) return false;
|
|
40
|
-
|
|
41
|
-
return a.every((key, index) => key === b[index]);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
38
|
const resolveStableDescriptorSource = <
|
|
45
39
|
TDescriptor extends BaseStackDescriptor,
|
|
46
40
|
>({
|
|
@@ -106,10 +100,13 @@ const getSceneActivityWindow = <
|
|
|
106
100
|
>): SceneActivityWindow => {
|
|
107
101
|
const focusedRouteKey = props.state.routes[props.state.index]?.key;
|
|
108
102
|
|
|
109
|
-
let focusedIndex =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
103
|
+
let focusedIndex = routes.findIndex((route) => route.key === focusedRouteKey);
|
|
104
|
+
|
|
105
|
+
if (focusedIndex === -1) {
|
|
106
|
+
throw new Error(
|
|
107
|
+
`Focused route "${focusedRouteKey}" is missing from routes`,
|
|
108
|
+
);
|
|
109
|
+
}
|
|
113
110
|
|
|
114
111
|
while (focusedIndex > 0 && closingRouteKeys.has(routes[focusedIndex]?.key)) {
|
|
115
112
|
focusedIndex--;
|
|
@@ -355,7 +352,7 @@ export const buildManagedStackState = <
|
|
|
355
352
|
scenes,
|
|
356
353
|
routeKeys:
|
|
357
354
|
params.previousState &&
|
|
358
|
-
|
|
355
|
+
routeKeyListsAreEqual(params.previousState.routeKeys, routeKeys)
|
|
359
356
|
? params.previousState.routeKeys
|
|
360
357
|
: routeKeys,
|
|
361
358
|
shouldShowFloatOverlay,
|
package/src/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
areDescriptorsEqual,
|
|
11
11
|
areRouteChildStateMapsEqual,
|
|
12
12
|
getRouteChildStateMap,
|
|
13
|
+
routesHaveSameKeys,
|
|
13
14
|
setsAreEqual,
|
|
14
15
|
} from "./helpers";
|
|
15
16
|
import { reconcileManagedRoutes } from "./reconcile-managed-routes";
|
|
@@ -35,15 +36,6 @@ const routesAreIdentical = <Route extends RouteWithKey>(
|
|
|
35
36
|
return a.every((route, index) => route === b[index]);
|
|
36
37
|
};
|
|
37
38
|
|
|
38
|
-
const routeKeysAreEqual = <Route extends RouteWithKey>(
|
|
39
|
-
a: Route[],
|
|
40
|
-
b: Route[],
|
|
41
|
-
): boolean => {
|
|
42
|
-
if (a.length !== b.length) return false;
|
|
43
|
-
|
|
44
|
-
return a.every((route, index) => route.key === b[index]?.key);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
39
|
export const deriveManagedStackState = <
|
|
48
40
|
TDescriptor extends BaseStackDescriptor,
|
|
49
41
|
TNavigation extends BaseStackNavigation,
|
|
@@ -85,7 +77,7 @@ export const deriveManagedStackState = <
|
|
|
85
77
|
focusedRouteUnchanged &&
|
|
86
78
|
closingRouteKeysUnchanged &&
|
|
87
79
|
routeChildStatesUnchanged &&
|
|
88
|
-
|
|
80
|
+
routesHaveSameKeys(current.routes, nextRoutesSnapshot) &&
|
|
89
81
|
areDescriptorSourceMapsEquivalent(
|
|
90
82
|
current.sourceDescriptors,
|
|
91
83
|
nextDescriptors,
|
|
@@ -38,6 +38,25 @@ export const setsAreEqual = <T>(
|
|
|
38
38
|
return true;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
+
export const routeKeyListsAreEqual = (
|
|
42
|
+
a: readonly string[],
|
|
43
|
+
b: readonly string[],
|
|
44
|
+
): boolean => {
|
|
45
|
+
if (a === b) return true;
|
|
46
|
+
if (a.length !== b.length) return false;
|
|
47
|
+
|
|
48
|
+
return a.every((key, index) => key === b[index]);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const routesHaveSameKeys = <Route extends RouteWithKey>(
|
|
52
|
+
a: readonly Route[],
|
|
53
|
+
b: readonly Route[],
|
|
54
|
+
): boolean => {
|
|
55
|
+
if (a.length !== b.length) return false;
|
|
56
|
+
|
|
57
|
+
return a.every((route, index) => route.key === b[index]?.key);
|
|
58
|
+
};
|
|
59
|
+
|
|
41
60
|
export const getRouteChildState = (route: RouteWithKey): unknown => {
|
|
42
61
|
if (!route || typeof route !== "object") {
|
|
43
62
|
return undefined;
|
package/src/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
} from "../../../../../types/stack.types";
|
|
5
5
|
import { composeDescriptors } from "../../../../../utils/navigation/compose-descriptors";
|
|
6
6
|
import { syncRoutesWithRemoved } from "../../../../../utils/navigation/sync-routes-with-removed";
|
|
7
|
+
import { routesHaveSameKeys } from "./helpers";
|
|
7
8
|
import type {
|
|
8
9
|
LocalRoutesState,
|
|
9
10
|
ManagedDescriptorSources,
|
|
@@ -19,17 +20,6 @@ type ReconcileManagedRoutesParams<TDescriptor extends BaseStackDescriptor> = {
|
|
|
19
20
|
closingRouteKeys: Set<string>;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
|
-
const haveSameRouteKeys = <Route extends RouteWithKey>(
|
|
23
|
-
previous: Route[],
|
|
24
|
-
next: Route[],
|
|
25
|
-
): boolean => {
|
|
26
|
-
if (previous.length !== next.length) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return previous.every((route, index) => route?.key === next[index]?.key);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
23
|
const alignRoutesWithLatest = <
|
|
34
24
|
Route extends RouteWithKey,
|
|
35
25
|
DescriptorMap extends Record<string, unknown>,
|
|
@@ -155,7 +145,7 @@ export const reconcileManagedRoutes = <TDescriptor extends BaseStackDescriptor>(
|
|
|
155
145
|
closingRouteKeys,
|
|
156
146
|
} = params;
|
|
157
147
|
|
|
158
|
-
const routeKeysUnchanged =
|
|
148
|
+
const routeKeysUnchanged = routesHaveSameKeys(
|
|
159
149
|
previousRoutesSnapshot,
|
|
160
150
|
nextRoutesSnapshot,
|
|
161
151
|
);
|
|
@@ -30,7 +30,7 @@ export const createManagedStackController = <
|
|
|
30
30
|
): ManagedStackControllerType<TDescriptor, TNavigation> => {
|
|
31
31
|
const closingRouteKeys = new Set<string>();
|
|
32
32
|
let props = initialProps;
|
|
33
|
-
let
|
|
33
|
+
let previousRoutesSnapshot = initialProps.state.routes;
|
|
34
34
|
let snapshot: ManagedStackControllerSnapshot<TDescriptor> = {
|
|
35
35
|
state: buildManagedStackState({
|
|
36
36
|
props,
|
|
@@ -60,16 +60,16 @@ export const createManagedStackController = <
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
const update = (nextProps: ManagedStackProps<TDescriptor, TNavigation>) => {
|
|
63
|
-
const
|
|
63
|
+
const lastRoutesSnapshot = previousRoutesSnapshot;
|
|
64
64
|
props = nextProps;
|
|
65
65
|
|
|
66
66
|
const nextState = deriveManagedStackState({
|
|
67
67
|
props,
|
|
68
68
|
current: snapshot.state,
|
|
69
|
-
previousRoutesSnapshot,
|
|
69
|
+
previousRoutesSnapshot: lastRoutesSnapshot,
|
|
70
70
|
closingRouteKeys,
|
|
71
71
|
});
|
|
72
|
-
|
|
72
|
+
previousRoutesSnapshot = nextProps.state.routes;
|
|
73
73
|
|
|
74
74
|
if (nextState === snapshot.state) {
|
|
75
75
|
return;
|
|
@@ -231,6 +231,25 @@ export type BoundsNavigationRevealOptions = {
|
|
|
231
231
|
* @default "freeform"
|
|
232
232
|
*/
|
|
233
233
|
gestureProgressMode?: GestureProgressMode;
|
|
234
|
+
/**
|
|
235
|
+
* Scale applied to the unfocused background content while the reveal runs
|
|
236
|
+
* above it.
|
|
237
|
+
*
|
|
238
|
+
* @default 0.9375
|
|
239
|
+
*/
|
|
240
|
+
backgroundScale?: number;
|
|
241
|
+
/**
|
|
242
|
+
* Whether reveal should reset the unfocused background content scale once the
|
|
243
|
+
* transition is logically settled.
|
|
244
|
+
*
|
|
245
|
+
* By default, reveal restores the background to scale `1` after settle so the
|
|
246
|
+
* next drag or programmatic dismiss starts from a fresh, unmodified layout
|
|
247
|
+
* measurement. Keeping the background transformed while idle can make the next
|
|
248
|
+
* measurement read the scaled screen instead of the real screen geometry.
|
|
249
|
+
*
|
|
250
|
+
* @default true
|
|
251
|
+
*/
|
|
252
|
+
shouldBackgroundScaleResetOnSettled?: boolean;
|
|
234
253
|
/**
|
|
235
254
|
* Temporarily blocks pointer-event pass-through on the inactive content until
|
|
236
255
|
* the source element transition handoff reaches progress `0.25`.
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
DRAG_MASK_HEIGHT_COLLAPSE_END,
|
|
14
14
|
HORIZONTAL_DRAG_MASK_COLLAPSE_SCALE,
|
|
15
15
|
IDENTITY_DRAG_SCALE_OUTPUT,
|
|
16
|
+
REVEAL_BACKGROUND_SCALE,
|
|
16
17
|
REVEAL_BORDER_RADIUS,
|
|
17
18
|
REVEAL_SHADOW_OFFSET,
|
|
18
19
|
REVEAL_USES_TRANSFORM_MASK,
|
|
@@ -65,6 +66,10 @@ export function buildRevealStyles({
|
|
|
65
66
|
const disablePointerEventsTillElementTransition =
|
|
66
67
|
revealOptions?.disablePointerEventsTillElementTransition ?? true;
|
|
67
68
|
const maskSizingMode = revealOptions?.maskSizingMode ?? "auto";
|
|
69
|
+
const backgroundScale =
|
|
70
|
+
revealOptions?.backgroundScale ?? REVEAL_BACKGROUND_SCALE;
|
|
71
|
+
const shouldBackgroundScaleResetOnSettled =
|
|
72
|
+
revealOptions?.shouldBackgroundScaleResetOnSettled ?? true;
|
|
68
73
|
const usesTransformMask =
|
|
69
74
|
maskSizingMode === "auto"
|
|
70
75
|
? REVEAL_USES_TRANSFORM_MASK
|
|
@@ -366,8 +371,6 @@ export function buildRevealStyles({
|
|
|
366
371
|
},
|
|
367
372
|
[link.id]: {
|
|
368
373
|
style: {
|
|
369
|
-
position: "relative",
|
|
370
|
-
zIndex: 999,
|
|
371
374
|
transform: [{ translateX: elementTX }, { translateY: elementY }],
|
|
372
375
|
},
|
|
373
376
|
},
|
|
@@ -376,10 +379,11 @@ export function buildRevealStyles({
|
|
|
376
379
|
|
|
377
380
|
/* ---------------------------- Unfocused Screen ---------------------------- */
|
|
378
381
|
|
|
379
|
-
const unfocusedScale = mixUnit(1,
|
|
380
|
-
const unfocusedContentScale =
|
|
381
|
-
|
|
382
|
-
|
|
382
|
+
const unfocusedScale = mixUnit(1, backgroundScale, props.active.progress);
|
|
383
|
+
const unfocusedContentScale =
|
|
384
|
+
props.active.logicallySettled && shouldBackgroundScaleResetOnSettled
|
|
385
|
+
? 1
|
|
386
|
+
: unfocusedScale;
|
|
383
387
|
|
|
384
388
|
const trackingContentTarget =
|
|
385
389
|
initialDestinationTarget ?? link.destination.bounds;
|
|
@@ -15,6 +15,7 @@ export const DRAG_MASK_HEIGHT_COLLAPSE_END = 0.7;
|
|
|
15
15
|
export const HORIZONTAL_DRAG_MASK_COLLAPSE_SCALE = 0.5;
|
|
16
16
|
export const DISMISS_SCALE_ORBIT_DEPTH = 0.5;
|
|
17
17
|
export const CLOSE_SOURCE_HANDOFF_PROGRESS = 0.25;
|
|
18
|
+
export const REVEAL_BACKGROUND_SCALE = 0.9375;
|
|
18
19
|
|
|
19
20
|
export const IDENTITY_DRAG_SCALE_OUTPUT = [1, 1] as const;
|
|
20
21
|
export const ZERO_TO_ONE_RANGE = [0, 1] as const;
|