one 1.1.371 → 1.1.373
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cli/runAndroid.js.map +1 -1
- package/dist/cjs/cli/runAndroid.native.js.map +1 -1
- package/dist/cjs/createApp.native.js +2 -5
- package/dist/cjs/createApp.native.js.map +2 -2
- package/dist/cjs/fork/NavigationContainer.cjs +39 -37
- package/dist/cjs/fork/NavigationContainer.js +20 -26
- package/dist/cjs/fork/NavigationContainer.js.map +1 -1
- package/dist/cjs/fork/NavigationContainer.native.js +35 -34
- package/dist/cjs/fork/NavigationContainer.native.js.map +3 -3
- package/dist/cjs/fork/getPathFromState.cjs +7 -4
- package/dist/cjs/fork/getPathFromState.js +7 -4
- package/dist/cjs/fork/getPathFromState.js.map +1 -1
- package/dist/cjs/fork/getPathFromState.native.js +7 -4
- package/dist/cjs/fork/getPathFromState.native.js.map +1 -1
- package/dist/cjs/fork/useBackButton.cjs +26 -0
- package/dist/cjs/fork/useBackButton.js +22 -0
- package/dist/cjs/fork/useBackButton.js.map +6 -0
- package/dist/cjs/fork/useBackButton.native.js +47 -0
- package/dist/cjs/fork/useBackButton.native.js.map +6 -0
- package/dist/cjs/fork/useDocumentTitle.cjs +54 -0
- package/dist/cjs/fork/useDocumentTitle.js +47 -0
- package/dist/cjs/fork/useDocumentTitle.js.map +6 -0
- package/dist/cjs/fork/useDocumentTitle.native.js +27 -0
- package/dist/cjs/fork/useDocumentTitle.native.js.map +6 -0
- package/dist/cjs/fork/useLinking.cjs +1 -1
- package/dist/cjs/fork/useLinking.js +1 -1
- package/dist/cjs/fork/useLinking.js.map +1 -1
- package/dist/cjs/fork/useLinking.native.js +6 -3
- package/dist/cjs/fork/useLinking.native.js.map +2 -2
- package/dist/cjs/fork/useThenable.cjs +59 -0
- package/dist/cjs/fork/useThenable.js +50 -0
- package/dist/cjs/fork/useThenable.js.map +6 -0
- package/dist/cjs/fork/useThenable.native.js +66 -0
- package/dist/cjs/fork/useThenable.native.js.map +6 -0
- package/dist/cjs/layouts/Tabs.cjs +19 -2
- package/dist/cjs/layouts/Tabs.js +16 -2
- package/dist/cjs/layouts/Tabs.js.map +1 -1
- package/dist/cjs/layouts/Tabs.native.js +16 -1
- package/dist/cjs/layouts/Tabs.native.js.map +2 -2
- package/dist/cjs/layouts/withLayoutContext.cjs +3 -4
- package/dist/cjs/layouts/withLayoutContext.js +3 -6
- package/dist/cjs/layouts/withLayoutContext.js.map +1 -1
- package/dist/cjs/layouts/withLayoutContext.native.js +8 -10
- package/dist/cjs/layouts/withLayoutContext.native.js.map +2 -2
- package/dist/cjs/setup.cjs +1 -1
- package/dist/cjs/setup.js +1 -1
- package/dist/cjs/setup.js.map +1 -1
- package/dist/cjs/vite/build.cjs +4 -4
- package/dist/cjs/vite/build.js +2 -2
- package/dist/cjs/vite/build.js.map +1 -1
- package/dist/cjs/vite/build.native.js +2 -2
- package/dist/cjs/vite/build.native.js.map +1 -1
- package/dist/cjs/vite/loadConfig.cjs +44 -0
- package/dist/cjs/vite/loadConfig.js +41 -0
- package/dist/cjs/vite/loadConfig.js.map +6 -0
- package/dist/cjs/vite/loadConfig.native.js +48 -0
- package/dist/cjs/vite/loadConfig.native.js.map +6 -0
- package/dist/cjs/vite/one.cjs +19 -26
- package/dist/cjs/vite/one.js +17 -28
- package/dist/cjs/vite/one.js.map +1 -1
- package/dist/cjs/vite/one.native.js +17 -30
- package/dist/cjs/vite/one.native.js.map +2 -2
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.cjs +4 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js +4 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js +4 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js.map +2 -2
- package/dist/esm/cli/runAndroid.js.map +1 -1
- package/dist/esm/cli/runAndroid.mjs.map +1 -1
- package/dist/esm/cli/runAndroid.native.js.map +1 -1
- package/dist/esm/createApp.native.js +1 -5
- package/dist/esm/createApp.native.js.map +2 -2
- package/dist/esm/fork/NavigationContainer.js +22 -25
- package/dist/esm/fork/NavigationContainer.js.map +1 -1
- package/dist/esm/fork/NavigationContainer.mjs +35 -33
- package/dist/esm/fork/NavigationContainer.mjs.map +1 -1
- package/dist/esm/fork/NavigationContainer.native.js +31 -29
- package/dist/esm/fork/NavigationContainer.native.js.map +3 -3
- package/dist/esm/fork/getPathFromState.js +7 -4
- package/dist/esm/fork/getPathFromState.js.map +1 -1
- package/dist/esm/fork/getPathFromState.mjs +7 -4
- package/dist/esm/fork/getPathFromState.mjs.map +1 -1
- package/dist/esm/fork/getPathFromState.native.js +7 -4
- package/dist/esm/fork/getPathFromState.native.js.map +1 -1
- package/dist/esm/fork/useBackButton.js +6 -0
- package/dist/esm/fork/useBackButton.js.map +6 -0
- package/dist/esm/fork/useBackButton.mjs +3 -0
- package/dist/esm/fork/useBackButton.mjs.map +1 -0
- package/dist/esm/fork/useBackButton.native.js +19 -0
- package/dist/esm/fork/useBackButton.native.js.map +6 -0
- package/dist/esm/fork/useDocumentTitle.js +23 -0
- package/dist/esm/fork/useDocumentTitle.js.map +6 -0
- package/dist/esm/fork/useDocumentTitle.mjs +20 -0
- package/dist/esm/fork/useDocumentTitle.mjs.map +1 -0
- package/dist/esm/fork/useDocumentTitle.native.js +6 -0
- package/dist/esm/fork/useDocumentTitle.native.js.map +6 -0
- package/dist/esm/fork/useLinking.js +3 -2
- package/dist/esm/fork/useLinking.js.map +1 -1
- package/dist/esm/fork/useLinking.mjs +2 -2
- package/dist/esm/fork/useLinking.mjs.map +1 -1
- package/dist/esm/fork/useLinking.native.js +7 -4
- package/dist/esm/fork/useLinking.native.js.map +2 -2
- package/dist/esm/fork/useThenable.js +26 -0
- package/dist/esm/fork/useThenable.js.map +6 -0
- package/dist/esm/fork/useThenable.mjs +25 -0
- package/dist/esm/fork/useThenable.mjs.map +1 -0
- package/dist/esm/fork/useThenable.native.js +37 -0
- package/dist/esm/fork/useThenable.native.js.map +6 -0
- package/dist/esm/layouts/Drawer.js.map +1 -1
- package/dist/esm/layouts/Drawer.mjs.map +1 -1
- package/dist/esm/layouts/Drawer.native.js.map +1 -1
- package/dist/esm/layouts/Tabs.js +18 -3
- package/dist/esm/layouts/Tabs.js.map +1 -1
- package/dist/esm/layouts/Tabs.mjs +20 -3
- package/dist/esm/layouts/Tabs.mjs.map +1 -1
- package/dist/esm/layouts/Tabs.native.js +17 -2
- package/dist/esm/layouts/Tabs.native.js.map +2 -2
- package/dist/esm/layouts/withLayoutContext.js +2 -5
- package/dist/esm/layouts/withLayoutContext.js.map +1 -1
- package/dist/esm/layouts/withLayoutContext.mjs +3 -5
- package/dist/esm/layouts/withLayoutContext.mjs.map +1 -1
- package/dist/esm/layouts/withLayoutContext.native.js +8 -10
- package/dist/esm/layouts/withLayoutContext.native.js.map +2 -2
- package/dist/esm/setup.js +1 -1
- package/dist/esm/setup.mjs +1 -1
- package/dist/esm/vite/build.js +2 -2
- package/dist/esm/vite/build.js.map +1 -1
- package/dist/esm/vite/build.mjs +2 -2
- package/dist/esm/vite/build.mjs.map +1 -1
- package/dist/esm/vite/build.native.js +2 -2
- package/dist/esm/vite/build.native.js.map +2 -2
- package/dist/esm/vite/loadConfig.js +26 -0
- package/dist/esm/vite/loadConfig.js.map +6 -0
- package/dist/esm/vite/loadConfig.mjs +20 -0
- package/dist/esm/vite/loadConfig.mjs.map +1 -0
- package/dist/esm/vite/loadConfig.native.js +27 -0
- package/dist/esm/vite/loadConfig.native.js.map +6 -0
- package/dist/esm/vite/one.js +17 -28
- package/dist/esm/vite/one.js.map +1 -1
- package/dist/esm/vite/one.mjs +20 -26
- package/dist/esm/vite/one.mjs.map +1 -1
- package/dist/esm/vite/one.native.js +17 -29
- package/dist/esm/vite/one.native.js.map +2 -2
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.js +4 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs +4 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js +4 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js.map +2 -2
- package/package.json +48 -48
- package/src/cli/runAndroid.ts +0 -2
- package/src/cli/runIos.ts +1 -1
- package/src/createApp.native.tsx +7 -7
- package/src/fork/NavigationContainer.tsx +42 -45
- package/src/fork/getPathFromState.ts +10 -4
- package/src/fork/useBackButton.native.tsx +20 -0
- package/src/fork/useBackButton.tsx +5 -0
- package/src/fork/useDocumentTitle.native.tsx +6 -0
- package/src/fork/useDocumentTitle.tsx +40 -0
- package/src/fork/useLinking.native.ts +40 -42
- package/src/fork/useLinking.ts +4 -4
- package/src/fork/useThenable.tsx +43 -0
- package/src/interfaces/router.ts +3 -2
- package/src/layouts/Drawer.tsx +2 -2
- package/src/layouts/Tabs.tsx +27 -2
- package/src/layouts/withLayoutContext.tsx +3 -3
- package/src/setup.ts +1 -1
- package/src/vite/build.ts +2 -2
- package/src/vite/loadConfig.ts +31 -0
- package/src/vite/one.ts +16 -30
- package/src/vite/plugins/fileSystemRouterPlugin.tsx +4 -1
- package/types/cli/runAndroid.d.ts.map +1 -1
- package/types/fork/NavigationContainer.d.ts +5 -5
- package/types/fork/NavigationContainer.d.ts.map +1 -1
- package/types/fork/createMemoryHistory.d.ts.map +1 -1
- package/types/fork/getPathFromState.d.ts.map +1 -1
- package/types/fork/useBackButton.d.ts +3 -0
- package/types/fork/useBackButton.d.ts.map +1 -0
- package/types/fork/useBackButton.native.d.ts +2 -0
- package/types/fork/useBackButton.native.d.ts.map +1 -0
- package/types/fork/useDocumentTitle.d.ts +12 -0
- package/types/fork/useDocumentTitle.d.ts.map +1 -0
- package/types/fork/useDocumentTitle.native.d.ts +5 -0
- package/types/fork/useDocumentTitle.native.d.ts.map +1 -0
- package/types/fork/useLinking.d.ts +2 -4
- package/types/fork/useLinking.d.ts.map +1 -1
- package/types/fork/useLinking.native.d.ts +3 -19
- package/types/fork/useLinking.native.d.ts.map +1 -1
- package/types/fork/useThenable.d.ts +2 -0
- package/types/fork/useThenable.d.ts.map +1 -0
- package/types/import-mode/index.native.d.ts.map +1 -1
- package/types/interfaces/router.d.ts +2 -2
- package/types/interfaces/router.d.ts.map +1 -1
- package/types/layouts/Drawer.d.ts +76 -80
- package/types/layouts/Drawer.d.ts.map +1 -1
- package/types/layouts/Stack.d.ts +68 -80
- package/types/layouts/Stack.d.ts.map +1 -1
- package/types/layouts/Tabs.d.ts +72 -127
- package/types/layouts/Tabs.d.ts.map +1 -1
- package/types/layouts/withLayoutContext.d.ts +3 -1
- package/types/layouts/withLayoutContext.d.ts.map +1 -1
- package/types/setup.d.ts +1 -1
- package/types/setup.d.ts.map +1 -1
- package/types/useScreens.d.ts +1 -17
- package/types/useScreens.d.ts.map +1 -1
- package/types/vite/loadConfig.d.ts +5 -0
- package/types/vite/loadConfig.d.ts.map +1 -0
- package/types/vite/one.d.ts +1 -2
- package/types/vite/one.d.ts.map +1 -1
- package/types/vite/plugins/fileSystemRouterPlugin.d.ts.map +1 -1
- package/src/fork/NavigationContainer.native.tsx +0 -147
- package/types/fork/NavigationContainer.native.d.ts +0 -15
- 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.
|
4
|
-
"
|
5
|
-
"types": "./types/index.d.ts",
|
3
|
+
"version": "1.1.373",
|
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": "~
|
107
|
-
"@react-navigation/core": "
|
108
|
-
"@react-navigation/drawer": "~
|
109
|
-
"@react-navigation/elements": "
|
110
|
-
"@react-navigation/native": "~
|
111
|
-
"@react-navigation/native-stack": "~
|
112
|
-
"@react-navigation/routers": "~
|
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.
|
116
|
-
"@vxrn/tslib-lite": "1.1.
|
117
|
-
"@vxrn/universal-color-scheme": "1.1.
|
118
|
-
"@vxrn/use-isomorphic-layout-effect": "1.1.
|
115
|
+
"@vxrn/resolve": "1.1.373",
|
116
|
+
"@vxrn/tslib-lite": "1.1.373",
|
117
|
+
"@vxrn/universal-color-scheme": "1.1.373",
|
118
|
+
"@vxrn/use-isomorphic-layout-effect": "1.1.373",
|
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.
|
123
|
+
"create-vxrn": "1.1.373",
|
124
124
|
"escape-string-regexp": "^5.0.0",
|
125
125
|
"expo-linking": "~6.3.1",
|
126
|
-
"expo-modules-core": "
|
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.
|
140
|
+
"react-native-reanimated": "~3.16.5",
|
141
141
|
"react-native-safe-area-context": "4.10.5",
|
142
|
-
"react-native-screens": "
|
143
|
-
"react-scan": "0.0.
|
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.
|
146
|
+
"vite": "^6.0.6",
|
147
147
|
"vite-tsconfig-paths": "^5.0.1",
|
148
|
-
"vxrn": "1.1.
|
148
|
+
"vxrn": "1.1.373",
|
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.
|
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.
|
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
|
}
|
package/src/cli/runAndroid.ts
CHANGED
package/src/cli/runIos.ts
CHANGED
package/src/createApp.native.tsx
CHANGED
@@ -2,7 +2,7 @@ import { AppRegistry, LogBox } from 'react-native' // This should be the first i
|
|
2
2
|
import './polyfills-mobile'
|
3
3
|
import './setup'
|
4
4
|
import { Root } from './Root'
|
5
|
-
import { ReactScan } from 'react-scan/native'
|
5
|
+
// import { ReactScan } from 'react-scan/native'
|
6
6
|
|
7
7
|
export type CreateAppProps = { routes: Record<string, () => Promise<unknown>> }
|
8
8
|
|
@@ -13,12 +13,12 @@ export function createApp(options: CreateAppProps): void {
|
|
13
13
|
const App = () => {
|
14
14
|
let contents = <Root isClient routes={options.routes} path="/" />
|
15
15
|
|
16
|
-
if (process.env.ONE_ENABLE_REACT_SCAN) {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
}
|
16
|
+
// if (process.env.ONE_ENABLE_REACT_SCAN) {
|
17
|
+
// console.warn(`React Scan enabled with options: ${process.env.ONE_ENABLE_REACT_SCAN}`)
|
18
|
+
// contents = (
|
19
|
+
// <ReactScan options={JSON.parse(process.env.ONE_ENABLE_REACT_SCAN)}>{contents}</ReactScan>
|
20
|
+
// )
|
21
|
+
// }
|
22
22
|
|
23
23
|
return contents
|
24
24
|
}
|
@@ -1,38 +1,40 @@
|
|
1
|
-
// Forked from React Navigation
|
2
|
-
|
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
|
-
|
29
|
+
globalThis.REACT_NAVIGATION_DEVTOOLS = new WeakMap()
|
29
30
|
|
30
31
|
type Props<ParamList extends object> = NavigationContainerProps & {
|
31
|
-
|
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
|
-
|
72
|
-
|
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
|
-
|
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
|
-
<
|
124
|
-
<
|
125
|
-
<
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
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
|
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.
|
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
|
-
|
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.
|
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,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
|
-
|
55
|
+
const independent = useNavigationIndependentTree()
|
55
56
|
|
56
|
-
React.useEffect(
|
57
|
-
()
|
58
|
-
|
59
|
-
|
60
|
-
}
|
57
|
+
React.useEffect(() => {
|
58
|
+
if (process.env.NODE_ENV === 'production') {
|
59
|
+
return undefined
|
60
|
+
}
|
61
61
|
|
62
|
-
|
63
|
-
|
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
|
-
|
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
|
-
|
87
|
-
linkingHandlers.push(handler)
|
88
|
-
// }
|
84
|
+
const handler = Symbol()
|
89
85
|
|
90
|
-
|
91
|
-
|
86
|
+
// if (enabled !== false) {
|
87
|
+
linkingHandlers.push(handler)
|
88
|
+
// }
|
92
89
|
|
93
|
-
|
94
|
-
|
95
|
-
|
90
|
+
return () => {
|
91
|
+
const index = linkingHandlers.indexOf(handler)
|
92
|
+
|
93
|
+
if (index > -1) {
|
94
|
+
linkingHandlers.splice(index, 1)
|
96
95
|
}
|
97
|
-
}
|
98
|
-
|
99
|
-
|
100
|
-
|
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`
|
package/src/fork/useLinking.ts
CHANGED
@@ -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
|
+
}
|
package/src/interfaces/router.ts
CHANGED
@@ -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>
|
package/src/layouts/Drawer.tsx
CHANGED
@@ -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
|
|