@react-navigation/native 7.0.0-alpha.1 → 7.0.0-alpha.11

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 (206) hide show
  1. package/lib/commonjs/Link.js +13 -5
  2. package/lib/commonjs/Link.js.map +1 -1
  3. package/lib/commonjs/LinkingContext.js +7 -5
  4. package/lib/commonjs/LinkingContext.js.map +1 -1
  5. package/lib/commonjs/LocaleDirContext.js +12 -0
  6. package/lib/commonjs/LocaleDirContext.js.map +1 -0
  7. package/lib/commonjs/NavigationContainer.js +57 -19
  8. package/lib/commonjs/NavigationContainer.js.map +1 -1
  9. package/lib/commonjs/ServerContainer.js +3 -4
  10. package/lib/commonjs/ServerContainer.js.map +1 -1
  11. package/lib/commonjs/ServerContext.js +3 -4
  12. package/lib/commonjs/ServerContext.js.map +1 -1
  13. package/lib/commonjs/UnhandledLinkingContext.js +20 -0
  14. package/lib/commonjs/UnhandledLinkingContext.js.map +1 -0
  15. package/lib/commonjs/__stubs__/createStackNavigator.js +19 -0
  16. package/lib/commonjs/__stubs__/createStackNavigator.js.map +1 -0
  17. package/lib/commonjs/__stubs__/window.js +79 -0
  18. package/lib/commonjs/__stubs__/window.js.map +1 -0
  19. package/lib/commonjs/createMemoryHistory.js +4 -7
  20. package/lib/commonjs/createMemoryHistory.js.map +1 -1
  21. package/lib/commonjs/createStaticNavigation.js +6 -4
  22. package/lib/commonjs/createStaticNavigation.js.map +1 -1
  23. package/lib/commonjs/extractPathFromURL.js +3 -3
  24. package/lib/commonjs/extractPathFromURL.js.map +1 -1
  25. package/lib/commonjs/index.js +17 -17
  26. package/lib/commonjs/index.js.map +1 -1
  27. package/lib/commonjs/theming/DarkTheme.js +1 -2
  28. package/lib/commonjs/theming/DarkTheme.js.map +1 -1
  29. package/lib/commonjs/theming/DefaultTheme.js +1 -2
  30. package/lib/commonjs/theming/DefaultTheme.js.map +1 -1
  31. package/lib/commonjs/theming/fonts.js +1 -2
  32. package/lib/commonjs/theming/fonts.js.map +1 -1
  33. package/lib/commonjs/types.js.map +1 -1
  34. package/lib/commonjs/useBackButton.js +3 -19
  35. package/lib/commonjs/useBackButton.js.map +1 -1
  36. package/lib/commonjs/useBackButton.native.js +27 -0
  37. package/lib/commonjs/useBackButton.native.js.map +1 -0
  38. package/lib/commonjs/useDocumentTitle.js +5 -5
  39. package/lib/commonjs/useDocumentTitle.js.map +1 -1
  40. package/lib/commonjs/useDocumentTitle.native.js.map +1 -1
  41. package/lib/commonjs/useLinkBuilder.js +80 -0
  42. package/lib/commonjs/useLinkBuilder.js.map +1 -0
  43. package/lib/commonjs/useLinkProps.js +20 -23
  44. package/lib/commonjs/useLinkProps.js.map +1 -1
  45. package/lib/commonjs/useLinkTo.js +30 -0
  46. package/lib/commonjs/useLinkTo.js.map +1 -0
  47. package/lib/commonjs/useLinking.js +34 -35
  48. package/lib/commonjs/useLinking.js.map +1 -1
  49. package/lib/commonjs/useLinking.native.js +30 -23
  50. package/lib/commonjs/useLinking.native.js.map +1 -1
  51. package/lib/commonjs/useLocale.js +23 -0
  52. package/lib/commonjs/useLocale.js.map +1 -0
  53. package/lib/commonjs/useScrollToTop.js +8 -6
  54. package/lib/commonjs/useScrollToTop.js.map +1 -1
  55. package/lib/commonjs/useThenable.js +3 -2
  56. package/lib/commonjs/useThenable.js.map +1 -1
  57. package/lib/commonjs/useUnhandledLinking.js +75 -0
  58. package/lib/commonjs/useUnhandledLinking.js.map +1 -0
  59. package/lib/module/Link.js +11 -3
  60. package/lib/module/Link.js.map +1 -1
  61. package/lib/module/LinkingContext.js +4 -1
  62. package/lib/module/LinkingContext.js.map +1 -1
  63. package/lib/module/LocaleDirContext.js +4 -0
  64. package/lib/module/LocaleDirContext.js.map +1 -0
  65. package/lib/module/NavigationContainer.js +53 -15
  66. package/lib/module/NavigationContainer.js.map +1 -1
  67. package/lib/module/ServerContainer.js.map +1 -1
  68. package/lib/module/ServerContext.js.map +1 -1
  69. package/lib/module/UnhandledLinkingContext.js +12 -0
  70. package/lib/module/UnhandledLinkingContext.js.map +1 -0
  71. package/lib/module/__stubs__/createStackNavigator.js +11 -0
  72. package/lib/module/__stubs__/createStackNavigator.js.map +1 -0
  73. package/lib/module/__stubs__/window.js +73 -0
  74. package/lib/module/__stubs__/window.js.map +1 -0
  75. package/lib/module/createMemoryHistory.js +4 -7
  76. package/lib/module/createMemoryHistory.js.map +1 -1
  77. package/lib/module/createStaticNavigation.js +4 -2
  78. package/lib/module/createStaticNavigation.js.map +1 -1
  79. package/lib/module/extractPathFromURL.js +3 -3
  80. package/lib/module/extractPathFromURL.js.map +1 -1
  81. package/lib/module/index.js +3 -3
  82. package/lib/module/index.js.map +1 -1
  83. package/lib/module/theming/DarkTheme.js.map +1 -1
  84. package/lib/module/theming/DefaultTheme.js.map +1 -1
  85. package/lib/module/theming/fonts.js.map +1 -1
  86. package/lib/module/types.js.map +1 -1
  87. package/lib/module/useBackButton.js +3 -17
  88. package/lib/module/useBackButton.js.map +1 -1
  89. package/lib/module/useBackButton.native.js +19 -0
  90. package/lib/module/useBackButton.native.js.map +1 -0
  91. package/lib/module/useDocumentTitle.js +3 -3
  92. package/lib/module/useDocumentTitle.js.map +1 -1
  93. package/lib/module/useDocumentTitle.native.js.map +1 -1
  94. package/lib/module/{useLinkTools.js → useLinkBuilder.js} +10 -10
  95. package/lib/module/useLinkBuilder.js.map +1 -0
  96. package/lib/module/useLinkProps.js +18 -21
  97. package/lib/module/useLinkProps.js.map +1 -1
  98. package/lib/module/useLinkTo.js +23 -0
  99. package/lib/module/useLinkTo.js.map +1 -0
  100. package/lib/module/useLinking.js +31 -34
  101. package/lib/module/useLinking.js.map +1 -1
  102. package/lib/module/useLinking.native.js +28 -21
  103. package/lib/module/useLinking.native.js.map +1 -1
  104. package/lib/module/useLocale.js +16 -0
  105. package/lib/module/useLocale.js.map +1 -0
  106. package/lib/module/useScrollToTop.js +7 -5
  107. package/lib/module/useScrollToTop.js.map +1 -1
  108. package/lib/module/useThenable.js +1 -0
  109. package/lib/module/useThenable.js.map +1 -1
  110. package/lib/module/useUnhandledLinking.js +69 -0
  111. package/lib/module/useUnhandledLinking.js.map +1 -0
  112. package/lib/typescript/src/Link.d.ts +3 -3
  113. package/lib/typescript/src/Link.d.ts.map +1 -1
  114. package/lib/typescript/src/LinkingContext.d.ts +1 -1
  115. package/lib/typescript/src/LinkingContext.d.ts.map +1 -1
  116. package/lib/typescript/src/LocaleDirContext.d.ts +4 -0
  117. package/lib/typescript/src/LocaleDirContext.d.ts.map +1 -0
  118. package/lib/typescript/src/NavigationContainer.d.ts +4 -4
  119. package/lib/typescript/src/NavigationContainer.d.ts.map +1 -1
  120. package/lib/typescript/src/ServerContainer.d.ts +1 -1
  121. package/lib/typescript/src/ServerContainer.d.ts.map +1 -1
  122. package/lib/typescript/src/UnhandledLinkingContext.d.ts +6 -0
  123. package/lib/typescript/src/UnhandledLinkingContext.d.ts.map +1 -0
  124. package/lib/typescript/src/__stubs__/createStackNavigator.d.ts +32 -0
  125. package/lib/typescript/src/__stubs__/createStackNavigator.d.ts.map +1 -0
  126. package/lib/typescript/src/{__mocks__ → __stubs__}/window.d.ts +1 -1
  127. package/lib/typescript/src/{__mocks__ → __stubs__}/window.d.ts.map +1 -1
  128. package/lib/typescript/src/createStaticNavigation.d.ts +2 -2
  129. package/lib/typescript/src/createStaticNavigation.d.ts.map +1 -1
  130. package/lib/typescript/src/extractPathFromURL.d.ts.map +1 -1
  131. package/lib/typescript/src/index.d.ts +3 -3
  132. package/lib/typescript/src/index.d.ts.map +1 -1
  133. package/lib/typescript/src/types.d.ts +37 -18
  134. package/lib/typescript/src/types.d.ts.map +1 -1
  135. package/lib/typescript/src/useBackButton.d.ts +2 -2
  136. package/lib/typescript/src/useBackButton.d.ts.map +1 -1
  137. package/lib/typescript/src/useBackButton.native.d.ts +4 -0
  138. package/lib/typescript/src/useBackButton.native.d.ts.map +1 -0
  139. package/lib/typescript/src/useLinkBuilder.d.ts +25 -0
  140. package/lib/typescript/src/useLinkBuilder.d.ts.map +1 -0
  141. package/lib/typescript/src/useLinkProps.d.ts +2 -2
  142. package/lib/typescript/src/useLinkProps.d.ts.map +1 -1
  143. package/lib/typescript/src/useLinkTo.d.ts +6 -0
  144. package/lib/typescript/src/useLinkTo.d.ts.map +1 -0
  145. package/lib/typescript/src/useLinking.d.ts +8 -20
  146. package/lib/typescript/src/useLinking.d.ts.map +1 -1
  147. package/lib/typescript/src/useLinking.native.d.ts +4 -20
  148. package/lib/typescript/src/useLinking.native.d.ts.map +1 -1
  149. package/lib/typescript/src/useLocale.d.ts +7 -0
  150. package/lib/typescript/src/useLocale.d.ts.map +1 -0
  151. package/lib/typescript/src/useScrollToTop.d.ts.map +1 -1
  152. package/lib/typescript/src/useThenable.d.ts.map +1 -1
  153. package/lib/typescript/src/useUnhandledLinking.d.ts +7 -0
  154. package/lib/typescript/src/useUnhandledLinking.d.ts.map +1 -0
  155. package/package.json +15 -15
  156. package/src/Link.tsx +11 -2
  157. package/src/LinkingContext.tsx +8 -2
  158. package/src/LocaleDirContext.tsx +7 -0
  159. package/src/NavigationContainer.tsx +80 -24
  160. package/src/ServerContainer.tsx +1 -1
  161. package/src/UnhandledLinkingContext.tsx +18 -0
  162. package/src/{__mocks__ → __stubs__}/window.tsx +7 -5
  163. package/src/createStaticNavigation.tsx +11 -4
  164. package/src/extractPathFromURL.tsx +4 -1
  165. package/src/index.tsx +3 -3
  166. package/src/types.tsx +40 -18
  167. package/src/useBackButton.native.tsx +33 -0
  168. package/src/useBackButton.tsx +3 -25
  169. package/src/{useLinkTools.tsx → useLinkBuilder.tsx} +8 -8
  170. package/src/useLinkProps.tsx +20 -19
  171. package/src/useLinkTo.tsx +30 -0
  172. package/src/useLinking.native.tsx +26 -20
  173. package/src/useLinking.tsx +43 -41
  174. package/src/useLocale.tsx +18 -0
  175. package/src/useScrollToTop.tsx +13 -7
  176. package/src/useThenable.tsx +1 -0
  177. package/src/useUnhandledLinking.tsx +91 -0
  178. package/lib/commonjs/theming/ThemeContext.js +0 -14
  179. package/lib/commonjs/theming/ThemeContext.js.map +0 -1
  180. package/lib/commonjs/theming/ThemeProvider.js +0 -20
  181. package/lib/commonjs/theming/ThemeProvider.js.map +0 -1
  182. package/lib/commonjs/theming/useTheme.js +0 -15
  183. package/lib/commonjs/theming/useTheme.js.map +0 -1
  184. package/lib/commonjs/useLinkTools.js +0 -80
  185. package/lib/commonjs/useLinkTools.js.map +0 -1
  186. package/lib/module/theming/ThemeContext.js +0 -5
  187. package/lib/module/theming/ThemeContext.js.map +0 -1
  188. package/lib/module/theming/ThemeProvider.js +0 -12
  189. package/lib/module/theming/ThemeProvider.js.map +0 -1
  190. package/lib/module/theming/useTheme.js +0 -7
  191. package/lib/module/theming/useTheme.js.map +0 -1
  192. package/lib/module/useLinkTools.js.map +0 -1
  193. package/lib/typescript/src/__mocks__/createStackNavigator.d.ts +0 -56
  194. package/lib/typescript/src/__mocks__/createStackNavigator.d.ts.map +0 -1
  195. package/lib/typescript/src/theming/ThemeContext.d.ts +0 -4
  196. package/lib/typescript/src/theming/ThemeContext.d.ts.map +0 -1
  197. package/lib/typescript/src/theming/ThemeProvider.d.ts +0 -9
  198. package/lib/typescript/src/theming/ThemeProvider.d.ts.map +0 -1
  199. package/lib/typescript/src/theming/useTheme.d.ts +0 -2
  200. package/lib/typescript/src/theming/useTheme.d.ts.map +0 -1
  201. package/lib/typescript/src/useLinkTools.d.ts +0 -33
  202. package/lib/typescript/src/useLinkTools.d.ts.map +0 -1
  203. package/src/theming/ThemeContext.tsx +0 -8
  204. package/src/theming/ThemeProvider.tsx +0 -15
  205. package/src/theming/useTheme.tsx +0 -9
  206. /package/src/{__mocks__ → __stubs__}/createStackNavigator.tsx +0 -0
@@ -1,22 +1,18 @@
1
- import { NavigationContainerRef, 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
+ /**
5
+ * Run async function in series as it's called.
6
+ */
7
+ export declare const series: (cb: () => Promise<void>) => () => void;
4
8
  type Options = LinkingOptions<ParamListBase>;
5
- export declare function useLinking(ref: React.RefObject<NavigationContainerRef<ParamListBase>>, { enabled, config, getStateFromPath, getPathFromState, getActionFromState, }: Options): {
9
+ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<ParamListBase>>, { enabled, config, getStateFromPath, getPathFromState, getActionFromState, }: Options, onUnhandledLinking: (lastUnhandledLining: string | undefined) => void): {
6
10
  getInitialState: () => PromiseLike<(Partial<Omit<Readonly<{
7
11
  key: string;
8
12
  index: number;
9
13
  routeNames: string[];
10
14
  history?: unknown[] | undefined;
11
- routes: (Readonly<{
12
- key: string;
13
- name: string;
14
- path?: string | undefined;
15
- }> & Readonly<{
16
- params?: Readonly<object | undefined>;
17
- }> & {
18
- state?: Readonly<any> | import("@react-navigation/core").PartialState<Readonly<any>> | undefined;
19
- })[];
15
+ routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
20
16
  type: string;
21
17
  stale: false;
22
18
  }>, "stale" | "routes">> & Readonly<{
@@ -28,15 +24,7 @@ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<P
28
24
  index: number;
29
25
  routeNames: string[];
30
26
  history?: unknown[] | undefined;
31
- routes: (Readonly<{
32
- key: string;
33
- name: string;
34
- path?: string | undefined;
35
- }> & Readonly<{
36
- params?: Readonly<object | undefined>;
37
- }> & {
38
- state?: Readonly<any> | import("@react-navigation/core").PartialState<Readonly<any>> | undefined;
39
- })[];
27
+ routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
40
28
  type: string;
41
29
  stale: false;
42
30
  }>, "stale" | "routes">> & Readonly<{
@@ -1 +1 @@
1
- {"version":3,"file":"useLinking.d.ts","sourceRoot":"","sources":["../../../src/useLinking.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,sBAAsB,EAEtB,aAAa,EAEd,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAiF9C,KAAK,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;AAE7C,wBAAgB,UAAU,CACxB,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,EAC3D,EACE,OAAc,EACd,MAAM,EACN,gBAA0C,EAC1C,gBAA0C,EAC1C,kBAA8C,GAC/C,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwTX"}
1
+ {"version":3,"file":"useLinking.d.ts","sourceRoot":"","sources":["../../../src/useLinking.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA4C9C;;GAEG;AACH,eAAO,MAAM,MAAM,OAAQ,MAAM,QAAQ,IAAI,CAAC,eAO7C,CAAC;AAIF,KAAK,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;AAE7C,wBAAgB,UAAU,CACxB,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,EAC3D,EACE,OAAc,EACd,MAAM,EACN,gBAA0C,EAC1C,gBAA0C,EAC1C,kBAA8C,GAC/C,EAAE,OAAO,EACV,kBAAkB,EAAE,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;EAgVtE"}
@@ -1,22 +1,14 @@
1
- import { NavigationContainerRef, 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
4
  type Options = LinkingOptions<ParamListBase>;
5
- export declare function useLinking(ref: React.RefObject<NavigationContainerRef<ParamListBase>>, { enabled, prefixes, filter, config, getInitialURL, subscribe, getStateFromPath, getActionFromState, }: Options): {
5
+ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<ParamListBase>>, { enabled, prefixes, filter, config, getInitialURL, subscribe, getStateFromPath, getActionFromState, }: Options, onUnhandledLinking: (lastUnhandledLining: string | undefined) => void): {
6
6
  getInitialState: () => PromiseLike<(Partial<Omit<Readonly<{
7
7
  key: string;
8
8
  index: number;
9
9
  routeNames: string[];
10
10
  history?: unknown[] | undefined;
11
- routes: (Readonly<{
12
- key: string;
13
- name: string;
14
- path?: string | undefined;
15
- }> & Readonly<{
16
- params?: Readonly<object | undefined>;
17
- }> & {
18
- state?: Readonly<any> | import("@react-navigation/core").PartialState<Readonly<any>> | undefined;
19
- })[];
11
+ routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
20
12
  type: string;
21
13
  stale: false;
22
14
  }>, "stale" | "routes">> & Readonly<{
@@ -28,15 +20,7 @@ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<P
28
20
  index: number;
29
21
  routeNames: string[];
30
22
  history?: unknown[] | undefined;
31
- routes: (Readonly<{
32
- key: string;
33
- name: string;
34
- path?: string | undefined;
35
- }> & Readonly<{
36
- params?: Readonly<object | undefined>;
37
- }> & {
38
- state?: Readonly<any> | import("@react-navigation/core").PartialState<Readonly<any>> | undefined;
39
- })[];
23
+ routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
40
24
  type: string;
41
25
  stale: false;
42
26
  }>, "stale" | "routes">> & Readonly<{
@@ -1 +1 @@
1
- {"version":3,"file":"useLinking.native.d.ts","sourceRoot":"","sources":["../../../src/useLinking.native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,sBAAsB,EACtB,aAAa,EAEd,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,CAAC,EAC3D,EACE,OAAc,EACd,QAAQ,EACR,MAAM,EACN,MAAM,EACN,aAQI,EACJ,SAmBC,EACD,gBAA0C,EAC1C,kBAA8C,GAC/C,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6JX"}
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,CAAC,EAC3D,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;;;;;;;;;;;;;;;;;;;;;;;;;;EAkKtE"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Hook to access the text direction specified in the `NavigationContainer`.
3
+ */
4
+ export declare function useLocale(): {
5
+ direction: import("./types").LocaleDirection;
6
+ };
7
+ //# sourceMappingURL=useLocale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../../src/useLocale.tsx"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,SAAS;;EAUxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollToTop.d.ts","sourceRoot":"","sources":["../../../src/useScrollToTop.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,KAAK,aAAa,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpE,KAAK,cAAc,GACf;IAAE,WAAW,IAAI,IAAI,CAAA;CAAE,GACvB;IAAE,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAA;CAAE,GAC1C;IAAE,cAAc,CAAC,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAA;CAAE,GAC1E;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,CAAC;AA8BnB,wBAAgB,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,QA+DrE"}
1
+ {"version":3,"file":"useScrollToTop.d.ts","sourceRoot":"","sources":["../../../src/useScrollToTop.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,KAAK,aAAa,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpE,KAAK,cAAc,GACf;IAAE,WAAW,IAAI,IAAI,CAAA;CAAE,GACvB;IAAE,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAA;CAAE,GAC1C;IAAE,cAAc,CAAC,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAA;CAAE,GAC1E;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,CAAC;AA8BnB,wBAAgB,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,QAoErE"}
@@ -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,4BAsC1D"}
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"}
@@ -0,0 +1,7 @@
1
+ import { type NavigationState, type PartialState } from '@react-navigation/core';
2
+ export declare function UNSTABLE_useUnhandledLinking(): {
3
+ lastUnhandledLink: string | undefined;
4
+ getStateForRouteNamesChange: (currentState: NavigationState) => PartialState<NavigationState> | undefined;
5
+ clearUnhandledLink: () => void;
6
+ };
7
+ //# sourceMappingURL=useUnhandledLinking.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUnhandledLinking.d.ts","sourceRoot":"","sources":["../../../src/useUnhandledLinking.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AA2BhC,wBAAgB,4BAA4B;;gDAU1B,eAAe,KAC5B,aAAa,eAAe,CAAC,GAAG,SAAS;;EA+C7C"}
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.0.0-alpha.1",
4
+ "version": "7.0.0-alpha.11",
5
5
  "keywords": [
6
6
  "react-native",
7
7
  "react-navigation",
@@ -37,26 +37,26 @@
37
37
  "clean": "del lib"
38
38
  },
39
39
  "dependencies": {
40
- "@react-navigation/core": "^7.0.0-alpha.1",
40
+ "@react-navigation/core": "^7.0.0-alpha.10",
41
41
  "escape-string-regexp": "^4.0.0",
42
42
  "fast-deep-equal": "^3.1.3",
43
- "nanoid": "^3.1.23"
43
+ "nanoid": "3.3.7",
44
+ "use-latest-callback": "^0.1.9"
44
45
  },
45
46
  "devDependencies": {
46
- "@testing-library/react-native": "^11.5.0",
47
- "@types/react": "~18.0.26",
48
- "@types/react-dom": "~18.0.9",
49
- "@types/react-native": "~0.70.8",
50
- "del-cli": "^5.0.0",
51
- "react": "18.1.0",
47
+ "@testing-library/react-native": "^12.4.3",
48
+ "@types/react": "~18.2.45",
49
+ "@types/react-dom": "~18.0.11",
50
+ "del-cli": "^5.1.0",
51
+ "react": "18.2.0",
52
52
  "react-dom": "18.2.0",
53
- "react-native": "0.70.5",
54
- "react-native-builder-bob": "^0.20.4",
55
- "typescript": "^4.9.4"
53
+ "react-native": "0.73.2",
54
+ "react-native-builder-bob": "^0.23.2",
55
+ "typescript": "^5.3.3"
56
56
  },
57
57
  "peerDependencies": {
58
- "react": "*",
59
- "react-native": "*"
58
+ "react": ">= 18.2.0",
59
+ "react-native": ">= 0.72.0"
60
60
  },
61
61
  "react-native-builder-bob": {
62
62
  "source": "src",
@@ -72,5 +72,5 @@
72
72
  ]
73
73
  ]
74
74
  },
75
- "gitHead": "230c09deeeb886929a15cb4cdcb496372a9496e1"
75
+ "gitHead": "b407411496a2eaeeeb29b563d66294e79ae31311"
76
76
  }
package/src/Link.tsx CHANGED
@@ -1,7 +1,13 @@
1
+ import { useTheme } from '@react-navigation/core';
1
2
  import * as React from 'react';
2
- import { GestureResponderEvent, Platform, Text, TextProps } from 'react-native';
3
+ import {
4
+ type GestureResponderEvent,
5
+ Platform,
6
+ Text,
7
+ type TextProps,
8
+ } from 'react-native';
3
9
 
4
- import { Props as LinkProps, useLinkProps } from './useLinkProps';
10
+ import { type Props as LinkProps, useLinkProps } from './useLinkProps';
5
11
 
6
12
  type Props<ParamList extends ReactNavigation.RootParamList> =
7
13
  LinkProps<ParamList> &
@@ -31,8 +37,10 @@ export function Link<ParamList extends ReactNavigation.RootParamList>({
31
37
  params,
32
38
  action,
33
39
  href,
40
+ style,
34
41
  ...rest
35
42
  }: Props<ParamList>) {
43
+ const { colors, fonts } = useTheme();
36
44
  // @ts-expect-error: This is already type-checked by the prop types
37
45
  const props = useLinkProps<ParamList>({ screen, params, action, href });
38
46
 
@@ -56,5 +64,6 @@ export function Link<ParamList extends ReactNavigation.RootParamList>({
56
64
  web: { onClick: onPress } as any,
57
65
  default: { onPress },
58
66
  }),
67
+ style: [{ color: colors.primary }, fonts.regular, style],
59
68
  });
60
69
  }
@@ -3,8 +3,14 @@ import * as React from 'react';
3
3
 
4
4
  import type { LinkingOptions } from './types';
5
5
 
6
+ const MISSING_CONTEXT_ERROR = "Couldn't find a LinkingContext context.";
7
+
6
8
  export const LinkingContext = React.createContext<{
7
- options: LinkingOptions<ParamListBase> | undefined;
8
- }>({ options: undefined });
9
+ options?: LinkingOptions<ParamListBase>;
10
+ }>({
11
+ get options(): any {
12
+ throw new Error(MISSING_CONTEXT_ERROR);
13
+ },
14
+ });
9
15
 
10
16
  LinkingContext.displayName = 'LinkingContext';
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+
3
+ import type { LocaleDirection } from './types';
4
+
5
+ export const LocaleDirContext = React.createContext<LocaleDirection>('ltr');
6
+
7
+ LocaleDirContext.displayName = 'LocaleDirContext';
@@ -3,23 +3,32 @@ import {
3
3
  getActionFromState,
4
4
  getPathFromState,
5
5
  getStateFromPath,
6
- NavigationContainerProps,
7
- NavigationContainerRef,
8
- ParamListBase,
6
+ type NavigationContainerProps,
7
+ type NavigationContainerRef,
8
+ type NavigationState,
9
+ type ParamListBase,
9
10
  validatePathConfig,
10
11
  } from '@react-navigation/core';
11
12
  import * as React from 'react';
13
+ import { I18nManager } from 'react-native';
14
+ import useLatestCallback from 'use-latest-callback';
12
15
 
13
16
  import { LinkingContext } from './LinkingContext';
17
+ import { LocaleDirContext } from './LocaleDirContext';
14
18
  import { DefaultTheme } from './theming/DefaultTheme';
15
- import { ThemeProvider } from './theming/ThemeProvider';
16
- import type { DocumentTitleOptions, LinkingOptions, Theme } from './types';
19
+ import type {
20
+ DocumentTitleOptions,
21
+ LinkingOptions,
22
+ LocaleDirection,
23
+ } from './types';
24
+ import { UnhandledLinkingContext } from './UnhandledLinkingContext';
17
25
  import { useBackButton } from './useBackButton';
18
26
  import { useDocumentTitle } from './useDocumentTitle';
19
27
  import { useLinking } from './useLinking';
20
28
  import { useThenable } from './useThenable';
21
29
 
22
30
  declare global {
31
+ // eslint-disable-next-line no-var
23
32
  var REACT_NAVIGATION_DEVTOOLS: WeakMap<
24
33
  NavigationContainerRef<any>,
25
34
  { readonly linking: LinkingOptions<any> }
@@ -29,7 +38,7 @@ declare global {
29
38
  global.REACT_NAVIGATION_DEVTOOLS = new WeakMap();
30
39
 
31
40
  type Props<ParamList extends {}> = NavigationContainerProps & {
32
- theme?: Theme;
41
+ direction?: LocaleDirection;
33
42
  linking?: LinkingOptions<ParamList>;
34
43
  fallback?: React.ReactNode;
35
44
  documentTitle?: DocumentTitleOptions;
@@ -43,7 +52,8 @@ type Props<ParamList extends {}> = NavigationContainerProps & {
43
52
  * @param props.onReady Callback which is called after the navigation tree mounts.
44
53
  * @param props.onStateChange Callback which is called with the latest navigation state when it changes.
45
54
  * @param props.onUnhandledAction Callback which is called when an action is not handled.
46
- * @param props.theme Theme object for the navigators.
55
+ * @param props.direction Text direction of the components. Defaults to `'ltr'`.
56
+ * @param props.theme Theme object for the UI elements.
47
57
  * @param props.linking Options for deep linking. Deep link handling is enabled when this prop is provided, unless `linking.enabled` is `false`.
48
58
  * @param props.fallback Fallback component to render until we have finished getting initial state when linking is enabled. Defaults to `null`.
49
59
  * @param props.documentTitle Options to configure the document title on Web. Updating document title is handled by default unless `documentTitle.enabled` is `false`.
@@ -52,10 +62,13 @@ type Props<ParamList extends {}> = NavigationContainerProps & {
52
62
  */
53
63
  function NavigationContainerInner(
54
64
  {
65
+ direction = I18nManager.getConstants().isRTL ? 'rtl' : 'ltr',
55
66
  theme = DefaultTheme,
56
67
  linking,
57
68
  fallback = null,
58
69
  documentTitle,
70
+ onReady,
71
+ onStateChange,
59
72
  ...rest
60
73
  }: Props<ParamListBase>,
61
74
  ref?: React.Ref<NavigationContainerRef<ParamListBase> | null>
@@ -72,12 +85,52 @@ function NavigationContainerInner(
72
85
  useBackButton(refContainer);
73
86
  useDocumentTitle(refContainer, documentTitle);
74
87
 
75
- const { getInitialState } = useLinking(refContainer, {
76
- enabled: isLinkingEnabled,
77
- prefixes: [],
78
- ...linking,
88
+ const [lastUnhandledLink, setLastUnhandledLink] = React.useState<
89
+ string | undefined
90
+ >();
91
+
92
+ const { getInitialState } = useLinking(
93
+ refContainer,
94
+ {
95
+ enabled: isLinkingEnabled,
96
+ prefixes: [],
97
+ ...linking,
98
+ },
99
+ setLastUnhandledLink
100
+ );
101
+
102
+ const linkingContext = React.useMemo(() => ({ options: linking }), [linking]);
103
+
104
+ const unhandledLinkingContext = React.useMemo(
105
+ () => ({ lastUnhandledLink, setLastUnhandledLink }),
106
+ [lastUnhandledLink, setLastUnhandledLink]
107
+ );
108
+
109
+ const onReadyForLinkingHandling = useLatestCallback(() => {
110
+ // If the screen path matches lastUnhandledLink, we do not track it
111
+ const path = refContainer.current?.getCurrentRoute()?.path;
112
+ setLastUnhandledLink((previousLastUnhandledLink) => {
113
+ if (previousLastUnhandledLink === path) {
114
+ return undefined;
115
+ }
116
+ return previousLastUnhandledLink;
117
+ });
118
+ onReady?.();
79
119
  });
80
120
 
121
+ const onStateChangeForLinkingHandling = useLatestCallback(
122
+ (state: Readonly<NavigationState> | undefined) => {
123
+ // If the screen path matches lastUnhandledLink, we do not track it
124
+ const path = refContainer.current?.getCurrentRoute()?.path;
125
+ setLastUnhandledLink((previousLastUnhandledLink) => {
126
+ if (previousLastUnhandledLink === path) {
127
+ return undefined;
128
+ }
129
+ return previousLastUnhandledLink;
130
+ });
131
+ onStateChange?.(state);
132
+ }
133
+ );
81
134
  // Add additional linking related info to the ref
82
135
  // This will be used by the devtools
83
136
  React.useEffect(() => {
@@ -102,8 +155,6 @@ function NavigationContainerInner(
102
155
 
103
156
  React.useImperativeHandle(ref, () => refContainer.current);
104
157
 
105
- const linkingContext = React.useMemo(() => ({ options: linking }), [linking]);
106
-
107
158
  const isLinkingReady =
108
159
  rest.initialState != null || !isLinkingEnabled || isResolved;
109
160
 
@@ -114,17 +165,22 @@ function NavigationContainerInner(
114
165
  }
115
166
 
116
167
  return (
117
- <LinkingContext.Provider value={linkingContext}>
118
- <ThemeProvider value={theme}>
119
- <BaseNavigationContainer
120
- {...rest}
121
- initialState={
122
- rest.initialState == null ? initialState : rest.initialState
123
- }
124
- ref={refContainer}
125
- />
126
- </ThemeProvider>
127
- </LinkingContext.Provider>
168
+ <LocaleDirContext.Provider value={direction}>
169
+ <UnhandledLinkingContext.Provider value={unhandledLinkingContext}>
170
+ <LinkingContext.Provider value={linkingContext}>
171
+ <BaseNavigationContainer
172
+ {...rest}
173
+ theme={theme}
174
+ onReady={onReadyForLinkingHandling}
175
+ onStateChange={onStateChangeForLinkingHandling}
176
+ initialState={
177
+ rest.initialState == null ? initialState : rest.initialState
178
+ }
179
+ ref={refContainer}
180
+ />
181
+ </LinkingContext.Provider>
182
+ </UnhandledLinkingContext.Provider>
183
+ </LocaleDirContext.Provider>
128
184
  );
129
185
  }
130
186
 
@@ -1,7 +1,7 @@
1
1
  import { CurrentRenderContext } from '@react-navigation/core';
2
2
  import * as React from 'react';
3
3
 
4
- import { ServerContext, ServerContextType } from './ServerContext';
4
+ import { ServerContext, type ServerContextType } from './ServerContext';
5
5
  import type { ServerContainerRef } from './types';
6
6
 
7
7
  type Props = ServerContextType & {
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+
3
+ const MISSING_CONTEXT_ERROR =
4
+ "Couldn't find an UnhandledLinkingContext context.";
5
+
6
+ export const UnhandledLinkingContext = React.createContext<{
7
+ lastUnhandledLink: string | undefined;
8
+ setLastUnhandledLink: (lastUnhandledUrl: string | undefined) => void;
9
+ }>({
10
+ get lastUnhandledLink(): any {
11
+ throw new Error(MISSING_CONTEXT_ERROR);
12
+ },
13
+ get setLastUnhandledLink(): any {
14
+ throw new Error(MISSING_CONTEXT_ERROR);
15
+ },
16
+ });
17
+
18
+ UnhandledLinkingContext.displayName = 'UnhandledLinkingContext';
@@ -1,4 +1,4 @@
1
- const location = new URL('', 'http://example.com');
1
+ let location = new URL('', 'http://example.com');
2
2
 
3
3
  let listeners: (() => void)[] = [];
4
4
  let entries = [{ state: null, href: location.href }];
@@ -12,7 +12,7 @@ const history = {
12
12
  },
13
13
 
14
14
  pushState(state: any, _: string, path: string) {
15
- Object.assign(location, new URL(path, location.origin));
15
+ location = new URL(path, location.origin);
16
16
 
17
17
  currentState = state;
18
18
  entries = entries.slice(0, index + 1);
@@ -21,7 +21,7 @@ const history = {
21
21
  },
22
22
 
23
23
  replaceState(state: any, _: string, path: string) {
24
- Object.assign(location, new URL(path, location.origin));
24
+ location = new URL(path, location.origin);
25
25
 
26
26
  currentState = state;
27
27
  entries[index] = { state, href: location.href };
@@ -35,7 +35,7 @@ const history = {
35
35
  ) {
36
36
  index += n;
37
37
  const entry = entries[index];
38
- Object.assign(location, new URL(entry.href));
38
+ location = new URL(entry.href);
39
39
  currentState = entry.state;
40
40
  listeners.forEach((cb) => cb());
41
41
  }
@@ -65,7 +65,9 @@ const removeEventListener = (type: 'popstate', listener: () => void) => {
65
65
 
66
66
  export const window = {
67
67
  document: { title: '' },
68
- location,
68
+ get location() {
69
+ return location;
70
+ },
69
71
  history,
70
72
  addEventListener,
71
73
  removeEventListener,
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  createComponentForStaticNavigation,
3
3
  createPathConfigForStaticNavigation,
4
- ParamListBase,
5
- StaticNavigation,
4
+ type NavigationContainerRef,
5
+ type ParamListBase,
6
+ type StaticNavigation,
6
7
  } from '@react-navigation/core';
7
8
  import * as React from 'react';
8
9
 
@@ -34,14 +35,20 @@ export function createStaticNavigation(tree: StaticNavigation<any, any, any>) {
34
35
  : {},
35
36
  };
36
37
 
37
- return function Navigation({ linking, ...rest }: Props) {
38
+ function Navigation(
39
+ { linking, ...rest }: Props,
40
+ ref: React.Ref<NavigationContainerRef<ParamListBase>>
41
+ ) {
38
42
  return (
39
43
  <NavigationContainer
40
44
  {...rest}
45
+ ref={ref}
41
46
  linking={linking ? { ...linking, config: linkingConfig } : undefined}
42
47
  >
43
48
  <Component />
44
49
  </NavigationContainer>
45
50
  );
46
- };
51
+ }
52
+
53
+ return React.forwardRef(Navigation);
47
54
  }
@@ -15,7 +15,10 @@ export function extractPathFromURL(prefixes: string[], url: string) {
15
15
  .join('\\.')}`
16
16
  );
17
17
 
18
- const normalizedURL = url.replace(/\/+/g, '/');
18
+ const [originAndPath, searchParams] = url.split('?');
19
+ const normalizedURL = originAndPath
20
+ .replace(/\/+/g, '/')
21
+ .concat(searchParams ? `?${searchParams}` : '');
19
22
 
20
23
  if (prefixRegex.test(normalizedURL)) {
21
24
  return normalizedURL.replace(prefixRegex, '');
package/src/index.tsx CHANGED
@@ -5,10 +5,10 @@ export { NavigationContainer } from './NavigationContainer';
5
5
  export { ServerContainer } from './ServerContainer';
6
6
  export { DarkTheme } from './theming/DarkTheme';
7
7
  export { DefaultTheme } from './theming/DefaultTheme';
8
- export { ThemeProvider } from './theming/ThemeProvider';
9
- export { useTheme } from './theming/useTheme';
10
8
  export * from './types';
9
+ export { useLinkBuilder } from './useLinkBuilder';
11
10
  export { useLinkProps } from './useLinkProps';
12
- export { useLinkTools } from './useLinkTools';
11
+ export { useLocale } from './useLocale';
13
12
  export { useScrollToTop } from './useScrollToTop';
13
+ export { UNSTABLE_useUnhandledLinking } from './useUnhandledLinking';
14
14
  export * from '@react-navigation/core';
package/src/types.tsx CHANGED
@@ -6,6 +6,31 @@ import type {
6
6
  Route,
7
7
  } from '@react-navigation/core';
8
8
 
9
+ declare global {
10
+ // eslint-disable-next-line @typescript-eslint/no-namespace
11
+ namespace ReactNavigation {
12
+ interface Theme {
13
+ dark: boolean;
14
+ colors: {
15
+ primary: string;
16
+ background: string;
17
+ card: string;
18
+ text: string;
19
+ border: string;
20
+ notification: string;
21
+ };
22
+ fonts: {
23
+ regular: FontStyle;
24
+ medium: FontStyle;
25
+ bold: FontStyle;
26
+ heavy: FontStyle;
27
+ };
28
+ }
29
+ }
30
+ }
31
+
32
+ export type LocaleDirection = 'ltr' | 'rtl';
33
+
9
34
  type FontStyle = {
10
35
  fontFamily: string;
11
36
  fontWeight:
@@ -22,23 +47,7 @@ type FontStyle = {
22
47
  | '900';
23
48
  };
24
49
 
25
- export type Theme = {
26
- dark: boolean;
27
- colors: {
28
- primary: string;
29
- background: string;
30
- card: string;
31
- text: string;
32
- border: string;
33
- notification: string;
34
- };
35
- fonts: {
36
- regular: FontStyle;
37
- medium: FontStyle;
38
- bold: FontStyle;
39
- heavy: FontStyle;
40
- };
41
- };
50
+ export type Theme = ReactNavigation.Theme;
42
51
 
43
52
  export type LinkingOptions<ParamList extends {}> = {
44
53
  /**
@@ -96,8 +105,21 @@ export type LinkingOptions<ParamList extends {}> = {
96
105
  * ```
97
106
  */
98
107
  config?: {
99
- initialRouteName?: keyof ParamList;
108
+ /**
109
+ * Path string to match against for the whole navigation tree.
110
+ * It's not possible to specify params here since this doesn't belong to a screen.
111
+ * This is useful when the whole app is under a specific path.
112
+ * e.g. all of the screens are under `/admin` in `https://example.com/admin`
113
+ */
114
+ path?: string;
115
+ /**
116
+ * Path configuration for child screens.
117
+ */
100
118
  screens: PathConfigMap<ParamList>;
119
+ /**
120
+ * Name of the initial route to use for the root navigator.
121
+ */
122
+ initialRouteName?: keyof ParamList;
101
123
  };
102
124
  /**
103
125
  * Custom function to get the initial URL used for linking.