expo-router 1.7.1 → 1.7.2
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/_entry.tsx +4 -3
- package/build/ExpoRoot.d.ts +4 -2
- package/build/ExpoRoot.d.ts.map +1 -1
- package/build/LocationProvider.d.ts +3 -4
- package/build/LocationProvider.d.ts.map +1 -1
- package/build/exports.d.ts +1 -1
- package/build/exports.d.ts.map +1 -1
- package/build/getLinkingConfig.d.ts +6 -1
- package/build/getLinkingConfig.d.ts.map +1 -1
- package/build/getRoutes.d.ts.map +1 -1
- package/build/hooks.d.ts +76 -0
- package/build/hooks.d.ts.map +1 -0
- package/build/layouts/Tabs.d.ts.map +1 -1
- package/build/link/Link.d.ts.map +1 -1
- package/build/link/stateOperations.d.ts +5 -5
- package/build/link/stateOperations.d.ts.map +1 -1
- package/build/link/useLinkToPath.d.ts.map +1 -1
- package/build/link/useRouter.d.ts.map +1 -1
- package/build/static/renderStaticContent.d.ts.map +1 -1
- package/build/testing-library/index.d.ts +7 -4
- package/build/testing-library/index.d.ts.map +1 -1
- package/build/testing-library/mocks.d.ts +5 -0
- package/build/testing-library/mocks.d.ts.map +1 -1
- package/build/useNavigation.d.ts +1 -1
- package/build/useNavigation.d.ts.map +1 -1
- package/build/views/Sitemap.d.ts.map +1 -1
- package/package.json +7 -3
- package/plugin/build/index.js +15 -0
- package/plugin/src/index.ts +19 -1
- package/src/ExpoRoot.tsx +127 -25
- package/src/LocationProvider.tsx +6 -19
- package/src/exports.ts +3 -1
- package/src/fork/getPathFromState.ts +11 -1
- package/src/getLinkingConfig.ts +19 -4
- package/src/getRoutes.ts +2 -0
- package/src/hooks.ts +139 -0
- package/src/layouts/Tabs.tsx +0 -1
- package/src/link/Link.tsx +5 -1
- package/src/link/href.ts +10 -8
- package/src/link/linking.ts +2 -2
- package/src/link/stateOperations.ts +28 -25
- package/src/link/useHref.ts +1 -1
- package/src/link/useLinkToPath.ts +7 -6
- package/src/link/useLoadedNavigation.ts +2 -2
- package/src/link/useRouter.ts +4 -2
- package/src/static/renderStaticContent.tsx +17 -7
- package/src/testing-library/index.tsx +23 -38
- package/src/testing-library/mocks.ts +34 -0
- package/src/useNavigation.ts +3 -3
- package/src/views/Sitemap.tsx +5 -12
- package/src/views/Unmatched.tsx +1 -1
- package/build/navigationStore/index.d.ts +0 -82
- package/build/navigationStore/index.d.ts.map +0 -1
- package/build/navigationStore/initialState.d.ts +0 -43
- package/build/navigationStore/initialState.d.ts.map +0 -1
- package/src/navigationStore/index.ts +0 -223
- package/src/navigationStore/initialState.ts +0 -25
package/_entry.tsx
CHANGED
|
@@ -18,15 +18,16 @@ export const ctx = require.context(
|
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
// Must be exported or Fast Refresh won't update the context >:[
|
|
21
|
-
export default function ExpoRouterRoot() {
|
|
22
|
-
return <ExpoRoot context={ctx} />;
|
|
21
|
+
export default function ExpoRouterRoot({ location }: { location: URL }) {
|
|
22
|
+
return <ExpoRoot context={ctx} location={location} />;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/** Get the linking manifest from a Node.js process. */
|
|
26
26
|
export async function getManifest(options: any) {
|
|
27
27
|
const routeTree = getRoutes(ctx, options);
|
|
28
|
+
|
|
28
29
|
if (!routeTree) {
|
|
29
|
-
|
|
30
|
+
throw new Error("No routes found");
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
// Evaluate all static params
|
package/build/ExpoRoot.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { RequireContext } from "./types";
|
|
3
|
-
export
|
|
3
|
+
export type ExpoRootProps = {
|
|
4
4
|
context: RequireContext;
|
|
5
|
-
|
|
5
|
+
location?: URL;
|
|
6
|
+
};
|
|
7
|
+
export declare function ExpoRoot({ context, location }: ExpoRootProps): JSX.Element;
|
|
6
8
|
//# sourceMappingURL=ExpoRoot.d.ts.map
|
package/build/ExpoRoot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":";AAqBA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAwBzC,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,aAAa,eAa5D"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { State } from "./fork/getPathFromState";
|
|
2
2
|
type SearchParams = Record<string, string | string[]>;
|
|
3
|
-
type UrlObject = {
|
|
3
|
+
export type UrlObject = {
|
|
4
|
+
unstable_globalHref: string;
|
|
4
5
|
pathname: string;
|
|
5
6
|
readonly params: SearchParams;
|
|
6
7
|
segments: string[];
|
|
@@ -9,11 +10,9 @@ export declare function getRouteInfoFromState(getPathFromState: (state: State, a
|
|
|
9
10
|
path: string;
|
|
10
11
|
params: any;
|
|
11
12
|
}, state: State): UrlObject;
|
|
12
|
-
export declare function compareRouteInfo(a: UrlObject, b: UrlObject): boolean;
|
|
13
|
-
export declare function compareUrlSearchParams(a: SearchParams, b: SearchParams): boolean;
|
|
14
13
|
export declare function getNormalizedStatePath({ path: statePath, params, }: {
|
|
15
14
|
path: string;
|
|
16
15
|
params: any;
|
|
17
|
-
}):
|
|
16
|
+
}): Pick<UrlObject, "segments" | "params">;
|
|
18
17
|
export {};
|
|
19
18
|
//# sourceMappingURL=LocationProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocationProvider.d.ts","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"LocationProvider.d.ts","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAEtD,MAAM,MAAM,SAAS,GAAG;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,gBAAgB,EAAE,CAChB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,OAAO,KACZ;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,EAClC,KAAK,EAAE,KAAK,GACX,SAAS,CASX;AAGD,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EAAE,SAAS,EACf,MAAM,GACP,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;CACb,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,QAAQ,CAAC,CAgBzC"}
|
package/build/exports.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Navigator, Slot } from "./views/Navigator";
|
|
2
2
|
export { useRouter } from "./link/useRouter";
|
|
3
|
-
export { usePathname, useLocalSearchParams, useSearchParams, useSegments, useRootNavigation, useRootNavigationState, } from "./
|
|
3
|
+
export { useUnstableGlobalHref, usePathname, useGlobalSearchParams, useLocalSearchParams, useSearchParams, useSegments, useRootNavigation, useRootNavigationState, } from "./hooks";
|
|
4
4
|
export { Link, Redirect } from "./link/Link";
|
|
5
5
|
export { withLayoutContext } from "./layouts/withLayoutContext";
|
|
6
6
|
export { Navigator, Slot };
|
package/build/exports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAG3B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { LinkingOptions } from "@react-navigation/native";
|
|
2
2
|
import { RouteNode } from "./Route";
|
|
3
3
|
import { Screen } from "./getReactNavigationConfig";
|
|
4
|
+
import { getPathFromState } from "./link/linking";
|
|
4
5
|
export declare function getNavigationConfig(routes: RouteNode): {
|
|
5
6
|
initialRouteName?: string;
|
|
6
7
|
screens: Record<string, Screen>;
|
|
7
8
|
};
|
|
8
|
-
export
|
|
9
|
+
export type ExpoLinkingOptions = LinkingOptions<object> & {
|
|
10
|
+
getPathFromState?: typeof getPathFromState;
|
|
11
|
+
};
|
|
12
|
+
export declare function getLinkingConfig(routes: RouteNode): ExpoLinkingOptions;
|
|
13
|
+
export declare const stateCache: Map<string, any>;
|
|
9
14
|
//# sourceMappingURL=getLinkingConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLinkingConfig.d.ts","sourceRoot":"","sources":["../src/getLinkingConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE9E,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"getLinkingConfig.d.ts","sourceRoot":"","sources":["../src/getLinkingConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE9E,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAA4B,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAGL,gBAAgB,EAEjB,MAAM,gBAAgB,CAAC;AAExB,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG;IACtD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAEA;AAED,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,MAAM,CAAC,GAAG;IACxD,gBAAgB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AAUD,+CAA+C;AAC/C,wBAAgB,cAAc,CAC5B,aAAa,EAAE,cAAc,EAC7B,OAAO,CAAC,EAAE,OAAO,GAChB,SAAS,GAAG,IAAI,CAIlB;AAYD,wBAAsB,mBAAmB,CACvC,aAAa,EAAE,cAAc,EAC7B,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAI3B;AA4CD;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,SAAS,GAChB,SAAS,GAAG,IAAI,CAkBlB"}
|
package/build/hooks.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { NavigationContainerRefWithCurrent } from "@react-navigation/native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { UrlObject } from "./LocationProvider";
|
|
4
|
+
import { RouteNode } from "./Route";
|
|
5
|
+
import { ResultState } from "./fork/getStateFromPath";
|
|
6
|
+
import { ExpoLinkingOptions } from "./getLinkingConfig";
|
|
7
|
+
type SearchParams = Record<string, string | string[]>;
|
|
8
|
+
export type ExpoRouterContextType = {
|
|
9
|
+
routeNode: RouteNode;
|
|
10
|
+
linking: ExpoLinkingOptions;
|
|
11
|
+
navigationRef: NavigationContainerRefWithCurrent<ReactNavigation.RootParamList>;
|
|
12
|
+
initialState: ResultState | undefined;
|
|
13
|
+
getRouteInfo: (state: ResultState) => UrlObject;
|
|
14
|
+
};
|
|
15
|
+
export type OnboardingExpoRouterContextType = Omit<ExpoRouterContextType, "routeNode"> & {
|
|
16
|
+
routeNode: null;
|
|
17
|
+
};
|
|
18
|
+
export declare const ExpoRouterContext: React.Context<ExpoRouterContextType | undefined>;
|
|
19
|
+
export type RootStateContextType = {
|
|
20
|
+
state?: ResultState;
|
|
21
|
+
routeInfo?: UrlObject;
|
|
22
|
+
};
|
|
23
|
+
export declare const RootStateContext: React.Context<RootStateContextType>;
|
|
24
|
+
export declare function useRootNavigationState(): RootStateContextType;
|
|
25
|
+
export declare function useRouteInfo(): UrlObject;
|
|
26
|
+
export declare function useExpoRouterContext(): ExpoRouterContextType;
|
|
27
|
+
export declare function useRootNavigation(): import("@react-navigation/native").NavigationContainerRef<ReactNavigation.RootParamList> | null;
|
|
28
|
+
export declare function useLinkingContext(): ExpoLinkingOptions;
|
|
29
|
+
/**
|
|
30
|
+
* @private
|
|
31
|
+
* @returns the current global pathname with query params attached. This may change in the future to include the hostname from a predefined universal link, i.e. `/foobar?hey=world` becomes `https://acme.dev/foobar?hey=world`
|
|
32
|
+
*/
|
|
33
|
+
export declare function useUnstableGlobalHref(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Get a list of selected file segments for the currently selected route. Segments are not normalized, so they will be the same as the file path. e.g. /[id]?id=normal -> ["[id]"]
|
|
36
|
+
*
|
|
37
|
+
* `useSegments` can be typed using an abstract.
|
|
38
|
+
* Consider the following file structure, and strictly typed `useSegments` function:
|
|
39
|
+
*
|
|
40
|
+
* ```md
|
|
41
|
+
* - app
|
|
42
|
+
* - [user]
|
|
43
|
+
* - index.js
|
|
44
|
+
* - followers.js
|
|
45
|
+
* - settings.js
|
|
46
|
+
* ```
|
|
47
|
+
* This can be strictly typed using the following abstract:
|
|
48
|
+
*
|
|
49
|
+
* ```ts
|
|
50
|
+
* const [first, second] = useSegments<['settings'] | ['[user]'] | ['[user]', 'followers']>()
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function useSegments<TSegments extends string[] = string[]>(): TSegments;
|
|
54
|
+
/** @returns global selected pathname without query parameters. */
|
|
55
|
+
export declare function usePathname(): string;
|
|
56
|
+
/**
|
|
57
|
+
* Get the globally selected query parameters, including dynamic path segments. This function will update even when the route is not focused.
|
|
58
|
+
* Useful for analytics or other background operations that don't draw to the screen.
|
|
59
|
+
*
|
|
60
|
+
* When querying search params in a stack, opt-towards using `useLocalSearchParams` as these will only
|
|
61
|
+
* update when the route is focused.
|
|
62
|
+
*
|
|
63
|
+
* @see `useLocalSearchParams`
|
|
64
|
+
*/
|
|
65
|
+
export declare function useGlobalSearchParams<TParams extends SearchParams = SearchParams>(): Partial<TParams>;
|
|
66
|
+
/** @deprecated renamed to `useGlobalSearchParams` */
|
|
67
|
+
export declare function useSearchParams<TParams extends SearchParams = SearchParams>(): Partial<TParams>;
|
|
68
|
+
/**
|
|
69
|
+
* Returns the URL search parameters for the contextually focused route. e.g. `/acme?foo=bar` -> `{ foo: "bar" }`.
|
|
70
|
+
* This is useful for stacks where you may push a new screen that changes the query parameters.
|
|
71
|
+
*
|
|
72
|
+
* To observe updates even when the invoking route is not focused, use `useGlobalSearchParams()`.
|
|
73
|
+
*/
|
|
74
|
+
export declare function useLocalSearchParams<TParams extends SearchParams = SearchParams>(): Partial<TParams>;
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EAIlC,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,aAAa,EAAE,iCAAiC,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;IAChF,YAAY,EAAE,WAAW,GAAG,SAAS,CAAC;IACtC,YAAY,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK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M,OAAO,CAAC;AAI1B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAMpC,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../src/layouts/Tabs.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAE3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAMpC,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Cf,CAAC;AAEH,eAAe,IAAI,CAAC"}
|
package/build/link/Link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAQ,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAY,MAAM,cAAc,CAAC;AAG/D,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAI3C,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,CAAC;IACvE,wBAAwB;IACxB,IAAI,EAAE,IAAI,CAAC;IAGX,mEAAmE;IACnE,OAAO,CAAC,EAA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;;;GAQG;AACH,eAAO,MAAM,IAAI,eAEY,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InitialState, NavigationState, ParamListBase, getActionFromState } from "@react-navigation/native";
|
|
1
|
+
import { InitialState, NavigationState, ParamListBase, PartialState, getActionFromState } from "@react-navigation/native";
|
|
2
2
|
import { ResultState } from "../fork/getStateFromPath";
|
|
3
3
|
export type NavigateAction = Extract<ReturnType<typeof getActionFromState>, {
|
|
4
4
|
type: "NAVIGATE";
|
|
@@ -26,7 +26,7 @@ export declare function findTopRouteForTarget(state: ResultState): Omit<import("
|
|
|
26
26
|
}> & Readonly<{
|
|
27
27
|
params?: Readonly<object | undefined>;
|
|
28
28
|
}> & {
|
|
29
|
-
state?: Readonly<any> |
|
|
29
|
+
state?: Readonly<any> | PartialState<Readonly<any>> | undefined;
|
|
30
30
|
})[];
|
|
31
31
|
type: string;
|
|
32
32
|
stale: false;
|
|
@@ -35,7 +35,7 @@ export declare function findTopRouteForTarget(state: ResultState): Omit<import("
|
|
|
35
35
|
}> | undefined;
|
|
36
36
|
};
|
|
37
37
|
/** @returns true if moving to a sibling inside the same navigator. */
|
|
38
|
-
export declare function isMovingToSiblingRoute(
|
|
38
|
+
export declare function isMovingToSiblingRoute(currentState: NavigationState | PartialState<NavigationState> | undefined, targetState: ResultState | undefined): boolean;
|
|
39
39
|
export declare function getQualifiedStateForTopOfTargetState(rootState: InitialState, targetState: ResultState): Readonly<Partial<Omit<Readonly<{
|
|
40
40
|
key: string;
|
|
41
41
|
index: number;
|
|
@@ -48,7 +48,7 @@ export declare function getQualifiedStateForTopOfTargetState(rootState: InitialS
|
|
|
48
48
|
}> & Readonly<{
|
|
49
49
|
params?: Readonly<object | undefined>;
|
|
50
50
|
}> & {
|
|
51
|
-
state?: Readonly<any> |
|
|
51
|
+
state?: Readonly<any> | PartialState<Readonly<any>> | undefined;
|
|
52
52
|
})[];
|
|
53
53
|
type: string;
|
|
54
54
|
stale: false;
|
|
@@ -66,7 +66,7 @@ export declare function getQualifiedStateForTopOfTargetState(rootState: InitialS
|
|
|
66
66
|
}> & Readonly<{
|
|
67
67
|
params?: Readonly<object | undefined>;
|
|
68
68
|
}> & {
|
|
69
|
-
state?: Readonly<any> |
|
|
69
|
+
state?: Readonly<any> | PartialState<Readonly<any>> | undefined;
|
|
70
70
|
})[];
|
|
71
71
|
type: string;
|
|
72
72
|
stale: false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stateOperations.d.ts","sourceRoot":"","sources":["../../src/link/stateOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,aAAa,EACb,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG,OAAO,CAClC,UAAU,CAAC,OAAO,kBAAkB,CAAC,EACrC;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CACrB,GAAG;IACF,OAAO,EAAE,oBAAoB,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAaF,iDAAiD;AACjD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;EAIvD;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CACpC,
|
|
1
|
+
{"version":3,"file":"stateOperations.d.ts","sourceRoot":"","sources":["../../src/link/stateOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,aAAa,EACb,YAAY,EACZ,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,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,mBAAmB,CAAC;AAc3B,wBAAgB,aAAa,WAIlB,MAAM,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"useLinkToPath.d.ts","sourceRoot":"","sources":["../../src/link/useLinkToPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAEnB,MAAM,wBAAwB,CAAC;AAOhC,OAAO,EAKL,cAAc,EACf,MAAM,mBAAmB,CAAC;AAc3B,wBAAgB,aAAa,WAIlB,MAAM,UAAU,MAAM,UAoHhC;AAED,uGAAuG;AACvG,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,GAC5C,MAAM,IAAI,cAAc,CAqB1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRouter.d.ts","sourceRoot":"","sources":["../../src/link/useRouter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAe,MAAM,QAAQ,CAAC;AAK3C,wBAAgB,OAAO,WAGtB;AAED,KAAK,MAAM,GAAG;IACZ,qCAAqC;IACrC,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC3B,0DAA0D;IAC1D,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC9B,8BAA8B;IAC9B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,6CAA6C;IAC7C,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;CACtD,CAAC;AAEF,wBAAgB,SAAS,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"useRouter.d.ts","sourceRoot":"","sources":["../../src/link/useRouter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAe,MAAM,QAAQ,CAAC;AAK3C,wBAAgB,OAAO,WAGtB;AAED,KAAK,MAAM,GAAG;IACZ,qCAAqC;IACrC,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC3B,0DAA0D;IAC1D,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC9B,8BAA8B;IAC9B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,6CAA6C;IAC7C,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;CACtD,CAAC;AAEF,wBAAgB,SAAS,IAAI,MAAM,CA+BlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderStaticContent.d.ts","sourceRoot":"","sources":["../../src/static/renderStaticContent.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"renderStaticContent.d.ts","sourceRoot":"","sources":["../../src/static/renderStaticContent.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAqBtD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,GAAG,GAAG,MAAM,CA+CtD;AA0BD,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "./mocks";
|
|
2
1
|
import "./expect";
|
|
3
2
|
import { render } from "@testing-library/react-native";
|
|
4
3
|
import React from "react";
|
|
@@ -10,10 +9,14 @@ type RouteOverrideFunction = () => React.ReactElement<any, any> | null;
|
|
|
10
9
|
type RouteOverride = {
|
|
11
10
|
default: RouteOverrideFunction;
|
|
12
11
|
} | RouteOverrideFunction;
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
type Result = ReturnType<typeof render> & {
|
|
13
|
+
getPathname(): string;
|
|
14
|
+
getSearchParams(): URLSearchParams;
|
|
15
|
+
};
|
|
16
|
+
export declare function renderRouter(context?: string, options?: RenderRouterOptions): Result;
|
|
17
|
+
export declare function renderRouter(context: Record<string, RouteOverride>, options?: RenderRouterOptions): Result;
|
|
15
18
|
export declare function renderRouter(context: {
|
|
16
19
|
appDir: string;
|
|
17
20
|
overrides: Record<string, RouteOverride>;
|
|
18
|
-
}, options?: RenderRouterOptions):
|
|
21
|
+
}, options?: RenderRouterOptions): Result;
|
|
19
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing-library/index.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing-library/index.tsx"],"names":[],"mappings":"AACA,OAAO,UAAU,CAAC;AAGlB,OAAO,EAAE,MAAM,EAAgB,MAAM,+BAA+B,CAAC;AAGrE,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,cAAc,+BAA+B,CAAC;AAE9C,KAAK,mBAAmB,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,qBAAqB,GAAG,MAAM,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;AAEvE,KAAK,aAAa,GAAG;IAAE,OAAO,EAAE,qBAAqB,CAAA;CAAE,GAAG,qBAAqB,CAAC;AAEhF,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,GAAG;IACxC,WAAW,IAAI,MAAM,CAAC;IACtB,eAAe,IAAI,eAAe,CAAC;CACpC,CAAC;AAQF,wBAAgB,YAAY,CAC1B,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,MAAM,CAAC;AACV,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EACtC,OAAO,CAAC,EAAE,mBAAmB,GAC5B,MAAM,CAAC;AACV,wBAAgB,YAAY,CAC1B,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CAAE,EACrE,OAAO,CAAC,EAAE,mBAAmB,GAC5B,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/testing-library/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,4CAA4C,CAAC"}
|
|
1
|
+
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/testing-library/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,4CAA4C,CAAC;AAgBpD,eAAO,MAAM,aAAa;;0BAEF,MAAM,KAAK,MAAM;;CAUxC,CAAC"}
|
package/build/useNavigation.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ import { NavigationProp } from "@react-navigation/native";
|
|
|
4
4
|
* @param parent Provide an absolute path like `/(root)` to the parent route or a relative path like `../../` to the parent route.
|
|
5
5
|
* @returns the navigation object for the provided route.
|
|
6
6
|
*/
|
|
7
|
-
export declare function useNavigation(parent?: string):
|
|
7
|
+
export declare function useNavigation<T = NavigationProp<ReactNavigation.RootParamList>>(parent?: string): T;
|
|
8
8
|
export declare function resolveParentId(contextKey: string, parentId?: string | null): string | null;
|
|
9
9
|
//# sourceMappingURL=useNavigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigation.d.ts","sourceRoot":"","sources":["../src/useNavigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACf,MAAM,0BAA0B,CAAC;AAMlC;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,
|
|
1
|
+
{"version":3,"file":"useNavigation.d.ts","sourceRoot":"","sources":["../src/useNavigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACf,MAAM,0BAA0B,CAAC;AAMlC;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,CAAC,GAAG,cAAc,CAAC,eAAe,CAAC,aAAa,CAAC,EACjD,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,CAgCpB;AAED,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GACvB,MAAM,GAAG,IAAI,CASf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sitemap.d.ts","sourceRoot":"","sources":["../../src/views/Sitemap.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"Sitemap.d.ts","sourceRoot":"","sources":["../../src/views/Sitemap.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AA+B9E,wBAAgB,aAAa,IAAI,4BAA4B,CAqB5D;AAED,wBAAgB,OAAO,gBA6BtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-router",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"main": "src/index.tsx",
|
|
5
5
|
"types": "build/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -52,6 +52,9 @@
|
|
|
52
52
|
"preset": "jest-expo",
|
|
53
53
|
"roots": [
|
|
54
54
|
"src"
|
|
55
|
+
],
|
|
56
|
+
"setupFilesAfterEnv": [
|
|
57
|
+
"./src/testing-library/mocks.ts"
|
|
55
58
|
]
|
|
56
59
|
},
|
|
57
60
|
"peerDependencies": {
|
|
@@ -94,7 +97,8 @@
|
|
|
94
97
|
"react-native-reanimated": "~2.14.4",
|
|
95
98
|
"react-native-safe-area-context": "~4.5.0",
|
|
96
99
|
"react-native-screens": "~3.20.0",
|
|
97
|
-
"tree-kill": "^1.2.2"
|
|
100
|
+
"tree-kill": "^1.2.2",
|
|
101
|
+
"tsd": "^0.28.1"
|
|
98
102
|
},
|
|
99
103
|
"dependencies": {
|
|
100
104
|
"@bacons/react-views": "^1.1.3",
|
|
@@ -103,7 +107,7 @@
|
|
|
103
107
|
"@react-navigation/bottom-tabs": "~6.5.7",
|
|
104
108
|
"@react-navigation/native": "~6.1.6",
|
|
105
109
|
"@react-navigation/native-stack": "~6.9.12",
|
|
106
|
-
"expo-head": "0.0.
|
|
110
|
+
"expo-head": "0.0.3",
|
|
107
111
|
"expo-splash-screen": "*",
|
|
108
112
|
"query-string": "7.1.3",
|
|
109
113
|
"react-helmet-async": "^1.3.0",
|
package/plugin/build/index.js
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
3
4
|
const schema_utils_1 = require("schema-utils");
|
|
4
5
|
const schema = require("../options.json");
|
|
6
|
+
const withExpoHeadIos = (config) => {
|
|
7
|
+
return (0, config_plugins_1.withInfoPlist)(config, (config) => {
|
|
8
|
+
// $(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route
|
|
9
|
+
if (!Array.isArray(config.modResults.NSUserActivityTypes)) {
|
|
10
|
+
config.modResults.NSUserActivityTypes = [];
|
|
11
|
+
}
|
|
12
|
+
// This ensures that stored `NSUserActivityType`s can be opened in-app.
|
|
13
|
+
// This is important for moving between native devices or from opening a link that was saved
|
|
14
|
+
// in a Quick Note or Siri Reminder.
|
|
15
|
+
config.modResults.NSUserActivityTypes.push("$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route");
|
|
16
|
+
return config;
|
|
17
|
+
});
|
|
18
|
+
};
|
|
5
19
|
const withRouter = (config, props) => {
|
|
6
20
|
(0, schema_utils_1.validate)(schema, props);
|
|
21
|
+
withExpoHeadIos(config);
|
|
7
22
|
return {
|
|
8
23
|
...config,
|
|
9
24
|
extra: {
|
package/plugin/src/index.ts
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
import { ConfigPlugin } from "expo/config-plugins";
|
|
1
|
+
import { ConfigPlugin, withInfoPlist } from "expo/config-plugins";
|
|
2
2
|
import { validate } from "schema-utils";
|
|
3
3
|
|
|
4
4
|
const schema = require("../options.json");
|
|
5
5
|
|
|
6
|
+
const withExpoHeadIos: ConfigPlugin = (config) => {
|
|
7
|
+
return withInfoPlist(config, (config) => {
|
|
8
|
+
// $(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route
|
|
9
|
+
if (!Array.isArray(config.modResults.NSUserActivityTypes)) {
|
|
10
|
+
config.modResults.NSUserActivityTypes = [];
|
|
11
|
+
}
|
|
12
|
+
// This ensures that stored `NSUserActivityType`s can be opened in-app.
|
|
13
|
+
// This is important for moving between native devices or from opening a link that was saved
|
|
14
|
+
// in a Quick Note or Siri Reminder.
|
|
15
|
+
config.modResults.NSUserActivityTypes.push(
|
|
16
|
+
"$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route"
|
|
17
|
+
);
|
|
18
|
+
return config;
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
6
22
|
const withRouter: ConfigPlugin<{
|
|
7
23
|
/** Production origin URL where assets in the public folder are hosted. The fetch function is polyfilled to support relative requests from this origin in production, development origin is inferred using the Expo CLI development server. */
|
|
8
24
|
origin: string;
|
|
@@ -15,6 +31,8 @@ const withRouter: ConfigPlugin<{
|
|
|
15
31
|
}> = (config, props) => {
|
|
16
32
|
validate(schema, props);
|
|
17
33
|
|
|
34
|
+
withExpoHeadIos(config);
|
|
35
|
+
|
|
18
36
|
return {
|
|
19
37
|
...config,
|
|
20
38
|
extra: {
|
package/src/ExpoRoot.tsx
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
|
+
import { useNavigationContainerRef } from "@react-navigation/native";
|
|
1
2
|
import { StatusBar } from "expo-status-bar";
|
|
2
3
|
import React from "react";
|
|
4
|
+
import { Platform } from "react-native";
|
|
3
5
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
4
6
|
|
|
7
|
+
import { getRouteInfoFromState } from "./LocationProvider";
|
|
5
8
|
import UpstreamNavigationContainer from "./fork/NavigationContainer";
|
|
6
|
-
import {
|
|
9
|
+
import getPathFromState, {
|
|
10
|
+
getPathDataFromState,
|
|
11
|
+
} from "./fork/getPathFromState";
|
|
12
|
+
import { ResultState } from "./fork/getStateFromPath";
|
|
13
|
+
import { getLinkingConfig } from "./getLinkingConfig";
|
|
14
|
+
import { getRoutes } from "./getRoutes";
|
|
15
|
+
import {
|
|
16
|
+
ExpoRouterContextType,
|
|
17
|
+
ExpoRouterContext,
|
|
18
|
+
RootStateContext,
|
|
19
|
+
RootStateContextType,
|
|
20
|
+
OnboardingExpoRouterContextType,
|
|
21
|
+
} from "./hooks";
|
|
7
22
|
import { RequireContext } from "./types";
|
|
8
23
|
import { getQualifiedRouteComponent } from "./useScreens";
|
|
9
24
|
import { SplashScreen } from "./views/Splash";
|
|
@@ -28,15 +43,19 @@ const INITIAL_METRICS = {
|
|
|
28
43
|
insets: { top: 0, left: 0, right: 0, bottom: 0 },
|
|
29
44
|
};
|
|
30
45
|
|
|
31
|
-
export
|
|
46
|
+
export type ExpoRootProps = {
|
|
47
|
+
context: RequireContext;
|
|
48
|
+
location?: URL;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export function ExpoRoot({ context, location }: ExpoRootProps) {
|
|
32
52
|
return (
|
|
33
53
|
<GestureHandlerRootView>
|
|
34
54
|
<SafeAreaProvider
|
|
35
|
-
testID="test"
|
|
36
55
|
// SSR support
|
|
37
56
|
initialMetrics={INITIAL_METRICS}
|
|
38
57
|
>
|
|
39
|
-
<ContextNavigator context={context} />
|
|
58
|
+
<ContextNavigator context={context} location={location} />
|
|
40
59
|
{/* Users can override this by adding another StatusBar element anywhere higher in the component tree. */}
|
|
41
60
|
<StatusBar style="auto" />
|
|
42
61
|
</SafeAreaProvider>
|
|
@@ -44,20 +63,98 @@ export function ExpoRoot({ context }: { context: RequireContext }) {
|
|
|
44
63
|
);
|
|
45
64
|
}
|
|
46
65
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
const initialUrl =
|
|
67
|
+
Platform.OS === "web" && typeof window !== "undefined"
|
|
68
|
+
? new URL(window.location.href)
|
|
69
|
+
: undefined;
|
|
70
|
+
|
|
71
|
+
function ContextNavigator({
|
|
72
|
+
context,
|
|
73
|
+
location: initialLocation = initialUrl,
|
|
74
|
+
}: ExpoRootProps) {
|
|
75
|
+
const navigationRef = useNavigationContainerRef();
|
|
76
|
+
const [shouldShowSplash, setShowSplash] = React.useState(
|
|
77
|
+
Platform.OS !== "web"
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const expoContext = React.useMemo<
|
|
81
|
+
ExpoRouterContextType | OnboardingExpoRouterContextType
|
|
82
|
+
>(() => {
|
|
83
|
+
const routeNode = getRoutes(context);
|
|
84
|
+
const linking = getLinkingConfig(routeNode!);
|
|
85
|
+
let initialState: ResultState | undefined;
|
|
86
|
+
|
|
87
|
+
if (initialLocation) {
|
|
88
|
+
initialState = linking.getStateFromPath?.(
|
|
89
|
+
initialLocation.pathname + initialLocation.search,
|
|
90
|
+
linking.config
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function getRouteInfo(state: ResultState) {
|
|
95
|
+
return getRouteInfoFromState(
|
|
96
|
+
(state: Parameters<typeof getPathFromState>[0], asPath: boolean) => {
|
|
97
|
+
return getPathDataFromState(state, {
|
|
98
|
+
screens: [],
|
|
99
|
+
...linking.config,
|
|
100
|
+
preserveDynamicRoutes: asPath,
|
|
101
|
+
preserveGroups: asPath,
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
state
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// This looks redundant but it makes TypeScript correctly infer the union return type.
|
|
109
|
+
return {
|
|
110
|
+
routeNode,
|
|
111
|
+
linking,
|
|
112
|
+
navigationRef,
|
|
113
|
+
initialState,
|
|
114
|
+
getRouteInfo,
|
|
115
|
+
};
|
|
116
|
+
}, [context, navigationRef, initialLocation]);
|
|
117
|
+
|
|
118
|
+
const { routeNode, initialState, linking, getRouteInfo } = expoContext;
|
|
119
|
+
|
|
120
|
+
const [rootState, setRootState] = React.useState<RootStateContextType>(() => {
|
|
121
|
+
if (initialState) {
|
|
122
|
+
return {
|
|
123
|
+
state: initialState,
|
|
124
|
+
routeInfo: getRouteInfo(initialState),
|
|
125
|
+
};
|
|
126
|
+
} else {
|
|
127
|
+
return {
|
|
128
|
+
routeInfo: {
|
|
129
|
+
unstable_globalHref: "",
|
|
130
|
+
pathname: "",
|
|
131
|
+
params: {},
|
|
132
|
+
segments: [],
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
React.useEffect(() => {
|
|
139
|
+
const subscription = navigationRef.addListener("state", (data) => {
|
|
140
|
+
const state = data.data.state as ResultState;
|
|
141
|
+
setRootState({
|
|
142
|
+
state,
|
|
143
|
+
routeInfo: getRouteInfo(state),
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
return () => subscription?.();
|
|
148
|
+
}, [navigationRef, getRouteInfo]);
|
|
149
|
+
|
|
150
|
+
if (!routeNode) {
|
|
151
|
+
if (process.env.NODE_ENV === "development") {
|
|
152
|
+
const Tutorial = require("./onboard/Tutorial").Tutorial;
|
|
153
|
+
SplashScreen.hideAsync();
|
|
154
|
+
return <Tutorial />;
|
|
155
|
+
} else {
|
|
156
|
+
throw new Error("No routes found");
|
|
157
|
+
}
|
|
61
158
|
}
|
|
62
159
|
|
|
63
160
|
const Component = getQualifiedRouteComponent(routeNode);
|
|
@@ -65,13 +162,18 @@ function ContextNavigator({ context }: { context: RequireContext }) {
|
|
|
65
162
|
return (
|
|
66
163
|
<>
|
|
67
164
|
{shouldShowSplash && <SplashScreen />}
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
165
|
+
<ExpoRouterContext.Provider value={expoContext}>
|
|
166
|
+
<UpstreamNavigationContainer
|
|
167
|
+
ref={navigationRef}
|
|
168
|
+
initialState={initialState}
|
|
169
|
+
linking={linking}
|
|
170
|
+
onReady={() => requestAnimationFrame(() => setShowSplash(false))}
|
|
171
|
+
>
|
|
172
|
+
<RootStateContext.Provider value={rootState}>
|
|
173
|
+
{!shouldShowSplash && <Component />}
|
|
174
|
+
</RootStateContext.Provider>
|
|
175
|
+
</UpstreamNavigationContainer>
|
|
176
|
+
</ExpoRouterContext.Provider>
|
|
75
177
|
</>
|
|
76
178
|
);
|
|
77
179
|
}
|