@react-navigation/native 7.1.26 → 8.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/lib/module/Link.js.map +1 -1
  2. package/lib/module/NavigationContainer.js +73 -63
  3. package/lib/module/NavigationContainer.js.map +1 -1
  4. package/lib/module/__stubs__/createStackNavigator.js.map +1 -1
  5. package/lib/module/extractPathFromURL.js +12 -7
  6. package/lib/module/extractPathFromURL.js.map +1 -1
  7. package/lib/module/getStateFromHref.js +30 -0
  8. package/lib/module/getStateFromHref.js.map +1 -0
  9. package/lib/module/index.js +0 -1
  10. package/lib/module/index.js.map +1 -1
  11. package/lib/module/theming/DarkTheme.js.map +1 -1
  12. package/lib/module/theming/DefaultTheme.js +1 -1
  13. package/lib/module/theming/DefaultTheme.js.map +1 -1
  14. package/lib/module/theming/fonts.js.map +1 -1
  15. package/lib/module/useLinkBuilder.js +5 -8
  16. package/lib/module/useLinkBuilder.js.map +1 -1
  17. package/lib/module/useLinkProps.js +20 -0
  18. package/lib/module/useLinkProps.js.map +1 -1
  19. package/lib/module/useLinking.js +23 -24
  20. package/lib/module/useLinking.js.map +1 -1
  21. package/lib/module/useLinking.native.js +21 -36
  22. package/lib/module/useLinking.native.js.map +1 -1
  23. package/lib/module/useScrollToTop.js +1 -0
  24. package/lib/module/useScrollToTop.js.map +1 -1
  25. package/lib/module/useThenable.js +9 -6
  26. package/lib/module/useThenable.js.map +1 -1
  27. package/lib/typescript/src/Link.d.ts +3 -2
  28. package/lib/typescript/src/Link.d.ts.map +1 -1
  29. package/lib/typescript/src/NavigationContainer.d.ts +35 -7
  30. package/lib/typescript/src/NavigationContainer.d.ts.map +1 -1
  31. package/lib/typescript/src/__stubs__/createStackNavigator.d.ts +1 -2
  32. package/lib/typescript/src/__stubs__/createStackNavigator.d.ts.map +1 -1
  33. package/lib/typescript/src/extractPathFromURL.d.ts +2 -1
  34. package/lib/typescript/src/extractPathFromURL.d.ts.map +1 -1
  35. package/lib/typescript/src/getStateFromHref.d.ts +4 -0
  36. package/lib/typescript/src/getStateFromHref.d.ts.map +1 -0
  37. package/lib/typescript/src/index.d.ts +0 -1
  38. package/lib/typescript/src/index.d.ts.map +1 -1
  39. package/lib/typescript/src/theming/DarkTheme.d.ts +63 -2
  40. package/lib/typescript/src/theming/DarkTheme.d.ts.map +1 -1
  41. package/lib/typescript/src/theming/DefaultTheme.d.ts +63 -2
  42. package/lib/typescript/src/theming/DefaultTheme.d.ts.map +1 -1
  43. package/lib/typescript/src/theming/fonts.d.ts.map +1 -1
  44. package/lib/typescript/src/types.d.ts +49 -23
  45. package/lib/typescript/src/types.d.ts.map +1 -1
  46. package/lib/typescript/src/useLinkBuilder.d.ts +14 -6
  47. package/lib/typescript/src/useLinkBuilder.d.ts.map +1 -1
  48. package/lib/typescript/src/useLinkProps.d.ts +3 -3
  49. package/lib/typescript/src/useLinkProps.d.ts.map +1 -1
  50. package/lib/typescript/src/useLinking.d.ts +48 -4
  51. package/lib/typescript/src/useLinking.d.ts.map +1 -1
  52. package/lib/typescript/src/useLinking.native.d.ts +69 -4
  53. package/lib/typescript/src/useLinking.native.d.ts.map +1 -1
  54. package/lib/typescript/src/useScrollToTop.d.ts.map +1 -1
  55. package/lib/typescript/src/useThenable.d.ts +4 -1
  56. package/lib/typescript/src/useThenable.d.ts.map +1 -1
  57. package/package.json +8 -8
  58. package/src/Link.tsx +18 -15
  59. package/src/NavigationContainer.tsx +141 -84
  60. package/src/__stubs__/createStackNavigator.tsx +0 -2
  61. package/src/extractPathFromURL.tsx +28 -18
  62. package/src/getStateFromHref.tsx +46 -0
  63. package/src/index.tsx +0 -1
  64. package/src/theming/DarkTheme.tsx +4 -3
  65. package/src/theming/DefaultTheme.tsx +5 -4
  66. package/src/theming/fonts.tsx +1 -2
  67. package/src/types.tsx +60 -22
  68. package/src/useLinkBuilder.tsx +6 -9
  69. package/src/useLinkProps.tsx +36 -7
  70. package/src/useLinking.native.tsx +25 -48
  71. package/src/useLinking.tsx +32 -38
  72. package/src/useScrollToTop.tsx +3 -1
  73. package/src/useThenable.tsx +14 -6
  74. package/lib/module/UnhandledLinkingContext.js +0 -14
  75. package/lib/module/UnhandledLinkingContext.js.map +0 -1
  76. package/lib/typescript/src/UnhandledLinkingContext.d.ts +0 -6
  77. package/lib/typescript/src/UnhandledLinkingContext.d.ts.map +0 -1
  78. package/src/UnhandledLinkingContext.tsx +0 -18
@@ -1,10 +1,6 @@
1
- import type { getActionFromState as getActionFromStateDefault, getPathFromState as getPathFromStateDefault, getStateFromPath as getStateFromPathDefault, PathConfigMap, Route } from '@react-navigation/core';
2
- declare global {
3
- namespace ReactNavigation {
4
- interface Theme extends NativeTheme {
5
- }
6
- }
7
- }
1
+ import type { getActionFromState as getActionFromStateDefault, getPathFromState as getPathFromStateDefault, getStateFromPath as getStateFromPathDefault, InitialState, NavigationState, PathConfigMap, Route } from '@react-navigation/core';
2
+ import type { ColorValue as ReactNativeColorValue } from 'react-native';
3
+ type ColorValue = `#${string}` | `rgb(${string})` | `rgba(${string})` | `hsl(${string})` | `hsla(${string})` | `hwb(${string})` | `hwba(${string})` | `var(--${string})` | ReactNativeColorValue;
8
4
  type FontStyle = {
9
5
  fontFamily: string;
10
6
  fontWeight: 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
@@ -12,12 +8,12 @@ type FontStyle = {
12
8
  interface NativeTheme {
13
9
  dark: boolean;
14
10
  colors: {
15
- primary: string;
16
- background: string;
17
- card: string;
18
- text: string;
19
- border: string;
20
- notification: string;
11
+ primary: ColorValue;
12
+ background: ColorValue;
13
+ card: ColorValue;
14
+ text: ColorValue;
15
+ border: ColorValue;
16
+ notification: ColorValue;
21
17
  };
22
18
  fonts: {
23
19
  regular: FontStyle;
@@ -26,17 +22,32 @@ interface NativeTheme {
26
22
  heavy: FontStyle;
27
23
  };
28
24
  }
29
- export type Theme = NativeTheme;
25
+ declare module '@react-navigation/core' {
26
+ interface Theme extends NativeTheme {
27
+ }
28
+ }
30
29
  export type LocaleDirection = 'ltr' | 'rtl';
30
+ export type LinkingPrefix = '*' | (string & {});
31
31
  export type LinkingOptions<ParamList extends {}> = {
32
32
  /**
33
33
  * Whether deep link handling should be enabled.
34
- * Defaults to true.
34
+ *
35
+ * Defaults to `true` when a linking config is specified.
35
36
  */
36
37
  enabled?: boolean;
37
38
  /**
38
- * The prefixes are stripped from the URL before parsing them.
39
- * Usually they are the `scheme` + `host` (e.g. `myapp://chat?user=jane`)
39
+ * The prefixes to match to determine whether to handle a URL.
40
+ *
41
+ * Supported prefix formats:
42
+ * - `${scheme}://` - App-specific scheme, e.g. `myapp://`
43
+ * - `${protocol}://${host}` - Universal links or app links, e.g. `https://example.com`, `https://subdomain.example.com`
44
+ * - `${protocol}://*.${domain}` - Any subdomain of given domain, e.g. `https://*.example.com`
45
+ * - `${protocol}://${host}/${path}` - Subpath of given host, e.g. `https://example.com/app`
46
+ * - `*` - Any domain or subdomain with `http://` and `https://` as well as any app-specific scheme
47
+ *
48
+ * The prefix will be stripped from the URL before it's parsed.
49
+ *
50
+ * Defaults to `[*]`.
40
51
  *
41
52
  * This is not supported on Web.
42
53
  *
@@ -44,14 +55,14 @@ export type LinkingOptions<ParamList extends {}> = {
44
55
  * ```js
45
56
  * {
46
57
  * prefixes: [
47
- * "myapp://", // App-specific scheme
48
- * "https://example.com", // Prefix for universal links
49
- * "https://*.example.com" // Prefix which matches any subdomain
58
+ * "myapp://",
59
+ * "https://example.com",
60
+ * "https://*.example.com"
50
61
  * ]
51
62
  * }
52
63
  * ```
53
64
  */
54
- prefixes: string[];
65
+ prefixes?: LinkingPrefix[];
55
66
  /**
56
67
  * Optional function which takes an incoming URL returns a boolean
57
68
  * indicating whether React Navigation should handle it.
@@ -126,9 +137,11 @@ export type LinkingOptions<ParamList extends {}> = {
126
137
  * subscribe: (listener) => {
127
138
  * const onReceiveURL = ({ url }) => listener(url);
128
139
  *
129
- * Linking.addEventListener('url', onReceiveURL);
140
+ * const subscription = Linking.addEventListener('url', onReceiveURL);
130
141
  *
131
- * return () => Linking.removeEventListener('url', onReceiveURL);
142
+ * return () => {
143
+ * subscription.remove();
144
+ * };
132
145
  * }
133
146
  * }
134
147
  * ```
@@ -152,6 +165,19 @@ export type DocumentTitleOptions = {
152
165
  enabled?: boolean;
153
166
  formatter?: (options: Record<string, any> | undefined, route: Route<string> | undefined) => string;
154
167
  };
168
+ export type Persistor = {
169
+ /**
170
+ * Callback to persist the navigation state.
171
+ */
172
+ persist(state: NavigationState | undefined): void;
173
+ /**
174
+ * Callback to restore the navigation state.
175
+ * Should return the restored state or a Promise which resolves to the restored state.
176
+ *
177
+ * If a Promise is returned, providing a `fallback` component is recommended.
178
+ */
179
+ restore(): PromiseLike<InitialState | undefined> | InitialState | undefined;
180
+ };
155
181
  export type ServerContainerRef = {
156
182
  getCurrentOptions(): Record<string, any> | undefined;
157
183
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,IAAI,yBAAyB,EAC/C,gBAAgB,IAAI,uBAAuB,EAC3C,gBAAgB,IAAI,uBAAuB,EAC3C,aAAa,EACb,KAAK,EACN,MAAM,wBAAwB,CAAC;AAEhC,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,eAAe,CAAC;QACxB,UAAU,KAAM,SAAQ,WAAW;SAAG;KACvC;CACF;AAED,KAAK,SAAS,GAAG;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EACN,QAAQ,GACR,MAAM,GACN,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,CAAC;CACX,CAAC;AAEF,UAAU,WAAW;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,E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AAM,GACN,IAAI,GACJ,SAAS,GACT,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IACvC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,SAAS,CAAC,EAAE,CACV,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,KAC5B,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IACrC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,uBAAuB,CAAC;IAClD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,uBAAuB,CAAC;IAClD;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,yBAAyB,CAAC;CACvD,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,CACV,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,EACxC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,KAC7B,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,GAAG,IAAI,CAAC;IAClD;;;;;OAKG;IACH,OAAO,IAAI,WAAW,CAAC,YAAY,GAAG,SAAS,CAAC,GAAG,YAAY,GAAG,SAAS,CAAC;CAC7E,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;CACtD,CAAC"}
@@ -29,30 +29,38 @@ export declare function useLinkBuilder(): {
29
29
  payload: {
30
30
  name: string;
31
31
  params?: object;
32
- path?: string;
32
+ path
33
+ /**
34
+ * Helpers to build href or action based on the linking options.
35
+ *
36
+ * @returns `buildHref` to build an `href` for screen and `buildAction` to build an action from an `href`.
37
+ */
38
+ ? /**
39
+ * Helpers to build href or action based on the linking options.
40
+ *
41
+ * @returns `buildHref` to build an `href` for screen and `buildAction` to build an action from an `href`.
42
+ */: string;
33
43
  merge?: boolean;
34
44
  pop?: boolean;
35
45
  };
36
46
  source?: string;
37
47
  target?: string;
38
48
  } | {
39
- type: "NAVIGATE_DEPRECATED";
49
+ type: "SET_PARAMS";
40
50
  payload: {
41
- name: string;
42
51
  params?: object;
43
- merge?: boolean;
44
52
  };
45
53
  source?: string;
46
54
  target?: string;
47
55
  } | {
48
- type: "SET_PARAMS";
56
+ type: "REPLACE_PARAMS";
49
57
  payload: {
50
58
  params?: object;
51
59
  };
52
60
  source?: string;
53
61
  target?: string;
54
62
  } | {
55
- type: "REPLACE_PARAMS";
63
+ type: "PUSH_PARAMS";
56
64
  payload: {
57
65
  params?: object;
58
66
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useLinkBuilder.d.ts","sourceRoot":"","sources":["../../../src/useLinkBuilder.tsx"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,wBAAgB,cAAc;sBAcnB,MAAM,WAAW,MAAM;wBAmEvB,MAAM;;;;;;;;;;;;;;;;;;;;;;;kBArFV,CAAC;gBAAsB,CAAC;iBAAuB,CAAC;eAE9C,CAAC;;;;;;;;kBAGmC,CAAC;iBAC1C,CAAC;;;;;;;kBAOmB,CAAC;;;;;;;kBAIvB,CAAC;;;;;;;;kBAWG,CALA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoFL"}
1
+ {"version":3,"file":"useLinkBuilder.d.ts","sourceRoot":"","sources":["../../../src/useLinkBuilder.tsx"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,wBAAgB,cAAc;sBAanB,MAAM,WAAW,MAAM;wBAmEvB,MAAM;;;;;;;;;;;;;;;;;;;;;;;kBAxFgC,CAAC;;YAGlD;;;;eAIG;YACH,CALA,CAAA;;;;eAIG;iBAHiB,CAAA;eAAsB,CAAC;;;;;;;kBAMhB,CAAC;;;;;;;kBAMhB,CAAC;;;;;;;kBAE2B,CAAC;;;;;;;;kBAKnB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqFtB"}
@@ -1,7 +1,7 @@
1
- import { type NavigationAction } from '@react-navigation/core';
1
+ import { type NavigationAction, type RootParamList } from '@react-navigation/core';
2
2
  import * as React from 'react';
3
3
  import { type GestureResponderEvent } from 'react-native';
4
- export type LinkProps<ParamList extends ReactNavigation.RootParamList, RouteName extends keyof ParamList = keyof ParamList> = ({
4
+ export type LinkProps<ParamList extends {} = RootParamList, RouteName extends keyof ParamList = keyof ParamList> = ({
5
5
  href?: string;
6
6
  action?: NavigationAction;
7
7
  } & (RouteName extends unknown ? undefined extends ParamList[RouteName] ? {
@@ -24,7 +24,7 @@ export type LinkProps<ParamList extends ReactNavigation.RootParamList, RouteName
24
24
  * @param props.href Optional absolute path to use for the href (e.g. `/feeds/hot`).
25
25
  * @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.
26
26
  */
27
- export declare function useLinkProps<ParamList extends ReactNavigation.RootParamList>({ screen, params, href, action, }: LinkProps<ParamList>): {
27
+ export declare function useLinkProps<const ParamList extends {} = RootParamList, const RouteName extends keyof ParamList = keyof ParamList>({ screen, params, href, action }: LinkProps<ParamList, RouteName>): {
28
28
  href: string | undefined;
29
29
  role: "link";
30
30
  onPress: (e?: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useLinkProps.d.ts","sourceRoot":"","sources":["../../../src/useLinkProps.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EAKtB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,qBAAqB,EAAY,MAAM,cAAc,CAAC;AAIpE,MAAM,MAAM,SAAS,CACnB,SAAS,SAAS,eAAe,CAAC,aAAa,EAC/C,SAAS,SAAS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d,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B,GAAG,CAAC,SAAS,SAAS,OAAO,GAC1B,SAAS,SAAS,SAAS,CAAC,SAAS,CAAC,GACpC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,GACpD;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,GACrD,KAAK,CAAC,CAAC,GACX;IACE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,CAAC;AA+BN;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,KAAK,CAAC,SAAS,SAAS,EAAE,GAAG,aAAa,EAC1C,KAAK,CAAC,SAAS,SAAS,MAAM,SAAS,GAAG,MAAM,SAAS,EACzD,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC;;;kBAM3D,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC,GAAG,qBAAqB;EAwG9E"}
@@ -1,14 +1,58 @@
1
- import { getStateFromPath as getStateFromPathDefault, type NavigationContainerRef, type ParamListBase } from '@react-navigation/core';
1
+ import { type NavigationContainerRef, type ParamListBase } from '@react-navigation/core';
2
2
  import * as React from 'react';
3
3
  import type { LinkingOptions } from './types';
4
- type ResultState = ReturnType<typeof getStateFromPathDefault>;
4
+ import type { Thenable } from './useThenable';
5
5
  /**
6
6
  * Run async function in series as it's called.
7
7
  */
8
8
  export declare const series: (cb: () => Promise<void>) => () => void;
9
9
  type Options = LinkingOptions<ParamListBase>;
10
- export declare function useLinking(ref: React.RefObject<NavigationContainerRef<ParamListBase> | null>, { enabled, config, getStateFromPath, getPathFromState, getActionFromState, }: Options, onUnhandledLinking: (lastUnhandledLining: string | undefined) => void): {
11
- getInitialState: () => PromiseLike<ResultState | undefined>;
10
+ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<ParamListBase> | null>, { enabled, config, getStateFromPath, getPathFromState, getActionFromState, }: Options): {
11
+ getInitialState: () => Thenable<(Partial<Omit<Readonly<{
12
+ key: string;
13
+ index: number;
14
+ routeNames: string[];
15
+ history?: unknown[];
16
+ routes: import("@react-navigation/routers").NavigationRoute<ParamListBase, string>[];
17
+ type: string;
18
+ stale: false;
19
+ }>, "stale" | "routes">> & Readonly<{
20
+ stale?: true;
21
+ routes: import("@react-navigation/routers").PartialRoute<Readonly<{
22
+ key: string;
23
+ name: string;
24
+ path?: string;
25
+ history?: {
26
+ type: "params";
27
+ params: object;
28
+ }[];
29
+ } & Readonly<{
30
+ params?: Readonly<object | undefined>;
31
+ }>>>[];
32
+ }> & {
33
+ state?: Partial<Omit<Readonly<{
34
+ key: string;
35
+ index: number;
36
+ routeNames: string[];
37
+ history?: unknown[];
38
+ routes: import("@react-navigation/routers").NavigationRoute<ParamListBase, string>[];
39
+ type: string;
40
+ stale: false;
41
+ }>, "stale" | "routes">> & Readonly<{
42
+ stale?: true;
43
+ routes: import("@react-navigation/routers").PartialRoute<Readonly<{
44
+ key: string;
45
+ name: string;
46
+ path?: string;
47
+ history?: {
48
+ type: "params";
49
+ params: object;
50
+ }[];
51
+ } & Readonly<{
52
+ params?: Readonly<object | undefined>;
53
+ }>>>[];
54
+ }> & /*elided*/ any;
55
+ }) | undefined>;
12
56
  };
13
57
  export {};
14
58
  //# sourceMappingURL=useLinking.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLinking.d.ts","sourceRoot":"","sources":["../../../src/useLinking.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,gBAAgB,IAAI,uBAAuB,EAC3C,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAC;AAE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,gBAA0C,EAC1C,gBAA0C,EAC1C,kBAA8C,GAC/C,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+UX"}
@@ -1,9 +1,10 @@
1
1
  import { type NavigationContainerRef, type ParamListBase } from '@react-navigation/core';
2
2
  import * as React from 'react';
3
3
  import type { LinkingOptions } from './types';
4
+ import type { Thenable } from './useThenable';
4
5
  type Options = LinkingOptions<ParamListBase>;
5
- export declare function useLinking(ref: React.RefObject<NavigationContainerRef<ParamListBase> | null>, { enabled, prefixes, filter, config, getInitialURL, subscribe, getStateFromPath, getActionFromState, }: Options, onUnhandledLinking: (lastUnhandledLining: string | undefined) => void): {
6
- getInitialState: () => PromiseLike<(Partial<Omit<Readonly<{
6
+ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<ParamListBase> | null>, { enabled, prefixes, filter, config, getInitialURL, subscribe, getStateFromPath, getActionFromState, }: Options): {
7
+ getInitialState: () => Thenable<(Partial<Omit<Readonly<{
7
8
  key: string;
8
9
  index: number;
9
10
  routeNames: string[];
@@ -13,7 +14,61 @@ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<P
13
14
  stale: false;
14
15
  }>, "stale" | "routes">> & Readonly<{
15
16
  stale?: true;
16
- routes: import("@react-navigation/routers").PartialRoute<import("@react-navigation/routers").Route<string, object | undefined>>[];
17
+ routes: import("@react-navigation/routers").PartialRoute<Readonly<{
18
+ key: string;
19
+ name: string;
20
+ path?: string;
21
+ history?: {
22
+ type: "params";
23
+ params: object;
24
+ }[];
25
+ } & Readonly<{
26
+ params?: Readonly<object | undefined>;
27
+ }>>>[];
28
+ }> & {
29
+ state?: Partial<Omit<Readonly<{
30
+ key: string;
31
+ index: number;
32
+ routeNames: string[];
33
+ history?: unknown[];
34
+ routes: import("@react-navigation/routers").NavigationRoute<ParamListBase, string>[];
35
+ type: string;
36
+ stale: false;
37
+ }>, "stale" | "routes">> & Readonly<{
38
+ stale?: true;
39
+ routes: import("@react-navigation/routers").PartialRoute<Readonly<{
40
+ key: string;
41
+ name: string;
42
+ path?: string;
43
+ history?: {
44
+ type: "params";
45
+ params: object;
46
+ }[];
47
+ } & Readonly<{
48
+ params?: Readonly<object | undefined>;
49
+ }>>>[];
50
+ }> & /*elided*/ any;
51
+ }) | undefined> | Promise<(Partial<Omit<Readonly<{
52
+ key: string;
53
+ index: number;
54
+ routeNames: string[];
55
+ history?: unknown[];
56
+ routes: import("@react-navigation/routers").NavigationRoute<ParamListBase, string>[];
57
+ type: string;
58
+ stale: false;
59
+ }>, "stale" | "routes">> & Readonly<{
60
+ stale?: true;
61
+ routes: import("@react-navigation/routers").PartialRoute<Readonly<{
62
+ key: string;
63
+ name: string;
64
+ path?: string;
65
+ history?: {
66
+ type: "params";
67
+ params: object;
68
+ }[];
69
+ } & Readonly<{
70
+ params?: Readonly<object | undefined>;
71
+ }>>>[];
17
72
  }> & {
18
73
  state?: Partial<Omit<Readonly<{
19
74
  key: string;
@@ -25,7 +80,17 @@ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<P
25
80
  stale: false;
26
81
  }>, "stale" | "routes">> & Readonly<{
27
82
  stale?: true;
28
- routes: import("@react-navigation/routers").PartialRoute<import("@react-navigation/routers").Route<string, object | undefined>>[];
83
+ routes: import("@react-navigation/routers").PartialRoute<Readonly<{
84
+ key: string;
85
+ name: string;
86
+ path?: string;
87
+ history?: {
88
+ type: "params";
89
+ params: object;
90
+ }[];
91
+ } & Readonly<{
92
+ params?: Readonly<object | undefined>;
93
+ }>>>[];
29
94
  }> & /*elided*/ any;
30
95
  }) | undefined>;
31
96
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useLinking.native.d.ts","sourceRoot":"","sources":["../../../src/useLinking.native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI9C,KAAK,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;AAI7C,wBAAgB,UAAU,CACxB,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,EAClE,EACE,OAAc,EACd,QAAQ,EACR,MAAM,EACN,MAAM,EACN,aAQI,EACJ,SAmBC,EACD,gBAA0C,EAC1C,kBAA8C,GAC/C,EAAE,OAAO,EACV,kBAAkB,EAAE,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;EA8JtE"}
1
+ {"version":3,"file":"useLinking.native.d.ts","sourceRoot":"","sources":["../../../src/useLinking.native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI9C,KAAK,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;AAI7C,wBAAgB,UAAU,CACxB,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,EAClE,EACE,OAAc,EACd,QAAgB,EAChB,MAAM,EACN,MAAM,EACN,aAQI,EACJ,SAQC,EACD,gBAA0C,EAC1C,kBAA8C,GAC/C,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkJX"}
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollToTop.d.ts","sourceRoot":"","sources":["../../../src/useScrollToTop.tsx"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,GACvB;IAAE,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAA;CAAE,GAC1C;IAAE,cAAc,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAA;CAAE,GACzE;IAAE,uBAAuB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAA;CAAE,CAAC;AAE9D,KAAK,iBAAiB,GAClB;IAAE,kBAAkB,IAAI,KAAK,CAAC,SAAS,GAAG,UAAU,CAAA;CAAE,GACtD;IAAE,OAAO,IAAI,cAAc,CAAA;CAAE,GAC7B,cAAc,GACd,IAAI,CAAC;AA8BT,wBAAgB,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,QAsErE"}
@@ -1,2 +1,5 @@
1
- export declare function useThenable<T>(create: () => PromiseLike<T>): [boolean, T | undefined];
1
+ export type Thenable<T> = {
2
+ then(onfulfilled?: (value: T) => unknown): PromiseLike<unknown>;
3
+ };
4
+ export declare function useThenable<T>(create: () => Thenable<T> | undefined): [boolean, T | undefined];
2
5
  //# sourceMappingURL=useThenable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useThenable.d.ts","sourceRoot":"","sources":["../../../src/useThenable.tsx"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,4BAuC1D"}
1
+ {"version":3,"file":"useThenable.d.ts","sourceRoot":"","sources":["../../../src/useThenable.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IACxB,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;CACjE,CAAC;AAEF,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,4BA2CnE"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-navigation/native",
3
3
  "description": "React Native integration for React Navigation",
4
- "version": "7.1.26",
4
+ "version": "8.0.0-alpha.0",
5
5
  "keywords": [
6
6
  "react-native",
7
7
  "react-navigation",
@@ -42,27 +42,27 @@
42
42
  "clean": "del lib"
43
43
  },
44
44
  "dependencies": {
45
- "@react-navigation/core": "^7.13.7",
45
+ "@react-navigation/core": "^8.0.0-alpha.0",
46
46
  "escape-string-regexp": "^4.0.0",
47
47
  "fast-deep-equal": "^3.1.3",
48
48
  "nanoid": "^3.3.11",
49
- "use-latest-callback": "^0.2.4"
49
+ "use-latest-callback": "^0.3.2"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@jest/globals": "^30.0.0",
53
53
  "@testing-library/react-native": "^13.2.1",
54
- "@types/react": "~19.0.10",
54
+ "@types/react": "~19.1.10",
55
55
  "@types/react-dom": "~19.1.7",
56
56
  "del-cli": "^6.0.0",
57
57
  "react": "19.1.0",
58
58
  "react-dom": "19.1.0",
59
- "react-native": "0.81.5",
60
- "react-native-builder-bob": "^0.40.17",
59
+ "react-native": "0.81.4",
60
+ "react-native-builder-bob": "^0.40.12",
61
61
  "react-test-renderer": "19.1.0",
62
62
  "typescript": "^5.9.2"
63
63
  },
64
64
  "peerDependencies": {
65
- "react": ">= 18.2.0",
65
+ "react": ">= 19.0.0",
66
66
  "react-native": "*"
67
67
  },
68
68
  "react-native-builder-bob": {
@@ -83,5 +83,5 @@
83
83
  ]
84
84
  ]
85
85
  },
86
- "gitHead": "2b7ee0d2d1b1ef0390b690f59c0c1dd8bd57e9eb"
86
+ "gitHead": "46daae524ec6a59737147ed506222dd09a5b6e39"
87
87
  }
package/src/Link.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { useTheme } from '@react-navigation/core';
1
+ import { type RootParamList, useTheme } from '@react-navigation/core';
2
2
  import * as React from 'react';
3
3
  import {
4
4
  type GestureResponderEvent,
@@ -9,18 +9,18 @@ import {
9
9
 
10
10
  import { type LinkProps, useLinkProps } from './useLinkProps';
11
11
 
12
- type Props<ParamList extends ReactNavigation.RootParamList> =
13
- LinkProps<ParamList> &
14
- Omit<TextProps, 'disabled'> & {
15
- target?: string;
16
- onPress?: (
17
- e:
18
- | React.MouseEvent<HTMLAnchorElement, MouseEvent>
19
- | GestureResponderEvent
20
- ) => void;
21
- disabled?: boolean | null;
22
- children: React.ReactNode;
23
- };
12
+ type Props<
13
+ ParamList extends {} = RootParamList,
14
+ RouteName extends keyof ParamList = keyof ParamList,
15
+ > = LinkProps<ParamList, RouteName> &
16
+ Omit<TextProps, 'disabled'> & {
17
+ target?: string;
18
+ onPress?: (
19
+ e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent
20
+ ) => void;
21
+ disabled?: boolean | null;
22
+ children: React.ReactNode;
23
+ };
24
24
 
25
25
  /**
26
26
  * Component to render link to another screen using a path.
@@ -32,14 +32,17 @@ type Props<ParamList extends ReactNavigation.RootParamList> =
32
32
  * @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.
33
33
  * @param props.children Child elements to render the content.
34
34
  */
35
- export function Link<ParamList extends ReactNavigation.RootParamList>({
35
+ export function Link<
36
+ const ParamList extends {} = RootParamList,
37
+ const RouteName extends keyof ParamList = keyof ParamList,
38
+ >({
36
39
  screen,
37
40
  params,
38
41
  action,
39
42
  href,
40
43
  style,
41
44
  ...rest
42
- }: Props<ParamList>) {
45
+ }: Props<ParamList, RouteName>) {
43
46
  const { colors, fonts } = useTheme();
44
47
  // @ts-expect-error: This is already type-checked by the prop types
45
48
  const props = useLinkProps<ParamList>({ screen, params, action, href });