one 1.1.371 → 1.1.372

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 (208) hide show
  1. package/dist/cjs/cli/runAndroid.js.map +1 -1
  2. package/dist/cjs/cli/runAndroid.native.js.map +1 -1
  3. package/dist/cjs/fork/NavigationContainer.cjs +39 -37
  4. package/dist/cjs/fork/NavigationContainer.js +20 -26
  5. package/dist/cjs/fork/NavigationContainer.js.map +1 -1
  6. package/dist/cjs/fork/NavigationContainer.native.js +35 -34
  7. package/dist/cjs/fork/NavigationContainer.native.js.map +3 -3
  8. package/dist/cjs/fork/getPathFromState.cjs +7 -4
  9. package/dist/cjs/fork/getPathFromState.js +7 -4
  10. package/dist/cjs/fork/getPathFromState.js.map +1 -1
  11. package/dist/cjs/fork/getPathFromState.native.js +7 -4
  12. package/dist/cjs/fork/getPathFromState.native.js.map +1 -1
  13. package/dist/cjs/fork/useBackButton.cjs +26 -0
  14. package/dist/cjs/fork/useBackButton.js +22 -0
  15. package/dist/cjs/fork/useBackButton.js.map +6 -0
  16. package/dist/cjs/fork/useBackButton.native.js +47 -0
  17. package/dist/cjs/fork/useBackButton.native.js.map +6 -0
  18. package/dist/cjs/fork/useDocumentTitle.cjs +54 -0
  19. package/dist/cjs/fork/useDocumentTitle.js +47 -0
  20. package/dist/cjs/fork/useDocumentTitle.js.map +6 -0
  21. package/dist/cjs/fork/useDocumentTitle.native.js +27 -0
  22. package/dist/cjs/fork/useDocumentTitle.native.js.map +6 -0
  23. package/dist/cjs/fork/useLinking.cjs +1 -1
  24. package/dist/cjs/fork/useLinking.js +1 -1
  25. package/dist/cjs/fork/useLinking.js.map +1 -1
  26. package/dist/cjs/fork/useLinking.native.js +6 -3
  27. package/dist/cjs/fork/useLinking.native.js.map +2 -2
  28. package/dist/cjs/fork/useThenable.cjs +59 -0
  29. package/dist/cjs/fork/useThenable.js +50 -0
  30. package/dist/cjs/fork/useThenable.js.map +6 -0
  31. package/dist/cjs/fork/useThenable.native.js +66 -0
  32. package/dist/cjs/fork/useThenable.native.js.map +6 -0
  33. package/dist/cjs/layouts/Tabs.cjs +19 -2
  34. package/dist/cjs/layouts/Tabs.js +16 -2
  35. package/dist/cjs/layouts/Tabs.js.map +1 -1
  36. package/dist/cjs/layouts/Tabs.native.js +16 -1
  37. package/dist/cjs/layouts/Tabs.native.js.map +2 -2
  38. package/dist/cjs/layouts/withLayoutContext.cjs +3 -4
  39. package/dist/cjs/layouts/withLayoutContext.js +3 -6
  40. package/dist/cjs/layouts/withLayoutContext.js.map +1 -1
  41. package/dist/cjs/layouts/withLayoutContext.native.js +8 -10
  42. package/dist/cjs/layouts/withLayoutContext.native.js.map +2 -2
  43. package/dist/cjs/setup.cjs +1 -1
  44. package/dist/cjs/setup.js +1 -1
  45. package/dist/cjs/setup.js.map +1 -1
  46. package/dist/cjs/vite/build.cjs +4 -4
  47. package/dist/cjs/vite/build.js +2 -2
  48. package/dist/cjs/vite/build.js.map +1 -1
  49. package/dist/cjs/vite/build.native.js +2 -2
  50. package/dist/cjs/vite/build.native.js.map +1 -1
  51. package/dist/cjs/vite/loadConfig.cjs +44 -0
  52. package/dist/cjs/vite/loadConfig.js +41 -0
  53. package/dist/cjs/vite/loadConfig.js.map +6 -0
  54. package/dist/cjs/vite/loadConfig.native.js +48 -0
  55. package/dist/cjs/vite/loadConfig.native.js.map +6 -0
  56. package/dist/cjs/vite/one.cjs +19 -26
  57. package/dist/cjs/vite/one.js +17 -28
  58. package/dist/cjs/vite/one.js.map +1 -1
  59. package/dist/cjs/vite/one.native.js +17 -30
  60. package/dist/cjs/vite/one.native.js.map +2 -2
  61. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.cjs +4 -1
  62. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js +4 -1
  63. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
  64. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js +4 -1
  65. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js.map +2 -2
  66. package/dist/esm/cli/runAndroid.js.map +1 -1
  67. package/dist/esm/cli/runAndroid.mjs.map +1 -1
  68. package/dist/esm/cli/runAndroid.native.js.map +1 -1
  69. package/dist/esm/fork/NavigationContainer.js +22 -25
  70. package/dist/esm/fork/NavigationContainer.js.map +1 -1
  71. package/dist/esm/fork/NavigationContainer.mjs +35 -33
  72. package/dist/esm/fork/NavigationContainer.mjs.map +1 -1
  73. package/dist/esm/fork/NavigationContainer.native.js +31 -29
  74. package/dist/esm/fork/NavigationContainer.native.js.map +3 -3
  75. package/dist/esm/fork/getPathFromState.js +7 -4
  76. package/dist/esm/fork/getPathFromState.js.map +1 -1
  77. package/dist/esm/fork/getPathFromState.mjs +7 -4
  78. package/dist/esm/fork/getPathFromState.mjs.map +1 -1
  79. package/dist/esm/fork/getPathFromState.native.js +7 -4
  80. package/dist/esm/fork/getPathFromState.native.js.map +1 -1
  81. package/dist/esm/fork/useBackButton.js +6 -0
  82. package/dist/esm/fork/useBackButton.js.map +6 -0
  83. package/dist/esm/fork/useBackButton.mjs +3 -0
  84. package/dist/esm/fork/useBackButton.mjs.map +1 -0
  85. package/dist/esm/fork/useBackButton.native.js +19 -0
  86. package/dist/esm/fork/useBackButton.native.js.map +6 -0
  87. package/dist/esm/fork/useDocumentTitle.js +23 -0
  88. package/dist/esm/fork/useDocumentTitle.js.map +6 -0
  89. package/dist/esm/fork/useDocumentTitle.mjs +20 -0
  90. package/dist/esm/fork/useDocumentTitle.mjs.map +1 -0
  91. package/dist/esm/fork/useDocumentTitle.native.js +6 -0
  92. package/dist/esm/fork/useDocumentTitle.native.js.map +6 -0
  93. package/dist/esm/fork/useLinking.js +3 -2
  94. package/dist/esm/fork/useLinking.js.map +1 -1
  95. package/dist/esm/fork/useLinking.mjs +2 -2
  96. package/dist/esm/fork/useLinking.mjs.map +1 -1
  97. package/dist/esm/fork/useLinking.native.js +7 -4
  98. package/dist/esm/fork/useLinking.native.js.map +2 -2
  99. package/dist/esm/fork/useThenable.js +26 -0
  100. package/dist/esm/fork/useThenable.js.map +6 -0
  101. package/dist/esm/fork/useThenable.mjs +25 -0
  102. package/dist/esm/fork/useThenable.mjs.map +1 -0
  103. package/dist/esm/fork/useThenable.native.js +37 -0
  104. package/dist/esm/fork/useThenable.native.js.map +6 -0
  105. package/dist/esm/layouts/Drawer.js.map +1 -1
  106. package/dist/esm/layouts/Drawer.mjs.map +1 -1
  107. package/dist/esm/layouts/Drawer.native.js.map +1 -1
  108. package/dist/esm/layouts/Tabs.js +18 -3
  109. package/dist/esm/layouts/Tabs.js.map +1 -1
  110. package/dist/esm/layouts/Tabs.mjs +20 -3
  111. package/dist/esm/layouts/Tabs.mjs.map +1 -1
  112. package/dist/esm/layouts/Tabs.native.js +17 -2
  113. package/dist/esm/layouts/Tabs.native.js.map +2 -2
  114. package/dist/esm/layouts/withLayoutContext.js +2 -5
  115. package/dist/esm/layouts/withLayoutContext.js.map +1 -1
  116. package/dist/esm/layouts/withLayoutContext.mjs +3 -5
  117. package/dist/esm/layouts/withLayoutContext.mjs.map +1 -1
  118. package/dist/esm/layouts/withLayoutContext.native.js +8 -10
  119. package/dist/esm/layouts/withLayoutContext.native.js.map +2 -2
  120. package/dist/esm/setup.js +1 -1
  121. package/dist/esm/setup.mjs +1 -1
  122. package/dist/esm/vite/build.js +2 -2
  123. package/dist/esm/vite/build.js.map +1 -1
  124. package/dist/esm/vite/build.mjs +2 -2
  125. package/dist/esm/vite/build.mjs.map +1 -1
  126. package/dist/esm/vite/build.native.js +2 -2
  127. package/dist/esm/vite/build.native.js.map +2 -2
  128. package/dist/esm/vite/loadConfig.js +26 -0
  129. package/dist/esm/vite/loadConfig.js.map +6 -0
  130. package/dist/esm/vite/loadConfig.mjs +20 -0
  131. package/dist/esm/vite/loadConfig.mjs.map +1 -0
  132. package/dist/esm/vite/loadConfig.native.js +27 -0
  133. package/dist/esm/vite/loadConfig.native.js.map +6 -0
  134. package/dist/esm/vite/one.js +17 -28
  135. package/dist/esm/vite/one.js.map +1 -1
  136. package/dist/esm/vite/one.mjs +20 -26
  137. package/dist/esm/vite/one.mjs.map +1 -1
  138. package/dist/esm/vite/one.native.js +17 -29
  139. package/dist/esm/vite/one.native.js.map +2 -2
  140. package/dist/esm/vite/plugins/fileSystemRouterPlugin.js +4 -1
  141. package/dist/esm/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
  142. package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs +4 -1
  143. package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs.map +1 -1
  144. package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js +4 -1
  145. package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js.map +2 -2
  146. package/package.json +48 -48
  147. package/src/cli/runAndroid.ts +0 -2
  148. package/src/cli/runIos.ts +1 -1
  149. package/src/fork/NavigationContainer.tsx +42 -45
  150. package/src/fork/getPathFromState.ts +10 -4
  151. package/src/fork/useBackButton.native.tsx +20 -0
  152. package/src/fork/useBackButton.tsx +5 -0
  153. package/src/fork/useDocumentTitle.native.tsx +6 -0
  154. package/src/fork/useDocumentTitle.tsx +40 -0
  155. package/src/fork/useLinking.native.ts +40 -42
  156. package/src/fork/useLinking.ts +4 -4
  157. package/src/fork/useThenable.tsx +43 -0
  158. package/src/interfaces/router.ts +3 -2
  159. package/src/layouts/Drawer.tsx +2 -2
  160. package/src/layouts/Tabs.tsx +27 -2
  161. package/src/layouts/withLayoutContext.tsx +3 -3
  162. package/src/setup.ts +1 -1
  163. package/src/vite/build.ts +2 -2
  164. package/src/vite/loadConfig.ts +31 -0
  165. package/src/vite/one.ts +16 -30
  166. package/src/vite/plugins/fileSystemRouterPlugin.tsx +4 -1
  167. package/types/cli/runAndroid.d.ts.map +1 -1
  168. package/types/fork/NavigationContainer.d.ts +5 -5
  169. package/types/fork/NavigationContainer.d.ts.map +1 -1
  170. package/types/fork/createMemoryHistory.d.ts.map +1 -1
  171. package/types/fork/getPathFromState.d.ts.map +1 -1
  172. package/types/fork/useBackButton.d.ts +3 -0
  173. package/types/fork/useBackButton.d.ts.map +1 -0
  174. package/types/fork/useBackButton.native.d.ts +2 -0
  175. package/types/fork/useBackButton.native.d.ts.map +1 -0
  176. package/types/fork/useDocumentTitle.d.ts +12 -0
  177. package/types/fork/useDocumentTitle.d.ts.map +1 -0
  178. package/types/fork/useDocumentTitle.native.d.ts +5 -0
  179. package/types/fork/useDocumentTitle.native.d.ts.map +1 -0
  180. package/types/fork/useLinking.d.ts +2 -4
  181. package/types/fork/useLinking.d.ts.map +1 -1
  182. package/types/fork/useLinking.native.d.ts +3 -19
  183. package/types/fork/useLinking.native.d.ts.map +1 -1
  184. package/types/fork/useThenable.d.ts +2 -0
  185. package/types/fork/useThenable.d.ts.map +1 -0
  186. package/types/import-mode/index.native.d.ts.map +1 -1
  187. package/types/interfaces/router.d.ts +2 -2
  188. package/types/interfaces/router.d.ts.map +1 -1
  189. package/types/layouts/Drawer.d.ts +76 -80
  190. package/types/layouts/Drawer.d.ts.map +1 -1
  191. package/types/layouts/Stack.d.ts +68 -80
  192. package/types/layouts/Stack.d.ts.map +1 -1
  193. package/types/layouts/Tabs.d.ts +72 -127
  194. package/types/layouts/Tabs.d.ts.map +1 -1
  195. package/types/layouts/withLayoutContext.d.ts +3 -1
  196. package/types/layouts/withLayoutContext.d.ts.map +1 -1
  197. package/types/setup.d.ts +1 -1
  198. package/types/setup.d.ts.map +1 -1
  199. package/types/useScreens.d.ts +1 -17
  200. package/types/useScreens.d.ts.map +1 -1
  201. package/types/vite/loadConfig.d.ts +5 -0
  202. package/types/vite/loadConfig.d.ts.map +1 -0
  203. package/types/vite/one.d.ts +1 -2
  204. package/types/vite/one.d.ts.map +1 -1
  205. package/types/vite/plugins/fileSystemRouterPlugin.d.ts.map +1 -1
  206. package/src/fork/NavigationContainer.native.tsx +0 -147
  207. package/types/fork/NavigationContainer.native.d.ts +0 -15
  208. package/types/fork/NavigationContainer.native.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,35 +1,12 @@
1
1
  {
2
2
  "name": "one",
3
- "version": "1.1.371",
4
- "source": "src/index.ts",
5
- "types": "./types/index.d.ts",
3
+ "version": "1.1.372",
4
+ "license": "BSD-3-Clause",
6
5
  "sideEffects": [
7
6
  "setup.mjs",
8
7
  "setup.js"
9
8
  ],
10
9
  "type": "module",
11
- "license": "BSD-3-Clause",
12
- "main": "dist/cjs",
13
- "module": "dist/esm",
14
- "bin": "run.mjs",
15
- "files": [
16
- "src",
17
- "types",
18
- "dist",
19
- "vendor",
20
- "LICENSE"
21
- ],
22
- "scripts": {
23
- "build": "tamagui-build",
24
- "watch": "tamagui-build --watch",
25
- "check": "yarn depcheck",
26
- "lint:fix": "../../node_modules/.bin/biome check --apply-unsafe src",
27
- "clean": "tamagui-build clean",
28
- "clean:build": "tamagui-build clean:build",
29
- "test:dev": "TEST_ONLY=dev yarn test",
30
- "test": "vitest --run --pool=forks",
31
- "test:watch": "vitest --watch"
32
- },
33
10
  "exports": {
34
11
  "./package.json": "./package.json",
35
12
  ".": {
@@ -94,6 +71,29 @@
94
71
  "import": "./vendor/react-dom/cjs/react-dom.development.js"
95
72
  }
96
73
  },
74
+ "main": "dist/cjs",
75
+ "module": "dist/esm",
76
+ "source": "src/index.ts",
77
+ "types": "./types/index.d.ts",
78
+ "bin": "run.mjs",
79
+ "files": [
80
+ "src",
81
+ "types",
82
+ "dist",
83
+ "vendor",
84
+ "LICENSE"
85
+ ],
86
+ "scripts": {
87
+ "build": "tamagui-build",
88
+ "check": "yarn depcheck",
89
+ "clean": "tamagui-build clean",
90
+ "clean:build": "tamagui-build clean:build",
91
+ "lint:fix": "../../node_modules/.bin/biome check --apply-unsafe src",
92
+ "test": "vitest --run --pool=forks",
93
+ "test:dev": "TEST_ONLY=dev yarn test",
94
+ "test:watch": "vitest --watch",
95
+ "watch": "tamagui-build --watch"
96
+ },
97
97
  "dependencies": {
98
98
  "@azure/core-asynciterator-polyfill": "^1.0.2",
99
99
  "@babel/core": "^7.26.0",
@@ -103,27 +103,27 @@
103
103
  "@babel/traverse": "^7.26.4",
104
104
  "@radix-ui/react-slot": "^1.0.2",
105
105
  "@react-native-masked-view/masked-view": "^0.3.1",
106
- "@react-navigation/bottom-tabs": "~6.5.8",
107
- "@react-navigation/core": "6.4.17",
108
- "@react-navigation/drawer": "~6.6.3",
109
- "@react-navigation/elements": "^1.3.30",
110
- "@react-navigation/native": "~6.1.7",
111
- "@react-navigation/native-stack": "~6.9.13",
112
- "@react-navigation/routers": "~6.1.9",
106
+ "@react-navigation/bottom-tabs": "~7",
107
+ "@react-navigation/core": "~7",
108
+ "@react-navigation/drawer": "~7",
109
+ "@react-navigation/elements": "~2",
110
+ "@react-navigation/native": "~7",
111
+ "@react-navigation/native-stack": "~7",
112
+ "@react-navigation/routers": "~7",
113
113
  "@swc/core": "^1.7.14",
114
114
  "@ungap/structured-clone": "^1.2.0",
115
- "@vxrn/resolve": "1.1.371",
116
- "@vxrn/tslib-lite": "1.1.371",
117
- "@vxrn/universal-color-scheme": "1.1.371",
118
- "@vxrn/use-isomorphic-layout-effect": "1.1.371",
115
+ "@vxrn/resolve": "^1.1.372",
116
+ "@vxrn/tslib-lite": "^1.1.372",
117
+ "@vxrn/universal-color-scheme": "^1.1.372",
118
+ "@vxrn/use-isomorphic-layout-effect": "^1.1.372",
119
119
  "babel-dead-code-elimination": "^1.0.6",
120
120
  "babel-plugin-react-compiler": "^19.0.0-beta-201e55d-20241215",
121
121
  "citty": "^0.1.6",
122
122
  "core-js": "^3.38.1",
123
- "create-vxrn": "1.1.371",
123
+ "create-vxrn": "^1.1.372",
124
124
  "escape-string-regexp": "^5.0.0",
125
125
  "expo-linking": "~6.3.1",
126
- "expo-modules-core": "^1.12.24",
126
+ "expo-modules-core": "2.1.2",
127
127
  "fast-deep-equal": "^3.1.3",
128
128
  "fast-glob": "^3.2.11",
129
129
  "fs-extra": "^11.2.0",
@@ -137,33 +137,33 @@
137
137
  "react-compiler-runtime": "^19.0.0-beta-201e55d-20241215",
138
138
  "react-dom": "^18.3.1",
139
139
  "react-native-gesture-handler": "^2.18.1",
140
- "react-native-reanimated": "~3.10.1",
140
+ "react-native-reanimated": "~3.16.5",
141
141
  "react-native-safe-area-context": "4.10.5",
142
- "react-native-screens": "3.31.1",
143
- "react-scan": "0.0.36-native",
142
+ "react-native-screens": "4.4.0-rc.1",
143
+ "react-scan": "^0.0.54",
144
144
  "rollup-plugin-node-externals": "^7.1.2",
145
145
  "url-parse": "^1.5.10",
146
- "vite": "^6.0.5",
146
+ "vite": "^6.0.6",
147
147
  "vite-tsconfig-paths": "^5.0.1",
148
- "vxrn": "1.1.371",
148
+ "vxrn": "^1.1.372",
149
149
  "ws": "^8.18.0",
150
150
  "xxhashjs": "^0.2.2"
151
151
  },
152
- "peerDependencies": {
153
- "react-native": "*"
154
- },
155
152
  "devDependencies": {
156
- "@tamagui/build": "^1.120.2",
153
+ "@tamagui/build": "^1.121.2",
157
154
  "@types/node": "^22.1.0",
158
155
  "@types/react-dom": "^18.2.25",
159
156
  "@types/url-parse": "^1.4.11",
160
157
  "@types/xxhashjs": "^0.2.4",
161
158
  "depcheck": "^1.4.7",
162
159
  "get-port": "^7.1.0",
163
- "react-native": "0.74.5",
160
+ "react-native": "0.76.4",
164
161
  "rollup": "^4.29.1",
165
162
  "vitest": "^2.1.8"
166
163
  },
164
+ "peerDependencies": {
165
+ "react-native": "*"
166
+ },
167
167
  "publishConfig": {
168
168
  "access": "public"
169
169
  }
@@ -1,5 +1,3 @@
1
- import { loadUserOneOptions } from '../vite/one'
2
-
3
1
  export async function run(args: {}) {
4
2
  const { runAndroid } = await import('vxrn')
5
3
 
package/src/cli/runIos.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { loadUserOneOptions } from '../vite/one'
1
+ import { loadUserOneOptions } from '../vite/loadConfig'
2
2
 
3
3
  export async function run(args: {}) {
4
4
  const { runIos } = await import('vxrn')
@@ -1,38 +1,40 @@
1
- // Forked from React Navigation in order to use a custom `useLinking` function.
2
- // https://github.com/react-navigation/react-navigation/blob/6.x/packages/native/src/NavigationContainer.tsx
1
+ // Forked from React Navigation
2
+
3
3
  import {
4
4
  BaseNavigationContainer,
5
- getActionFromState,
6
- getPathFromState,
7
- getStateFromPath,
8
- type NavigationContainerProps,
9
- type NavigationContainerRef,
10
- type ParamListBase,
11
- validatePathConfig,
12
- } from '@react-navigation/core'
13
- import {
14
5
  DefaultTheme,
15
- ThemeProvider,
16
6
  type DocumentTitleOptions,
17
- type LinkingOptions,
18
7
  LinkingContext,
8
+ type LinkingOptions,
9
+ LocaleDirContext,
10
+ type LocaleDirection,
11
+ type NavigationContainerProps,
12
+ type NavigationContainerRef,
13
+ type ParamListBase,
19
14
  type Theme,
15
+ ThemeProvider,
16
+ getActionFromState,
17
+ getPathFromState,
18
+ getStateFromPath,
19
+ validatePathConfig,
20
20
  } from '@react-navigation/native'
21
- // import useBackButton from '@react-navigation/native/src/useBackButton'
22
- // import useDocumentTitle from '@react-navigation/native/src/useDocumentTitle'
23
- // import useThenable from '@react-navigation/native/src/useThenable'
24
21
  import * as React from 'react'
25
22
 
26
23
  import useLinking from './useLinking'
24
+ import { I18nManager } from 'react-native'
25
+ import { useBackButton } from './useBackButton'
26
+ import { useDocumentTitle } from './useDocumentTitle'
27
+ import { useThenable } from './useThenable'
27
28
 
28
- global.REACT_NAVIGATION_DEVTOOLS = new WeakMap()
29
+ globalThis.REACT_NAVIGATION_DEVTOOLS = new WeakMap()
29
30
 
30
31
  type Props<ParamList extends object> = NavigationContainerProps & {
31
- theme?: Theme
32
- linking?: LinkingOptions<ParamList>
33
- fallback?: React.ReactNode
32
+ direction?: LocaleDirection
34
33
  documentTitle?: DocumentTitleOptions
34
+ fallback?: React.ReactNode
35
+ linking?: LinkingOptions<ParamList>
35
36
  onReady?: () => void
37
+ theme?: Theme
36
38
  }
37
39
 
38
40
  /**
@@ -51,6 +53,7 @@ type Props<ParamList extends object> = NavigationContainerProps & {
51
53
  */
52
54
  function NavigationContainerInner(
53
55
  {
56
+ direction = I18nManager.getConstants().isRTL ? 'rtl' : 'ltr',
54
57
  theme = DefaultTheme,
55
58
  linking,
56
59
  fallback = null,
@@ -68,11 +71,10 @@ function NavigationContainerInner(
68
71
 
69
72
  const refContainer = React.useRef<NavigationContainerRef<ParamListBase>>(null)
70
73
 
71
- // useBackButton(refContainer)
72
- // useDocumentTitle(refContainer, documentTitle)
74
+ useBackButton(refContainer)
75
+ useDocumentTitle(refContainer, documentTitle)
73
76
 
74
77
  const { getInitialState } = useLinking(refContainer, {
75
- independent: rest.independent,
76
78
  enabled: isLinkingEnabled,
77
79
  prefixes: [],
78
80
  ...linking,
@@ -97,19 +99,7 @@ function NavigationContainerInner(
97
99
  }
98
100
  })
99
101
 
100
- if (cache.val === 0) {
101
- cache.promise = new Promise<void>((res) => {
102
- getInitialState().then((val) => {
103
- cache.val = val
104
- cache.done = true
105
- res()
106
- })
107
- })
108
- }
109
- if (!cache.done) {
110
- throw cache.promise
111
- }
112
- const initialState = cache.val!
102
+ const [isResolved, initialState] = useThenable(getInitialState)
113
103
 
114
104
  React.useImperativeHandle(ref, () => refContainer.current)
115
105
 
@@ -119,16 +109,23 @@ function NavigationContainerInner(
119
109
  onReady?.()
120
110
  }, [onReady])
121
111
 
112
+ if (!isResolved) {
113
+ return <ThemeProvider value={theme}>{fallback}</ThemeProvider>
114
+ }
115
+
122
116
  return (
123
- <LinkingContext.Provider value={linkingContext}>
124
- <ThemeProvider value={theme}>
125
- <BaseNavigationContainer
126
- {...rest}
127
- initialState={rest.initialState == null ? initialState : rest.initialState}
128
- ref={refContainer}
129
- />
130
- </ThemeProvider>
131
- </LinkingContext.Provider>
117
+ <LocaleDirContext.Provider value={direction}>
118
+ <LinkingContext.Provider value={linkingContext}>
119
+ <ThemeProvider value={theme}>
120
+ <BaseNavigationContainer
121
+ {...rest}
122
+ theme={theme}
123
+ ref={refContainer}
124
+ initialState={initialState ?? rest.initialState}
125
+ />
126
+ </ThemeProvider>
127
+ </LinkingContext.Provider>
128
+ </LocaleDirContext.Provider>
132
129
  )
133
130
  }
134
131
 
@@ -217,7 +217,8 @@ function walkConfigItems(
217
217
  ) {
218
218
  // NOTE: Fill in current route using state that was passed as params.
219
219
  if (!route.state && isInvalidParams(route.params)) {
220
- route.state = createFakeState(route.params)
220
+ // FIXME: This is a hack to make things work since the `route` object is immutable on react-navigation v7 (`TypeError: Cannot add property state, object is not extensible`), and seems that things are working. But we might want to do a proper migration for these forked code.
221
+ // route.state = createFakeState(route.params)
221
222
  }
222
223
 
223
224
  let pattern: string | null = null
@@ -264,7 +265,8 @@ function walkConfigItems(
264
265
  }
265
266
 
266
267
  if (!route.state && isInvalidParams(route.params)) {
267
- route.state = createFakeState(route.params)
268
+ // FIXME: This is a hack to make things work since the `route` object is immutable on react-navigation v7, and seems that things are working. But we might want to do a proper migration for these forked code.
269
+ // route.state = createFakeState(route.params)
268
270
  }
269
271
 
270
272
  // If there is no `screens` property or no nested state, we return pattern
@@ -327,7 +329,10 @@ function walkConfigItems(
327
329
  routeName: route.name,
328
330
  })
329
331
  }
330
- Object.assign(focusedParams, collectedParams)
332
+ focusedParams = {
333
+ ...focusedParams,
334
+ ...collectedParams,
335
+ }
331
336
  }
332
337
 
333
338
  return {
@@ -362,7 +367,8 @@ function getPathFromResolvedState(
362
367
  // NOTE: Fill in current route using state that was passed as params.
363
368
  // if (isInvalidParams(route.params)) {
364
369
  if (!route.state && isInvalidParams(route.params)) {
365
- route.state = createFakeState(route.params)
370
+ // FIXME: This is a hack to make things work since the `route` object is immutable on react-navigation v7, and seems that things are working. But we might want to do a proper migration for these forked code.
371
+ // route.state = createFakeState(route.params)
366
372
  }
367
373
 
368
374
  const {
@@ -0,0 +1,20 @@
1
+ // No change just vendored to avoid import issue with RR7
2
+
3
+ import * as React from 'react'
4
+ import { BackHandler } from 'react-native'
5
+ export function useBackButton(ref) {
6
+ React.useEffect(() => {
7
+ const subscription = BackHandler.addEventListener('hardwareBackPress', () => {
8
+ const navigation = ref.current
9
+ if (navigation == null) {
10
+ return false
11
+ }
12
+ if (navigation.canGoBack()) {
13
+ navigation.goBack()
14
+ return true
15
+ }
16
+ return false
17
+ })
18
+ return () => subscription.remove()
19
+ }, [ref])
20
+ }
@@ -0,0 +1,5 @@
1
+ // No change just vendored to avoid import issue with RR7
2
+
3
+ import type { NavigationContainerRef, ParamListBase } from '@react-navigation/core'
4
+
5
+ export function useBackButton(_: React.RefObject<NavigationContainerRef<ParamListBase>>) {}
@@ -0,0 +1,6 @@
1
+ // No change just vendored to avoid import issue with RR7
2
+
3
+ /**
4
+ * Set the document title for the active screen
5
+ */
6
+ export function useDocumentTitle(ref) {}
@@ -0,0 +1,40 @@
1
+ // No change just vendored to avoid import issue with RR7
2
+
3
+ import type { NavigationContainerRef, ParamListBase, Route } from '@react-navigation/core'
4
+ import * as React from 'react'
5
+
6
+ type DocumentTitleOptions = {
7
+ enabled?: boolean
8
+ formatter?: (options: Record<string, any> | undefined, route: Route<string> | undefined) => string
9
+ }
10
+
11
+ /**
12
+ * Set the document title for the active screen
13
+ */
14
+ export function useDocumentTitle(
15
+ ref: React.RefObject<NavigationContainerRef<ParamListBase>>,
16
+ {
17
+ enabled = true,
18
+ formatter = (options, route) => options?.title ?? route?.name,
19
+ }: DocumentTitleOptions = {}
20
+ ) {
21
+ React.useEffect(() => {
22
+ if (!enabled) {
23
+ return
24
+ }
25
+
26
+ const navigation = ref.current
27
+
28
+ if (navigation) {
29
+ const title = formatter(navigation.getCurrentOptions(), navigation.getCurrentRoute())
30
+
31
+ document.title = title
32
+ }
33
+
34
+ return navigation?.addListener('options', (e) => {
35
+ const title = formatter(e.data.options, navigation?.getCurrentRoute())
36
+
37
+ document.title = title
38
+ })
39
+ })
40
+ }
@@ -7,6 +7,7 @@ import {
7
7
  type ParamListBase,
8
8
  getActionFromState as getActionFromStateDefault,
9
9
  getStateFromPath as getStateFromPathDefault,
10
+ useNavigationIndependentTree,
10
11
  } from '@react-navigation/core'
11
12
  import type { LinkingOptions } from '@react-navigation/native'
12
13
  import * as React from 'react'
@@ -51,55 +52,52 @@ export default function useLinking(
51
52
  getActionFromState = getActionFromStateDefault,
52
53
  }: Options
53
54
  ) {
54
- // const independent = useNavigationIndependentTree();
55
+ const independent = useNavigationIndependentTree()
55
56
 
56
- React.useEffect(
57
- () => {
58
- if (process.env.NODE_ENV === 'production') {
59
- return undefined
60
- }
57
+ React.useEffect(() => {
58
+ if (process.env.NODE_ENV === 'production') {
59
+ return undefined
60
+ }
61
61
 
62
- // if (independent) {
63
- // return undefined;
64
- // }
65
-
66
- if (
67
- // enabled !== false &&
68
- linkingHandlers.length
69
- ) {
70
- console.error(
71
- [
72
- 'Looks like you have configured linking in multiple places. This is likely an error since deep links should only be handled in one place to avoid conflicts. Make sure that:',
73
- "- You don't have multiple NavigationContainers in the app each with 'linking' enabled",
74
- '- Only a single instance of the root component is rendered',
75
- Platform.OS === 'android'
76
- ? "- You have set 'android:launchMode=singleTask' in the '<activity />' section of the 'AndroidManifest.xml' file to avoid launching multiple instances"
77
- : '',
78
- ]
79
- .join('\n')
80
- .trim()
81
- )
82
- }
62
+ if (independent) {
63
+ return
64
+ }
83
65
 
84
- const handler = Symbol()
66
+ if (
67
+ // enabled !== false &&
68
+ linkingHandlers.length
69
+ ) {
70
+ console.error(
71
+ [
72
+ 'Looks like you have configured linking in multiple places. This is likely an error since deep links should only be handled in one place to avoid conflicts. Make sure that:',
73
+ "- You don't have multiple NavigationContainers in the app each with 'linking' enabled",
74
+ '- Only a single instance of the root component is rendered',
75
+ Platform.OS === 'android'
76
+ ? "- You have set 'android:launchMode=singleTask' in the '<activity />' section of the 'AndroidManifest.xml' file to avoid launching multiple instances"
77
+ : '',
78
+ ]
79
+ .join('\n')
80
+ .trim()
81
+ )
82
+ }
85
83
 
86
- // if (enabled !== false) {
87
- linkingHandlers.push(handler)
88
- // }
84
+ const handler = Symbol()
89
85
 
90
- return () => {
91
- const index = linkingHandlers.indexOf(handler)
86
+ // if (enabled !== false) {
87
+ linkingHandlers.push(handler)
88
+ // }
92
89
 
93
- if (index > -1) {
94
- linkingHandlers.splice(index, 1)
95
- }
90
+ return () => {
91
+ const index = linkingHandlers.indexOf(handler)
92
+
93
+ if (index > -1) {
94
+ linkingHandlers.splice(index, 1)
96
95
  }
97
- },
98
- [
99
- // enabled,
100
- // independent
101
- ]
102
- )
96
+ }
97
+ }, [
98
+ // enabled,
99
+ independent,
100
+ ])
103
101
 
104
102
  // We store these options in ref to avoid re-creating getInitialState and re-subscribing listeners
105
103
  // This lets user avoid wrapping the items in `React.useCallback` or `React.useMemo`
@@ -7,6 +7,7 @@ import {
7
7
  getActionFromState as getActionFromStateDefault,
8
8
  getPathFromState as getPathFromStateDefault,
9
9
  getStateFromPath as getStateFromPathDefault,
10
+ useNavigationIndependentTree,
10
11
  type NavigationContainerRef,
11
12
  type NavigationState,
12
13
  type ParamListBase,
@@ -88,14 +89,11 @@ export const series = (cb: () => Promise<void>) => {
88
89
 
89
90
  let linkingHandlers: Symbol[] = []
90
91
 
91
- type Options = LinkingOptions<ParamListBase> & {
92
- independent?: boolean
93
- }
92
+ type Options = LinkingOptions<ParamListBase>
94
93
 
95
94
  export default function useLinking(
96
95
  ref: React.RefObject<NavigationContainerRef<ParamListBase>>,
97
96
  {
98
- independent,
99
97
  enabled = true,
100
98
  config,
101
99
  getStateFromPath = getStateFromPathDefault,
@@ -103,6 +101,8 @@ export default function useLinking(
103
101
  getActionFromState = getActionFromStateDefault,
104
102
  }: Options
105
103
  ) {
104
+ const independent = useNavigationIndependentTree()
105
+
106
106
  React.useEffect(() => {
107
107
  if (process.env.NODE_ENV === 'production') {
108
108
  return undefined
@@ -0,0 +1,43 @@
1
+ // No change just vendored to avoid import issue with RR7
2
+ import * as React from 'react'
3
+
4
+ export function useThenable<T>(create: () => PromiseLike<T>) {
5
+ const [promise] = React.useState(create)
6
+
7
+ let initialState: [boolean, T | undefined] = [false, undefined]
8
+
9
+ // Check if our thenable is synchronous
10
+ // eslint-disable-next-line promise/catch-or-return, promise/always-return
11
+ promise.then((result) => {
12
+ initialState = [true, result]
13
+ })
14
+
15
+ const [state, setState] = React.useState(initialState)
16
+ const [resolved] = state
17
+
18
+ React.useEffect(() => {
19
+ let cancelled = false
20
+
21
+ const resolve = async () => {
22
+ let result
23
+
24
+ try {
25
+ result = await promise
26
+ } finally {
27
+ if (!cancelled) {
28
+ setState([true, result])
29
+ }
30
+ }
31
+ }
32
+
33
+ if (!resolved) {
34
+ resolve()
35
+ }
36
+
37
+ return () => {
38
+ cancelled = true
39
+ }
40
+ }, [promise, resolved])
41
+
42
+ return state
43
+ }
@@ -4,7 +4,7 @@ import type {
4
4
  PartialState,
5
5
  } from '@react-navigation/core'
6
6
  import type { ReactNode } from 'react'
7
- import type { TextProps, GestureResponderEvent } from 'react-native'
7
+ import type { TextProps, GestureResponderEvent, PressableProps } from 'react-native'
8
8
 
9
9
  export namespace OneRouter {
10
10
  export interface __routes<T extends string = string> extends Record<string, unknown> {}
@@ -305,7 +305,8 @@ export namespace OneRouter {
305
305
  }
306
306
 
307
307
  export interface LinkProps<T extends string | object>
308
- extends Omit<TextProps, 'href'>,
308
+ extends Omit<TextProps, 'href' | 'disabled' | 'onLongPress' | 'onPressIn' | 'onPressOut'>,
309
+ Pick<PressableProps, 'disabled' | 'onLongPress' | 'onPressIn' | 'onPressOut'>,
309
310
  WebAnchorProps {
310
311
  /** Path to route to. */
311
312
  href: Href<T>
@@ -1,7 +1,7 @@
1
1
  import {
2
- type DrawerNavigationEventMap,
3
- type DrawerNavigationOptions,
4
2
  createDrawerNavigator,
3
+ type DrawerNavigationOptions,
4
+ type DrawerNavigationEventMap,
5
5
  } from '@react-navigation/drawer'
6
6
  import type { DrawerNavigationState, ParamListBase } from '@react-navigation/native'
7
7