react-native-screen-transitions 4.0.0-alpha.9 → 4.0.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/README.md +5 -10
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js +53 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +43 -8
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +2 -3
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
- package/lib/commonjs/components/boundary/utils/source-signals.js +6 -4
- package/lib/commonjs/components/boundary/utils/source-signals.js.map +1 -1
- package/lib/commonjs/components/overlay/helpers/get-active-overlay.js +3 -24
- package/lib/commonjs/components/overlay/helpers/get-active-overlay.js.map +1 -1
- package/lib/commonjs/components/overlay/helpers/retain-ready-overlay-resources.js +4 -3
- package/lib/commonjs/components/overlay/helpers/retain-ready-overlay-resources.js.map +1 -1
- package/lib/commonjs/components/overlay/hooks/use-overlay-slot.js +1 -2
- package/lib/commonjs/components/overlay/hooks/use-overlay-slot.js.map +1 -1
- package/lib/commonjs/components/overlay/variations/float-overlay.js +0 -2
- package/lib/commonjs/components/overlay/variations/float-overlay.js.map +1 -1
- package/lib/commonjs/components/overlay/variations/overlay-host.js +18 -15
- package/lib/commonjs/components/overlay/variations/overlay-host.js.map +1 -1
- package/lib/commonjs/components/screen-container/layers/content.js +10 -5
- package/lib/commonjs/components/screen-container/layers/content.js.map +1 -1
- package/lib/commonjs/components/screen-container/layers/surface.js +50 -0
- package/lib/commonjs/components/screen-container/layers/surface.js.map +1 -0
- package/lib/commonjs/components/stack-view.js +7 -29
- package/lib/commonjs/components/stack-view.js.map +1 -1
- package/lib/commonjs/configs/index.js +1 -4
- package/lib/commonjs/configs/index.js.map +1 -1
- package/lib/commonjs/configs/presets.js +1 -384
- package/lib/commonjs/configs/presets.js.map +1 -1
- package/lib/commonjs/navigators/create-blank-stack-navigator.js +7 -67
- package/lib/commonjs/navigators/create-blank-stack-navigator.js.map +1 -1
- package/lib/commonjs/navigators/expo-router/index.js +1 -18
- package/lib/commonjs/navigators/expo-router/index.js.map +1 -1
- package/lib/commonjs/navigators/react-navigation/index.js +1 -3
- package/lib/commonjs/navigators/react-navigation/index.js.map +1 -1
- package/lib/commonjs/providers/screen/animation/animation.provider.js +6 -1
- package/lib/commonjs/providers/screen/animation/animation.provider.js.map +1 -1
- package/lib/commonjs/providers/screen/animation/use-screen-animation.js +1 -8
- package/lib/commonjs/providers/screen/animation/use-screen-animation.js.map +1 -1
- package/lib/commonjs/providers/screen/styles/constants.js +4 -0
- package/lib/commonjs/providers/screen/styles/constants.js.map +1 -1
- package/lib/commonjs/providers/screen/styles/hooks/slot-resolvers.js +1 -9
- package/lib/commonjs/providers/screen/styles/hooks/slot-resolvers.js.map +1 -1
- package/lib/commonjs/providers/screen/styles/slot.provider.js +3 -1
- package/lib/commonjs/providers/screen/styles/slot.provider.js.map +1 -1
- package/lib/commonjs/providers/stack/blank-stack-state/helpers/build-blank-stack-state.js +10 -4
- package/lib/commonjs/providers/stack/blank-stack-state/helpers/build-blank-stack-state.js.map +1 -1
- package/lib/commonjs/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.js +4 -3
- package/lib/commonjs/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.js.map +1 -1
- package/lib/commonjs/providers/stack/blank-stack-state/helpers/reconcile-blank-stack-routes.js.map +1 -1
- package/lib/commonjs/providers/stack/blank-stack-state/helpers/state-equality.js +9 -2
- package/lib/commonjs/providers/stack/blank-stack-state/helpers/state-equality.js.map +1 -1
- package/lib/commonjs/utils/create-provider.js +14 -3
- package/lib/commonjs/utils/create-provider.js.map +1 -1
- package/lib/module/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js +50 -0
- package/lib/module/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js.map +1 -1
- package/lib/module/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +44 -9
- package/lib/module/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +2 -3
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
- package/lib/module/components/boundary/utils/source-signals.js +6 -4
- package/lib/module/components/boundary/utils/source-signals.js.map +1 -1
- package/lib/module/components/overlay/helpers/get-active-overlay.js +3 -24
- package/lib/module/components/overlay/helpers/get-active-overlay.js.map +1 -1
- package/lib/module/components/overlay/helpers/retain-ready-overlay-resources.js +4 -3
- package/lib/module/components/overlay/helpers/retain-ready-overlay-resources.js.map +1 -1
- package/lib/module/components/overlay/hooks/use-overlay-slot.js +1 -2
- package/lib/module/components/overlay/hooks/use-overlay-slot.js.map +1 -1
- package/lib/module/components/overlay/variations/float-overlay.js +0 -2
- package/lib/module/components/overlay/variations/float-overlay.js.map +1 -1
- package/lib/module/components/overlay/variations/overlay-host.js +19 -16
- package/lib/module/components/overlay/variations/overlay-host.js.map +1 -1
- package/lib/module/components/screen-container/layers/content.js +10 -5
- package/lib/module/components/screen-container/layers/content.js.map +1 -1
- package/lib/module/components/screen-container/layers/surface.js +45 -0
- package/lib/module/components/screen-container/layers/surface.js.map +1 -0
- package/lib/module/components/stack-view.js +7 -29
- package/lib/module/components/stack-view.js.map +1 -1
- package/lib/module/configs/index.js +2 -5
- package/lib/module/configs/index.js.map +1 -1
- package/lib/module/configs/presets.js +0 -380
- package/lib/module/configs/presets.js.map +1 -1
- package/lib/module/navigators/create-blank-stack-navigator.js +7 -66
- package/lib/module/navigators/create-blank-stack-navigator.js.map +1 -1
- package/lib/module/navigators/expo-router/index.js +1 -18
- package/lib/module/navigators/expo-router/index.js.map +1 -1
- package/lib/module/navigators/react-navigation/index.js +1 -3
- package/lib/module/navigators/react-navigation/index.js.map +1 -1
- package/lib/module/providers/screen/animation/animation.provider.js +4 -0
- package/lib/module/providers/screen/animation/animation.provider.js.map +1 -1
- package/lib/module/providers/screen/animation/use-screen-animation.js +2 -9
- package/lib/module/providers/screen/animation/use-screen-animation.js.map +1 -1
- package/lib/module/providers/screen/styles/constants.js +4 -0
- package/lib/module/providers/screen/styles/constants.js.map +1 -1
- package/lib/module/providers/screen/styles/hooks/slot-resolvers.js +2 -10
- package/lib/module/providers/screen/styles/hooks/slot-resolvers.js.map +1 -1
- package/lib/module/providers/screen/styles/slot.provider.js +1 -0
- package/lib/module/providers/screen/styles/slot.provider.js.map +1 -1
- package/lib/module/providers/stack/blank-stack-state/helpers/build-blank-stack-state.js +11 -5
- package/lib/module/providers/stack/blank-stack-state/helpers/build-blank-stack-state.js.map +1 -1
- package/lib/module/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.js +5 -4
- package/lib/module/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.js.map +1 -1
- package/lib/module/providers/stack/blank-stack-state/helpers/reconcile-blank-stack-routes.js.map +1 -1
- package/lib/module/providers/stack/blank-stack-state/helpers/state-equality.js +7 -1
- package/lib/module/providers/stack/blank-stack-state/helpers/state-equality.js.map +1 -1
- package/lib/module/types/animation.types.js +10 -0
- package/lib/module/types/animation.types.js.map +1 -1
- package/lib/module/utils/create-provider.js +14 -3
- package/lib/module/utils/create-provider.js.map +1 -1
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.d.ts +20 -1
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts.map +1 -1
- package/lib/typescript/components/boundary/utils/source-signals.d.ts.map +1 -1
- package/lib/typescript/components/overlay/helpers/get-active-overlay.d.ts +2 -8
- package/lib/typescript/components/overlay/helpers/get-active-overlay.d.ts.map +1 -1
- package/lib/typescript/components/overlay/helpers/retain-ready-overlay-resources.d.ts +2 -1
- package/lib/typescript/components/overlay/helpers/retain-ready-overlay-resources.d.ts.map +1 -1
- package/lib/typescript/components/overlay/hooks/use-overlay-slot.d.ts.map +1 -1
- package/lib/typescript/components/overlay/variations/float-overlay.d.ts.map +1 -1
- package/lib/typescript/components/overlay/variations/overlay-host.d.ts +2 -3
- package/lib/typescript/components/overlay/variations/overlay-host.d.ts.map +1 -1
- package/lib/typescript/components/screen-container/layers/content.d.ts.map +1 -1
- package/lib/typescript/components/screen-container/layers/surface.d.ts +7 -0
- package/lib/typescript/components/screen-container/layers/surface.d.ts.map +1 -0
- package/lib/typescript/components/stack-view.d.ts +1 -1
- package/lib/typescript/components/stack-view.d.ts.map +1 -1
- package/lib/typescript/configs/index.d.ts +0 -9
- package/lib/typescript/configs/index.d.ts.map +1 -1
- package/lib/typescript/configs/presets.d.ts +0 -9
- package/lib/typescript/configs/presets.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -10
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/navigators/create-blank-stack-navigator.d.ts +2 -4
- package/lib/typescript/navigators/create-blank-stack-navigator.d.ts.map +1 -1
- package/lib/typescript/navigators/expo-router/index.d.ts +3 -3
- package/lib/typescript/navigators/expo-router/index.d.ts.map +1 -1
- package/lib/typescript/navigators/react-navigation/index.d.ts +1 -1
- package/lib/typescript/navigators/react-navigation/index.d.ts.map +1 -1
- package/lib/typescript/providers/screen/animation/animation.provider.d.ts +10 -1
- package/lib/typescript/providers/screen/animation/animation.provider.d.ts.map +1 -1
- package/lib/typescript/providers/screen/animation/use-screen-animation.d.ts.map +1 -1
- package/lib/typescript/providers/screen/styles/constants.d.ts.map +1 -1
- package/lib/typescript/providers/screen/styles/hooks/slot-resolvers.d.ts.map +1 -1
- package/lib/typescript/providers/screen/styles/slot.provider.d.ts +11 -2
- package/lib/typescript/providers/screen/styles/slot.provider.d.ts.map +1 -1
- package/lib/typescript/providers/stack/blank-stack-state/helpers/build-blank-stack-state.d.ts +3 -3
- package/lib/typescript/providers/stack/blank-stack-state/helpers/build-blank-stack-state.d.ts.map +1 -1
- package/lib/typescript/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.d.ts.map +1 -1
- package/lib/typescript/providers/stack/blank-stack-state/helpers/reconcile-blank-stack-routes.d.ts +3 -2
- package/lib/typescript/providers/stack/blank-stack-state/helpers/reconcile-blank-stack-routes.d.ts.map +1 -1
- package/lib/typescript/providers/stack/blank-stack-state/helpers/state-equality.d.ts +4 -4
- package/lib/typescript/providers/stack/blank-stack-state/helpers/state-equality.d.ts.map +1 -1
- package/lib/typescript/providers/stack/blank-stack-state/helpers/types.d.ts +6 -5
- package/lib/typescript/providers/stack/blank-stack-state/helpers/types.d.ts.map +1 -1
- package/lib/typescript/providers/stack/blank-stack.provider.d.ts +3 -1
- package/lib/typescript/providers/stack/blank-stack.provider.d.ts.map +1 -1
- package/lib/typescript/types/animation.types.d.ts +15 -7
- package/lib/typescript/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/types/blank-stack.types.d.ts +2 -23
- package/lib/typescript/types/blank-stack.types.d.ts.map +1 -1
- package/lib/typescript/types/index.d.ts +2 -2
- package/lib/typescript/types/index.d.ts.map +1 -1
- package/lib/typescript/types/providers/blank-stack-provider.types.d.ts +8 -6
- package/lib/typescript/types/providers/blank-stack-provider.types.d.ts.map +1 -1
- package/lib/typescript/types/screen.types.d.ts +31 -0
- package/lib/typescript/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/utils/create-provider.d.ts +4 -1
- package/lib/typescript/utils/create-provider.d.ts.map +1 -1
- package/package.json +3 -8
- package/src/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.ts +89 -0
- package/src/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.ts +97 -14
- package/src/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.ts +2 -6
- package/src/components/boundary/utils/source-signals.ts +6 -4
- package/src/components/overlay/helpers/get-active-overlay.ts +4 -36
- package/src/components/overlay/helpers/retain-ready-overlay-resources.ts +10 -1
- package/src/components/overlay/hooks/use-overlay-slot.ts +1 -5
- package/src/components/overlay/variations/float-overlay.tsx +9 -12
- package/src/components/overlay/variations/overlay-host.tsx +24 -22
- package/src/components/screen-container/layers/content.tsx +12 -7
- package/src/components/screen-container/layers/surface.tsx +65 -0
- package/src/components/stack-view.tsx +8 -39
- package/src/configs/index.ts +0 -6
- package/src/configs/presets.ts +0 -447
- package/src/index.ts +3 -1
- package/src/navigators/create-blank-stack-navigator.tsx +16 -124
- package/src/navigators/expo-router/index.tsx +0 -23
- package/src/navigators/react-navigation/index.tsx +0 -3
- package/src/providers/screen/animation/animation.provider.tsx +60 -54
- package/src/providers/screen/animation/use-screen-animation.tsx +2 -14
- package/src/providers/screen/styles/constants.ts +2 -0
- package/src/providers/screen/styles/hooks/slot-resolvers.tsx +2 -17
- package/src/providers/screen/styles/slot.provider.tsx +2 -0
- package/src/providers/stack/blank-stack-state/helpers/build-blank-stack-state.ts +30 -12
- package/src/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.ts +11 -3
- package/src/providers/stack/blank-stack-state/helpers/reconcile-blank-stack-routes.ts +2 -2
- package/src/providers/stack/blank-stack-state/helpers/state-equality.ts +27 -16
- package/src/providers/stack/blank-stack-state/helpers/types.ts +9 -4
- package/src/types/animation.types.ts +15 -9
- package/src/types/blank-stack.types.ts +1 -29
- package/src/types/index.ts +3 -1
- package/src/types/providers/blank-stack-provider.types.ts +14 -11
- package/src/types/screen.types.ts +36 -0
- package/src/utils/create-provider.tsx +22 -4
- package/lib/commonjs/components/boundary/portal/utils/teleport-control.js +0 -16
- package/lib/commonjs/components/boundary/portal/utils/teleport-control.js.map +0 -1
- package/lib/commonjs/providers/navigation/navigation-host.provider.js +0 -56
- package/lib/commonjs/providers/navigation/navigation-host.provider.js.map +0 -1
- package/lib/commonjs/providers/navigation/react-navigation-host.js +0 -23
- package/lib/commonjs/providers/navigation/react-navigation-host.js.map +0 -1
- package/lib/module/components/boundary/portal/utils/teleport-control.js +0 -11
- package/lib/module/components/boundary/portal/utils/teleport-control.js.map +0 -1
- package/lib/module/providers/navigation/navigation-host.provider.js +0 -50
- package/lib/module/providers/navigation/navigation-host.provider.js.map +0 -1
- package/lib/module/providers/navigation/react-navigation-host.js +0 -19
- package/lib/module/providers/navigation/react-navigation-host.js.map +0 -1
- package/lib/typescript/components/boundary/portal/utils/teleport-control.d.ts +0 -3
- package/lib/typescript/components/boundary/portal/utils/teleport-control.d.ts.map +0 -1
- package/lib/typescript/providers/navigation/navigation-host.provider.d.ts +0 -21
- package/lib/typescript/providers/navigation/navigation-host.provider.d.ts.map +0 -1
- package/lib/typescript/providers/navigation/react-navigation-host.d.ts +0 -3
- package/lib/typescript/providers/navigation/react-navigation-host.d.ts.map +0 -1
- package/src/components/boundary/portal/utils/teleport-control.ts +0 -13
- package/src/providers/navigation/navigation-host.provider.tsx +0 -75
- package/src/providers/navigation/react-navigation-host.tsx +0 -24
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
createStandardNavigator,
|
|
4
|
-
type NavigatorDescriptor,
|
|
5
|
-
} from "standard-navigation";
|
|
1
|
+
import { createStandardNavigator } from "standard-navigation";
|
|
6
2
|
import { StackView } from "../components/stack-view";
|
|
7
|
-
import {
|
|
8
|
-
type NavigationHostContextValue,
|
|
9
|
-
NavigationHostProvider,
|
|
10
|
-
} from "../providers/navigation/navigation-host.provider";
|
|
11
|
-
import type {
|
|
12
|
-
BlankStackDescriptor,
|
|
13
|
-
BlankStackFactoryOptions,
|
|
14
|
-
BlankStackNavigationHelpers,
|
|
15
|
-
BlankStackNavigationOptions,
|
|
16
|
-
} from "../types/blank-stack.types";
|
|
3
|
+
import type { BlankStackNavigationOptions } from "../types/blank-stack.types";
|
|
17
4
|
import type {
|
|
18
5
|
BaseStackNavigation,
|
|
19
6
|
BaseStackRoute,
|
|
@@ -22,122 +9,27 @@ import type {
|
|
|
22
9
|
|
|
23
10
|
export type BlankStackStandardEventMap = {};
|
|
24
11
|
|
|
25
|
-
export type BlankStackStandardNavigatorProps =
|
|
12
|
+
export type BlankStackStandardNavigatorProps = {
|
|
26
13
|
navigationState?: BaseStackState<BaseStackRoute>;
|
|
27
14
|
navigation?: BaseStackNavigation;
|
|
28
|
-
navigationHost?: NavigationHostContextValue;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
type StandardDescriptor = NavigatorDescriptor<BlankStackNavigationOptions> & {
|
|
32
|
-
navigation?: BaseStackNavigation;
|
|
33
|
-
route?: BaseStackRoute;
|
|
34
15
|
};
|
|
35
16
|
|
|
36
|
-
type StandardDescriptorMap = Record<string, StandardDescriptor>;
|
|
37
|
-
type BlankStackDescriptorMap = Record<string, BlankStackDescriptor>;
|
|
38
|
-
|
|
39
|
-
function createDescriptorMap({
|
|
40
|
-
routes,
|
|
41
|
-
descriptors,
|
|
42
|
-
navigation,
|
|
43
|
-
}: {
|
|
44
|
-
routes: BaseStackRoute[];
|
|
45
|
-
descriptors: StandardDescriptorMap;
|
|
46
|
-
navigation: BaseStackNavigation;
|
|
47
|
-
}): BlankStackDescriptorMap {
|
|
48
|
-
const result: BlankStackDescriptorMap = {};
|
|
49
|
-
|
|
50
|
-
for (const route of routes) {
|
|
51
|
-
const descriptor = descriptors[route.key];
|
|
52
|
-
|
|
53
|
-
if (!descriptor) {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
result[route.key] = {
|
|
58
|
-
route: descriptor.route ?? route,
|
|
59
|
-
navigation: (descriptor.navigation ??
|
|
60
|
-
navigation) as BlankStackDescriptor["navigation"],
|
|
61
|
-
options: descriptor.options,
|
|
62
|
-
render: () => descriptor.render() as React.JSX.Element,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return result;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
17
|
export const BlankStackNavigator = createStandardNavigator<
|
|
70
18
|
BlankStackNavigationOptions,
|
|
71
19
|
BlankStackStandardEventMap,
|
|
72
20
|
BlankStackStandardNavigatorProps
|
|
73
|
-
>(
|
|
74
|
-
({
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
state,
|
|
78
|
-
navigation,
|
|
79
|
-
navigationHost,
|
|
80
|
-
navigationState,
|
|
81
|
-
}) => {
|
|
82
|
-
const stackState = navigationState ?? {
|
|
83
|
-
key: "blank-stack",
|
|
84
|
-
index: state.index,
|
|
85
|
-
routes: state.routes as BaseStackRoute[],
|
|
86
|
-
};
|
|
87
|
-
const stackStateRef = React.useRef(stackState);
|
|
88
|
-
stackStateRef.current = stackState;
|
|
89
|
-
|
|
90
|
-
const fallbackNavigation = React.useMemo<BaseStackNavigation>(
|
|
91
|
-
() => ({
|
|
92
|
-
getState: () => stackStateRef.current,
|
|
93
|
-
dispatch: (action) => {
|
|
94
|
-
if (action?.type === "GO_BACK" || action?.type === "POP") {
|
|
95
|
-
actions.back();
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const name = action?.payload?.name;
|
|
100
|
-
if (action?.type === "NAVIGATE" && typeof name === "string") {
|
|
101
|
-
actions.navigate(name, action.payload.params);
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
}),
|
|
105
|
-
[actions],
|
|
106
|
-
);
|
|
107
|
-
const stackNavigation = navigation ?? fallbackNavigation;
|
|
108
|
-
const stackDescriptors = React.useMemo(
|
|
109
|
-
() =>
|
|
110
|
-
createDescriptorMap({
|
|
111
|
-
routes: stackState.routes,
|
|
112
|
-
descriptors,
|
|
113
|
-
navigation: stackNavigation,
|
|
114
|
-
}),
|
|
115
|
-
[descriptors, stackNavigation, stackState.routes],
|
|
116
|
-
);
|
|
117
|
-
const describe = React.useCallback(
|
|
118
|
-
(route: BlankStackDescriptor["route"]) => {
|
|
119
|
-
const descriptor = stackDescriptors[route.key];
|
|
120
|
-
|
|
121
|
-
if (!descriptor) {
|
|
122
|
-
throw new Error(
|
|
123
|
-
`BlankStack could not find a descriptor for route "${route.key}".`,
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return descriptor;
|
|
128
|
-
},
|
|
129
|
-
[stackDescriptors],
|
|
21
|
+
>(({ descriptors, navigation, navigationState }) => {
|
|
22
|
+
if (!navigationState || !navigation) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
"BlankStack requires navigation state and helpers from its integration.",
|
|
130
25
|
);
|
|
26
|
+
}
|
|
131
27
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
</NavigationHostProvider>
|
|
141
|
-
);
|
|
142
|
-
},
|
|
143
|
-
);
|
|
28
|
+
return (
|
|
29
|
+
<StackView
|
|
30
|
+
state={navigationState}
|
|
31
|
+
navigation={navigation}
|
|
32
|
+
descriptors={descriptors}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
});
|
|
@@ -4,11 +4,6 @@ import {
|
|
|
4
4
|
type StackRouterOptions,
|
|
5
5
|
unstable_integrateWithRouter,
|
|
6
6
|
} from "expo-router";
|
|
7
|
-
import {
|
|
8
|
-
NavigationContext,
|
|
9
|
-
NavigationRouteContext,
|
|
10
|
-
} from "expo-router/react-navigation";
|
|
11
|
-
import type { NavigationScreenProviderComponent } from "../../providers/navigation/navigation-host.provider";
|
|
12
7
|
import type { BlankStackNavigationOptions } from "../../types/blank-stack.types";
|
|
13
8
|
import {
|
|
14
9
|
BlankStackNavigator,
|
|
@@ -18,22 +13,6 @@ import {
|
|
|
18
13
|
|
|
19
14
|
type BlankStackExpoRouterParamList = Record<string, object | undefined>;
|
|
20
15
|
|
|
21
|
-
const ExpoRouterScreenProvider: NavigationScreenProviderComponent = ({
|
|
22
|
-
children,
|
|
23
|
-
navigation,
|
|
24
|
-
route,
|
|
25
|
-
}) => (
|
|
26
|
-
<NavigationContext.Provider value={navigation as never}>
|
|
27
|
-
<NavigationRouteContext.Provider value={route as never}>
|
|
28
|
-
{children}
|
|
29
|
-
</NavigationRouteContext.Provider>
|
|
30
|
-
</NavigationContext.Provider>
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
const expoRouterNavigationHost = {
|
|
34
|
-
ScreenProvider: ExpoRouterScreenProvider,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
16
|
export const BlankStack = unstable_integrateWithRouter<
|
|
38
17
|
BlankStackNavigationOptions,
|
|
39
18
|
StackNavigationState<BlankStackExpoRouterParamList>,
|
|
@@ -44,14 +23,12 @@ export const BlankStack = unstable_integrateWithRouter<
|
|
|
44
23
|
createProps: ({ state, navigation }) => ({
|
|
45
24
|
navigationState: state,
|
|
46
25
|
navigation,
|
|
47
|
-
navigationHost: expoRouterNavigationHost,
|
|
48
26
|
}),
|
|
49
27
|
});
|
|
50
28
|
|
|
51
29
|
export const BlankStackScreen = BlankStack.Screen;
|
|
52
30
|
|
|
53
31
|
export type {
|
|
54
|
-
BlankStackFactoryOptions,
|
|
55
32
|
BlankStackNavigationEventMap,
|
|
56
33
|
BlankStackNavigationOptions,
|
|
57
34
|
BlankStackNavigationProp,
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
type StackRouterOptions,
|
|
7
7
|
type StandardNavigationTypeBagBase,
|
|
8
8
|
} from "@react-navigation/native";
|
|
9
|
-
import { reactNavigationHost } from "../../providers/navigation/react-navigation-host";
|
|
10
9
|
import type {
|
|
11
10
|
BlankStackNavigationEventMap,
|
|
12
11
|
BlankStackNavigationOptions,
|
|
@@ -33,11 +32,9 @@ export const {
|
|
|
33
32
|
>(BlankStackNavigator, StackRouter, ({ state, navigation }) => ({
|
|
34
33
|
navigationState: state,
|
|
35
34
|
navigation,
|
|
36
|
-
navigationHost: reactNavigationHost,
|
|
37
35
|
}));
|
|
38
36
|
|
|
39
37
|
export type {
|
|
40
|
-
BlankStackFactoryOptions,
|
|
41
38
|
BlankStackNavigationEventMap,
|
|
42
39
|
BlankStackNavigationOptions,
|
|
43
40
|
BlankStackNavigationProp,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ReactNode, useMemo } from "react";
|
|
2
2
|
import { createBoundsAccessor } from "../../../utils/bounds";
|
|
3
3
|
import createProvider from "../../../utils/create-provider";
|
|
4
|
+
import { useBlankStackStore } from "../../stack/blank-stack.provider";
|
|
4
5
|
import { useDescriptorsStore } from "../descriptors";
|
|
5
6
|
import { useCurrentScreenRelationships } from "../use-current-screen-relationships";
|
|
6
7
|
import { useScreenAnimationPipeline } from "./helpers/pipeline";
|
|
@@ -26,63 +27,68 @@ const createScreenAnimationProvider = createProvider("ScreenAnimation", {
|
|
|
26
27
|
})<Props, ScreenAnimationContextValue>;
|
|
27
28
|
|
|
28
29
|
export const {
|
|
30
|
+
StoreProvider: ScreenAnimationStoreProvider,
|
|
29
31
|
ScreenAnimationProvider,
|
|
30
32
|
useOptionalScreenAnimationStore,
|
|
31
33
|
useScreenAnimationStore,
|
|
32
|
-
}: ReturnType<
|
|
33
|
-
createScreenAnimationProvider
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
}: ReturnType<
|
|
35
|
+
typeof createScreenAnimationProvider
|
|
36
|
+
> = createScreenAnimationProvider((_props) => {
|
|
37
|
+
const currentScreenKey = useDescriptorsStore(
|
|
38
|
+
(store) => store.derivations.currentScreenKey,
|
|
39
|
+
);
|
|
40
|
+
const isClosing = useBlankStackStore(
|
|
41
|
+
(store) => store.scenesByKey[currentScreenKey]?.activity === "closing",
|
|
42
|
+
);
|
|
43
|
+
const relationships = useCurrentScreenRelationships();
|
|
44
|
+
const pipeline = useScreenAnimationPipeline();
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return pipeline.screenInterpolatorProps.get();
|
|
48
|
-
}),
|
|
46
|
+
const screenAnimationSource = useMemo<ScreenAnimationTransitionSource>(
|
|
47
|
+
() => ({
|
|
48
|
+
screenInterpolatorProps: pipeline.screenInterpolatorProps,
|
|
49
|
+
screenInterpolatorPropsRevision: pipeline.screenInterpolatorPropsRevision,
|
|
50
|
+
boundsAccessor: createBoundsAccessor(() => {
|
|
51
|
+
"worklet";
|
|
52
|
+
return pipeline.screenInterpolatorProps.get();
|
|
49
53
|
}),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
}),
|
|
55
|
+
[
|
|
56
|
+
pipeline.screenInterpolatorProps,
|
|
57
|
+
pipeline.screenInterpolatorPropsRevision,
|
|
58
|
+
],
|
|
59
|
+
);
|
|
60
|
+
const ancestorSources =
|
|
61
|
+
useOptionalScreenAnimationStore(
|
|
62
|
+
relationships.parentScreenKey,
|
|
63
|
+
(store) => store.transitionSourcesThroughSelf,
|
|
64
|
+
) ?? EMPTY_TRANSITION_SOURCES;
|
|
65
|
+
const descendantSources =
|
|
66
|
+
useOptionalScreenAnimationStore(
|
|
67
|
+
relationships.activeChildScreenKey,
|
|
68
|
+
(store) => store.transitionSourcesFromSelf,
|
|
69
|
+
) ?? EMPTY_TRANSITION_SOURCES;
|
|
70
|
+
const transitionSourcesThroughSelf = useMemo(
|
|
71
|
+
() => [...ancestorSources, screenAnimationSource],
|
|
72
|
+
[ancestorSources, screenAnimationSource],
|
|
73
|
+
);
|
|
74
|
+
const transitionSourcesFromSelf = useMemo(
|
|
75
|
+
() => [screenAnimationSource, ...descendantSources],
|
|
76
|
+
[screenAnimationSource, descendantSources],
|
|
77
|
+
);
|
|
78
|
+
const transitionSources = useMemo(
|
|
79
|
+
() => [...transitionSourcesThroughSelf, ...descendantSources],
|
|
80
|
+
[transitionSourcesThroughSelf, descendantSources],
|
|
81
|
+
);
|
|
77
82
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
}
|
|
83
|
+
return {
|
|
84
|
+
key: currentScreenKey,
|
|
85
|
+
unregisterOnCleanup: isClosing,
|
|
86
|
+
value: {
|
|
87
|
+
...pipeline,
|
|
88
|
+
transitionSources,
|
|
89
|
+
transitionOriginIndex: ancestorSources.length,
|
|
90
|
+
transitionSourcesThroughSelf,
|
|
91
|
+
transitionSourcesFromSelf,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
});
|
|
@@ -3,8 +3,7 @@ import type {
|
|
|
3
3
|
ScreenInterpolationProps,
|
|
4
4
|
ScreenTransitionTarget,
|
|
5
5
|
} from "../../../types/animation.types";
|
|
6
|
-
import {
|
|
7
|
-
import { useOptionalScreenAnimationStore } from "./animation.provider";
|
|
6
|
+
import { useScreenAnimationStore } from "./animation.provider";
|
|
8
7
|
import { useBuildTransitionAccessor } from "./helpers/accessors/use-build-transition-accessor";
|
|
9
8
|
import { readScreenAnimationRevisions } from "./helpers/read-screen-animation-revisions";
|
|
10
9
|
import type { ScreenAnimationTarget } from "./types";
|
|
@@ -23,18 +22,7 @@ export function useScreenAnimation(
|
|
|
23
22
|
):
|
|
24
23
|
| DerivedValue<ScreenInterpolationProps>
|
|
25
24
|
| DerivedValue<ScreenInterpolationProps | null> {
|
|
26
|
-
const
|
|
27
|
-
const localAnimationStore = useOptionalScreenAnimationStore();
|
|
28
|
-
const keyedAnimationStore = useOptionalScreenAnimationStore(
|
|
29
|
-
localAnimationStore ? null : routeKey,
|
|
30
|
-
);
|
|
31
|
-
const screenAnimationStore = localAnimationStore ?? keyedAnimationStore;
|
|
32
|
-
|
|
33
|
-
if (!screenAnimationStore) {
|
|
34
|
-
throw new Error(
|
|
35
|
-
`ScreenAnimationStore is unavailable for route "${routeKey}"`,
|
|
36
|
-
);
|
|
37
|
-
}
|
|
25
|
+
const screenAnimationStore = useScreenAnimationStore();
|
|
38
26
|
|
|
39
27
|
const { transitionSources } = screenAnimationStore;
|
|
40
28
|
const transition = useBuildTransitionAccessor(screenAnimationStore);
|
|
@@ -22,6 +22,7 @@ const IDENTITY_TRANSFORM = [
|
|
|
22
22
|
* please add its identity value here in a PR.
|
|
23
23
|
*/
|
|
24
24
|
export const STYLE_RESET_VALUES: Record<string, unknown> = {
|
|
25
|
+
filter: [{ blur: 0.01 }],
|
|
25
26
|
transform: IDENTITY_TRANSFORM,
|
|
26
27
|
translateX: 0,
|
|
27
28
|
translateY: 0,
|
|
@@ -67,6 +68,7 @@ export const PROP_RESET_VALUES: Record<string, unknown> = {
|
|
|
67
68
|
const RESERVED_STYLE_SLOT_IDS = {
|
|
68
69
|
overlay: true,
|
|
69
70
|
content: true,
|
|
71
|
+
surface: true,
|
|
70
72
|
backdrop: true,
|
|
71
73
|
[NAVIGATION_MASK_ELEMENT_STYLE_ID]: true,
|
|
72
74
|
[NAVIGATION_MASK_CONTAINER_STYLE_ID]: true,
|
|
@@ -1,29 +1,14 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { useAnimatedProps, useAnimatedStyle } from "react-native-reanimated";
|
|
3
3
|
import { NO_PROPS, NO_STYLES } from "../../../../constants";
|
|
4
|
-
import { useNavigationRoute } from "../../../navigation/navigation-host.provider";
|
|
5
4
|
import {
|
|
6
5
|
composeSlotStyleWithLocalTransform,
|
|
7
6
|
getLocalTransformForSlotComposition,
|
|
8
7
|
} from "../helpers/compose-slot-style";
|
|
9
|
-
import {
|
|
8
|
+
import { useScreenSlotStore } from "../slot.provider";
|
|
10
9
|
|
|
11
10
|
const useCurrentScreenSlotsMap = () => {
|
|
12
|
-
|
|
13
|
-
const localSlotsMap = useOptionalScreenSlotStore(
|
|
14
|
-
(store) => store?.slotsMap ?? null,
|
|
15
|
-
);
|
|
16
|
-
const keyedSlotsMap = useOptionalScreenSlotStore(
|
|
17
|
-
localSlotsMap ? null : routeKey,
|
|
18
|
-
(store) => store.slotsMap,
|
|
19
|
-
);
|
|
20
|
-
const slotsMap = localSlotsMap ?? keyedSlotsMap;
|
|
21
|
-
|
|
22
|
-
if (!slotsMap) {
|
|
23
|
-
throw new Error(`ScreenSlotStore is unavailable for route "${routeKey}"`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return slotsMap;
|
|
11
|
+
return useScreenSlotStore((store) => store.slotsMap);
|
|
27
12
|
};
|
|
28
13
|
|
|
29
14
|
export const useSlotStyles = (slotId: string | undefined) => {
|
|
@@ -18,6 +18,7 @@ type Props = { children: ReactNode };
|
|
|
18
18
|
export type ScreenSlotName =
|
|
19
19
|
| "overlay"
|
|
20
20
|
| "content"
|
|
21
|
+
| "surface"
|
|
21
22
|
| "backdrop"
|
|
22
23
|
| typeof NAVIGATION_MASK_CONTAINER_STYLE_ID
|
|
23
24
|
| typeof NAVIGATION_MASK_ELEMENT_STYLE_ID;
|
|
@@ -33,6 +34,7 @@ const createScreenSlotProvider = createProvider("ScreenSlot", {
|
|
|
33
34
|
})<Props, ScreenSlotContextValue>;
|
|
34
35
|
|
|
35
36
|
export const {
|
|
37
|
+
StoreProvider: ScreenSlotStoreProvider,
|
|
36
38
|
ScreenSlotProvider,
|
|
37
39
|
useOptionalScreenSlotStore,
|
|
38
40
|
useScreenSlotStore,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { BlankStackDescriptor } from "../../../../types/blank-stack.types";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
BlankStackDescriptorSource,
|
|
4
|
+
BlankStackDescriptorSources,
|
|
5
|
+
BlankStackProviderProps,
|
|
6
|
+
} from "../../../../types/providers/blank-stack-provider.types";
|
|
3
7
|
import type {
|
|
4
8
|
BaseStackScene,
|
|
5
9
|
StackSceneActivity,
|
|
@@ -9,6 +13,7 @@ import { resolveSceneNeighbors } from "./navigation/resolve-scene-neighbors";
|
|
|
9
13
|
import {
|
|
10
14
|
areDescriptorSourcesEquivalent,
|
|
11
15
|
areDescriptorsEqual,
|
|
16
|
+
areRecordsShallowEqual,
|
|
12
17
|
areRouteChildStateMapsEqual,
|
|
13
18
|
getRouteChildState,
|
|
14
19
|
routeKeyListsAreEqual,
|
|
@@ -24,7 +29,7 @@ import type {
|
|
|
24
29
|
type BuildBlankStackStateParams = {
|
|
25
30
|
props: BlankStackProviderProps;
|
|
26
31
|
routes: BlankStackRoutes;
|
|
27
|
-
descriptors:
|
|
32
|
+
descriptors: BlankStackDescriptorSources;
|
|
28
33
|
closingRouteKeys: ReadonlySet<string>;
|
|
29
34
|
previousState?: LocalRoutesState;
|
|
30
35
|
};
|
|
@@ -35,9 +40,9 @@ const resolveStableDescriptorSource = ({
|
|
|
35
40
|
previousState,
|
|
36
41
|
}: {
|
|
37
42
|
routeKey: string;
|
|
38
|
-
sourceDescriptor:
|
|
43
|
+
sourceDescriptor: BlankStackDescriptorSource;
|
|
39
44
|
previousState?: LocalRoutesState;
|
|
40
|
-
}):
|
|
45
|
+
}): BlankStackDescriptorSource => {
|
|
41
46
|
const previousSourceDescriptor = previousState?.sourceDescriptors[routeKey];
|
|
42
47
|
|
|
43
48
|
if (
|
|
@@ -125,6 +130,7 @@ const getSceneActivityWindow = ({
|
|
|
125
130
|
};
|
|
126
131
|
|
|
127
132
|
const buildBaseScenes = ({
|
|
133
|
+
props,
|
|
128
134
|
routes,
|
|
129
135
|
descriptors,
|
|
130
136
|
closingRouteKeys,
|
|
@@ -136,7 +142,7 @@ const buildBaseScenes = ({
|
|
|
136
142
|
const routeKeys: string[] = [];
|
|
137
143
|
const scenes: BaseStackScene<BlankStackDescriptor>[] = [];
|
|
138
144
|
const routeChildStates: Record<string, unknown> = {};
|
|
139
|
-
const sourceDescriptors:
|
|
145
|
+
const sourceDescriptors: BlankStackDescriptorSources = {};
|
|
140
146
|
const blankStackDescriptors: BlankStackDescriptors = {};
|
|
141
147
|
let shouldShowFloatOverlay = false;
|
|
142
148
|
|
|
@@ -169,14 +175,28 @@ const buildBaseScenes = ({
|
|
|
169
175
|
});
|
|
170
176
|
|
|
171
177
|
const previousDescriptor = previousState?.descriptors[route.key];
|
|
178
|
+
const descriptorRoute =
|
|
179
|
+
previousDescriptor &&
|
|
180
|
+
childStateUnchanged &&
|
|
181
|
+
areRecordsShallowEqual(
|
|
182
|
+
previousDescriptor.route as unknown as Record<string, unknown>,
|
|
183
|
+
route as unknown as Record<string, unknown>,
|
|
184
|
+
)
|
|
185
|
+
? previousDescriptor.route
|
|
186
|
+
: route;
|
|
172
187
|
const descriptor =
|
|
173
188
|
previousDescriptor &&
|
|
174
189
|
childStateUnchanged &&
|
|
175
|
-
previousDescriptor.route ===
|
|
176
|
-
previousDescriptor.navigation ===
|
|
190
|
+
previousDescriptor.route === descriptorRoute &&
|
|
191
|
+
previousDescriptor.navigation === props.navigation &&
|
|
177
192
|
previousDescriptor.options === sourceDescriptor.options
|
|
178
193
|
? previousDescriptor
|
|
179
|
-
:
|
|
194
|
+
: ({
|
|
195
|
+
route: descriptorRoute,
|
|
196
|
+
navigation: props.navigation,
|
|
197
|
+
options: sourceDescriptor.options,
|
|
198
|
+
render: sourceDescriptor.render,
|
|
199
|
+
} as BlankStackDescriptor);
|
|
180
200
|
|
|
181
201
|
routeKeys.push(route.key);
|
|
182
202
|
routeChildStates[route.key] = routeChildState;
|
|
@@ -206,12 +226,10 @@ const buildBaseScenes = ({
|
|
|
206
226
|
|
|
207
227
|
const withSceneRelationships = ({
|
|
208
228
|
scenes,
|
|
209
|
-
sourceDescriptors,
|
|
210
229
|
closingRouteKeys,
|
|
211
230
|
previousState,
|
|
212
231
|
}: {
|
|
213
232
|
scenes: BaseStackScene<BlankStackDescriptor>[];
|
|
214
|
-
sourceDescriptors: BlankStackDescriptors;
|
|
215
233
|
closingRouteKeys: ReadonlySet<string>;
|
|
216
234
|
previousState?: LocalRoutesState;
|
|
217
235
|
}): BaseStackScene<BlankStackDescriptor>[] => {
|
|
@@ -231,7 +249,7 @@ const withSceneRelationships = ({
|
|
|
231
249
|
|
|
232
250
|
const relationshipScenes = scenes.map((scene) => ({
|
|
233
251
|
route: scene.route,
|
|
234
|
-
descriptor:
|
|
252
|
+
descriptor: scene.descriptor,
|
|
235
253
|
}));
|
|
236
254
|
|
|
237
255
|
const nextScenes = scenes.map((scene, sceneIndex) => {
|
|
@@ -296,7 +314,6 @@ export const buildBlankStackState = (
|
|
|
296
314
|
|
|
297
315
|
const scenes = withSceneRelationships({
|
|
298
316
|
scenes: baseScenes,
|
|
299
|
-
sourceDescriptors,
|
|
300
317
|
closingRouteKeys: params.closingRouteKeys,
|
|
301
318
|
previousState: params.previousState,
|
|
302
319
|
});
|
|
@@ -305,6 +322,7 @@ export const buildBlankStackState = (
|
|
|
305
322
|
|
|
306
323
|
return {
|
|
307
324
|
routes: params.routes,
|
|
325
|
+
navigation: params.props.navigation,
|
|
308
326
|
descriptors:
|
|
309
327
|
params.previousState &&
|
|
310
328
|
areDescriptorsEqual(
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
areDescriptorsEqual,
|
|
8
8
|
areRouteChildStateMapsEqual,
|
|
9
9
|
getRouteChildStateMap,
|
|
10
|
-
|
|
10
|
+
routesAreShallowlyEqual,
|
|
11
11
|
setsAreEqual,
|
|
12
12
|
} from "./state-equality";
|
|
13
13
|
import type { BlankStackRoutes, LocalRoutesState } from "./types";
|
|
@@ -39,6 +39,7 @@ export const deriveBlankStackState = ({
|
|
|
39
39
|
const nextDescriptors = props.descriptors;
|
|
40
40
|
const nextRouteChildStates = getRouteChildStateMap(nextRoutesSnapshot);
|
|
41
41
|
const nextFocusedRouteKey = nextRoutesSnapshot[props.state.index]?.key;
|
|
42
|
+
const navigationUnchanged = current.navigation === props.navigation;
|
|
42
43
|
const focusedRouteUnchanged = current.focusedRouteKey === nextFocusedRouteKey;
|
|
43
44
|
const closingRouteKeysUnchanged = setsAreEqual(
|
|
44
45
|
current.closingRouteKeys,
|
|
@@ -50,6 +51,7 @@ export const deriveBlankStackState = ({
|
|
|
50
51
|
);
|
|
51
52
|
|
|
52
53
|
const alreadyAligned =
|
|
54
|
+
navigationUnchanged &&
|
|
53
55
|
focusedRouteUnchanged &&
|
|
54
56
|
closingRouteKeysUnchanged &&
|
|
55
57
|
routeChildStatesUnchanged &&
|
|
@@ -61,10 +63,11 @@ export const deriveBlankStackState = ({
|
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
const logicallyAligned =
|
|
66
|
+
navigationUnchanged &&
|
|
64
67
|
focusedRouteUnchanged &&
|
|
65
68
|
closingRouteKeysUnchanged &&
|
|
66
69
|
routeChildStatesUnchanged &&
|
|
67
|
-
|
|
70
|
+
routesAreShallowlyEqual(current.routes, nextRoutesSnapshot) &&
|
|
68
71
|
areDescriptorSourceMapsEquivalent(
|
|
69
72
|
current.sourceDescriptors,
|
|
70
73
|
nextDescriptors,
|
|
@@ -92,7 +95,12 @@ export const deriveBlankStackState = ({
|
|
|
92
95
|
closingRouteKeys,
|
|
93
96
|
);
|
|
94
97
|
|
|
95
|
-
if (
|
|
98
|
+
if (
|
|
99
|
+
navigationUnchanged &&
|
|
100
|
+
!routesChanged &&
|
|
101
|
+
!descriptorsChanged &&
|
|
102
|
+
!closingRouteKeysChanged
|
|
103
|
+
) {
|
|
96
104
|
return current;
|
|
97
105
|
}
|
|
98
106
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { BlankStackDescriptorSources } from "../../../../types/providers/blank-stack-provider.types";
|
|
1
2
|
import type { RouteWithKey } from "../../../../types/stack.types";
|
|
2
3
|
import { composeDescriptors } from "./navigation/compose-descriptors";
|
|
3
4
|
import { syncRoutesWithRemoved } from "./navigation/sync-routes-with-removed";
|
|
4
5
|
import { routesHaveSameKeys } from "./state-equality";
|
|
5
6
|
import type {
|
|
6
|
-
BlankStackDescriptors,
|
|
7
7
|
BlankStackRoutes,
|
|
8
8
|
LocalRoutesState,
|
|
9
9
|
ReconciledRoutes,
|
|
@@ -13,7 +13,7 @@ type ReconcileBlankStackRoutesParams = {
|
|
|
13
13
|
current: LocalRoutesState;
|
|
14
14
|
previousRoutesSnapshot: BlankStackRoutes;
|
|
15
15
|
nextRoutesSnapshot: BlankStackRoutes;
|
|
16
|
-
nextDescriptors:
|
|
16
|
+
nextDescriptors: BlankStackDescriptorSources;
|
|
17
17
|
closingRouteKeys: Set<string>;
|
|
18
18
|
};
|
|
19
19
|
|