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
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NavigationContext,
|
|
3
|
+
NavigationRouteContext,
|
|
4
|
+
} from "@react-navigation/native";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { Fragment } from "react";
|
|
7
|
+
import { Overlay } from "../../shared/components/overlay";
|
|
8
|
+
import { ManagedLifecycle } from "../../shared/controller/managed-lifecycle";
|
|
9
|
+
import { ScreenComposer } from "../../shared/providers/screen/screen-composer";
|
|
10
|
+
import { withStackCore } from "../../shared/providers/stack/core.provider";
|
|
11
|
+
import { withManagedStack } from "../../shared/providers/stack/managed.provider";
|
|
12
|
+
import type {
|
|
13
|
+
BlankStackDescriptor,
|
|
14
|
+
BlankStackNavigationHelpers,
|
|
15
|
+
} from "../types";
|
|
16
|
+
import { AdjustedScreen } from "./adjusted-screen";
|
|
17
|
+
import { AdjustedScreenContainer } from "./adjusted-screen-container";
|
|
18
|
+
|
|
19
|
+
function isFabric() {
|
|
20
|
+
return "nativeFabricUIManager" in global;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type SceneViewProps = {
|
|
24
|
+
descriptor: BlankStackDescriptor;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const SceneView = React.memo(function SceneView({
|
|
28
|
+
descriptor,
|
|
29
|
+
}: SceneViewProps) {
|
|
30
|
+
const { route, navigation, render } = descriptor;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<NavigationContext.Provider value={navigation}>
|
|
34
|
+
<NavigationRouteContext.Provider value={route}>
|
|
35
|
+
{descriptor.options.overlayMode === "screen" && <Overlay.Screen />}
|
|
36
|
+
{render()}
|
|
37
|
+
</NavigationRouteContext.Provider>
|
|
38
|
+
</NavigationContext.Provider>
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const StackView = withStackCore(
|
|
43
|
+
{ TRANSITIONS_ALWAYS_ON: true, DISABLE_NATIVE_SCREENS: false },
|
|
44
|
+
withManagedStack<BlankStackDescriptor, BlankStackNavigationHelpers>(
|
|
45
|
+
({ descriptors, focusedIndex, scenes, shouldShowFloatOverlay }) => {
|
|
46
|
+
return (
|
|
47
|
+
<Fragment>
|
|
48
|
+
{shouldShowFloatOverlay ? <Overlay.Float /> : null}
|
|
49
|
+
|
|
50
|
+
<AdjustedScreenContainer>
|
|
51
|
+
{scenes.map((scene, sceneIndex) => {
|
|
52
|
+
const descriptor = scene.descriptor;
|
|
53
|
+
const route = scene.route;
|
|
54
|
+
const isFocused = focusedIndex === sceneIndex;
|
|
55
|
+
const isBelowFocused = focusedIndex - 1 === sceneIndex;
|
|
56
|
+
|
|
57
|
+
const previousDescriptor =
|
|
58
|
+
scenes[sceneIndex - 1]?.descriptor ?? undefined;
|
|
59
|
+
const nextDescriptor =
|
|
60
|
+
scenes[sceneIndex + 1]?.descriptor ?? undefined;
|
|
61
|
+
|
|
62
|
+
const isPreloaded = descriptors[route.key] === undefined;
|
|
63
|
+
|
|
64
|
+
// On Fabric, when screen is frozen, animated and reanimated values are not updated
|
|
65
|
+
// due to component being unmounted. To avoid this, we don't freeze the previous screen there
|
|
66
|
+
const shouldFreeze = isFabric()
|
|
67
|
+
? !isPreloaded && !isFocused && !isBelowFocused
|
|
68
|
+
: !isPreloaded && !isFocused;
|
|
69
|
+
return (
|
|
70
|
+
<AdjustedScreen
|
|
71
|
+
key={route.key}
|
|
72
|
+
isPreloaded={isPreloaded}
|
|
73
|
+
index={sceneIndex}
|
|
74
|
+
routeKey={route.key}
|
|
75
|
+
shouldFreeze={shouldFreeze}
|
|
76
|
+
freezeOnBlur={descriptor.options.freezeOnBlur}
|
|
77
|
+
>
|
|
78
|
+
<ScreenComposer
|
|
79
|
+
previous={previousDescriptor}
|
|
80
|
+
current={descriptor}
|
|
81
|
+
next={nextDescriptor}
|
|
82
|
+
LifecycleController={ManagedLifecycle}
|
|
83
|
+
>
|
|
84
|
+
<SceneView key={route.key} descriptor={descriptor} />
|
|
85
|
+
</ScreenComposer>
|
|
86
|
+
</AdjustedScreen>
|
|
87
|
+
);
|
|
88
|
+
})}
|
|
89
|
+
</AdjustedScreenContainer>
|
|
90
|
+
</Fragment>
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
),
|
|
94
|
+
);
|
|
@@ -4,18 +4,17 @@ import {
|
|
|
4
4
|
} from "@react-navigation/native";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { Fragment } from "react";
|
|
7
|
-
import { StyleSheet } from "react-native";
|
|
8
|
-
import { ScreenContainer } from "react-native-screens";
|
|
9
7
|
import { Overlay } from "../../shared/components/overlay";
|
|
8
|
+
import { ManagedLifecycle } from "../../shared/controller/managed-lifecycle";
|
|
10
9
|
import { ScreenComposer } from "../../shared/providers/screen/screen-composer";
|
|
11
10
|
import { withStackCore } from "../../shared/providers/stack/core.provider";
|
|
12
11
|
import { withManagedStack } from "../../shared/providers/stack/managed.provider";
|
|
13
|
-
import { BlankStackScreenLifecycleController } from "../controllers/blank-stack-lifecycle";
|
|
14
12
|
import type {
|
|
15
13
|
BlankStackDescriptor,
|
|
16
14
|
BlankStackNavigationHelpers,
|
|
17
15
|
} from "../types";
|
|
18
|
-
import {
|
|
16
|
+
import { AdjustedScreen } from "./adjusted-screen";
|
|
17
|
+
import { AdjustedScreenContainer } from "./adjusted-screen-container";
|
|
19
18
|
|
|
20
19
|
function isFabric() {
|
|
21
20
|
return "nativeFabricUIManager" in global;
|
|
@@ -41,60 +40,55 @@ const SceneView = React.memo(function SceneView({
|
|
|
41
40
|
});
|
|
42
41
|
|
|
43
42
|
export const StackView = withStackCore(
|
|
44
|
-
{ TRANSITIONS_ALWAYS_ON: true },
|
|
43
|
+
{ TRANSITIONS_ALWAYS_ON: true, DISABLE_NATIVE_SCREENS: true },
|
|
45
44
|
withManagedStack<BlankStackDescriptor, BlankStackNavigationHelpers>(
|
|
46
45
|
({ descriptors, focusedIndex, scenes, shouldShowFloatOverlay }) => {
|
|
47
46
|
return (
|
|
48
47
|
<Fragment>
|
|
49
48
|
{shouldShowFloatOverlay ? <Overlay.Float /> : null}
|
|
50
|
-
<Overlay.Container>
|
|
51
|
-
<ScreenContainer style={styles.container}>
|
|
52
|
-
{scenes.map((scene, sceneIndex) => {
|
|
53
|
-
const descriptor = scene.descriptor;
|
|
54
|
-
const route = scene.route;
|
|
55
|
-
const isFocused = focusedIndex === sceneIndex;
|
|
56
|
-
const isBelowFocused = focusedIndex - 1 === sceneIndex;
|
|
57
49
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
<AdjustedScreenContainer>
|
|
51
|
+
{scenes.map((scene, sceneIndex) => {
|
|
52
|
+
const descriptor = scene.descriptor;
|
|
53
|
+
const route = scene.route;
|
|
54
|
+
const isFocused = focusedIndex === sceneIndex;
|
|
55
|
+
const isBelowFocused = focusedIndex - 1 === sceneIndex;
|
|
62
56
|
|
|
63
|
-
|
|
57
|
+
const previousDescriptor =
|
|
58
|
+
scenes[sceneIndex - 1]?.descriptor ?? undefined;
|
|
59
|
+
const nextDescriptor =
|
|
60
|
+
scenes[sceneIndex + 1]?.descriptor ?? undefined;
|
|
64
61
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
62
|
+
const isPreloaded = descriptors[route.key] === undefined;
|
|
63
|
+
|
|
64
|
+
// On Fabric, when screen is frozen, animated and reanimated values are not updated
|
|
65
|
+
// due to component being unmounted. To avoid this, we don't freeze the previous screen there
|
|
66
|
+
const shouldFreeze = isFabric()
|
|
67
|
+
? !isPreloaded && !isFocused && !isBelowFocused
|
|
68
|
+
: !isPreloaded && !isFocused;
|
|
69
|
+
return (
|
|
70
|
+
<AdjustedScreen
|
|
71
|
+
key={route.key}
|
|
72
|
+
isPreloaded={isPreloaded}
|
|
73
|
+
index={sceneIndex}
|
|
74
|
+
routeKey={route.key}
|
|
75
|
+
shouldFreeze={shouldFreeze}
|
|
76
|
+
freezeOnBlur={descriptor.options.freezeOnBlur}
|
|
77
|
+
>
|
|
78
|
+
<ScreenComposer
|
|
79
|
+
previous={previousDescriptor}
|
|
80
|
+
current={descriptor}
|
|
81
|
+
next={nextDescriptor}
|
|
82
|
+
LifecycleController={ManagedLifecycle}
|
|
78
83
|
>
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<SceneView key={route.key} descriptor={descriptor} />
|
|
86
|
-
</ScreenComposer>
|
|
87
|
-
</Screen>
|
|
88
|
-
);
|
|
89
|
-
})}
|
|
90
|
-
</ScreenContainer>
|
|
91
|
-
</Overlay.Container>
|
|
84
|
+
<SceneView key={route.key} descriptor={descriptor} />
|
|
85
|
+
</ScreenComposer>
|
|
86
|
+
</AdjustedScreen>
|
|
87
|
+
);
|
|
88
|
+
})}
|
|
89
|
+
</AdjustedScreenContainer>
|
|
92
90
|
</Fragment>
|
|
93
91
|
);
|
|
94
92
|
},
|
|
95
93
|
),
|
|
96
94
|
);
|
|
97
|
-
|
|
98
|
-
const styles = StyleSheet.create({
|
|
99
|
-
container: { flex: 1 },
|
|
100
|
-
});
|
package/src/blank-stack/types.ts
CHANGED
|
@@ -57,8 +57,9 @@ export type BlankStackScene = {
|
|
|
57
57
|
descriptor: BlankStackDescriptor;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
type BlankStackNavigationConfig = {
|
|
61
|
+
DISABLE_NATIVE_SCREENS?: boolean;
|
|
62
|
+
};
|
|
62
63
|
|
|
63
64
|
/**
|
|
64
65
|
* Props passed to overlay components in blank-stack.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StyleSheet, View } from "react-native";
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const ComponentScreenContainer = ({ children }: Props) => {
|
|
8
|
+
return <View style={styles.container}>{children}</View>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const styles = StyleSheet.create({
|
|
12
|
+
container: {
|
|
13
|
+
flex: 1,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { StyleSheet, type View } from "react-native";
|
|
3
|
+
import Animated, {
|
|
4
|
+
useAnimatedProps,
|
|
5
|
+
useAnimatedRef,
|
|
6
|
+
} from "react-native-reanimated";
|
|
7
|
+
import { LayoutAnchorProvider } from "../../shared/providers/layout-anchor.provider";
|
|
8
|
+
import { AnimationStore } from "../../shared/stores/animation.store";
|
|
9
|
+
|
|
10
|
+
interface ScreenProps {
|
|
11
|
+
routeKey: string;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const ComponentScreen = ({ routeKey, children }: ScreenProps) => {
|
|
16
|
+
const sceneClosing = AnimationStore.getAnimation(routeKey, "closing");
|
|
17
|
+
const screenRef = useAnimatedRef<View>();
|
|
18
|
+
|
|
19
|
+
const animatedProps = useAnimatedProps(() => {
|
|
20
|
+
return {
|
|
21
|
+
pointerEvents: sceneClosing.get()
|
|
22
|
+
? ("none" as const)
|
|
23
|
+
: ("box-none" as const),
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const ComponentScreenComponent = Animated.View;
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<ComponentScreenComponent
|
|
31
|
+
ref={screenRef}
|
|
32
|
+
style={StyleSheet.absoluteFill}
|
|
33
|
+
animatedProps={animatedProps}
|
|
34
|
+
>
|
|
35
|
+
<LayoutAnchorProvider anchorRef={screenRef}>
|
|
36
|
+
{children}
|
|
37
|
+
</LayoutAnchorProvider>
|
|
38
|
+
</ComponentScreenComponent>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NavigationContext,
|
|
3
|
+
NavigationRouteContext,
|
|
4
|
+
} from "@react-navigation/native";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { Fragment } from "react";
|
|
7
|
+
import { Overlay } from "../../shared/components/overlay";
|
|
8
|
+
import { ManagedLifecycle } from "../../shared/controller/managed-lifecycle";
|
|
9
|
+
import { ScreenComposer } from "../../shared/providers/screen/screen-composer";
|
|
10
|
+
import { withStackCore } from "../../shared/providers/stack/core.provider";
|
|
11
|
+
import { withManagedStack } from "../../shared/providers/stack/managed.provider";
|
|
12
|
+
import type {
|
|
13
|
+
ComponentStackDescriptor,
|
|
14
|
+
ComponentStackNavigationHelpers,
|
|
15
|
+
} from "../types";
|
|
16
|
+
import { ComponentScreen } from "./component-screen";
|
|
17
|
+
import { ComponentScreenContainer } from "./component-screen-container";
|
|
18
|
+
|
|
19
|
+
type SceneViewProps = {
|
|
20
|
+
descriptor: ComponentStackDescriptor;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const SceneView = React.memo(function SceneView({
|
|
24
|
+
descriptor,
|
|
25
|
+
}: SceneViewProps) {
|
|
26
|
+
const { route, navigation, render } = descriptor;
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<NavigationContext.Provider value={navigation}>
|
|
30
|
+
<NavigationRouteContext.Provider value={route}>
|
|
31
|
+
{descriptor.options.overlayMode === "screen" && <Overlay.Screen />}
|
|
32
|
+
{render()}
|
|
33
|
+
</NavigationRouteContext.Provider>
|
|
34
|
+
</NavigationContext.Provider>
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const StackView = withStackCore(
|
|
39
|
+
{ TRANSITIONS_ALWAYS_ON: true },
|
|
40
|
+
withManagedStack<ComponentStackDescriptor, ComponentStackNavigationHelpers>(
|
|
41
|
+
({ scenes, shouldShowFloatOverlay }) => {
|
|
42
|
+
return (
|
|
43
|
+
<Fragment>
|
|
44
|
+
{shouldShowFloatOverlay ? <Overlay.Float /> : null}
|
|
45
|
+
|
|
46
|
+
<ComponentScreenContainer>
|
|
47
|
+
{scenes.map((scene, sceneIndex) => {
|
|
48
|
+
const descriptor = scene.descriptor;
|
|
49
|
+
const route = scene.route;
|
|
50
|
+
|
|
51
|
+
const previousDescriptor =
|
|
52
|
+
scenes[sceneIndex - 1]?.descriptor ?? undefined;
|
|
53
|
+
const nextDescriptor =
|
|
54
|
+
scenes[sceneIndex + 1]?.descriptor ?? undefined;
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<ComponentScreen key={route.key} routeKey={route.key}>
|
|
58
|
+
<ScreenComposer
|
|
59
|
+
previous={previousDescriptor}
|
|
60
|
+
current={descriptor}
|
|
61
|
+
next={nextDescriptor}
|
|
62
|
+
LifecycleController={ManagedLifecycle}
|
|
63
|
+
>
|
|
64
|
+
<SceneView key={route.key} descriptor={descriptor} />
|
|
65
|
+
</ScreenComposer>
|
|
66
|
+
</ComponentScreen>
|
|
67
|
+
);
|
|
68
|
+
})}
|
|
69
|
+
</ComponentScreenContainer>
|
|
70
|
+
</Fragment>
|
|
71
|
+
);
|
|
72
|
+
},
|
|
73
|
+
),
|
|
74
|
+
);
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { createComponentNavigator } from "./navigators/create-component-navigator";
|
|
1
|
+
export { createComponentStackNavigator } from "../component-stack/navigators/create-component-stack-navigator";
|
|
3
2
|
export type {
|
|
4
|
-
|
|
5
|
-
ComponentNavigatorProps,
|
|
6
|
-
ComponentRoute,
|
|
7
|
-
ComponentScreenConfig,
|
|
8
|
-
ComponentScreenProps,
|
|
9
|
-
ComponentStackDescriptor,
|
|
3
|
+
ComponentStackNavigationEventMap,
|
|
10
4
|
ComponentStackNavigationOptions,
|
|
5
|
+
ComponentStackNavigationProp,
|
|
6
|
+
ComponentStackNavigatorProps,
|
|
7
|
+
ComponentStackOptionsArgs,
|
|
11
8
|
ComponentStackOverlayProps,
|
|
12
|
-
ComponentStackScene,
|
|
13
9
|
ComponentStackScreenProps,
|
|
14
|
-
|
|
15
|
-
ComponentStackState,
|
|
16
|
-
} from "./types";
|
|
10
|
+
} from "../component-stack/types";
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createNavigatorFactory,
|
|
3
|
+
NavigationContainer,
|
|
4
|
+
NavigationIndependentTree,
|
|
5
|
+
type NavigatorTypeBagBase,
|
|
6
|
+
type ParamListBase,
|
|
7
|
+
type StackActionHelpers,
|
|
8
|
+
type StackNavigationState,
|
|
9
|
+
StackRouter,
|
|
10
|
+
type StackRouterOptions,
|
|
11
|
+
type StaticConfig,
|
|
12
|
+
type TypedNavigator,
|
|
13
|
+
useNavigationBuilder,
|
|
14
|
+
} from "@react-navigation/native";
|
|
15
|
+
import { StackView } from "../components/stack-view";
|
|
16
|
+
import type {
|
|
17
|
+
ComponentStackNavigationEventMap,
|
|
18
|
+
ComponentStackNavigationOptions,
|
|
19
|
+
ComponentStackNavigationProp,
|
|
20
|
+
ComponentStackNavigatorProps,
|
|
21
|
+
} from "../types";
|
|
22
|
+
|
|
23
|
+
function ComponentStackNavigator({
|
|
24
|
+
id,
|
|
25
|
+
initialRouteName,
|
|
26
|
+
children,
|
|
27
|
+
layout,
|
|
28
|
+
screenListeners,
|
|
29
|
+
screenOptions,
|
|
30
|
+
screenLayout,
|
|
31
|
+
...rest
|
|
32
|
+
}: ComponentStackNavigatorProps) {
|
|
33
|
+
const { state, describe, descriptors, navigation, NavigationContent } =
|
|
34
|
+
useNavigationBuilder<
|
|
35
|
+
StackNavigationState<ParamListBase>,
|
|
36
|
+
StackRouterOptions,
|
|
37
|
+
StackActionHelpers<ParamListBase>,
|
|
38
|
+
ComponentStackNavigationOptions,
|
|
39
|
+
ComponentStackNavigationEventMap
|
|
40
|
+
>(StackRouter, {
|
|
41
|
+
id,
|
|
42
|
+
initialRouteName,
|
|
43
|
+
children,
|
|
44
|
+
layout,
|
|
45
|
+
screenListeners,
|
|
46
|
+
screenOptions,
|
|
47
|
+
screenLayout,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<NavigationIndependentTree>
|
|
52
|
+
<NavigationContainer>
|
|
53
|
+
<NavigationContent>
|
|
54
|
+
<StackView
|
|
55
|
+
{...rest}
|
|
56
|
+
state={state}
|
|
57
|
+
navigation={navigation}
|
|
58
|
+
descriptors={descriptors}
|
|
59
|
+
describe={describe}
|
|
60
|
+
/>
|
|
61
|
+
</NavigationContent>
|
|
62
|
+
</NavigationContainer>
|
|
63
|
+
</NavigationIndependentTree>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function createComponentStackNavigator<
|
|
68
|
+
const ParamList extends ParamListBase,
|
|
69
|
+
const NavigatorID extends string | undefined = undefined,
|
|
70
|
+
const TypeBag extends NavigatorTypeBagBase = {
|
|
71
|
+
ParamList: ParamList;
|
|
72
|
+
NavigatorID: NavigatorID;
|
|
73
|
+
State: StackNavigationState<ParamList>;
|
|
74
|
+
ScreenOptions: ComponentStackNavigationOptions;
|
|
75
|
+
EventMap: ComponentStackNavigationEventMap;
|
|
76
|
+
NavigationList: {
|
|
77
|
+
[RouteName in keyof ParamList]: ComponentStackNavigationProp<
|
|
78
|
+
ParamList,
|
|
79
|
+
RouteName,
|
|
80
|
+
NavigatorID
|
|
81
|
+
>;
|
|
82
|
+
};
|
|
83
|
+
Navigator: typeof ComponentStackNavigator;
|
|
84
|
+
},
|
|
85
|
+
const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>,
|
|
86
|
+
>(config?: Config): TypedNavigator<TypeBag, Config> {
|
|
87
|
+
return createNavigatorFactory(ComponentStackNavigator)(config);
|
|
88
|
+
}
|