react-native-screen-transitions 3.2.0-beta.0 → 3.2.0-beta.1
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 +103 -8
- package/lib/commonjs/blank-stack/components/adjusted-screen-container.js +36 -0
- package/lib/commonjs/blank-stack/components/adjusted-screen-container.js.map +1 -0
- package/lib/commonjs/blank-stack/components/{screens.js → adjusted-screen.js} +31 -11
- package/lib/commonjs/blank-stack/components/adjusted-screen.js.map +1 -0
- package/lib/commonjs/blank-stack/components/stack-view.js +33 -41
- package/lib/commonjs/blank-stack/components/stack-view.js.map +1 -1
- package/lib/commonjs/blank-stack/components/stack-view.native.js +81 -0
- package/lib/commonjs/blank-stack/components/stack-view.native.js.map +1 -0
- package/lib/commonjs/component-stack/components/component-screen-container.js +23 -0
- package/lib/commonjs/component-stack/components/component-screen-container.js.map +1 -0
- package/lib/commonjs/component-stack/components/component-screen.js +36 -0
- package/lib/commonjs/component-stack/components/component-screen.js.map +1 -0
- package/lib/commonjs/component-stack/components/stack-view.js +64 -0
- package/lib/commonjs/component-stack/components/stack-view.js.map +1 -0
- package/lib/commonjs/component-stack/index.js +3 -10
- package/lib/commonjs/component-stack/index.js.map +1 -1
- package/lib/commonjs/component-stack/navigators/create-component-stack-navigator.js +52 -0
- package/lib/commonjs/component-stack/navigators/create-component-stack-navigator.js.map +1 -0
- package/lib/commonjs/native-stack/views/NativeStackView.native.js +103 -105
- package/lib/commonjs/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/commonjs/shared/components/overlay/helpers/get-active-overlay.js +0 -25
- package/lib/commonjs/shared/components/overlay/helpers/get-active-overlay.js.map +1 -1
- package/lib/commonjs/shared/components/overlay/index.js +1 -3
- package/lib/commonjs/shared/components/overlay/index.js.map +1 -1
- package/lib/commonjs/shared/constants.js +3 -1
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/{blank-stack/controllers/blank-stack-lifecycle.js → shared/controller/managed-lifecycle.js} +16 -19
- package/lib/commonjs/shared/controller/managed-lifecycle.js.map +1 -0
- package/lib/commonjs/shared/hooks/animation/use-high-refresh-rate.js +7 -1
- package/lib/commonjs/shared/hooks/animation/use-high-refresh-rate.js.map +1 -1
- package/lib/commonjs/shared/hooks/animation/use-screen-animation.js +2 -2
- package/lib/commonjs/shared/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js +3 -1
- package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/commonjs/shared/hooks/navigation/use-stack.js.map +1 -1
- package/lib/commonjs/shared/hooks/reanimated/use-shared-value-state.js +5 -0
- package/lib/commonjs/shared/hooks/reanimated/use-shared-value-state.js.map +1 -1
- package/lib/commonjs/shared/providers/layout-anchor.provider.js +73 -0
- package/lib/commonjs/shared/providers/layout-anchor.provider.js.map +1 -0
- package/lib/commonjs/shared/providers/register-bounds.provider.js +9 -4
- package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/keys.provider.js +2 -2
- package/lib/commonjs/shared/providers/screen/styles.provider.js +38 -4
- package/lib/commonjs/shared/providers/screen/styles.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/core.provider.js +35 -12
- package/lib/commonjs/shared/providers/stack/core.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/direct.provider.js +6 -4
- package/lib/commonjs/shared/providers/stack/direct.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/managed.provider.js +7 -5
- package/lib/commonjs/shared/providers/stack/managed.provider.js.map +1 -1
- package/lib/commonjs/shared/types/index.js.map +1 -1
- package/lib/commonjs/shared/types/stack.types.js +26 -0
- package/lib/commonjs/shared/types/stack.types.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/index.js +13 -1
- package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/shared/utils/navigation/sync-routes-with-removed.js +20 -45
- package/lib/commonjs/shared/utils/navigation/sync-routes-with-removed.js.map +1 -1
- package/lib/module/blank-stack/components/adjusted-screen-container.js +31 -0
- package/lib/module/blank-stack/components/adjusted-screen-container.js.map +1 -0
- package/lib/module/blank-stack/components/{screens.js → adjusted-screen.js} +30 -10
- package/lib/module/blank-stack/components/adjusted-screen.js.map +1 -0
- package/lib/module/blank-stack/components/stack-view.js +33 -41
- package/lib/module/blank-stack/components/stack-view.js.map +1 -1
- package/lib/module/blank-stack/components/stack-view.native.js +76 -0
- package/lib/module/blank-stack/components/stack-view.native.js.map +1 -0
- package/lib/module/component-stack/components/component-screen-container.js +18 -0
- package/lib/module/component-stack/components/component-screen-container.js.map +1 -0
- package/lib/module/component-stack/components/component-screen.js +30 -0
- package/lib/module/component-stack/components/component-screen.js.map +1 -0
- package/lib/module/component-stack/components/stack-view.js +59 -0
- package/lib/module/component-stack/components/stack-view.js.map +1 -0
- package/lib/module/component-stack/index.js +1 -2
- package/lib/module/component-stack/index.js.map +1 -1
- package/lib/module/component-stack/navigators/create-component-stack-navigator.js +48 -0
- package/lib/module/component-stack/navigators/create-component-stack-navigator.js.map +1 -0
- package/lib/module/native-stack/views/NativeStackView.native.js +103 -105
- package/lib/module/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/module/shared/components/overlay/helpers/get-active-overlay.js +0 -24
- package/lib/module/shared/components/overlay/helpers/get-active-overlay.js.map +1 -1
- package/lib/module/shared/components/overlay/index.js +1 -3
- package/lib/module/shared/components/overlay/index.js.map +1 -1
- package/lib/module/shared/constants.js +2 -0
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/{blank-stack/controllers/blank-stack-lifecycle.js → shared/controller/managed-lifecycle.js} +14 -17
- package/lib/module/shared/controller/managed-lifecycle.js.map +1 -0
- package/lib/module/shared/hooks/animation/use-high-refresh-rate.js +8 -1
- package/lib/module/shared/hooks/animation/use-high-refresh-rate.js.map +1 -1
- package/lib/module/shared/hooks/animation/use-screen-animation.js +2 -2
- package/lib/module/shared/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-build-gestures.js +4 -2
- package/lib/module/shared/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/module/shared/hooks/navigation/use-stack.js.map +1 -1
- package/lib/module/shared/hooks/reanimated/use-shared-value-state.js +5 -0
- package/lib/module/shared/hooks/reanimated/use-shared-value-state.js.map +1 -1
- package/lib/module/shared/providers/layout-anchor.provider.js +67 -0
- package/lib/module/shared/providers/layout-anchor.provider.js.map +1 -0
- package/lib/module/shared/providers/register-bounds.provider.js +9 -4
- package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/module/shared/providers/screen/keys.provider.js +2 -2
- package/lib/module/shared/providers/screen/styles.provider.js +39 -5
- package/lib/module/shared/providers/screen/styles.provider.js.map +1 -1
- package/lib/module/shared/providers/stack/core.provider.js +34 -11
- package/lib/module/shared/providers/stack/core.provider.js.map +1 -1
- package/lib/module/shared/providers/stack/direct.provider.js +6 -4
- package/lib/module/shared/providers/stack/direct.provider.js.map +1 -1
- package/lib/module/shared/providers/stack/managed.provider.js +7 -5
- package/lib/module/shared/providers/stack/managed.provider.js.map +1 -1
- package/lib/module/shared/types/index.js.map +1 -1
- package/lib/module/shared/types/stack.types.js +30 -1
- package/lib/module/shared/types/stack.types.js.map +1 -1
- package/lib/module/shared/utils/bounds/index.js +13 -1
- package/lib/module/shared/utils/bounds/index.js.map +1 -1
- package/lib/module/shared/utils/navigation/sync-routes-with-removed.js +20 -45
- package/lib/module/shared/utils/navigation/sync-routes-with-removed.js.map +1 -1
- package/lib/typescript/blank-stack/components/adjusted-screen-container.d.ts +6 -0
- package/lib/typescript/blank-stack/components/adjusted-screen-container.d.ts.map +1 -0
- package/lib/typescript/blank-stack/components/{screens.d.ts → adjusted-screen.d.ts} +2 -2
- package/lib/typescript/blank-stack/components/adjusted-screen.d.ts.map +1 -0
- package/lib/typescript/blank-stack/components/stack-view.d.ts +1 -1
- package/lib/typescript/blank-stack/components/stack-view.d.ts.map +1 -1
- package/lib/typescript/blank-stack/components/stack-view.native.d.ts +4 -0
- package/lib/typescript/blank-stack/components/stack-view.native.d.ts.map +1 -0
- package/lib/typescript/blank-stack/types.d.ts +3 -1
- package/lib/typescript/blank-stack/types.d.ts.map +1 -1
- package/lib/typescript/component-stack/components/component-screen-container.d.ts +6 -0
- package/lib/typescript/component-stack/components/component-screen-container.d.ts.map +1 -0
- package/lib/typescript/component-stack/components/component-screen.d.ts +8 -0
- package/lib/typescript/component-stack/components/component-screen.d.ts.map +1 -0
- package/lib/typescript/component-stack/components/stack-view.d.ts +4 -0
- package/lib/typescript/component-stack/components/stack-view.d.ts.map +1 -0
- package/lib/typescript/component-stack/index.d.ts +2 -3
- package/lib/typescript/component-stack/index.d.ts.map +1 -1
- package/lib/typescript/component-stack/navigators/create-component-stack-navigator.d.ts +16 -0
- package/lib/typescript/component-stack/navigators/create-component-stack-navigator.d.ts.map +1 -0
- package/lib/typescript/component-stack/types.d.ts +24 -191
- package/lib/typescript/component-stack/types.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/NativeStackView.native.d.ts +1 -1
- package/lib/typescript/native-stack/views/NativeStackView.native.d.ts.map +1 -1
- package/lib/typescript/shared/components/overlay/helpers/get-active-overlay.d.ts +0 -9
- package/lib/typescript/shared/components/overlay/helpers/get-active-overlay.d.ts.map +1 -1
- package/lib/typescript/shared/components/overlay/index.d.ts +0 -2
- package/lib/typescript/shared/components/overlay/index.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts +1 -0
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/controller/managed-lifecycle.d.ts +9 -0
- package/lib/typescript/shared/controller/managed-lifecycle.d.ts.map +1 -0
- package/lib/typescript/shared/hooks/animation/use-high-refresh-rate.d.ts +7 -0
- package/lib/typescript/shared/hooks/animation/use-high-refresh-rate.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/animation/use-screen-animation.d.ts +2 -1
- package/lib/typescript/shared/hooks/animation/use-screen-animation.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts +4 -9
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/reanimated/use-shared-value-state.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +13 -13
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/layout-anchor.provider.d.ts +34 -0
- package/lib/typescript/shared/providers/layout-anchor.provider.d.ts.map +1 -0
- package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/keys.provider.d.ts +2 -2
- package/lib/typescript/shared/providers/screen/styles.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/core.provider.d.ts +15 -4
- package/lib/typescript/shared/providers/stack/core.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/direct.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/managed.provider.d.ts +1 -1
- package/lib/typescript/shared/providers/stack/managed.provider.d.ts.map +1 -1
- package/lib/typescript/shared/types/bounds.types.d.ts +1 -0
- package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +1 -1
- package/lib/typescript/shared/types/index.d.ts.map +1 -1
- package/lib/typescript/shared/types/overlay.types.d.ts +1 -12
- package/lib/typescript/shared/types/overlay.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/screen.types.d.ts +2 -2
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/stack.types.d.ts +5 -2
- package/lib/typescript/shared/types/stack.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/navigation/sync-routes-with-removed.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/blank-stack/components/adjusted-screen-container.tsx +25 -0
- package/src/blank-stack/components/{screens.tsx → adjusted-screen.tsx} +33 -12
- package/src/blank-stack/components/stack-view.native.tsx +94 -0
- package/src/blank-stack/components/stack-view.tsx +41 -47
- package/src/blank-stack/types.ts +3 -2
- package/src/component-stack/components/component-screen-container.tsx +15 -0
- package/src/component-stack/components/component-screen.tsx +40 -0
- package/src/component-stack/components/stack-view.tsx +74 -0
- package/src/component-stack/index.ts +6 -12
- package/src/component-stack/navigators/create-component-stack-navigator.tsx +88 -0
- package/src/component-stack/types.ts +80 -188
- package/src/native-stack/views/NativeStackView.native.tsx +104 -106
- package/src/shared/__tests__/sync-routes-with-removed.test.ts +0 -146
- package/src/shared/components/overlay/helpers/get-active-overlay.ts +0 -26
- package/src/shared/components/overlay/index.ts +0 -2
- package/src/shared/constants.ts +3 -0
- package/src/{blank-stack/controllers/blank-stack-lifecycle.tsx → shared/controller/managed-lifecycle.tsx} +14 -18
- package/src/shared/hooks/animation/use-high-refresh-rate.tsx +7 -1
- package/src/shared/hooks/animation/use-screen-animation.tsx +5 -3
- package/src/shared/hooks/gestures/use-build-gestures.tsx +9 -1
- package/src/shared/hooks/navigation/use-stack.tsx +4 -15
- package/src/shared/hooks/reanimated/use-shared-value-state.ts +5 -0
- package/src/shared/index.ts +2 -1
- package/src/shared/providers/layout-anchor.provider.tsx +81 -0
- package/src/shared/providers/register-bounds.provider.tsx +11 -4
- package/src/shared/providers/screen/keys.provider.tsx +2 -2
- package/src/shared/providers/screen/styles.provider.tsx +50 -5
- package/src/shared/providers/stack/core.provider.tsx +51 -28
- package/src/shared/providers/stack/direct.provider.tsx +4 -1
- package/src/shared/providers/stack/managed.provider.tsx +5 -2
- package/src/shared/types/bounds.types.ts +5 -0
- package/src/shared/types/index.ts +0 -1
- package/src/shared/types/overlay.types.ts +1 -14
- package/src/shared/types/screen.types.ts +2 -8
- package/src/shared/types/stack.types.ts +6 -2
- package/src/shared/utils/bounds/index.ts +18 -1
- package/src/shared/utils/navigation/sync-routes-with-removed.ts +28 -58
- package/lib/commonjs/blank-stack/components/screens.js.map +0 -1
- package/lib/commonjs/blank-stack/controllers/blank-stack-lifecycle.js.map +0 -1
- package/lib/commonjs/component-stack/components/component-view.js +0 -63
- package/lib/commonjs/component-stack/components/component-view.js.map +0 -1
- package/lib/commonjs/component-stack/components/screens.js +0 -64
- package/lib/commonjs/component-stack/components/screens.js.map +0 -1
- package/lib/commonjs/component-stack/controllers/component-stack-lifecycle.js +0 -82
- package/lib/commonjs/component-stack/controllers/component-stack-lifecycle.js.map +0 -1
- package/lib/commonjs/component-stack/hooks/use-component-navigation-builder.js +0 -321
- package/lib/commonjs/component-stack/hooks/use-component-navigation-builder.js.map +0 -1
- package/lib/commonjs/component-stack/hooks/use-component-navigation.js +0 -28
- package/lib/commonjs/component-stack/hooks/use-component-navigation.js.map +0 -1
- package/lib/commonjs/component-stack/navigators/create-component-navigator.js +0 -97
- package/lib/commonjs/component-stack/navigators/create-component-navigator.js.map +0 -1
- package/lib/commonjs/shared/components/overlay/variations/container-overlay.js +0 -99
- package/lib/commonjs/shared/components/overlay/variations/container-overlay.js.map +0 -1
- package/lib/module/blank-stack/components/screens.js.map +0 -1
- package/lib/module/blank-stack/controllers/blank-stack-lifecycle.js.map +0 -1
- package/lib/module/component-stack/components/component-view.js +0 -58
- package/lib/module/component-stack/components/component-view.js.map +0 -1
- package/lib/module/component-stack/components/screens.js +0 -58
- package/lib/module/component-stack/components/screens.js.map +0 -1
- package/lib/module/component-stack/controllers/component-stack-lifecycle.js +0 -76
- package/lib/module/component-stack/controllers/component-stack-lifecycle.js.map +0 -1
- package/lib/module/component-stack/hooks/use-component-navigation-builder.js +0 -316
- package/lib/module/component-stack/hooks/use-component-navigation-builder.js.map +0 -1
- package/lib/module/component-stack/hooks/use-component-navigation.js +0 -25
- package/lib/module/component-stack/hooks/use-component-navigation.js.map +0 -1
- package/lib/module/component-stack/navigators/create-component-navigator.js +0 -91
- package/lib/module/component-stack/navigators/create-component-navigator.js.map +0 -1
- package/lib/module/shared/components/overlay/variations/container-overlay.js +0 -97
- package/lib/module/shared/components/overlay/variations/container-overlay.js.map +0 -1
- package/lib/typescript/blank-stack/components/screens.d.ts.map +0 -1
- package/lib/typescript/blank-stack/controllers/blank-stack-lifecycle.d.ts +0 -9
- package/lib/typescript/blank-stack/controllers/blank-stack-lifecycle.d.ts.map +0 -1
- package/lib/typescript/component-stack/components/component-view.d.ts +0 -4
- package/lib/typescript/component-stack/components/component-view.d.ts.map +0 -1
- package/lib/typescript/component-stack/components/screens.d.ts +0 -9
- package/lib/typescript/component-stack/components/screens.d.ts.map +0 -1
- package/lib/typescript/component-stack/controllers/component-stack-lifecycle.d.ts +0 -10
- package/lib/typescript/component-stack/controllers/component-stack-lifecycle.d.ts.map +0 -1
- package/lib/typescript/component-stack/hooks/use-component-navigation-builder.d.ts +0 -19
- package/lib/typescript/component-stack/hooks/use-component-navigation-builder.d.ts.map +0 -1
- package/lib/typescript/component-stack/hooks/use-component-navigation.d.ts +0 -19
- package/lib/typescript/component-stack/hooks/use-component-navigation.d.ts.map +0 -1
- package/lib/typescript/component-stack/navigators/create-component-navigator.d.ts +0 -35
- package/lib/typescript/component-stack/navigators/create-component-navigator.d.ts.map +0 -1
- package/lib/typescript/shared/components/overlay/variations/container-overlay.d.ts +0 -8
- package/lib/typescript/shared/components/overlay/variations/container-overlay.d.ts.map +0 -1
- package/src/component-stack/components/component-view.tsx +0 -72
- package/src/component-stack/components/screens.tsx +0 -86
- package/src/component-stack/controllers/component-stack-lifecycle.tsx +0 -80
- package/src/component-stack/hooks/use-component-navigation-builder.tsx +0 -388
- package/src/component-stack/hooks/use-component-navigation.tsx +0 -22
- package/src/component-stack/navigators/create-component-navigator.tsx +0 -104
- package/src/shared/components/overlay/variations/container-overlay.tsx +0 -98
|
@@ -1,388 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { useCallback, useMemo, useReducer, useRef } from "react";
|
|
3
|
-
import type {
|
|
4
|
-
ComponentNavigation,
|
|
5
|
-
ComponentRoute,
|
|
6
|
-
ComponentScreenConfig,
|
|
7
|
-
ComponentScreenProps,
|
|
8
|
-
ComponentStackDescriptor,
|
|
9
|
-
ComponentStackDescriptorMap,
|
|
10
|
-
ComponentStackNavigationOptions,
|
|
11
|
-
ComponentStackState,
|
|
12
|
-
} from "../types";
|
|
13
|
-
|
|
14
|
-
// Generate unique keys for routes
|
|
15
|
-
let keyCounter = 0;
|
|
16
|
-
const generateKey = () => `component-route-${++keyCounter}`;
|
|
17
|
-
|
|
18
|
-
// Generate unique key for stack instance
|
|
19
|
-
const generateStackKey = () => `component-stack-${Date.now()}`;
|
|
20
|
-
|
|
21
|
-
type NavigationAction =
|
|
22
|
-
| { type: "PUSH"; name: string; params?: Record<string, unknown> }
|
|
23
|
-
| { type: "POP" }
|
|
24
|
-
| { type: "POP_BY_KEY"; key: string }
|
|
25
|
-
| { type: "NAVIGATE"; name: string; params?: Record<string, unknown> }
|
|
26
|
-
| { type: "RESET"; name?: string; params?: Record<string, unknown> };
|
|
27
|
-
|
|
28
|
-
interface ScreenRegistry {
|
|
29
|
-
[name: string]: ComponentScreenConfig;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function createRoute(
|
|
33
|
-
name: string,
|
|
34
|
-
params?: Record<string, unknown>,
|
|
35
|
-
): ComponentRoute {
|
|
36
|
-
return {
|
|
37
|
-
key: generateKey(),
|
|
38
|
-
name,
|
|
39
|
-
params,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function navigationReducer(
|
|
44
|
-
state: ComponentStackState,
|
|
45
|
-
action: NavigationAction & {
|
|
46
|
-
screens: ScreenRegistry;
|
|
47
|
-
initialRouteName: string;
|
|
48
|
-
},
|
|
49
|
-
): ComponentStackState {
|
|
50
|
-
switch (action.type) {
|
|
51
|
-
case "PUSH": {
|
|
52
|
-
if (!action.screens[action.name]) {
|
|
53
|
-
console.warn(
|
|
54
|
-
`[ComponentStack] Screen "${action.name}" not found in navigator`,
|
|
55
|
-
);
|
|
56
|
-
return state;
|
|
57
|
-
}
|
|
58
|
-
const newRoute = createRoute(action.name, action.params);
|
|
59
|
-
return {
|
|
60
|
-
...state,
|
|
61
|
-
routes: [...state.routes, newRoute],
|
|
62
|
-
index: state.routes.length,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
case "POP": {
|
|
67
|
-
if (state.routes.length <= 1) {
|
|
68
|
-
return state;
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
...state,
|
|
72
|
-
routes: state.routes.slice(0, -1),
|
|
73
|
-
index: state.index - 1,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
case "POP_BY_KEY": {
|
|
78
|
-
const routeIndex = state.routes.findIndex(
|
|
79
|
-
(route) => route.key === action.key,
|
|
80
|
-
);
|
|
81
|
-
if (routeIndex === -1) {
|
|
82
|
-
// Route not found, nothing to do
|
|
83
|
-
return state;
|
|
84
|
-
}
|
|
85
|
-
if (state.routes.length <= 1) {
|
|
86
|
-
// Can't pop the last route
|
|
87
|
-
return state;
|
|
88
|
-
}
|
|
89
|
-
const nextRoutes = state.routes.filter(
|
|
90
|
-
(route) => route.key !== action.key,
|
|
91
|
-
);
|
|
92
|
-
return {
|
|
93
|
-
...state,
|
|
94
|
-
routes: nextRoutes,
|
|
95
|
-
index: Math.min(state.index, nextRoutes.length - 1),
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
case "NAVIGATE": {
|
|
100
|
-
if (!action.screens[action.name]) {
|
|
101
|
-
console.warn(
|
|
102
|
-
`[ComponentStack] Screen "${action.name}" not found in navigator`,
|
|
103
|
-
);
|
|
104
|
-
return state;
|
|
105
|
-
}
|
|
106
|
-
// Check if screen already exists in stack
|
|
107
|
-
const existingIndex = state.routes.findIndex(
|
|
108
|
-
(route) => route.name === action.name,
|
|
109
|
-
);
|
|
110
|
-
if (existingIndex !== -1) {
|
|
111
|
-
// Navigate to existing screen (pop to it)
|
|
112
|
-
return {
|
|
113
|
-
...state,
|
|
114
|
-
routes: state.routes.slice(0, existingIndex + 1),
|
|
115
|
-
index: existingIndex,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
// Push new screen
|
|
119
|
-
const newRoute = createRoute(action.name, action.params);
|
|
120
|
-
return {
|
|
121
|
-
...state,
|
|
122
|
-
routes: [...state.routes, newRoute],
|
|
123
|
-
index: state.routes.length,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
case "RESET": {
|
|
128
|
-
const targetName = action.name || action.initialRouteName;
|
|
129
|
-
if (!action.screens[targetName]) {
|
|
130
|
-
console.warn(
|
|
131
|
-
`[ComponentStack] Screen "${targetName}" not found in navigator`,
|
|
132
|
-
);
|
|
133
|
-
return state;
|
|
134
|
-
}
|
|
135
|
-
const newRoute = createRoute(targetName, action.params);
|
|
136
|
-
return {
|
|
137
|
-
...state,
|
|
138
|
-
routes: [newRoute],
|
|
139
|
-
index: 0,
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
default:
|
|
144
|
-
return state;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
interface UseComponentNavigationBuilderOptions {
|
|
149
|
-
children: React.ReactNode;
|
|
150
|
-
initialRouteName?: string;
|
|
151
|
-
screenOptions?: ComponentStackNavigationOptions;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
interface ComponentNavigationBuilderResult {
|
|
155
|
-
state: ComponentStackState;
|
|
156
|
-
navigation: ComponentNavigation;
|
|
157
|
-
describe: (
|
|
158
|
-
route: ComponentRoute,
|
|
159
|
-
placeholder: boolean,
|
|
160
|
-
) => ComponentStackDescriptor;
|
|
161
|
-
descriptors: ComponentStackDescriptorMap;
|
|
162
|
-
NavigationContent: React.FC<{ children: React.ReactNode }>;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Parse children to extract screen configurations.
|
|
167
|
-
* Expects children to be ComponentScreen elements.
|
|
168
|
-
*/
|
|
169
|
-
function parseScreens(children: React.ReactNode): ScreenRegistry {
|
|
170
|
-
const screens: ScreenRegistry = {};
|
|
171
|
-
|
|
172
|
-
React.Children.forEach(children, (child) => {
|
|
173
|
-
if (!React.isValidElement(child)) {
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const props = child.props as ComponentScreenProps;
|
|
178
|
-
if (props.name && props.component) {
|
|
179
|
-
screens[props.name] = {
|
|
180
|
-
name: props.name,
|
|
181
|
-
component: props.component,
|
|
182
|
-
options: props.options,
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
return screens;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export function useComponentNavigationBuilder({
|
|
191
|
-
children,
|
|
192
|
-
initialRouteName,
|
|
193
|
-
screenOptions,
|
|
194
|
-
}: UseComponentNavigationBuilderOptions): ComponentNavigationBuilderResult {
|
|
195
|
-
// Parse screen configs from children
|
|
196
|
-
const screens = useMemo(() => parseScreens(children), [children]);
|
|
197
|
-
|
|
198
|
-
// Determine initial route
|
|
199
|
-
const screenNames = Object.keys(screens);
|
|
200
|
-
const initialRoute = initialRouteName || screenNames[0];
|
|
201
|
-
|
|
202
|
-
if (!initialRoute) {
|
|
203
|
-
throw new Error(
|
|
204
|
-
"[ComponentStack] No screens defined. Add at least one ComponentStack.Screen child.",
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// Stable stack key
|
|
209
|
-
const stackKeyRef = useRef(generateStackKey());
|
|
210
|
-
|
|
211
|
-
// Navigation state reducer
|
|
212
|
-
const [state, internalDispatch] = useReducer(
|
|
213
|
-
(state: ComponentStackState, action: NavigationAction) =>
|
|
214
|
-
navigationReducer(state, {
|
|
215
|
-
...action,
|
|
216
|
-
screens,
|
|
217
|
-
initialRouteName: initialRoute,
|
|
218
|
-
}),
|
|
219
|
-
{
|
|
220
|
-
routes: [createRoute(initialRoute)],
|
|
221
|
-
index: 0,
|
|
222
|
-
key: stackKeyRef.current,
|
|
223
|
-
},
|
|
224
|
-
);
|
|
225
|
-
|
|
226
|
-
// Dispatch method that handles both internal actions and StackActions format
|
|
227
|
-
const dispatch = useCallback(
|
|
228
|
-
(
|
|
229
|
-
action:
|
|
230
|
-
| NavigationAction
|
|
231
|
-
| { type: string; source?: string; target?: string; payload?: unknown },
|
|
232
|
-
) => {
|
|
233
|
-
// Handle StackActions.pop() format from useLocalRoutes: { type: 'POP', source: routeKey }
|
|
234
|
-
if (
|
|
235
|
-
action.type === "POP" &&
|
|
236
|
-
"source" in action &&
|
|
237
|
-
typeof action.source === "string"
|
|
238
|
-
) {
|
|
239
|
-
internalDispatch({ type: "POP_BY_KEY", key: action.source });
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// Handle standard internal actions
|
|
244
|
-
switch (action.type) {
|
|
245
|
-
case "PUSH":
|
|
246
|
-
if ("name" in action && typeof action.name === "string") {
|
|
247
|
-
internalDispatch({
|
|
248
|
-
type: "PUSH",
|
|
249
|
-
name: action.name,
|
|
250
|
-
params: action.params as Record<string, unknown> | undefined,
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
break;
|
|
254
|
-
case "POP":
|
|
255
|
-
internalDispatch({ type: "POP" });
|
|
256
|
-
break;
|
|
257
|
-
case "NAVIGATE":
|
|
258
|
-
if ("name" in action && typeof action.name === "string") {
|
|
259
|
-
internalDispatch({
|
|
260
|
-
type: "NAVIGATE",
|
|
261
|
-
name: action.name,
|
|
262
|
-
params: action.params as Record<string, unknown> | undefined,
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
break;
|
|
266
|
-
case "RESET":
|
|
267
|
-
internalDispatch({
|
|
268
|
-
type: "RESET",
|
|
269
|
-
name:
|
|
270
|
-
"name" in action
|
|
271
|
-
? (action.name as string | undefined)
|
|
272
|
-
: undefined,
|
|
273
|
-
params:
|
|
274
|
-
"params" in action
|
|
275
|
-
? (action.params as Record<string, unknown> | undefined)
|
|
276
|
-
: undefined,
|
|
277
|
-
});
|
|
278
|
-
break;
|
|
279
|
-
case "POP_BY_KEY":
|
|
280
|
-
if ("key" in action && typeof action.key === "string") {
|
|
281
|
-
internalDispatch({ type: "POP_BY_KEY", key: action.key });
|
|
282
|
-
}
|
|
283
|
-
break;
|
|
284
|
-
}
|
|
285
|
-
},
|
|
286
|
-
[],
|
|
287
|
-
);
|
|
288
|
-
|
|
289
|
-
// Ref for getState to always return latest state
|
|
290
|
-
const stateRef = useRef(state);
|
|
291
|
-
stateRef.current = state;
|
|
292
|
-
|
|
293
|
-
// Navigation object
|
|
294
|
-
const navigation: ComponentNavigation = useMemo(() => {
|
|
295
|
-
return {
|
|
296
|
-
push: (name: string, params?: Record<string, unknown>) => {
|
|
297
|
-
internalDispatch({ type: "PUSH", name, params });
|
|
298
|
-
},
|
|
299
|
-
pop: () => {
|
|
300
|
-
internalDispatch({ type: "POP" });
|
|
301
|
-
},
|
|
302
|
-
goBack: () => {
|
|
303
|
-
internalDispatch({ type: "POP" });
|
|
304
|
-
},
|
|
305
|
-
navigate: (name: string, params?: Record<string, unknown>) => {
|
|
306
|
-
internalDispatch({ type: "NAVIGATE", name, params });
|
|
307
|
-
},
|
|
308
|
-
canGoBack: () => stateRef.current.routes.length > 1,
|
|
309
|
-
reset: (name?: string, params?: Record<string, unknown>) => {
|
|
310
|
-
internalDispatch({ type: "RESET", name, params });
|
|
311
|
-
},
|
|
312
|
-
dispatch,
|
|
313
|
-
getState: () => stateRef.current,
|
|
314
|
-
index: state.index,
|
|
315
|
-
};
|
|
316
|
-
}, [state.index, dispatch]);
|
|
317
|
-
|
|
318
|
-
// Build descriptors for each route
|
|
319
|
-
const descriptors = useMemo(() => {
|
|
320
|
-
const result: ComponentStackDescriptorMap = {};
|
|
321
|
-
|
|
322
|
-
for (const route of state.routes) {
|
|
323
|
-
const screenConfig = screens[route.name];
|
|
324
|
-
if (!screenConfig) {
|
|
325
|
-
continue;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const Component = screenConfig.component;
|
|
329
|
-
const mergedOptions: ComponentStackNavigationOptions = {
|
|
330
|
-
...screenOptions,
|
|
331
|
-
...screenConfig.options,
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
const descriptor: ComponentStackDescriptor = {
|
|
335
|
-
route,
|
|
336
|
-
navigation,
|
|
337
|
-
options: mergedOptions,
|
|
338
|
-
render: (): React.JSX.Element => (
|
|
339
|
-
<Component navigation={navigation} route={route} />
|
|
340
|
-
),
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
result[route.key] = descriptor;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
return result;
|
|
347
|
-
}, [state.routes, screens, screenOptions, navigation]);
|
|
348
|
-
|
|
349
|
-
// Describe function: creates a descriptor for a route (used for placeholder screens)
|
|
350
|
-
const describe = useCallback(
|
|
351
|
-
(route: ComponentRoute, placeholder: boolean): ComponentStackDescriptor => {
|
|
352
|
-
const screenConfig = screens[route.name];
|
|
353
|
-
const mergedOptions: ComponentStackNavigationOptions = {
|
|
354
|
-
...screenOptions,
|
|
355
|
-
...screenConfig?.options,
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
const Component = screenConfig?.component;
|
|
359
|
-
|
|
360
|
-
return {
|
|
361
|
-
route,
|
|
362
|
-
navigation,
|
|
363
|
-
options: mergedOptions,
|
|
364
|
-
render: (): React.JSX.Element | null =>
|
|
365
|
-
placeholder || !Component ? null : (
|
|
366
|
-
<Component navigation={navigation} route={route} />
|
|
367
|
-
),
|
|
368
|
-
};
|
|
369
|
-
},
|
|
370
|
-
[screens, screenOptions, navigation],
|
|
371
|
-
);
|
|
372
|
-
|
|
373
|
-
// NavigationContent wrapper (simple pass-through for component-stack)
|
|
374
|
-
const NavigationContent = useCallback(
|
|
375
|
-
({ children }: { children: React.ReactNode }) => {
|
|
376
|
-
return <>{children}</>;
|
|
377
|
-
},
|
|
378
|
-
[],
|
|
379
|
-
);
|
|
380
|
-
|
|
381
|
-
return {
|
|
382
|
-
state,
|
|
383
|
-
navigation,
|
|
384
|
-
describe,
|
|
385
|
-
descriptors,
|
|
386
|
-
NavigationContent,
|
|
387
|
-
};
|
|
388
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { useComponentNavigationContext } from "../navigators/create-component-navigator";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Hook to access the component navigation object from within a screen.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* function MyScreen() {
|
|
9
|
-
* const navigation = useComponentNavigation();
|
|
10
|
-
*
|
|
11
|
-
* return (
|
|
12
|
-
* <Button
|
|
13
|
-
* title="Go to Details"
|
|
14
|
-
* onPress={() => navigation.push('Details')}
|
|
15
|
-
* />
|
|
16
|
-
* );
|
|
17
|
-
* }
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export function useComponentNavigation() {
|
|
21
|
-
return useComponentNavigationContext();
|
|
22
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import type { ManagedStackProps } from "../../shared/providers/stack/managed.provider";
|
|
3
|
-
import { ComponentView } from "../components/component-view";
|
|
4
|
-
import { useComponentNavigationBuilder } from "../hooks/use-component-navigation-builder";
|
|
5
|
-
import type {
|
|
6
|
-
ComponentNavigation,
|
|
7
|
-
ComponentNavigatorProps,
|
|
8
|
-
ComponentScreenProps,
|
|
9
|
-
ComponentStackDescriptor,
|
|
10
|
-
} from "../types";
|
|
11
|
-
|
|
12
|
-
// Context for component navigation
|
|
13
|
-
const ComponentNavigationContext =
|
|
14
|
-
React.createContext<ComponentNavigation | null>(null);
|
|
15
|
-
|
|
16
|
-
export function useComponentNavigationContext(): ComponentNavigation {
|
|
17
|
-
const context = React.useContext(ComponentNavigationContext);
|
|
18
|
-
if (!context) {
|
|
19
|
-
throw new Error(
|
|
20
|
-
"useComponentNavigation must be used within a ComponentStack.Navigator",
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
return context;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Screen component for defining screens in a ComponentNavigator.
|
|
28
|
-
* This is a configuration component - it doesn't render anything itself.
|
|
29
|
-
*/
|
|
30
|
-
function ComponentScreen(_props: ComponentScreenProps): null {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Navigator component that manages internal component navigation.
|
|
36
|
-
* Does not affect React Navigation or Expo Router routes.
|
|
37
|
-
*/
|
|
38
|
-
function ComponentNavigator({
|
|
39
|
-
children,
|
|
40
|
-
initialRouteName,
|
|
41
|
-
screenOptions,
|
|
42
|
-
}: ComponentNavigatorProps) {
|
|
43
|
-
const { state, navigation, describe, descriptors, NavigationContent } =
|
|
44
|
-
useComponentNavigationBuilder({
|
|
45
|
-
children,
|
|
46
|
-
initialRouteName,
|
|
47
|
-
screenOptions,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const managedStackProps: ManagedStackProps<
|
|
51
|
-
ComponentStackDescriptor,
|
|
52
|
-
ComponentNavigation
|
|
53
|
-
> = {
|
|
54
|
-
state,
|
|
55
|
-
navigation,
|
|
56
|
-
describe,
|
|
57
|
-
descriptors,
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<ComponentNavigationContext.Provider value={navigation}>
|
|
62
|
-
<NavigationContent>
|
|
63
|
-
<ComponentView {...managedStackProps} />
|
|
64
|
-
</NavigationContent>
|
|
65
|
-
</ComponentNavigationContext.Provider>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
interface ComponentStack {
|
|
70
|
-
Navigator: React.FC<ComponentNavigatorProps>;
|
|
71
|
-
Screen: React.FC<ComponentScreenProps>;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Creates a component navigation stack.
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```tsx
|
|
79
|
-
* const Stack = createComponentNavigator();
|
|
80
|
-
*
|
|
81
|
-
* function MyComponent() {
|
|
82
|
-
* return (
|
|
83
|
-
* <Stack.Navigator initialRouteName="Home">
|
|
84
|
-
* <Stack.Screen
|
|
85
|
-
* name="Home"
|
|
86
|
-
* component={HomeScreen}
|
|
87
|
-
* options={{ ...SlideFromBottom() }}
|
|
88
|
-
* />
|
|
89
|
-
* <Stack.Screen
|
|
90
|
-
* name="Details"
|
|
91
|
-
* component={DetailsScreen}
|
|
92
|
-
* options={{ ...SlideFromBottom() }}
|
|
93
|
-
* />
|
|
94
|
-
* </Stack.Navigator>
|
|
95
|
-
* );
|
|
96
|
-
* }
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
export function createComponentNavigator(): ComponentStack {
|
|
100
|
-
return {
|
|
101
|
-
Navigator: ComponentNavigator,
|
|
102
|
-
Screen: ComponentScreen,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { memo, useMemo } from "react";
|
|
2
|
-
import { useWindowDimensions } from "react-native";
|
|
3
|
-
import { useDerivedValue } from "react-native-reanimated";
|
|
4
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
|
-
import type { useScreenAnimation } from "../../../hooks/animation/use-screen-animation";
|
|
6
|
-
import { type StackScene, useStack } from "../../../hooks/navigation/use-stack";
|
|
7
|
-
import type { OverlayInterpolationProps } from "../../../types/animation.types";
|
|
8
|
-
import type { ContainerOverlayProps } from "../../../types/overlay.types";
|
|
9
|
-
import { getActiveContainerOverlay } from "../helpers/get-active-overlay";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Inner component that renders when container overlay is active.
|
|
13
|
-
* Separated to ensure hooks are called unconditionally.
|
|
14
|
-
*/
|
|
15
|
-
const ContainerOverlayHost = memo(function ContainerOverlayHost({
|
|
16
|
-
children,
|
|
17
|
-
scene,
|
|
18
|
-
scenes,
|
|
19
|
-
overlayIndex,
|
|
20
|
-
}: {
|
|
21
|
-
children: React.ReactNode;
|
|
22
|
-
scene: StackScene;
|
|
23
|
-
scenes: StackScene[];
|
|
24
|
-
overlayIndex: number;
|
|
25
|
-
}) {
|
|
26
|
-
const { routes, focusedIndex, stackProgress } = useStack();
|
|
27
|
-
const screen = useWindowDimensions();
|
|
28
|
-
const insets = useSafeAreaInsets();
|
|
29
|
-
|
|
30
|
-
const OverlayComponent = scene.descriptor.options.overlay;
|
|
31
|
-
|
|
32
|
-
// Compute relative progress from overlay position
|
|
33
|
-
const relativeProgress = useDerivedValue(() => {
|
|
34
|
-
"worklet";
|
|
35
|
-
return stackProgress.value - overlayIndex;
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const overlayAnimation = useDerivedValue<OverlayInterpolationProps>(() => ({
|
|
39
|
-
progress: relativeProgress.value,
|
|
40
|
-
layouts: { screen },
|
|
41
|
-
insets,
|
|
42
|
-
}));
|
|
43
|
-
|
|
44
|
-
// Get focused scene for meta and route info
|
|
45
|
-
const focusedScene = scenes[focusedIndex] ?? scene;
|
|
46
|
-
|
|
47
|
-
if (!OverlayComponent) {
|
|
48
|
-
return <>{children}</>;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const overlayProps: ContainerOverlayProps<
|
|
52
|
-
typeof scene.descriptor.navigation
|
|
53
|
-
> = {
|
|
54
|
-
children,
|
|
55
|
-
routes,
|
|
56
|
-
overlayAnimation,
|
|
57
|
-
// screenAnimation is not available at container level, pass a placeholder
|
|
58
|
-
screenAnimation: overlayAnimation as unknown as ReturnType<
|
|
59
|
-
typeof useScreenAnimation
|
|
60
|
-
>,
|
|
61
|
-
focusedRoute: focusedScene.route,
|
|
62
|
-
focusedIndex,
|
|
63
|
-
meta: focusedScene.descriptor.options.meta,
|
|
64
|
-
navigation: scene.descriptor.navigation,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
return <OverlayComponent {...overlayProps} />;
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Container overlay component that wraps all screen content.
|
|
72
|
-
* Receives children (the screens) and passes them to the overlay component.
|
|
73
|
-
*/
|
|
74
|
-
export function ContainerOverlay({ children }: { children: React.ReactNode }) {
|
|
75
|
-
const { scenes, flags } = useStack();
|
|
76
|
-
|
|
77
|
-
const activeOverlay = useMemo(
|
|
78
|
-
() => getActiveContainerOverlay(scenes, flags.TRANSITIONS_ALWAYS_ON),
|
|
79
|
-
[scenes, flags.TRANSITIONS_ALWAYS_ON],
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
// If no container overlay, just render children directly
|
|
83
|
-
if (!activeOverlay) {
|
|
84
|
-
return <>{children}</>;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const { scene, overlayIndex } = activeOverlay;
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<ContainerOverlayHost
|
|
91
|
-
scene={scene}
|
|
92
|
-
scenes={scenes}
|
|
93
|
-
overlayIndex={overlayIndex}
|
|
94
|
-
>
|
|
95
|
-
{children}
|
|
96
|
-
</ContainerOverlayHost>
|
|
97
|
-
);
|
|
98
|
-
}
|