expo-router 1.7.3 → 1.7.4

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.
Files changed (95) hide show
  1. package/_ctx.android.tsx +7 -0
  2. package/_ctx.ios.tsx +7 -0
  3. package/_ctx.tsx +5 -0
  4. package/_ctx.web.tsx +7 -0
  5. package/_entry.tsx +3 -8
  6. package/babel.js +38 -8
  7. package/build/ExpoRoot.d.ts +5 -1
  8. package/build/ExpoRoot.d.ts.map +1 -1
  9. package/build/exports.d.ts +2 -2
  10. package/build/exports.d.ts.map +1 -1
  11. package/build/fork/extractPathFromURL.d.ts +1 -1
  12. package/build/fork/extractPathFromURL.d.ts.map +1 -1
  13. package/build/fork/findFocusedRoute.d.ts +1 -1
  14. package/build/fork/useLinking.native.d.ts +2 -2
  15. package/build/getRoutes.d.ts.map +1 -1
  16. package/build/global-state/router-store.d.ts +47 -0
  17. package/build/global-state/router-store.d.ts.map +1 -0
  18. package/build/global-state/routing.d.ts +12 -0
  19. package/build/global-state/routing.d.ts.map +1 -0
  20. package/build/global-state/sort-routes.d.ts +4 -0
  21. package/build/global-state/sort-routes.d.ts.map +1 -0
  22. package/build/hooks.d.ts +5 -26
  23. package/build/hooks.d.ts.map +1 -1
  24. package/build/imperative-api.d.ts +3 -0
  25. package/build/imperative-api.d.ts.map +1 -0
  26. package/build/import-mode/index.android.d.ts +3 -0
  27. package/build/import-mode/index.android.d.ts.map +1 -0
  28. package/build/import-mode/index.d.ts +3 -0
  29. package/build/import-mode/index.d.ts.map +1 -0
  30. package/build/import-mode/index.ios.d.ts +3 -0
  31. package/build/import-mode/index.ios.d.ts.map +1 -0
  32. package/build/import-mode/index.web.d.ts +3 -0
  33. package/build/import-mode/index.web.d.ts.map +1 -0
  34. package/build/layouts/Drawer.d.ts +2 -2
  35. package/build/layouts/Stack.d.ts +2 -2
  36. package/build/layouts/Tabs.d.ts +2 -2
  37. package/build/link/Link.d.ts.map +1 -1
  38. package/build/link/stateOperations.d.ts +3 -3
  39. package/build/onboard/Tutorial.d.ts.map +1 -1
  40. package/build/onboard/createEntryFile.d.ts.map +1 -1
  41. package/build/renderRootComponent.d.ts.map +1 -1
  42. package/build/testing-library/index.d.ts +1 -1
  43. package/build/testing-library/index.d.ts.map +1 -1
  44. package/build/testing-library/mocks.d.ts +1 -3
  45. package/build/testing-library/mocks.d.ts.map +1 -1
  46. package/build/types.d.ts +11 -0
  47. package/build/types.d.ts.map +1 -1
  48. package/build/useScreens.d.ts.map +1 -1
  49. package/build/views/Navigator.d.ts +1 -2
  50. package/build/views/Navigator.d.ts.map +1 -1
  51. package/build/views/Sitemap.d.ts.map +1 -1
  52. package/build/views/Splash.d.ts +2 -0
  53. package/build/views/Splash.d.ts.map +1 -1
  54. package/build/views/Unmatched.d.ts.map +1 -1
  55. package/entry.js +1 -6
  56. package/package.json +5 -4
  57. package/plugin/build/index.d.ts +6 -1
  58. package/plugin/options.json +32 -6
  59. package/plugin/src/index.ts +3 -1
  60. package/src/ExpoRoot.tsx +32 -84
  61. package/src/exports.ts +4 -1
  62. package/src/fork/extractPathFromURL.ts +1 -1
  63. package/src/getRoutes.ts +2 -1
  64. package/src/global-state/router-store.ts +209 -0
  65. package/src/global-state/routing.ts +203 -0
  66. package/src/global-state/sort-routes.ts +48 -0
  67. package/src/hooks.ts +27 -43
  68. package/src/imperative-api.ts +9 -0
  69. package/src/import-mode/index.android.ts +1 -0
  70. package/src/import-mode/index.ios.ts +1 -0
  71. package/src/import-mode/index.ts +1 -0
  72. package/src/import-mode/index.web.ts +1 -0
  73. package/src/link/Link.tsx +1 -1
  74. package/src/link/useLinkToPathProps.tsx +2 -2
  75. package/src/link/useLoadedNavigation.ts +2 -2
  76. package/src/onboard/Tutorial.tsx +18 -2
  77. package/src/onboard/createEntryFile.ts +8 -0
  78. package/src/renderRootComponent.tsx +5 -2
  79. package/src/testing-library/index.tsx +16 -9
  80. package/src/testing-library/mocks.ts +3 -13
  81. package/src/types.ts +13 -0
  82. package/src/useScreens.tsx +20 -19
  83. package/src/views/Navigator.tsx +6 -3
  84. package/src/views/Sitemap.tsx +3 -17
  85. package/src/views/Splash.tsx +40 -2
  86. package/src/views/Unmatched.tsx +1 -2
  87. package/build/link/useLinkToPath.d.ts +0 -6
  88. package/build/link/useLinkToPath.d.ts.map +0 -1
  89. package/build/link/useRouter.d.ts +0 -15
  90. package/build/link/useRouter.d.ts.map +0 -1
  91. package/build/useCreateExpoRouterContext.d.ts +0 -23
  92. package/build/useCreateExpoRouterContext.d.ts.map +0 -1
  93. package/src/link/useLinkToPath.ts +0 -182
  94. package/src/link/useRouter.ts +0 -56
  95. package/src/useCreateExpoRouterContext.ts +0 -88
@@ -0,0 +1,7 @@
1
+ export const ctx = require.context(
2
+ process.env.EXPO_ROUTER_APP_ROOT!,
3
+ true,
4
+ /.*/,
5
+ // @ts-expect-error
6
+ process.env.EXPO_ROUTER_IMPORT_MODE_ANDROID
7
+ );
package/_ctx.ios.tsx ADDED
@@ -0,0 +1,7 @@
1
+ export const ctx = require.context(
2
+ process.env.EXPO_ROUTER_APP_ROOT!,
3
+ true,
4
+ /.*/,
5
+ // @ts-expect-error
6
+ process.env.EXPO_ROUTER_IMPORT_MODE_IOS
7
+ );
package/_ctx.tsx ADDED
@@ -0,0 +1,5 @@
1
+ export const ctx = require.context(
2
+ process.env.EXPO_ROUTER_APP_ROOT!,
3
+ true,
4
+ /.*/
5
+ );
package/_ctx.web.tsx ADDED
@@ -0,0 +1,7 @@
1
+ export const ctx = require.context(
2
+ process.env.EXPO_ROUTER_APP_ROOT!,
3
+ true,
4
+ /.*/,
5
+ // @ts-expect-error
6
+ process.env.EXPO_ROUTER_IMPORT_MODE_WEB
7
+ );
package/_entry.tsx CHANGED
@@ -4,19 +4,12 @@ import "@expo/metro-runtime";
4
4
 
5
5
  import React from "react";
6
6
 
7
+ import { ctx } from "./_ctx";
7
8
  import { ExpoRoot } from "./src";
8
9
  import { getNavigationConfig } from "./src/getLinkingConfig";
9
10
  import { getRoutes } from "./src/getRoutes";
10
11
  import { loadStaticParamsAsync } from "./src/loadStaticParamsAsync";
11
12
 
12
- export const ctx = require.context(
13
- process.env.EXPO_ROUTER_APP_ROOT!,
14
- true,
15
- /.*/,
16
- // @ts-expect-error
17
- process.env.EXPO_ROUTER_IMPORT_MODE!
18
- );
19
-
20
13
  // Must be exported or Fast Refresh won't update the context >:[
21
14
  export default function ExpoRouterRoot({ location }: { location: URL }) {
22
15
  return <ExpoRoot context={ctx} location={location} />;
@@ -35,3 +28,5 @@ export async function getManifest(options: any) {
35
28
 
36
29
  return getNavigationConfig(routeTree);
37
30
  }
31
+
32
+ export { ctx };
package/babel.js CHANGED
@@ -1,6 +1,8 @@
1
1
  const { getConfig } = require("expo/config");
2
+ const fs = require("fs");
2
3
  const nodePath = require("path");
3
4
  const resolveFrom = require("resolve-from");
5
+
4
6
  const { getExpoConstantsManifest } = require("./node/getExpoConstantsManifest");
5
7
 
6
8
  const debug = require("debug")("expo:router:babel");
@@ -27,15 +29,26 @@ function getConfigMemo(projectRoot) {
27
29
  }
28
30
 
29
31
  function getExpoRouterImportMode(projectRoot, platform) {
30
- if (process.env.EXPO_ROUTER_IMPORT_MODE) {
31
- return process.env.EXPO_ROUTER_IMPORT_MODE;
32
+ const envVar = "EXPO_ROUTER_IMPORT_MODE_" + platform.toUpperCase();
33
+ if (process.env[envVar]) {
34
+ return process.env[envVar];
32
35
  }
33
36
  const env = process.env.NODE_ENV || process.env.BABEL_ENV;
34
37
 
35
38
  const { exp } = getConfigMemo(projectRoot);
36
- let mode = [env, true].includes(exp.extra?.router?.asyncRoutes)
37
- ? "lazy"
38
- : "sync";
39
+
40
+ let asyncRoutesSetting;
41
+
42
+ if (exp.extra?.router?.asyncRoutes) {
43
+ const asyncRoutes = exp.extra?.router?.asyncRoutes;
44
+ if (typeof asyncRoutes === "string") {
45
+ asyncRoutesSetting = asyncRoutes;
46
+ } else if (typeof asyncRoutes === "object") {
47
+ asyncRoutesSetting = asyncRoutes[platform] ?? asyncRoutes.default;
48
+ }
49
+ }
50
+
51
+ let mode = [env, true].includes(asyncRoutesSetting) ? "lazy" : "sync";
39
52
 
40
53
  // TODO: Production bundle splitting
41
54
 
@@ -53,10 +66,25 @@ function getExpoRouterImportMode(projectRoot, platform) {
53
66
  // Development
54
67
  debug("Router import mode", mode);
55
68
 
56
- process.env.EXPO_ROUTER_IMPORT_MODE = mode;
69
+ process.env[envVar] = mode;
57
70
  return mode;
58
71
  }
59
72
 
73
+ function directoryExistsSync(file) {
74
+ return fs.statSync(file, { throwIfNoEntry: false })?.isDirectory() ?? false;
75
+ }
76
+
77
+ function getRouterDirectory(projectRoot) {
78
+ // more specific directories first
79
+ if (directoryExistsSync(nodePath.join(projectRoot, "src/app"))) {
80
+ // Log.log(chalk.gray('Using src/app as the root directory for Expo Router.'));
81
+ return "./src/app";
82
+ }
83
+
84
+ // Log.debug('Using app as the root directory for Expo Router.');
85
+ return "./app";
86
+ }
87
+
60
88
  function getExpoRouterAppRoot(projectRoot) {
61
89
  // Bump to v2 to prevent the CLI from setting the variable anymore.
62
90
  // TODO: Bump to v3 to revert back to the CLI setting the variable again, but with custom value
@@ -67,7 +95,8 @@ function getExpoRouterAppRoot(projectRoot) {
67
95
  const routerEntry = resolveFrom.silent(projectRoot, "expo-router/entry");
68
96
 
69
97
  const { exp } = getConfigMemo(projectRoot);
70
- const customSrc = exp.extra?.router?.unstable_src || "./app";
98
+ const customSrc =
99
+ exp.extra?.router?.unstable_src || getRouterDirectory(projectRoot);
71
100
  const isAbsolute = customSrc.startsWith("/");
72
101
  // It doesn't matter if the app folder exists.
73
102
  const appFolder = isAbsolute
@@ -166,8 +195,9 @@ module.exports = function (api) {
166
195
 
167
196
  // Expose the app route import mode.
168
197
  if (
198
+ platform &&
169
199
  t.isIdentifier(parent.node.property, {
170
- name: "EXPO_ROUTER_IMPORT_MODE",
200
+ name: "EXPO_ROUTER_IMPORT_MODE_" + platform.toUpperCase(),
171
201
  }) &&
172
202
  !parent.parentPath.isAssignmentExpression()
173
203
  ) {
@@ -1,4 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { ExpoRootProps } from "./useCreateExpoRouterContext";
2
+ import { RequireContext } from "./types";
3
+ export type ExpoRootProps = {
4
+ context: RequireContext;
5
+ location?: URL;
6
+ };
3
7
  export declare function ExpoRoot({ context, location }: ExpoRootProps): JSX.Element;
4
8
  //# sourceMappingURL=ExpoRoot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":";AAaA,OAAO,EACL,aAAa,EAEd,MAAM,8BAA8B,CAAC;AA8BtC,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,aAAa,eAa5D"}
1
+ {"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CAAC;AA4BF,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,aAAa,eAa5D"}
@@ -1,6 +1,6 @@
1
1
  import { Navigator, Slot } from "./views/Navigator";
2
- export { useRouter } from "./link/useRouter";
3
- export { useUnstableGlobalHref, usePathname, useGlobalSearchParams, useLocalSearchParams, useSearchParams, useSegments, useRootNavigation, useRootNavigationState, } from "./hooks";
2
+ export { useRouter, useUnstableGlobalHref, usePathname, useGlobalSearchParams, useLocalSearchParams, useSearchParams, useSegments, useRootNavigation, useRootNavigationState, } from "./hooks";
3
+ export { router } from "./imperative-api";
4
4
  export { Link, Redirect } from "./link/Link";
5
5
  export { withLayoutContext } from "./layouts/withLayoutContext";
6
6
  export { Navigator, Slot };
@@ -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,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
+ {"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,EACL,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,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,4 +1,4 @@
1
- export declare function extractExpoPathFromURL(url: string): string;
1
+ export declare function extractExpoPathFromURL(url?: string): string;
2
2
  export declare function adjustPathname(url: {
3
3
  hostname?: string | null;
4
4
  pathname: string;
@@ -1 +1 @@
1
- {"version":3,"file":"extractPathFromURL.d.ts","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":"AAwFA,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,UAGjD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE;IAClC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB,UAMA"}
1
+ {"version":3,"file":"extractPathFromURL.d.ts","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":"AAwFA,wBAAgB,sBAAsB,CAAC,GAAG,GAAE,MAAW,UAGtD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE;IAClC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB,UAMA"}
@@ -16,7 +16,7 @@ export declare function findFocusedRoute(state: InitialState): (Omit<import("@re
16
16
  })[];
17
17
  type: string;
18
18
  stale: false;
19
- }>, "routes" | "stale">> & {
19
+ }>, "stale" | "routes">> & {
20
20
  routes: (Omit<import("@react-navigation/routers").Route<string, object | undefined>, "key"> & any)[];
21
21
  }> | undefined;
22
22
  }) | undefined;
@@ -19,7 +19,7 @@ export default function useLinking(ref: React.RefObject<NavigationContainerRef<P
19
19
  })[];
20
20
  type: string;
21
21
  stale: false;
22
- }>, "routes" | "stale">> & Readonly<{
22
+ }>, "stale" | "routes">> & Readonly<{
23
23
  stale?: true | undefined;
24
24
  routes: import("@react-navigation/core").PartialRoute<import("@react-navigation/core").Route<string, object | undefined>>[];
25
25
  }> & {
@@ -39,7 +39,7 @@ export default function useLinking(ref: React.RefObject<NavigationContainerRef<P
39
39
  })[];
40
40
  type: string;
41
41
  stale: false;
42
- }>, "routes" | "stale">> & Readonly<{
42
+ }>, "stale" | "routes">> & Readonly<{
43
43
  stale?: true | undefined;
44
44
  routes: import("@react-navigation/core").PartialRoute<import("@react-navigation/core").Route<string, object | undefined>>[];
45
45
  }> & any) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"getRoutes.d.ts","sourceRoot":"","sources":["../src/getRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAU5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,YAAY,GAAG,WAAW,CAAC,GAAG;IACnE,yBAAyB;IACzB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,8CAA8C;IAC9C,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,KAAK,OAAO,GAAG;IAC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AAS,GAChB,SAAS,GAAG,IAAI,CAkBlB"}
@@ -0,0 +1,47 @@
1
+ import { NavigationContainerRefWithCurrent } from "@react-navigation/native";
2
+ import { ComponentType } from "react";
3
+ import { UrlObject } from "../LocationProvider";
4
+ import { RouteNode } from "../Route";
5
+ import { ResultState } from "../fork/getStateFromPath";
6
+ import { ExpoLinkingOptions } from "../getLinkingConfig";
7
+ import { RequireContext } from "../types";
8
+ /**
9
+ * This is the global state for the router. It is used to keep track of the current route, and to provide a way to navigate to other routes.
10
+ *
11
+ * There should only be one instance of this class and be initialized via `useInitializeExpoRouter`
12
+ */
13
+ export declare class RouterStore {
14
+ routeNode: RouteNode | null;
15
+ rootComponent: ComponentType;
16
+ linking: ExpoLinkingOptions | undefined;
17
+ isReady: boolean;
18
+ initialState: ResultState | undefined;
19
+ rootState: ResultState | undefined;
20
+ routeInfo?: UrlObject | undefined;
21
+ navigationRef: NavigationContainerRefWithCurrent<ReactNavigation.RootParamList>;
22
+ navigationRefSubscription: () => void;
23
+ rootStateSubscribers: Set<() => void>;
24
+ storeSubscribers: Set<() => void>;
25
+ linkTo: (href: string, event?: string | undefined) => void;
26
+ getSortedRoutes: () => RouteNode[];
27
+ goBack: () => void;
28
+ push: (url: import("../link/href").Href) => void;
29
+ replace: (url: import("../link/href").Href) => void;
30
+ setParams: (params?: Record<string, string | number> | undefined) => any;
31
+ initialize(context: RequireContext, navigationRef: NavigationContainerRefWithCurrent<ReactNavigation.RootParamList>, initialLocation?: URL): void;
32
+ getRouteInfo(state: ResultState): UrlObject;
33
+ shouldShowTutorial(): boolean;
34
+ /** Make sure these are arrow functions so `this` is correctly bound */
35
+ onReady: () => void;
36
+ subscribeToRootState: (subscriber: () => void) => () => boolean;
37
+ subscribeToStore: (subscriber: () => void) => () => boolean;
38
+ snapshot: () => this;
39
+ rootStateSnapshot: () => ResultState;
40
+ routeInfoSnapshot: () => UrlObject;
41
+ }
42
+ export declare const store: RouterStore;
43
+ export declare function useExpoRouter(): RouterStore;
44
+ export declare function useStoreRootState(): ResultState;
45
+ export declare function useStoreRouteInfo(): UrlObject;
46
+ export declare function useInitializeExpoRouter(context: RequireContext, initialLocation: URL | undefined): RouterStore;
47
+ //# sourceMappingURL=router-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router-store.d.ts","sourceRoot":"","sources":["../../src/global-state/router-store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EAGlC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAiC,aAAa,EAAY,MAAM,OAAO,CAAC;AAE/E,OAAO,EAAE,SAAS,EAAyB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAoB,MAAM,qBAAqB,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAM1C;;;;GAIG;AACH,qBAAa,WAAW;IACtB,SAAS,EAAG,SAAS,GAAG,IAAI,CAAC;IAC7B,aAAa,EAAG,aAAa,CAAC;IAC9B,OAAO,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACxC,OAAO,EAAE,OAAO,CAAS;IAEzB,YAAY,EAAE,WAAW,GAAG,SAAS,CAAC;IACtC,SAAS,EAAE,WAAW,GAAG,SAAS,CAAC;IACnC,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAElC,aAAa,EAAG,iCAAiC,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;IACjF,yBAAyB,EAAG,MAAM,IAAI,CAAC;IAEvC,oBAAoB,YAAiB,IAAI,EAAI;IAC7C,gBAAgB,YAAiB,IAAI,EAAI;IAEzC,MAAM,qDAAqB;IAC3B,eAAe,oBAA8B;IAC7C,MAAM,aAAqB;IAC3B,IAAI,6CAAmB;IACvB,OAAO,6CAAsB;IAC7B,SAAS,gEAAwB;IAEjC,UAAU,CACR,OAAO,EAAE,cAAc,EACvB,aAAa,EAAE,iCAAiC,CAAC,eAAe,CAAC,aAAa,CAAC,EAC/E,eAAe,CAAC,EAAE,GAAG;IA2EvB,YAAY,CAAC,KAAK,EAAE,WAAW;IAgB/B,kBAAkB;IAIlB,uEAAuE;IACvE,OAAO,aAKL;IACF,oBAAoB,eAAgB,MAAM,IAAI,mBAG5C;IACF,gBAAgB,eAAgB,MAAM,IAAI,mBAGxC;IACF,QAAQ,aAEN;IACF,iBAAiB,oBAEf;IACF,iBAAiB,kBAEf;CACH;AAED,eAAO,MAAM,KAAK,aAAoB,CAAC;AAEvC,wBAAgB,aAAa,gBAM5B;AAED,wBAAgB,iBAAiB,gBAMhC;AAED,wBAAgB,iBAAiB,cAMhC;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,cAAc,EACvB,eAAe,EAAE,GAAG,GAAG,SAAS,eASjC"}
@@ -0,0 +1,12 @@
1
+ import { getActionFromState } from "@react-navigation/core";
2
+ import { Href } from "../link/href";
3
+ import { NavigateAction } from "../link/stateOperations";
4
+ import type { RouterStore } from "./router-store";
5
+ export declare function push(this: RouterStore, url: Href): void;
6
+ export declare function replace(this: RouterStore, url: Href): void;
7
+ export declare function goBack(this: RouterStore): void;
8
+ export declare function setParams(this: RouterStore, params?: Record<string, string | number>): any;
9
+ export declare function linkTo(this: RouterStore, href: string, event?: string): void;
10
+ /** @returns `true` if the action is moving to the first screen of all the navigators in the action. */
11
+ export declare function isAbsoluteInitialRoute(action: ReturnType<typeof getActionFromState>): action is NavigateAction;
12
+ //# sourceMappingURL=routing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/global-state/routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAEnB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAE,IAAI,EAAe,MAAM,cAAc,CAAC;AAEjD,OAAO,EACL,cAAc,EAKf,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAQlD,wBAAgB,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,QAEhD;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,QAEnD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,WAAW,QAGvC;AAED,wBAAgB,SAAS,CACvB,IAAI,EAAE,WAAW,EACjB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAM,OAI7C;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,QAkHrE;AAMD,uGAAuG;AACvG,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,GAC5C,MAAM,IAAI,cAAc,CAqB1B"}
@@ -0,0 +1,4 @@
1
+ import { RouteNode } from "../Route";
2
+ import type { RouterStore } from "./router-store";
3
+ export declare function getSortedRoutes(this: RouterStore): RouteNode[];
4
+ //# sourceMappingURL=sort-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sort-routes.d.ts","sourceRoot":"","sources":["../../src/global-state/sort-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,eA2ChD"}
package/build/hooks.d.ts CHANGED
@@ -1,31 +1,10 @@
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";
1
+ import { Router } from "./types";
7
2
  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;
3
+ export declare function useRootNavigationState(): import("./fork/getStateFromPath").ResultState;
4
+ export declare function useRouteInfo(): import("./LocationProvider").UrlObject;
27
5
  export declare function useRootNavigation(): import("@react-navigation/native").NavigationContainerRef<ReactNavigation.RootParamList> | null;
28
- export declare function useLinkingContext(): ExpoLinkingOptions;
6
+ export declare function useLink(): Router;
7
+ export declare function useRouter(): Router;
29
8
  /**
30
9
  * @private
31
10
  * @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`
@@ -1 +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,CAA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AY,KACxC,OAAO,CAAC,OAAO,CAAC,CAEpB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,SAAS,YAAY,GAAG,YAAY,KACxC,OAAO,CAAC,OAAO,CAAC,CAEpB"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAEtD,wBAAgB,sBAAsB,kDAErC;AAED,wBAAgB,YAAY,2CAE3B;AAED,wBAAgB,iBAAiB,oGAEhC;AAGD,wBAAgB,OAAO,WAGtB;AAED,wBAAgB,SAAS,IAAI,MAAM,CASlC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CACzB,SAAS,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,KAClC,SAAS,CAEb;AAED,kEAAkE;AAClE,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,SAAS,YAAY,GAAG,YAAY,KACxC,OAAO,CAAC,OAAO,CAAC,CAEpB;AAED,qDAAqD;AACrD,wBAAgB,eAAe,CAC7B,OAAO,SAAS,YAAY,GAAG,YAAY,KACxC,OAAO,CAAC,OAAO,CAAC,CAEpB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,SAAS,YAAY,GAAG,YAAY,KACxC,OAAO,CAAC,OAAO,CAAC,CAEpB"}
@@ -0,0 +1,3 @@
1
+ import { Router } from "./types";
2
+ export declare const router: Router;
3
+ //# sourceMappingURL=imperative-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imperative-api.d.ts","sourceRoot":"","sources":["../src/imperative-api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,eAAO,MAAM,MAAM,EAAE,MAKpB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: string | undefined;
2
+ export default _default;
3
+ //# sourceMappingURL=index.android.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.android.d.ts","sourceRoot":"","sources":["../../src/import-mode/index.android.ts"],"names":[],"mappings":";AAAA,wBAA2D"}
@@ -0,0 +1,3 @@
1
+ declare const _default: "sync" | "lazy";
2
+ export default _default;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/import-mode/index.ts"],"names":[],"mappings":";AAAA,wBAAyC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: string | undefined;
2
+ export default _default;
3
+ //# sourceMappingURL=index.ios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.ios.d.ts","sourceRoot":"","sources":["../../src/import-mode/index.ios.ts"],"names":[],"mappings":";AAAA,wBAAuD"}
@@ -0,0 +1,3 @@
1
+ declare const _default: string | undefined;
2
+ export default _default;
3
+ //# sourceMappingURL=index.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../src/import-mode/index.web.ts"],"names":[],"mappings":";AAAA,wBAAuD"}
@@ -27,7 +27,7 @@ export declare const Drawer: import("react").ForwardRefExoticComponent<Omit<Omit
27
27
  backBehavior?: import("@react-navigation/routers/lib/typescript/src/TabRouter").BackBehavior | undefined;
28
28
  } & {
29
29
  defaultStatus?: import("@react-navigation/routers").DrawerStatus | undefined;
30
- } & import("@react-navigation/drawer/lib/typescript/src/types").DrawerNavigationConfig, "children" | "id" | "initialRouteName" | "screenListeners" | "screenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
30
+ } & import("@react-navigation/drawer/lib/typescript/src/types").DrawerNavigationConfig, "initialRouteName" | "children" | "id" | "screenListeners" | "screenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
31
31
  id?: string | undefined;
32
32
  children: import("react").ReactNode;
33
33
  screenListeners?: Partial<{
@@ -77,7 +77,7 @@ export declare const Drawer: import("react").ForwardRefExoticComponent<Omit<Omit
77
77
  backBehavior?: import("@react-navigation/routers/lib/typescript/src/TabRouter").BackBehavior | undefined;
78
78
  } & {
79
79
  defaultStatus?: import("@react-navigation/routers").DrawerStatus | undefined;
80
- } & import("@react-navigation/drawer/lib/typescript/src/types").DrawerNavigationConfig, "children" | "id" | "initialRouteName" | "screenListeners" | "screenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
80
+ } & import("@react-navigation/drawer/lib/typescript/src/types").DrawerNavigationConfig, "initialRouteName" | "children" | "id" | "screenListeners" | "screenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
81
81
  id?: string | undefined;
82
82
  children: import("react").ReactNode;
83
83
  screenListeners?: Partial<{
@@ -25,7 +25,7 @@ export declare const Stack: import("react").ForwardRefExoticComponent<Omit<Omit<
25
25
  route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
26
26
  navigation: any;
27
27
  }) => NativeStackNavigationOptions) | undefined;
28
- } & import("@react-navigation/routers").StackRouterOptions, "children" | "id" | "initialRouteName" | "screenListeners" | "screenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
28
+ } & import("@react-navigation/routers").StackRouterOptions, "initialRouteName" | "children" | "id" | "screenListeners" | "screenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
29
29
  id?: string | undefined;
30
30
  children: import("react").ReactNode;
31
31
  screenListeners?: Partial<{
@@ -75,7 +75,7 @@ export declare const Stack: import("react").ForwardRefExoticComponent<Omit<Omit<
75
75
  route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
76
76
  navigation: any;
77
77
  }) => NativeStackNavigationOptions) | undefined;
78
- } & import("@react-navigation/routers").StackRouterOptions, "children" | "id" | "initialRouteName" | "screenListeners" | "screenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
78
+ } & import("@react-navigation/routers").StackRouterOptions, "initialRouteName" | "children" | "id" | "screenListeners" | "screenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
79
79
  id?: string | undefined;
80
80
  children: import("react").ReactNode;
81
81
  screenListeners?: Partial<{
@@ -28,7 +28,7 @@ export declare const Tabs: React.ForwardRefExoticComponent<Omit<Omit<import("@re
28
28
  }) => BottomTabNavigationOptions) | undefined;
29
29
  } & import("@react-navigation/routers").DefaultRouterOptions & {
30
30
  backBehavior?: import("@react-navigation/routers/lib/typescript/src/TabRouter").BackBehavior | undefined;
31
- } & import("@react-navigation/bottom-tabs/lib/typescript/src/types").BottomTabNavigationConfig, "children" | "id" | "initialRouteName" | "screenListeners" | "screenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
31
+ } & import("@react-navigation/bottom-tabs/lib/typescript/src/types").BottomTabNavigationConfig, "initialRouteName" | "children" | "id" | "screenListeners" | "screenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
32
32
  id?: string | undefined;
33
33
  children: React.ReactNode;
34
34
  screenListeners?: Partial<{
@@ -80,7 +80,7 @@ export declare const Tabs: React.ForwardRefExoticComponent<Omit<Omit<import("@re
80
80
  }) => BottomTabNavigationOptions) | undefined;
81
81
  } & import("@react-navigation/routers").DefaultRouterOptions & {
82
82
  backBehavior?: import("@react-navigation/routers/lib/typescript/src/TabRouter").BackBehavior | undefined;
83
- } & import("@react-navigation/bottom-tabs/lib/typescript/src/types").BottomTabNavigationConfig, "children" | "id" | "initialRouteName" | "screenListeners" | "screenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
83
+ } & import("@react-navigation/bottom-tabs/lib/typescript/src/types").BottomTabNavigationConfig, "initialRouteName" | "children" | "id" | "screenListeners" | "screenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
84
84
  id?: string | undefined;
85
85
  children: React.ReactNode;
86
86
  screenListeners?: Partial<{
@@ -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,EAAE,OAAO,CAAC;IAElB,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,OAAO,CAAC,EAAE,CACR,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC,GAAG,qBAAqB,KACvE,IAAI,CAAC;CACX;AAED,iEAAiE;AACjE,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,QAUhD;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;IACzD,6DAA6D;IAC7D,WAAW,EAAE,OAAO,WAAW,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,eAEY,CAAC"}
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;AAI/D,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAG3C,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,CAAC;IACvE,wBAAwB;IACxB,IAAI,EAAE,IAAI,CAAC;IAGX,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,OAAO,CAAC,EAAE,CACR,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC,GAAG,qBAAqB,KACvE,IAAI,CAAC;CACX;AAED,iEAAiE;AACjE,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,QAUhD;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;IACzD,6DAA6D;IAC7D,WAAW,EAAE,OAAO,WAAW,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,eAEY,CAAC"}
@@ -30,7 +30,7 @@ export declare function findTopRouteForTarget(state: ResultState): Omit<import("
30
30
  })[];
31
31
  type: string;
32
32
  stale: false;
33
- }>, "routes" | "stale">> & {
33
+ }>, "stale" | "routes">> & {
34
34
  routes: (Omit<import("@react-navigation/native").Route<string, object | undefined>, "key"> & any)[];
35
35
  }> | undefined;
36
36
  };
@@ -52,7 +52,7 @@ export declare function getQualifiedStateForTopOfTargetState(rootState: InitialS
52
52
  })[];
53
53
  type: string;
54
54
  stale: false;
55
- }>, "routes" | "stale">> & {
55
+ }>, "stale" | "routes">> & {
56
56
  routes: (Omit<import("@react-navigation/native").Route<string, object | undefined>, "key"> & {
57
57
  state?: Readonly<Partial<Omit<Readonly<{
58
58
  key: string;
@@ -70,7 +70,7 @@ export declare function getQualifiedStateForTopOfTargetState(rootState: InitialS
70
70
  })[];
71
71
  type: string;
72
72
  stale: false;
73
- }>, "routes" | "stale">> & any> | undefined;
73
+ }>, "stale" | "routes">> & any> | undefined;
74
74
  })[];
75
75
  }>;
76
76
  export declare function getEarliestMismatchedRoute<T extends ParamListBase>(rootState: NavigationState<T> | undefined, actionParams: NavigateActionParams): {
@@ -1 +1 @@
1
- {"version":3,"file":"Tutorial.d.ts","sourceRoot":"","sources":["../../src/onboard/Tutorial.tsx"],"names":[],"mappings":";AAqCA,wBAAgB,QAAQ,gBAwCvB"}
1
+ {"version":3,"file":"Tutorial.d.ts","sourceRoot":"","sources":["../../src/onboard/Tutorial.tsx"],"names":[],"mappings":";AAqCA,wBAAgB,QAAQ,gBAyCvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"createEntryFile.d.ts","sourceRoot":"","sources":["../../src/onboard/createEntryFile.ts"],"names":[],"mappings":"AAEA,4DAA4D;AAC5D,wBAAgB,oBAAoB,kCAenC"}
1
+ {"version":3,"file":"createEntryFile.d.ts","sourceRoot":"","sources":["../../src/onboard/createEntryFile.ts"],"names":[],"mappings":"AAEA,4DAA4D;AAC5D,wBAAgB,oBAAoB,kCAuBnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"renderRootComponent.d.ts","sourceRoot":"","sources":["../src/renderRootComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgD1B;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,QA+BtE"}
1
+ {"version":3,"file":"renderRootComponent.d.ts","sourceRoot":"","sources":["../src/renderRootComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgD1B;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,QAkCtE"}
@@ -3,7 +3,7 @@ import { render } from "@testing-library/react-native";
3
3
  import { FileStub } from "./context-stubs";
4
4
  export * from "@testing-library/react-native";
5
5
  type RenderRouterOptions = Parameters<typeof render>[1] & {
6
- initialUrl?: string;
6
+ initialUrl?: any;
7
7
  };
8
8
  type Result = ReturnType<typeof render> & {
9
9
  getPathname(): string;
@@ -1 +1 @@
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;AAQrE,OAAO,EACL,QAAQ,EAIT,MAAM,iBAAiB,CAAC;AAIzB,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,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,QAAQ,CAAC,EACjC,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,QAAQ,CAAC,CAAA;CAAE,EAChE,OAAO,CAAC,EAAE,mBAAmB,GAC5B,MAAM,CAAC"}
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;AAQrE,OAAO,EACL,QAAQ,EAIT,MAAM,iBAAiB,CAAC;AAIzB,cAAc,+BAA+B,CAAC;AAE9C,KAAK,mBAAmB,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG;IACxD,UAAU,CAAC,EAAE,GAAG,CAAC;CAClB,CAAC;AAEF,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,QAAQ,CAAC,EACjC,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,QAAQ,CAAC,CAAA;CAAE,EAChE,OAAO,CAAC,EAAE,mBAAmB,GAC5B,MAAM,CAAC"}
@@ -1,7 +1,5 @@
1
1
  import "@testing-library/jest-native/extend-expect";
2
2
  export declare const initialUrlRef: {
3
- value: string;
4
- then(onfulfilled: (v: string) => string): any;
5
- catch(): any;
3
+ value: string | Promise<string>;
6
4
  };
7
5
  //# sourceMappingURL=mocks.d.ts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/testing-library/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,4CAA4C,CAAC;AAgBpD,eAAO,MAAM,aAAa,EAAE;IAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CAE5D,CAAC"}
package/build/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Href } from "./link/href";
1
2
  export interface RequireContext {
2
3
  /** Return the keys that can be resolved. */
3
4
  keys(): string[];
@@ -10,4 +11,14 @@ export interface RequireContext {
10
11
  }
11
12
  /** The list of input keys will become optional, everything else will remain the same. */
12
13
  export type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
14
+ export type Router = {
15
+ /** Navigate to the provided href. */
16
+ push: (href: Href) => void;
17
+ /** Navigate to route without appending to the history. */
18
+ replace: (href: Href) => void;
19
+ /** Go back in the history. */
20
+ back: () => void;
21
+ /** Update the current route query params. */
22
+ setParams: (params?: Record<string, string>) => void;
23
+ };
13
24
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,cAAc;IAC7B,4CAA4C;IAC5C,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,CAAC;IAClB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;IACnB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,yFAAyF;AACzF,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACxD,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGnC,MAAM,WAAW,cAAc;IAC7B,4CAA4C;IAC5C,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,CAAC;IAClB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;IACnB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,yFAAyF;AACzF,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACxD,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtB,MAAM,MAAM,MAAM,GAAG;IACnB,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"useScreens.d.ts","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAIL,SAAS,EAGV,MAAM,SAAS,CAAC;AAMjB,MAAM,MAAM,WAAW,CACrB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAA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AAE,GAAG,KAAK,CAAC,SAAS,EAAE,CAUxE;AA6BD,mFAAmF;AACnF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,SAAS,kIAuE1D;AAED,oGAAoG;AACpG,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC;;sCA0B5C"}
@@ -110,12 +110,11 @@ export declare function useNavigatorContext(): {
110
110
  state?: Readonly<any> | import("@react-navigation/native").PartialState<Readonly<any>> | undefined;
111
111
  })[];
112
112
  type: string;
113
- /** Used to configure route settings. */
114
113
  stale: false;
115
114
  }>>): void;
116
115
  goBack(): void;
117
116
  isFocused(): boolean;
118
- canGoBack(): boolean;
117
+ canGoBack(): boolean; /** Used to configure route settings. */
119
118
  getId(): string | undefined;
120
119
  getParent<T = import("@react-navigation/native").NavigationHelpers<import("@react-navigation/native").ParamListBase, {}> | undefined>(id?: string | undefined): T;
121
120
  getState(): Readonly<{