expo-router 1.7.0 → 1.7.1
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.plugin.js +1 -0
- package/babel.js +1 -1
- package/build/navigationStore/index.d.ts.map +1 -1
- package/package.json +5 -2
- package/plugin/build/index.d.ts +12 -0
- package/plugin/build/index.js +18 -0
- package/plugin/options.json +48 -0
- package/plugin/src/index.ts +30 -0
- package/plugin/tsconfig.json +9 -0
- package/src/navigationStore/index.ts +10 -2
package/app.plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./plugin/build");
|
package/babel.js
CHANGED
|
@@ -41,7 +41,7 @@ function getExpoRouterImportMode(projectRoot, platform) {
|
|
|
41
41
|
|
|
42
42
|
if (env === "production" && mode === "lazy") {
|
|
43
43
|
throw new Error(
|
|
44
|
-
"Async routes are not supported in production yet. Set `
|
|
44
|
+
"Async routes are not supported in production yet. Set the `expo-router` Config Plugin prop `asyncRoutes` to `development`, `false`, or `undefined`."
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigationStore/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigationStore/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EAIb,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,gBAEN,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;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sB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAOrC;AAED,wBAAgB,YAAY,cAO3B;AAED,wBAAgB,WAAW,aAE1B;AAED,wBAAgB,WAAW,WAE1B;AAED,wBAAgB,eAAe,iBAE9B;AAED,wBAAgB,oBAAoB,CAClC,OAAO,SAAS,YAAY,GAAG,YAAY,KACxC,OAAO,CAAC,OAAO,CAAC,CAEpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-router",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"main": "src/index.tsx",
|
|
5
5
|
"types": "build/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"stack.ts",
|
|
22
22
|
"tabs.ts",
|
|
23
23
|
"types",
|
|
24
|
+
"plugin",
|
|
25
|
+
"app.plugin.js",
|
|
24
26
|
"!**/__tests__"
|
|
25
27
|
],
|
|
26
28
|
"repository": {
|
|
@@ -101,10 +103,11 @@
|
|
|
101
103
|
"@react-navigation/bottom-tabs": "~6.5.7",
|
|
102
104
|
"@react-navigation/native": "~6.1.6",
|
|
103
105
|
"@react-navigation/native-stack": "~6.9.12",
|
|
104
|
-
"expo-head": "0.0.
|
|
106
|
+
"expo-head": "0.0.2",
|
|
105
107
|
"expo-splash-screen": "*",
|
|
106
108
|
"query-string": "7.1.3",
|
|
107
109
|
"react-helmet-async": "^1.3.0",
|
|
110
|
+
"schema-utils": "^4.0.1",
|
|
108
111
|
"url": "^0.11.0"
|
|
109
112
|
}
|
|
110
113
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
+
declare const withRouter: ConfigPlugin<{
|
|
3
|
+
/** Production origin URL where assets in the public folder are hosted. The fetch function is polyfilled to support relative requests from this origin in production, development origin is inferred using the Expo CLI development server. */
|
|
4
|
+
origin: string;
|
|
5
|
+
/** A more specific origin URL used in the `expo-router/head` module for iOS handoff. Defaults to `origin`. */
|
|
6
|
+
headOrigin?: string;
|
|
7
|
+
/** Changes the routes directory from `app` to another value. Defaults to `app`. Avoid using this property. */
|
|
8
|
+
unstable_src?: string;
|
|
9
|
+
/** Should Async Routes be enabled, currently only `development` is supported. */
|
|
10
|
+
asyncRoutes?: string;
|
|
11
|
+
}>;
|
|
12
|
+
export default withRouter;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const schema_utils_1 = require("schema-utils");
|
|
4
|
+
const schema = require("../options.json");
|
|
5
|
+
const withRouter = (config, props) => {
|
|
6
|
+
(0, schema_utils_1.validate)(schema, props);
|
|
7
|
+
return {
|
|
8
|
+
...config,
|
|
9
|
+
extra: {
|
|
10
|
+
...config.extra,
|
|
11
|
+
router: {
|
|
12
|
+
...config.extra?.router,
|
|
13
|
+
...props,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
exports.default = withRouter;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "expo-router config plugin options",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"$ref": "#/definitions/Props",
|
|
5
|
+
"definitions": {
|
|
6
|
+
"Props": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"origin": {
|
|
10
|
+
"description": "Production origin URL where assets in the public folder are hosted. The fetch function is polyfilled to support relative requests from this origin in production, development origin is inferred using the Expo CLI development server.",
|
|
11
|
+
"oneOf": [
|
|
12
|
+
{
|
|
13
|
+
"type": "string"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"type": "boolean"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"headOrigin": {
|
|
21
|
+
"description": "A more specific origin URL used in the `expo-router/head` module for iOS handoff. Defaults to `origin`.",
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"unstable_src": {
|
|
25
|
+
"description": "Changes the routes directory from `app` to another value. Defaults to `app`. Avoid using this property.",
|
|
26
|
+
"type": "string"
|
|
27
|
+
},
|
|
28
|
+
"asyncRoutes": {
|
|
29
|
+
"description": "Should Async Routes be enabled, currently only `development` is supported.",
|
|
30
|
+
"oneOf": [
|
|
31
|
+
{
|
|
32
|
+
"type": "string",
|
|
33
|
+
"enum": [
|
|
34
|
+
"development",
|
|
35
|
+
"production"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"type": "boolean"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"required": ["origin"],
|
|
45
|
+
"additionalProperties": false
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
+
import { validate } from "schema-utils";
|
|
3
|
+
|
|
4
|
+
const schema = require("../options.json");
|
|
5
|
+
|
|
6
|
+
const withRouter: ConfigPlugin<{
|
|
7
|
+
/** Production origin URL where assets in the public folder are hosted. The fetch function is polyfilled to support relative requests from this origin in production, development origin is inferred using the Expo CLI development server. */
|
|
8
|
+
origin: string;
|
|
9
|
+
/** A more specific origin URL used in the `expo-router/head` module for iOS handoff. Defaults to `origin`. */
|
|
10
|
+
headOrigin?: string;
|
|
11
|
+
/** Changes the routes directory from `app` to another value. Defaults to `app`. Avoid using this property. */
|
|
12
|
+
unstable_src?: string;
|
|
13
|
+
/** Should Async Routes be enabled, currently only `development` is supported. */
|
|
14
|
+
asyncRoutes?: string;
|
|
15
|
+
}> = (config, props) => {
|
|
16
|
+
validate(schema, props);
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
...config,
|
|
20
|
+
extra: {
|
|
21
|
+
...config.extra,
|
|
22
|
+
router: {
|
|
23
|
+
...config.extra?.router,
|
|
24
|
+
...props,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default withRouter;
|
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
ParamListBase,
|
|
5
5
|
PartialState,
|
|
6
6
|
createNavigationContainerRef,
|
|
7
|
-
|
|
7
|
+
NavigationRouteContext,
|
|
8
|
+
RouteProp,
|
|
8
9
|
} from "@react-navigation/native";
|
|
9
10
|
import React from "react";
|
|
10
11
|
|
|
@@ -211,5 +212,12 @@ export function useSearchParams() {
|
|
|
211
212
|
export function useLocalSearchParams<
|
|
212
213
|
TParams extends SearchParams = SearchParams
|
|
213
214
|
>(): Partial<TParams> {
|
|
214
|
-
return (
|
|
215
|
+
return (useOptionalLocalRoute()?.params ?? ({} as any)) as Partial<TParams>;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function useOptionalLocalRoute<T extends RouteProp<ParamListBase>>():
|
|
219
|
+
| T
|
|
220
|
+
| undefined {
|
|
221
|
+
const route = React.useContext(NavigationRouteContext);
|
|
222
|
+
return route as T | undefined;
|
|
215
223
|
}
|