expo-router 2.0.0 → 2.0.2
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/build/ExpoRoot.d.ts.map +1 -1
- package/build/global-state/router-store.d.ts +1 -2
- package/build/global-state/router-store.d.ts.map +1 -1
- package/build/global-state/routing.d.ts.map +1 -1
- package/build/hooks.d.ts.map +1 -1
- package/build/link/href.d.ts.map +1 -1
- package/build/onboard/Tutorial.d.ts.map +1 -1
- package/build/useDeprecated.d.ts +3 -0
- package/build/useDeprecated.d.ts.map +1 -0
- package/build/views/ErrorBoundary.d.ts.map +1 -1
- package/build/views/Screen.d.ts.map +1 -1
- package/build/views/Sitemap.d.ts.map +1 -1
- package/build/views/Splash.d.ts.map +1 -1
- package/build/views/Unmatched.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/ExpoRoot.tsx +14 -2
- package/src/global-state/router-store.tsx +5 -10
- package/src/global-state/routing.ts +25 -18
- package/src/hooks.ts +13 -9
- package/src/link/href.ts +9 -7
- package/src/onboard/Tutorial.tsx +5 -11
- package/src/static/html.tsx +1 -1
- package/src/useDeprecated.ts +35 -0
- package/src/views/ErrorBoundary.tsx +1 -5
- package/src/views/Screen.tsx +17 -1
- package/src/views/Sitemap.tsx +0 -1
- package/src/views/Splash.tsx +5 -5
- package/src/views/Unmatched.tsx +2 -10
- package/types/react-native-web.d.ts +0 -2
package/build/ExpoRoot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,iBAAiB,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAMtE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,OAAO,CAAC,EAAE,iBAAiB,CAAC;QAAE,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;CACtD,CAAC;AAqCF,wBAAgB,QAAQ,CAAC,EACvB,OAAO,EAAE,aAAwB,EACjC,GAAG,KAAK,EACT,EAAE,aAAa,eA2Bf"}
|
|
@@ -14,7 +14,7 @@ export declare class RouterStore {
|
|
|
14
14
|
routeNode: RouteNode | null;
|
|
15
15
|
rootComponent: ComponentType;
|
|
16
16
|
linking: ExpoLinkingOptions | undefined;
|
|
17
|
-
|
|
17
|
+
private hasAttemptedToHideSplash;
|
|
18
18
|
initialState: ResultState | undefined;
|
|
19
19
|
rootState: ResultState | undefined;
|
|
20
20
|
nextState: ResultState | undefined;
|
|
@@ -35,7 +35,6 @@ export declare class RouterStore {
|
|
|
35
35
|
getRouteInfo(state: ResultState): UrlObject;
|
|
36
36
|
shouldShowTutorial(): boolean;
|
|
37
37
|
/** Make sure these are arrow functions so `this` is correctly bound */
|
|
38
|
-
onReady: () => void;
|
|
39
38
|
subscribeToRootState: (subscriber: () => void) => () => boolean;
|
|
40
39
|
subscribeToStore: (subscriber: () => void) => () => boolean;
|
|
41
40
|
snapshot: () => this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router-store.d.ts","sourceRoot":"","sources":["../../src/global-state/router-store.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EAGlC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAiC,aAAa,EAAY,MAAM,OAAO,CAAC;AAE/E,OAAO,EAAE,SAAS,EAAyB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAoB,MAAM,qBAAq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,WAAW,QAGvC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/global-state/routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAEnB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAE,IAAI,EAAe,MAAM,cAAc,CAAC;AAEjD,OAAO,EACL,cAAc,EAKf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAUlD,wBAAgB,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,QAEhD;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,QAEnD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,WAAW,QAGvC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAKpD;AAED,wBAAgB,SAAS,CACvB,IAAI,EAAE,WAAW,EACjB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAM,OAI7C;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,QA6HrE;AAED,uGAAuG;AACvG,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,GAC5C,MAAM,IAAI,cAAc,CAqB1B"}
|
package/build/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjC,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAEtD,wBAAgB,sBAAsB,kDAErC;AAED,wBAAgB,YAAY,2CAE3B;AAED,wBAAgB,iBAAiB,oGAEhC;AAGD,wBAAgB,OAAO,WAGtB;AAED,wBAAgB,SAAS,IAAI,MAAM,CAYlC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CACzB,SAAS,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,KAClC,SAAS,CAEb;AAED,kEAAkE;AAClE,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,SAAS,YAAY,GAAG,YAAY,KACxC,OAAO,CAAC,OAAO,CAAC,CAEpB;AAED,qDAAqD;AACrD,wBAAgB,eAAe,CAC7B,OAAO,SAAS,YAAY,GAAG,YAAY,KACxC,OAAO,CAAC,OAAO,CAAC,CAEpB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,SAAS,YAAY,GAAG,YAAY,KACxC,OAAO,CAAC,OAAO,CAAC,CAEpB"}
|
package/build/link/href.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"href.d.ts","sourceRoot":"","sources":["../../src/link/href.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,UAAU,CAAC;AAEvC,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAED,oEAAoE;AACpE,eAAO,MAAM,WAAW,SAAU,IAAI,KAAG,
|
|
1
|
+
{"version":3,"file":"href.d.ts","sourceRoot":"","sources":["../../src/link/href.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,UAAU,CAAC;AAEvC,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAED,oEAAoE;AACpE,eAAO,MAAM,WAAW,SAAU,IAAI,KAAG,MAaxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tutorial.d.ts","sourceRoot":"","sources":["../../src/onboard/Tutorial.tsx"],"names":[],"mappings":";AAqCA,wBAAgB,QAAQ,
|
|
1
|
+
{"version":3,"file":"Tutorial.d.ts","sourceRoot":"","sources":["../../src/onboard/Tutorial.tsx"],"names":[],"mappings":";AAqCA,wBAAgB,QAAQ,gBAqCvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeprecated.d.ts","sourceRoot":"","sources":["../src/useDeprecated.ts"],"names":[],"mappings":"AAaA,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,OAAc,EACrB,GAAG,SAAU,QAUd;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,OAAc,EACrB,GAAG,SAAU,QAGd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/views/ErrorBoundary.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAmC3C,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/views/ErrorBoundary.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAmC3C,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,kBAAkB,eAuDjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Screen.d.ts","sourceRoot":"","sources":["../../src/views/Screen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Screen.d.ts","sourceRoot":"","sources":["../../src/views/Screen.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,WAAW,CACrB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IACxD;IACF;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,aAAa,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IACvC,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB,CAAC;AAKF,sEAAsE;AACtE,wBAAgB,MAAM,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,EAAE,EACvD,IAAI,EACJ,QAAQ,EACR,OAAO,GACR,EAAE,WAAW,CAAC,QAAQ,CAAC,QAkCvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sitemap.d.ts","sourceRoot":"","sources":["../../src/views/Sitemap.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAkB9E,wBAAgB,aAAa,IAAI,4BAA4B,
|
|
1
|
+
{"version":3,"file":"Sitemap.d.ts","sourceRoot":"","sources":["../../src/views/Sitemap.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAkB9E,wBAAgB,aAAa,IAAI,4BAA4B,CAoB5D;AAED,wBAAgB,OAAO,gBA6BtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Splash.d.ts","sourceRoot":"","sources":["../../src/views/Splash.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Splash.d.ts","sourceRoot":"","sources":["../../src/views/Splash.tsx"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,SAM3B;yBANe,YAAY;;;;;;AAmC5B,eAAO,MAAM,8BAA8B,YAe1C,CAAC;AAEF,eAAO,MAAM,wBAAwB,YAOpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Unmatched.d.ts","sourceRoot":"","sources":["../../src/views/Unmatched.tsx"],"names":[],"mappings":";AAwBA,2CAA2C;AAC3C,wBAAgB,SAAS,
|
|
1
|
+
{"version":3,"file":"Unmatched.d.ts","sourceRoot":"","sources":["../../src/views/Unmatched.tsx"],"names":[],"mappings":";AAwBA,2CAA2C;AAC3C,wBAAgB,SAAS,gBA4CxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-router",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"main": "src/index.tsx",
|
|
5
5
|
"types": "build/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@react-navigation/drawer": "^6.5.8",
|
|
64
|
-
"expo": "^49.0.0
|
|
64
|
+
"expo": "^49.0.0",
|
|
65
65
|
"expo-constants": "*",
|
|
66
66
|
"expo-linking": "*",
|
|
67
67
|
"expo-status-bar": "*",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
106
|
"@bacons/react-views": "^1.1.3",
|
|
107
|
-
"@expo/metro-runtime": "2.2.
|
|
107
|
+
"@expo/metro-runtime": "2.2.5",
|
|
108
108
|
"@radix-ui/react-slot": "1.0.1",
|
|
109
109
|
"@react-navigation/bottom-tabs": "~6.5.7",
|
|
110
110
|
"@react-navigation/native": "~6.1.6",
|
package/src/ExpoRoot.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Constants from "expo-constants";
|
|
1
2
|
import { StatusBar } from "expo-status-bar";
|
|
2
3
|
import React, { FunctionComponent, ReactNode, Fragment } from "react";
|
|
3
4
|
import { Platform } from "react-native";
|
|
@@ -44,6 +45,11 @@ const INITIAL_METRICS = {
|
|
|
44
45
|
insets: { top: 0, left: 0, right: 0, bottom: 0 },
|
|
45
46
|
};
|
|
46
47
|
|
|
48
|
+
const hasViewControllerBasedStatusBarAppearance =
|
|
49
|
+
Platform.OS === "ios" &&
|
|
50
|
+
!!Constants.expoConfig?.ios?.infoPlist
|
|
51
|
+
?.UIViewControllerBasedStatusBarAppearance;
|
|
52
|
+
|
|
47
53
|
export function ExpoRoot({
|
|
48
54
|
wrapper: ParentWrapper = Fragment,
|
|
49
55
|
...props
|
|
@@ -64,7 +70,9 @@ export function ExpoRoot({
|
|
|
64
70
|
{children}
|
|
65
71
|
|
|
66
72
|
{/* Users can override this by adding another StatusBar element anywhere higher in the component tree. */}
|
|
67
|
-
|
|
73
|
+
{!hasViewControllerBasedStatusBarAppearance && (
|
|
74
|
+
<StatusBar style="auto" />
|
|
75
|
+
)}
|
|
68
76
|
</SafeAreaProvider>
|
|
69
77
|
</GestureHandlerRootView>
|
|
70
78
|
</ParentWrapper>
|
|
@@ -90,7 +98,11 @@ function ContextNavigator({
|
|
|
90
98
|
SplashScreen.hideAsync();
|
|
91
99
|
if (process.env.NODE_ENV === "development") {
|
|
92
100
|
const Tutorial = require("./onboard/Tutorial").Tutorial;
|
|
93
|
-
return
|
|
101
|
+
return (
|
|
102
|
+
<WrapperComponent>
|
|
103
|
+
<Tutorial />
|
|
104
|
+
</WrapperComponent>
|
|
105
|
+
);
|
|
94
106
|
} else {
|
|
95
107
|
// Ensure tutorial styles are stripped in production.
|
|
96
108
|
return null;
|
|
@@ -26,7 +26,7 @@ export class RouterStore {
|
|
|
26
26
|
routeNode!: RouteNode | null;
|
|
27
27
|
rootComponent!: ComponentType;
|
|
28
28
|
linking: ExpoLinkingOptions | undefined;
|
|
29
|
-
|
|
29
|
+
private hasAttemptedToHideSplash: boolean = false;
|
|
30
30
|
|
|
31
31
|
initialState: ResultState | undefined;
|
|
32
32
|
rootState: ResultState | undefined;
|
|
@@ -53,7 +53,6 @@ export class RouterStore {
|
|
|
53
53
|
initialLocation?: URL
|
|
54
54
|
) {
|
|
55
55
|
// Clean up any previous state
|
|
56
|
-
this.isReady ||= Boolean(initialLocation);
|
|
57
56
|
this.initialState = undefined;
|
|
58
57
|
this.rootState = undefined;
|
|
59
58
|
this.nextState = undefined;
|
|
@@ -118,8 +117,10 @@ export class RouterStore {
|
|
|
118
117
|
(data) => {
|
|
119
118
|
const state = data.data.state as ResultState;
|
|
120
119
|
|
|
121
|
-
if (
|
|
122
|
-
this.
|
|
120
|
+
if (!this.hasAttemptedToHideSplash) {
|
|
121
|
+
this.hasAttemptedToHideSplash = true;
|
|
122
|
+
// NOTE(EvanBacon): `navigationRef.isReady` is sometimes not true when state is called initially.
|
|
123
|
+
requestAnimationFrame(() => _internal_maybeHideAsync());
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
let shouldUpdateSubscribers = this.nextState === state;
|
|
@@ -178,12 +179,6 @@ export class RouterStore {
|
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
/** Make sure these are arrow functions so `this` is correctly bound */
|
|
181
|
-
onReady = () => {
|
|
182
|
-
if (!this.isReady) {
|
|
183
|
-
requestAnimationFrame(() => _internal_maybeHideAsync());
|
|
184
|
-
}
|
|
185
|
-
this.isReady = true;
|
|
186
|
-
};
|
|
187
182
|
subscribeToRootState = (subscriber: () => void) => {
|
|
188
183
|
this.rootStateSubscribers.add(subscriber);
|
|
189
184
|
return () => this.rootStateSubscribers.delete(subscriber);
|
|
@@ -19,7 +19,7 @@ import { hasUrlProtocolPrefix } from "../utils/url";
|
|
|
19
19
|
import type { RouterStore } from "./router-store";
|
|
20
20
|
|
|
21
21
|
function assertIsReady(store: RouterStore) {
|
|
22
|
-
if (!store.
|
|
22
|
+
if (!store.navigationRef.isReady()) {
|
|
23
23
|
throw new Error(
|
|
24
24
|
"Attempted to navigate before mounting the Root Layout component. Ensure the Root Layout component is rendering a Slot, or other navigator on the first render."
|
|
25
25
|
);
|
|
@@ -40,7 +40,9 @@ export function goBack(this: RouterStore) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export function canGoBack(this: RouterStore): boolean {
|
|
43
|
-
|
|
43
|
+
if (!this.navigationRef.isReady()) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
44
46
|
return this.navigationRef?.current?.canGoBack() ?? false;
|
|
45
47
|
}
|
|
46
48
|
|
|
@@ -110,23 +112,28 @@ export function linkTo(this: RouterStore, href: string, event?: string) {
|
|
|
110
112
|
state
|
|
111
113
|
)!;
|
|
112
114
|
const nextRoute = findTopRouteForTarget(state);
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
// NOTE(EvanBacon): There's an issue where moving from "a -> b" is considered siblings:
|
|
116
|
+
// a. index (initialRouteName="index")
|
|
117
|
+
// b. stack/index
|
|
118
|
+
// However, the preservation approach doesn't work because it would be moving to a route with the same name.
|
|
119
|
+
// The next check will see if the current focused route has the same name as the next route, if so, then fallback on
|
|
120
|
+
// the default React Navigation logic.
|
|
121
|
+
if (
|
|
122
|
+
findTopRouteForTarget(
|
|
123
|
+
// @ts-expect-error: stale types don't matter here
|
|
124
|
+
rootState
|
|
125
|
+
)?.name !== nextRoute.name
|
|
126
|
+
) {
|
|
115
127
|
if (event === "REPLACE") {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
} else {
|
|
126
|
-
if (event === "REPLACE") {
|
|
127
|
-
navigationRef.dispatch(
|
|
128
|
-
StackActions.replace(nextRoute.name, nextRoute.params)
|
|
129
|
-
);
|
|
128
|
+
if (knownOwnerState.type === "tab") {
|
|
129
|
+
navigationRef.dispatch(
|
|
130
|
+
TabActions.jumpTo(nextRoute.name, nextRoute.params)
|
|
131
|
+
);
|
|
132
|
+
} else {
|
|
133
|
+
navigationRef.dispatch(
|
|
134
|
+
StackActions.replace(nextRoute.name, nextRoute.params)
|
|
135
|
+
);
|
|
136
|
+
}
|
|
130
137
|
} else {
|
|
131
138
|
// NOTE: Not sure if we should pop or push here...
|
|
132
139
|
navigationRef.dispatch(
|
package/src/hooks.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
useStoreRouteInfo,
|
|
12
12
|
} from "./global-state/router-store";
|
|
13
13
|
import { Router } from "./types";
|
|
14
|
+
import { useDeprecated } from "./useDeprecated";
|
|
14
15
|
|
|
15
16
|
type SearchParams = Record<string, string | string[]>;
|
|
16
17
|
|
|
@@ -28,19 +29,22 @@ export function useRootNavigation() {
|
|
|
28
29
|
|
|
29
30
|
// Wraps useLinkTo to provide an API which is similar to the Link component.
|
|
30
31
|
export function useLink() {
|
|
31
|
-
|
|
32
|
+
useDeprecated("`useLink()` is deprecated in favor of `useRouter()`");
|
|
32
33
|
return useRouter();
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export function useRouter(): Router {
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
return React.useMemo(
|
|
38
|
+
() => ({
|
|
39
|
+
push: store.push,
|
|
40
|
+
back: store.goBack,
|
|
41
|
+
replace: store.replace,
|
|
42
|
+
setParams: store.setParams,
|
|
43
|
+
canGoBack: store.canGoBack,
|
|
44
|
+
// TODO(EvanBacon): add `reload`
|
|
45
|
+
}),
|
|
46
|
+
[]
|
|
47
|
+
);
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
/**
|
package/src/link/href.ts
CHANGED
|
@@ -19,10 +19,8 @@ export const resolveHref = (href: Href): string => {
|
|
|
19
19
|
const { pathname, params } = createQualifiedPathname(path, {
|
|
20
20
|
...href.params,
|
|
21
21
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
(Object.keys(params).length ? `?${createQueryParams(params)}` : "")
|
|
25
|
-
);
|
|
22
|
+
const paramsString = createQueryParams(params);
|
|
23
|
+
return pathname + (paramsString ? `?${paramsString}` : "");
|
|
26
24
|
};
|
|
27
25
|
|
|
28
26
|
function createQualifiedPathname(
|
|
@@ -54,7 +52,11 @@ function encodeParam(param: any): string {
|
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
function createQueryParams(params: Record<string, any>): string {
|
|
57
|
-
return
|
|
58
|
-
.
|
|
59
|
-
|
|
55
|
+
return (
|
|
56
|
+
Object.entries(params)
|
|
57
|
+
// Allow nullish params
|
|
58
|
+
.filter(([, value]) => value != null)
|
|
59
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(value.toString())}`)
|
|
60
|
+
.join("&")
|
|
61
|
+
);
|
|
60
62
|
}
|
package/src/onboard/Tutorial.tsx
CHANGED
|
@@ -11,8 +11,8 @@ function Header() {
|
|
|
11
11
|
<Pressable>
|
|
12
12
|
{({ hovered }) => (
|
|
13
13
|
<Text
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
role="heading"
|
|
15
|
+
aria-level={1}
|
|
16
16
|
style={[styles.title, Platform.OS !== "web" && { textAlign: "left" }]}
|
|
17
17
|
>
|
|
18
18
|
Welcome to{" "}
|
|
@@ -62,11 +62,7 @@ export function Tutorial() {
|
|
|
62
62
|
<SafeAreaView style={styles.safeArea}>
|
|
63
63
|
<View style={styles.container}>
|
|
64
64
|
<Header />
|
|
65
|
-
<Text
|
|
66
|
-
accessibilityRole="header"
|
|
67
|
-
accessibilityLevel={2}
|
|
68
|
-
style={styles.subtitle}
|
|
69
|
-
>
|
|
65
|
+
<Text role="heading" aria-level={2} style={styles.subtitle}>
|
|
70
66
|
Start by creating a file{"\n"}in the{" "}
|
|
71
67
|
<Text style={{ fontWeight: "bold" }}>{getRootDir()}</Text>{" "}
|
|
72
68
|
directory.
|
|
@@ -122,10 +118,7 @@ function Button() {
|
|
|
122
118
|
},
|
|
123
119
|
]}
|
|
124
120
|
>
|
|
125
|
-
<Text
|
|
126
|
-
selectable={false}
|
|
127
|
-
style={[styles.code, hovered && { color: "black" }]}
|
|
128
|
-
>
|
|
121
|
+
<Text style={[styles.code, hovered && { color: "black" }]}>
|
|
129
122
|
<Text style={{ color: "#BCC3CD" }}>$</Text> touch {getRootDir()}
|
|
130
123
|
/index.js
|
|
131
124
|
</Text>
|
|
@@ -179,6 +172,7 @@ const styles = StyleSheet.create({
|
|
|
179
172
|
color: "black",
|
|
180
173
|
},
|
|
181
174
|
code: {
|
|
175
|
+
userSelect: "none",
|
|
182
176
|
fontSize: 18,
|
|
183
177
|
transitionDuration: "200ms",
|
|
184
178
|
fontWeight: "bold",
|
package/src/static/html.tsx
CHANGED
|
@@ -14,7 +14,7 @@ export function ScrollViewStyleReset() {
|
|
|
14
14
|
<style
|
|
15
15
|
id="expo-reset"
|
|
16
16
|
dangerouslySetInnerHTML={{
|
|
17
|
-
__html: `#root,body,html{height:100%}
|
|
17
|
+
__html: `#root,body{display:flex}#root,body,html{width:100%;-webkit-overflow-scrolling:touch;margin:0;padding:0;min-height:100%}#root{flex-shrink:0;flex-basis:auto;flex-grow:1;flex:1}html{scroll-behavior:smooth;-webkit-text-size-adjust:100%;height:calc(100% + env(safe-area-inset-top))}body{overflow-y:auto;overscroll-behavior-y:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-ms-overflow-style:scrollbar}`,
|
|
18
18
|
}}
|
|
19
19
|
/>
|
|
20
20
|
);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useLayoutEffect } from "react";
|
|
2
|
+
import { Platform } from "react-native";
|
|
3
|
+
|
|
4
|
+
// Node environment may render in multiple processes causing the warning to log mutiple times
|
|
5
|
+
// Hence we skip the warning in these environments.
|
|
6
|
+
const canWarn = Platform.select({
|
|
7
|
+
native: process.env.NODE_ENV !== "production",
|
|
8
|
+
default:
|
|
9
|
+
process.env.NODE_ENV !== "production" && typeof window !== "undefined",
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const warned = new Set<string>();
|
|
13
|
+
|
|
14
|
+
export function useWarnOnce(
|
|
15
|
+
message: string,
|
|
16
|
+
guard: unknown = true,
|
|
17
|
+
key = message
|
|
18
|
+
) {
|
|
19
|
+
// useLayoutEffect typically doesn't run in node environments.
|
|
20
|
+
// Combined with skipWarn, this should prevent unwanted warnings
|
|
21
|
+
useLayoutEffect(() => {
|
|
22
|
+
if (guard && canWarn && !warned.has(key)) {
|
|
23
|
+
warned.add(key);
|
|
24
|
+
console.warn(message);
|
|
25
|
+
}
|
|
26
|
+
}, [guard]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function useDeprecated(
|
|
30
|
+
message: string,
|
|
31
|
+
guard: unknown = true,
|
|
32
|
+
key = message
|
|
33
|
+
) {
|
|
34
|
+
return useWarnOnce(key, guard, `Expo Router: ${message}`);
|
|
35
|
+
}
|
|
@@ -62,11 +62,7 @@ export function ErrorBoundary({ error, retry }: ErrorBoundaryProps) {
|
|
|
62
62
|
alignItems: "center",
|
|
63
63
|
}}
|
|
64
64
|
>
|
|
65
|
-
<Text
|
|
66
|
-
accessibilityRole="header"
|
|
67
|
-
accessibilityLevel={1}
|
|
68
|
-
style={styles.title}
|
|
69
|
-
>
|
|
65
|
+
<Text role="heading" aria-level={1} style={styles.title}>
|
|
70
66
|
Something went wrong
|
|
71
67
|
</Text>
|
|
72
68
|
</View>
|
package/src/views/Screen.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
+
import { useDeprecated } from "../useDeprecated";
|
|
3
4
|
import { useNavigation } from "../useNavigation";
|
|
4
5
|
|
|
5
6
|
export type ScreenProps<
|
|
@@ -33,9 +34,24 @@ export function Screen<TOptions extends object = object>({
|
|
|
33
34
|
const navigation = useNavigation(name);
|
|
34
35
|
|
|
35
36
|
useLayoutEffect(() => {
|
|
36
|
-
|
|
37
|
+
if (
|
|
38
|
+
options &&
|
|
39
|
+
// React Navigation will infinitely loop in some cases if an empty object is passed to setOptions.
|
|
40
|
+
// https://github.com/expo/router/issues/452
|
|
41
|
+
Object.keys(options).length
|
|
42
|
+
) {
|
|
43
|
+
navigation.setOptions(options);
|
|
44
|
+
}
|
|
37
45
|
}, [navigation, options]);
|
|
38
46
|
|
|
47
|
+
if (process.env.NODE_ENV === "development") {
|
|
48
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
49
|
+
useDeprecated(
|
|
50
|
+
"The `redirect` prop on <Screen /> is deprecated and will be removed. Please use `router.redirect` instead",
|
|
51
|
+
redirect
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
39
55
|
if (process.env.NODE_ENV !== "production") {
|
|
40
56
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
41
57
|
React.useEffect(() => {
|
package/src/views/Sitemap.tsx
CHANGED
package/src/views/Splash.tsx
CHANGED
|
@@ -3,6 +3,8 @@ import { nanoid } from "nanoid/non-secure";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Platform } from "react-native";
|
|
5
5
|
|
|
6
|
+
import { useDeprecated } from "../useDeprecated";
|
|
7
|
+
|
|
6
8
|
const globalStack: string[] = [];
|
|
7
9
|
|
|
8
10
|
/**
|
|
@@ -25,11 +27,9 @@ const globalStack: string[] = [];
|
|
|
25
27
|
*/
|
|
26
28
|
export function SplashScreen() {
|
|
27
29
|
useGlobalSplash();
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
);
|
|
32
|
-
}, []);
|
|
30
|
+
useDeprecated(
|
|
31
|
+
"The <SplashScreen /> component is deprecated. Use `SplashScreen.preventAutoHideAsync()` and `SplashScreen.hideAsync` from `expo-router` instead."
|
|
32
|
+
);
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
35
35
|
|
package/src/views/Unmatched.tsx
CHANGED
|
@@ -37,18 +37,10 @@ export function Unmatched() {
|
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
39
|
<View style={styles.container}>
|
|
40
|
-
<Text
|
|
41
|
-
accessibilityRole="header"
|
|
42
|
-
accessibilityLevel={1}
|
|
43
|
-
style={styles.title}
|
|
44
|
-
>
|
|
40
|
+
<Text role="heading" aria-level={1} style={styles.title}>
|
|
45
41
|
Unmatched Route
|
|
46
42
|
</Text>
|
|
47
|
-
<Text
|
|
48
|
-
accessibilityRole="header"
|
|
49
|
-
accessibilityLevel={2}
|
|
50
|
-
style={styles.subtitle}
|
|
51
|
-
>
|
|
43
|
+
<Text role="heading" aria-level={2} style={styles.subtitle}>
|
|
52
44
|
Page could not be found.{" "}
|
|
53
45
|
<Text
|
|
54
46
|
onPress={() => {
|