expo-router 1.7.4 → 1.7.6
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/_app.tsx
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// The entry component (one that uses context modules) cannot be in the same file as the
|
|
2
|
+
// entry side-effects, otherwise they'll be updated when files are added/removed from the
|
|
3
|
+
// app directory. This will cause a lot of unfortunate errors regarding HMR and Fast Refresh.
|
|
4
|
+
// This is because Fast Refresh is sending the entire file containing an updated component.
|
|
5
|
+
import { ExpoRoot } from "expo-router";
|
|
6
|
+
import Head from "expo-router/head";
|
|
7
|
+
|
|
8
|
+
import { ctx } from "./_ctx";
|
|
9
|
+
|
|
10
|
+
// Must be exported or Fast Refresh won't update the context
|
|
11
|
+
export function App() {
|
|
12
|
+
return (
|
|
13
|
+
<Head.Provider>
|
|
14
|
+
<ExpoRoot context={ctx} />
|
|
15
|
+
</Head.Provider>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerRootComponent.d.ts","sourceRoot":"","sources":["../../../src/fork/expo/registerRootComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,CAAC;AAG5B,OAAO,qBAAqB,CAAC;AAI7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,KAAK,YAAY,GAAG;IAClB,GAAG,EAAE;QACH,YAAY,CAAC,EAAE,GAAG,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;
|
|
1
|
+
{"version":3,"file":"registerRootComponent.d.ts","sourceRoot":"","sources":["../../../src/fork/expo/registerRootComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,CAAC;AAG5B,OAAO,qBAAqB,CAAC;AAI7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,KAAK,YAAY,GAAG;IAClB,GAAG,EAAE;QACH,YAAY,CAAC,EAAE,GAAG,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAKF,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,CAAC,SAAS,YAAY,EAClE,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,GAChC,IAAI,CA6CN"}
|
package/entry.js
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
// `@expo/metro-runtime` MUST be the first import to ensure Fast Refresh works
|
|
2
2
|
// on web.
|
|
3
3
|
import "@expo/metro-runtime";
|
|
4
|
-
import { ExpoRoot } from "expo-router";
|
|
5
|
-
import Head from "expo-router/head";
|
|
6
|
-
import { renderRootComponent } from "expo-router/src/renderRootComponent";
|
|
7
4
|
|
|
8
|
-
import
|
|
5
|
+
// This file should only import and register the root. No components or exports
|
|
6
|
+
// should be added here.
|
|
7
|
+
import { renderRootComponent } from "expo-router/src/renderRootComponent";
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
export function App() {
|
|
12
|
-
return (
|
|
13
|
-
<Head.Provider>
|
|
14
|
-
<ExpoRoot context={ctx} />
|
|
15
|
-
</Head.Provider>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
9
|
+
import { App } from "./_app";
|
|
18
10
|
|
|
19
11
|
renderRootComponent(App);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-router",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.6",
|
|
4
4
|
"main": "src/index.tsx",
|
|
5
5
|
"types": "build/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"plugin",
|
|
25
25
|
"app.plugin.js",
|
|
26
26
|
"!**/__tests__",
|
|
27
|
-
"_ctx.*"
|
|
27
|
+
"_ctx.*",
|
|
28
|
+
"_app.tsx"
|
|
28
29
|
],
|
|
29
30
|
"repository": {
|
|
30
31
|
"url": "https://github.com/expo/router.git",
|
|
@@ -103,12 +104,12 @@
|
|
|
103
104
|
},
|
|
104
105
|
"dependencies": {
|
|
105
106
|
"@bacons/react-views": "^1.1.3",
|
|
106
|
-
"@expo/metro-runtime": "2.1.
|
|
107
|
-
"@radix-ui/react-slot": "
|
|
107
|
+
"@expo/metro-runtime": "2.1.5",
|
|
108
|
+
"@radix-ui/react-slot": "1.0.1",
|
|
108
109
|
"@react-navigation/bottom-tabs": "~6.5.7",
|
|
109
110
|
"@react-navigation/native": "~6.1.6",
|
|
110
111
|
"@react-navigation/native-stack": "~6.9.12",
|
|
111
|
-
"expo-head": "0.0.
|
|
112
|
+
"expo-head": "0.0.7",
|
|
112
113
|
"expo-splash-screen": "*",
|
|
113
114
|
"query-string": "7.1.3",
|
|
114
115
|
"react-helmet-async": "^1.3.0",
|
|
@@ -24,6 +24,9 @@ type InitialProps = {
|
|
|
24
24
|
[key: string]: any;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
// Web root tag is preserved for re-use between refreshes.
|
|
28
|
+
let rootTag: import("react-dom/client").Root | null = null;
|
|
29
|
+
|
|
27
30
|
export default function registerRootComponent<P extends InitialProps>(
|
|
28
31
|
component: React.ComponentType<P>
|
|
29
32
|
): void {
|
|
@@ -67,7 +70,7 @@ export default function registerRootComponent<P extends InitialProps>(
|
|
|
67
70
|
if (process.env.EXPO_PUBLIC_USE_STATIC) {
|
|
68
71
|
hydrateRoot(tag, React.createElement(qualifiedComponent));
|
|
69
72
|
} else {
|
|
70
|
-
|
|
73
|
+
rootTag ??= createRoot(tag);
|
|
71
74
|
rootTag.render(React.createElement(qualifiedComponent));
|
|
72
75
|
}
|
|
73
76
|
}
|