expo-router 7.0.0-canary-20251206-615dec1 → 7.0.0-canary-20251210-1f163e3
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/android/build.gradle +2 -2
- package/build/ExpoRoot.d.ts.map +1 -1
- package/build/ExpoRoot.js +2 -1
- package/build/ExpoRoot.js.map +1 -1
- package/build/color/android.dynamic.types.d.ts +3 -3
- package/build/color/android.dynamic.types.js.map +1 -1
- package/build/color/android.material.types.d.ts +3 -3
- package/build/color/android.material.types.js.map +1 -1
- package/build/fork/getPathFromState.d.ts.map +1 -1
- package/build/fork/getPathFromState.js +2 -1
- package/build/fork/getPathFromState.js.map +1 -1
- package/build/fork/getStateFromPath-forks.d.ts.map +1 -1
- package/build/fork/getStateFromPath-forks.js +3 -7
- package/build/fork/getStateFromPath-forks.js.map +1 -1
- package/build/link/Link.d.ts +2 -0
- package/build/link/Link.d.ts.map +1 -1
- package/build/link/Link.js +2 -0
- package/build/link/Link.js.map +1 -1
- package/build/link/elements.d.ts +15 -4
- package/build/link/elements.d.ts.map +1 -1
- package/build/link/elements.js +7 -2
- package/build/link/elements.js.map +1 -1
- package/build/link/preview/native.d.ts +5 -1
- package/build/link/preview/native.d.ts.map +1 -1
- package/build/link/preview/native.js +12 -1
- package/build/link/preview/native.js.map +1 -1
- package/build/link/useLinkHooks.d.ts +1 -1
- package/build/link/zoom/link-apple-zoom-target.d.ts +3 -0
- package/build/link/zoom/link-apple-zoom-target.d.ts.map +1 -0
- package/build/link/zoom/link-apple-zoom-target.js +20 -0
- package/build/link/zoom/link-apple-zoom-target.js.map +1 -0
- package/build/link/zoom/useZoomTransitionPrimitives.ios.d.ts.map +1 -1
- package/build/link/zoom/useZoomTransitionPrimitives.ios.js +4 -1
- package/build/link/zoom/useZoomTransitionPrimitives.ios.js.map +1 -1
- package/build/link/zoom/zoom-transition-context.d.ts +7 -0
- package/build/link/zoom/zoom-transition-context.d.ts.map +1 -1
- package/build/link/zoom/zoom-transition-context.js +32 -1
- package/build/link/zoom/zoom-transition-context.js.map +1 -1
- package/build/loaders/utils.d.ts.map +1 -1
- package/build/loaders/utils.js +2 -1
- package/build/loaders/utils.js.map +1 -1
- package/build/native-tabs/NativeTabTrigger.d.ts +1 -1
- package/build/native-tabs/NativeTabTrigger.d.ts.map +1 -1
- package/build/native-tabs/NativeTabTrigger.js +5 -6
- package/build/native-tabs/NativeTabTrigger.js.map +1 -1
- package/build/native-tabs/NativeTabsView.web.js +1 -1
- package/build/native-tabs/NativeTabsView.web.js.map +1 -1
- package/build/typed-routes/types.d.ts +4 -1
- package/build/typed-routes/types.d.ts.map +1 -1
- package/build/typed-routes/types.js.map +1 -1
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +6 -3
- package/build/useScreens.js.map +1 -1
- package/build/utils/url.d.ts +1 -0
- package/build/utils/url.d.ts.map +1 -1
- package/build/utils/url.js +9 -0
- package/build/utils/url.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/LinkPreview/LinkPreviewNativeActionView.swift +1 -1
- package/ios/LinkPreview/LinkPreviewNativeModule.swift +11 -0
- package/ios/LinkPreview/LinkZoomTransition.swift +126 -15
- package/ios/Toolbar/RouterToolbarHostView.swift +5 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1.module → 7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3.module} +7 -7
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3.module.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1.pom → 7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3.pom} +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha512 +1 -1
- package/package.json +10 -10
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1.module.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1.pom.sha512 +0 -1
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1-sources.jar → 7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3-sources.jar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1-sources.jar.md5 → 7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3-sources.jar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1-sources.jar.sha1 → 7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3-sources.jar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1-sources.jar.sha256 → 7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3-sources.jar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1-sources.jar.sha512 → 7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3-sources.jar.sha512} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1.aar → 7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3.aar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1.aar.md5 → 7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3.aar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1.aar.sha1 → 7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3.aar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1.aar.sha256 → 7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3.aar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251206-615dec1/expo.modules.router-7.0.0-canary-20251206-615dec1.aar.sha512 → 7.0.0-canary-20251210-1f163e3/expo.modules.router-7.0.0-canary-20251210-1f163e3.aar.sha512} +0 -0
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
'use client';
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZoomTransitionSourceContext = void 0;
|
|
4
|
+
exports.ZoomTransitionTargetContext = exports.ZoomTransitionSourceContext = void 0;
|
|
5
|
+
exports.ZoomTransitionTargetContextProvider = ZoomTransitionTargetContextProvider;
|
|
4
6
|
const react_1 = require("react");
|
|
7
|
+
const ZoomTransitionEnabler_ios_1 = require("./ZoomTransitionEnabler.ios");
|
|
8
|
+
const navigationParams_1 = require("../../navigationParams");
|
|
9
|
+
const PreviewRouteContext_1 = require("../preview/PreviewRouteContext");
|
|
5
10
|
exports.ZoomTransitionSourceContext = (0, react_1.createContext)(undefined);
|
|
11
|
+
exports.ZoomTransitionTargetContext = (0, react_1.createContext)({
|
|
12
|
+
identifier: null,
|
|
13
|
+
});
|
|
14
|
+
function ZoomTransitionTargetContextProvider({ route, children, }) {
|
|
15
|
+
const isPreview = (0, PreviewRouteContext_1.useIsPreview)();
|
|
16
|
+
if ((0, ZoomTransitionEnabler_ios_1.isZoomTransitionEnabled)() &&
|
|
17
|
+
!isPreview &&
|
|
18
|
+
route &&
|
|
19
|
+
typeof route === 'object' &&
|
|
20
|
+
'params' in route &&
|
|
21
|
+
typeof route.params === 'object' &&
|
|
22
|
+
'key' in route &&
|
|
23
|
+
typeof route.key === 'string') {
|
|
24
|
+
const params = route.params ?? {};
|
|
25
|
+
const internalParams = (0, navigationParams_1.getInternalExpoRouterParams)(params);
|
|
26
|
+
const zoomTransitionId = internalParams[navigationParams_1.INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME];
|
|
27
|
+
const zoomTransitionScreenId = internalParams[navigationParams_1.INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME];
|
|
28
|
+
const hasZoomTransition = !!zoomTransitionId && zoomTransitionScreenId === route.key;
|
|
29
|
+
if (hasZoomTransition && typeof zoomTransitionId === 'string') {
|
|
30
|
+
return (<exports.ZoomTransitionTargetContext value={{ identifier: zoomTransitionId }}>
|
|
31
|
+
{children}
|
|
32
|
+
</exports.ZoomTransitionTargetContext>);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return children;
|
|
36
|
+
}
|
|
6
37
|
//# sourceMappingURL=zoom-transition-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zoom-transition-context.js","sourceRoot":"","sources":["../../../src/link/zoom/zoom-transition-context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zoom-transition-context.js","sourceRoot":"","sources":["../../../src/link/zoom/zoom-transition-context.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AA2Bb,kFA+BC;AAxDD,iCAA8D;AAE9D,2EAAsE;AACtE,6DAIgC;AAChC,wEAA8D;AAUjD,QAAA,2BAA2B,GACtC,IAAA,qBAAa,EAAuC,SAAS,CAAC,CAAC;AAEpD,QAAA,2BAA2B,GAAG,IAAA,qBAAa,EAAgC;IACtF,UAAU,EAAE,IAAI;CACjB,CAAC,CAAC;AAEH,SAAgB,mCAAmC,CAAC,EAClD,KAAK,EACL,QAAQ,GAC8B;IACtC,MAAM,SAAS,GAAG,IAAA,kCAAY,GAAE,CAAC;IACjC,IACE,IAAA,mDAAuB,GAAE;QACzB,CAAC,SAAS;QACV,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,QAAQ,IAAI,KAAK;QACjB,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;QAChC,KAAK,IAAI,KAAK;QACd,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,EAC7B,CAAC;QACD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC;QAClC,MAAM,cAAc,GAAG,IAAA,8CAA2B,EAAC,MAAM,CAAC,CAAC;QAC3D,MAAM,gBAAgB,GACpB,cAAc,CAAC,4EAAyD,CAAC,CAAC;QAC5E,MAAM,sBAAsB,GAC1B,cAAc,CAAC,4EAAyD,CAAC,CAAC;QAC5E,MAAM,iBAAiB,GAAG,CAAC,CAAC,gBAAgB,IAAI,sBAAsB,KAAK,KAAK,CAAC,GAAG,CAAC;QACrF,IAAI,iBAAiB,IAAI,OAAO,gBAAgB,KAAK,QAAQ,EAAE,CAAC;YAC9D,OAAO,CACL,CAAC,mCAA2B,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC,CACnE;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,mCAA2B,CAAC,CAC/B,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["'use client';\n\nimport { createContext, type PropsWithChildren } from 'react';\n\nimport { isZoomTransitionEnabled } from './ZoomTransitionEnabler.ios';\nimport {\n getInternalExpoRouterParams,\n INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME,\n INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME,\n} from '../../navigationParams';\nimport { useIsPreview } from '../preview/PreviewRouteContext';\n\nexport type ZoomTransitionSourceContextValueType =\n | {\n identifier: string;\n addSource: () => void;\n removeSource: () => void;\n }\n | undefined;\n\nexport const ZoomTransitionSourceContext =\n createContext<ZoomTransitionSourceContextValueType>(undefined);\n\nexport const ZoomTransitionTargetContext = createContext<{ identifier: string | null }>({\n identifier: null,\n});\n\nexport function ZoomTransitionTargetContextProvider({\n route,\n children,\n}: PropsWithChildren<{ route: unknown }>) {\n const isPreview = useIsPreview();\n if (\n isZoomTransitionEnabled() &&\n !isPreview &&\n route &&\n typeof route === 'object' &&\n 'params' in route &&\n typeof route.params === 'object' &&\n 'key' in route &&\n typeof route.key === 'string'\n ) {\n const params = route.params ?? {};\n const internalParams = getInternalExpoRouterParams(params);\n const zoomTransitionId =\n internalParams[INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME];\n const zoomTransitionScreenId =\n internalParams[INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME];\n const hasZoomTransition = !!zoomTransitionId && zoomTransitionScreenId === route.key;\n if (hasZoomTransition && typeof zoomTransitionId === 'string') {\n return (\n <ZoomTransitionTargetContext value={{ identifier: zoomTransitionId }}>\n {children}\n </ZoomTransitionTargetContext>\n );\n }\n }\n return children;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/loaders/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/loaders/utils.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM5D;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAiBvE"}
|
package/build/loaders/utils.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getLoaderModulePath = getLoaderModulePath;
|
|
4
4
|
exports.fetchLoaderModule = fetchLoaderModule;
|
|
5
|
+
const url_1 = require("../utils/url");
|
|
5
6
|
/**
|
|
6
7
|
* Convert a route's pathname to a loader module path.
|
|
7
8
|
*
|
|
@@ -11,7 +12,7 @@ exports.fetchLoaderModule = fetchLoaderModule;
|
|
|
11
12
|
* getLoaderModulePath(`/posts/1`) // `/_expo/loaders/posts/1`
|
|
12
13
|
*/
|
|
13
14
|
function getLoaderModulePath(pathname) {
|
|
14
|
-
const urlPath =
|
|
15
|
+
const urlPath = (0, url_1.parseUrlUsingCustomBase)(pathname).pathname;
|
|
15
16
|
const normalizedPath = urlPath === '/' ? '/' : urlPath.replace(/\/$/, '');
|
|
16
17
|
const pathSegment = normalizedPath === '/' ? '/index' : normalizedPath;
|
|
17
18
|
return `/_expo/loaders${pathSegment}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/loaders/utils.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/loaders/utils.ts"],"names":[],"mappings":";;AAUA,kDAMC;AASD,8CAiBC;AA1CD,sCAAuD;AAEvD;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAAC,QAAgB;IAClD,MAAM,OAAO,GAAG,IAAA,6BAAuB,EAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;IAC3D,MAAM,cAAc,GAAG,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1E,MAAM,WAAW,GAAG,cAAc,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC;IAEvE,OAAO,iBAAiB,WAAW,EAAE,CAAC;AACxC,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CAAC,SAAiB;IACvD,MAAM,UAAU,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAElD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE;QACvC,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;SAC3B;KACF,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,gCAAgC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC","sourcesContent":["import { parseUrlUsingCustomBase } from '../utils/url';\n\n/**\n * Convert a route's pathname to a loader module path.\n *\n * @example\n * getLoaderModulePath(`/`); // `/_expo/loaders/index`\n * getLoaderModulePath(`/about`) // `/_expo/loaders/about`\n * getLoaderModulePath(`/posts/1`) // `/_expo/loaders/posts/1`\n */\nexport function getLoaderModulePath(pathname: string): string {\n const urlPath = parseUrlUsingCustomBase(pathname).pathname;\n const normalizedPath = urlPath === '/' ? '/' : urlPath.replace(/\\/$/, '');\n const pathSegment = normalizedPath === '/' ? '/index' : normalizedPath;\n\n return `/_expo/loaders${pathSegment}`;\n}\n\n/**\n * Fetches and parses a loader module from the given route path.\n * This works in all environments including:\n * 1. Development with Metro dev server (see `LoaderModuleMiddleware`)\n * 2. Production with static files (SSG)\n * 3. SSR environments\n */\nexport async function fetchLoaderModule(routePath: string): Promise<any> {\n const loaderPath = getLoaderModulePath(routePath);\n\n const response = await fetch(loaderPath, {\n headers: {\n Accept: 'application/json',\n },\n });\n if (!response.ok) {\n throw new Error(`Failed to fetch loader data: ${response.status}`);\n }\n\n try {\n return await response.json();\n } catch (error) {\n throw new Error(`Failed to parse loader data: ${error}`);\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
-
import type { NativeTabOptions, NativeTabTriggerProps } from './types';
|
|
3
2
|
import { type NativeTabsTriggerBadgeProps, type NativeTabsTriggerLabelProps, type NativeTabsTriggerIconProps } from './common/elements';
|
|
3
|
+
import type { NativeTabOptions, NativeTabTriggerProps } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* The component used to customize the native tab options both in the _layout file and from the tab screen.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTabTrigger.d.ts","sourceRoot":"","sources":["../../src/native-tabs/NativeTabTrigger.tsx"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"NativeTabTrigger.d.ts","sourceRoot":"","sources":["../../src/native-tabs/NativeTabTrigger.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA+B,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAKL,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAEhC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAOvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,iBAAS,oBAAoB,CAAC,KAAK,EAAE,qBAAqB,QAuBzD;AAED,eAAO,MAAM,gBAAgB;;;;;CAK3B,CAAC;AAEH,wBAAgB,wBAAwB,CACtC,EACE,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,6BAA6B,EAC7B,YAAY,GACb,EAAE,qBAAqB,EACxB,SAAS,GAAE,OAAe,oBAqC3B;AAyBD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,0BAA0B,QA8C7F;AA+BD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,KAAK,IAAI,YAAY,CAAC,qBAAqB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CA6BjE"}
|
|
@@ -8,9 +8,9 @@ exports.isNativeTabTrigger = isNativeTabTrigger;
|
|
|
8
8
|
const native_1 = require("@react-navigation/native");
|
|
9
9
|
const react_1 = require("react");
|
|
10
10
|
const react_native_1 = require("react-native");
|
|
11
|
-
const PreviewRouteContext_1 = require("../link/preview/PreviewRouteContext");
|
|
12
|
-
const useSafeLayoutEffect_1 = require("../views/useSafeLayoutEffect");
|
|
13
11
|
const elements_1 = require("./common/elements");
|
|
12
|
+
const PreviewRouteContext_1 = require("../link/preview/PreviewRouteContext");
|
|
13
|
+
const useFocusEffect_1 = require("../useFocusEffect");
|
|
14
14
|
const children_1 = require("../utils/children");
|
|
15
15
|
const icon_1 = require("./utils/icon");
|
|
16
16
|
const materialIconConverter_1 = require("./utils/materialIconConverter");
|
|
@@ -57,20 +57,19 @@ const materialIconConverter_1 = require("./utils/materialIconConverter");
|
|
|
57
57
|
function NativeTabTriggerImpl(props) {
|
|
58
58
|
const route = (0, native_1.useRoute)();
|
|
59
59
|
const navigation = (0, native_1.useNavigation)();
|
|
60
|
-
const isFocused = navigation.isFocused();
|
|
61
60
|
const isInPreview = (0, PreviewRouteContext_1.useIsPreview)();
|
|
62
|
-
(0,
|
|
61
|
+
(0, useFocusEffect_1.useFocusEffect)((0, react_1.useCallback)(() => {
|
|
63
62
|
// This will cause the tab to update only when it is focused.
|
|
64
63
|
// As long as all tabs are loaded at the start, we don't need this check.
|
|
65
64
|
// It is here to ensure similar behavior to stack
|
|
66
|
-
if (
|
|
65
|
+
if (!isInPreview) {
|
|
67
66
|
if (navigation.getState()?.type !== 'tab') {
|
|
68
67
|
throw new Error(`Trigger component can only be used in the tab screen. Current route: ${route.name}`);
|
|
69
68
|
}
|
|
70
69
|
const options = convertTabPropsToOptions(props, true);
|
|
71
70
|
navigation.setOptions(options);
|
|
72
71
|
}
|
|
73
|
-
}, [
|
|
72
|
+
}, [props, isInPreview]));
|
|
74
73
|
return null;
|
|
75
74
|
}
|
|
76
75
|
exports.NativeTabTrigger = Object.assign(NativeTabTriggerImpl, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTabTrigger.js","sourceRoot":"","sources":["../../src/native-tabs/NativeTabTrigger.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AA8Fb,4DAgDC;AAyBD,8CA8CC;AA+BD,gDAgCC;AAlRD,qDAAmE;AACnE,iCAA0E;AAC1E,+CAAoE;AAGpE,6EAAmE;AACnE,sEAAmE;AACnE,gDAS2B;AAC3B,gDAAiF;AACjF,uCAAgE;AAChE,yEAAqF;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,SAAS,oBAAoB,CAAC,KAA4B;IACxD,MAAM,KAA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A8E,CAChJ,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;YAC1C,IACE,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,IAAI,CAChC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,GAAG,IAAI,KAAK,CAAC,KAAK,CAC9E,EACD,CAAC;gBACD,MAAM,IAAI,KAAK,CACb,uDAAuD,UAAU,0GAA0G,CAC5K,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["'use client';\n\nimport { useNavigation, useRoute } from '@react-navigation/native';\nimport { isValidElement, type ReactElement, type ReactNode } from 'react';\nimport { StyleSheet, type ImageSourcePropType } from 'react-native';\n\nimport type { NativeTabOptions, NativeTabTriggerProps } from './types';\nimport { useIsPreview } from '../link/preview/PreviewRouteContext';\nimport { useSafeLayoutEffect } from '../views/useSafeLayoutEffect';\nimport {\n NativeTabsTriggerIcon,\n NativeTabsTriggerBadge,\n NativeTabsTriggerLabel,\n NativeTabsTriggerVectorIcon,\n type NativeTabsTriggerBadgeProps,\n type NativeTabsTriggerLabelProps,\n type NativeTabsTriggerIconProps,\n type SrcIcon,\n} from './common/elements';\nimport { filterAllowedChildrenElements, isChildOfType } from '../utils/children';\nimport { convertComponentSrcToImageSource } from './utils/icon';\nimport { convertMaterialIconNameToImageSource } from './utils/materialIconConverter';\n\n/**\n * The component used to customize the native tab options both in the _layout file and from the tab screen.\n *\n * When used in the _layout file, you need to provide a `name` prop.\n * When used in the tab screen, the `name` prop takes no effect.\n *\n * @example\n * ```tsx\n * // In _layout file\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function Layout() {\n * return (\n * <NativeTabs>\n * <NativeTabs.Trigger name=\"home\" />\n * <NativeTabs.Trigger name=\"settings\" />\n * </NativeTabs>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // In a tab screen\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function HomeScreen() {\n * return (\n * <View>\n * <NativeTabs.Trigger>\n * <NativeTabs.Trigger.Label>Home</NativeTabs.Trigger.Label>\n * </NativeTabs.Trigger>\n * <Text>This is home screen!</Text>\n * </View>\n * );\n * }\n * ```\n *\n * > **Note:** You can use the alias `NativeTabs.Trigger` for this component.\n */\nfunction NativeTabTriggerImpl(props: NativeTabTriggerProps) {\n const route = useRoute();\n const navigation = useNavigation();\n const isFocused = navigation.isFocused();\n const isInPreview = useIsPreview();\n\n useSafeLayoutEffect(() => {\n // This will cause the tab to update only when it is focused.\n // As long as all tabs are loaded at the start, we don't need this check.\n // It is here to ensure similar behavior to stack\n if (isFocused && !isInPreview) {\n if (navigation.getState()?.type !== 'tab') {\n throw new Error(\n `Trigger component can only be used in the tab screen. Current route: ${route.name}`\n );\n }\n const options = convertTabPropsToOptions(props, true);\n navigation.setOptions(options);\n }\n }, [isFocused, props, isInPreview]);\n\n return null;\n}\n\nexport const NativeTabTrigger = Object.assign(NativeTabTriggerImpl, {\n Label: NativeTabsTriggerLabel,\n Icon: NativeTabsTriggerIcon,\n Badge: NativeTabsTriggerBadge,\n VectorIcon: NativeTabsTriggerVectorIcon,\n});\n\nexport function convertTabPropsToOptions(\n {\n hidden,\n children,\n role,\n disablePopToTop,\n disableScrollToTop,\n unstable_nativeProps,\n disableAutomaticContentInsets,\n contentStyle,\n }: NativeTabTriggerProps,\n isDynamic: boolean = false\n) {\n const initialOptions: NativeTabOptions = isDynamic\n ? {\n ...(unstable_nativeProps ? { nativeProps: unstable_nativeProps } : {}),\n }\n : {\n hidden: !!hidden,\n specialEffects: {\n repeatedTabSelection: {\n popToRoot: !disablePopToTop,\n scrollToTop: !disableScrollToTop,\n },\n },\n contentStyle,\n role,\n nativeProps: unstable_nativeProps,\n disableAutomaticContentInsets,\n };\n const allowedChildren = filterAllowedChildrenElements(children, [\n NativeTabsTriggerBadge,\n NativeTabsTriggerLabel,\n NativeTabsTriggerIcon,\n ]);\n return allowedChildren.reduce<NativeTabOptions>(\n (acc, child) => {\n if (isChildOfType(child, NativeTabsTriggerBadge)) {\n appendBadgeOptions(acc, child.props);\n } else if (isChildOfType(child, NativeTabsTriggerLabel)) {\n appendLabelOptions(acc, child.props);\n } else if (isChildOfType(child, NativeTabsTriggerIcon)) {\n appendIconOptions(acc, child.props);\n }\n return acc;\n },\n { ...initialOptions }\n );\n}\n\nfunction appendBadgeOptions(options: NativeTabOptions, props: NativeTabsTriggerBadgeProps) {\n if (props.children) {\n options.badgeValue = String(props.children);\n options.selectedBadgeBackgroundColor = props.selectedBackgroundColor;\n } else if (!props.hidden) {\n // If no value is provided, we set it to a space to show the badge\n // Otherwise, the `react-native-screens` will interpret it as a hidden badge\n // https://github.com/software-mansion/react-native-screens/blob/b4358fd95dd0736fc54df6bb97f210dc89edf24c/ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm#L172\n options.badgeValue = ' ';\n }\n}\n\nfunction appendLabelOptions(options: NativeTabOptions, props: NativeTabsTriggerLabelProps) {\n if (props.hidden) {\n options.title = '';\n } else {\n options.title = props.children;\n if (props.selectedStyle) {\n options.selectedLabelStyle = StyleSheet.flatten(props.selectedStyle);\n }\n }\n}\n\nexport function appendIconOptions(options: NativeTabOptions, props: NativeTabsTriggerIconProps) {\n if ('sf' in props && props.sf && process.env.EXPO_OS === 'ios') {\n if (typeof props.sf === 'string') {\n options.icon = props.sf\n ? {\n sf: props.sf,\n }\n : undefined;\n options.selectedIcon = undefined;\n } else if (props.sf) {\n options.icon = props.sf.default\n ? {\n sf: props.sf.default,\n }\n : undefined;\n options.selectedIcon = props.sf.selected\n ? {\n sf: props.sf.selected,\n }\n : undefined;\n }\n } else if ('drawable' in props && props.drawable && process.env.EXPO_OS === 'android') {\n if ('md' in props) {\n console.warn(\n 'Both `md` and `drawable` props are provided to NativeTabs.Trigger.Icon. `drawable` will take precedence on Android platform.'\n );\n }\n options.icon = { drawable: props.drawable };\n options.selectedIcon = undefined;\n } else if ('md' in props && props.md && process.env.EXPO_OS === 'android') {\n if (process.env.NODE_ENV !== 'production') {\n if ('drawable' in props) {\n console.warn(\n 'Both `md` and `drawable` props are provided to NativeTabs.Trigger.Icon. `drawable` will take precedence on Android platform.'\n );\n }\n }\n options.icon = convertMaterialIconNameToImageSource(props.md);\n } else if ('src' in props && props.src) {\n const icon = convertIconSrcToIconOption(props);\n options.icon = icon?.icon;\n options.selectedIcon = icon?.selectedIcon;\n }\n if (props.selectedColor) {\n options.selectedIconColor = props.selectedColor;\n }\n}\n\nfunction convertIconSrcToIconOption(\n icon: SrcIcon | undefined\n): Pick<NativeTabOptions, 'icon' | 'selectedIcon'> | undefined {\n if (icon && icon.src) {\n const { defaultIcon, selected } =\n typeof icon.src === 'object' && 'selected' in icon.src\n ? { defaultIcon: icon.src.default, selected: icon.src.selected }\n : { defaultIcon: icon.src };\n\n const options: Pick<NativeTabOptions, 'icon' | 'selectedIcon'> = {};\n options.icon = convertSrcOrComponentToSrc(defaultIcon);\n options.selectedIcon = convertSrcOrComponentToSrc(selected);\n return options;\n }\n\n return undefined;\n}\n\nfunction convertSrcOrComponentToSrc(src: ImageSourcePropType | ReactElement | undefined) {\n if (src) {\n if (isValidElement(src)) {\n return convertComponentSrcToImageSource(src);\n } else {\n return { src };\n }\n }\n return undefined;\n}\n\nexport function isNativeTabTrigger(\n child: ReactNode,\n contextKey?: string\n): child is ReactElement<NativeTabTriggerProps & { name: string }> {\n if (isValidElement(child) && child && child.type === NativeTabTrigger) {\n if (\n typeof child.props === 'object' &&\n child.props &&\n 'name' in child.props &&\n !child.props.name\n ) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must have a \\`name\\` prop when used as a child of a Layout Route.`\n );\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (\n ['component', 'getComponent'].some(\n (key) => child.props && typeof child.props === 'object' && key in child.props\n )\n ) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must not have a \\`component\\` or \\`getComponent\\` prop when used as a child of a Layout Route`\n );\n }\n }\n\n return true;\n }\n\n return false;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"NativeTabTrigger.js","sourceRoot":"","sources":["../../src/native-tabs/NativeTabTrigger.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AA+Fb,4DAgDC;AAyBD,8CA8CC;AA+BD,gDAgCC;AAnRD,qDAAmE;AACnE,iCAAuF;AACvF,+CAAoE;AAEpE,gDAS2B;AAE3B,6EAAmE;AACnE,sDAAmD;AACnD,gDAAiF;AACjF,uCAAgE;AAChE,yEAAqF;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,SAAS,oBAAoB,CAAC,KAA4B;IACxD,MAAM,KAAK,GAAG,IAAA,iBAAQ,GAAE,CAAC;IACzB,MAAM,UAAU,GAAG,IAAA,sBAAa,GAAE,CAAC;IACnC,MAAM,WAAW,GAAG,IAAA,kCAAY,GAAE,CAAC;IAEnC,IAAA,+BAAc,EACZ,IAAA,mBAAW,EAAC,GAAG,EAAE;QACf,6DAA6D;QAC7D,yEAAyE;QACzE,iDAAiD;QACjD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,IAAI,UAAU,CAAC,QAAQ,EAAE,EAAE,IAAI,KAAK,KAAK,EAAE,CAAC;gBAC1C,MAAM,IAAI,KAAK,CACb,wEAAwE,KAAK,CAAC,IAAI,EAAE,CACrF,CAAC;YACJ,CAAC;YACD,MAAM,OAAO,GAAG,wBAAwB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACtD,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CACzB,CAAC;IAEF,OAAO,I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CAAC;YACxB,OAAO,IAAA,uCAAgC,EAAC,GAAG,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,OAAO,EAAE,GAAG,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,kBAAkB,CAChC,KAAgB,EAChB,UAAmB;IAEnB,IAAI,IAAA,sBAAc,EAAC,KAAK,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,wBAAgB,EAAE,CAAC;QACtE,IACE,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;YAC/B,KAAK,CAAC,KAAK;YACX,MAAM,IAAI,KAAK,CAAC,KAAK;YACrB,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EACjB,CAAC;YACD,MAAM,IAAI,KAAK,CACb,uDAAuD,UAAU,8EAA8E,CAChJ,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;YAC1C,IACE,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,IAAI,CAChC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,GAAG,IAAI,KAAK,CAAC,KAAK,CAC9E,EACD,CAAC;gBACD,MAAM,IAAI,KAAK,CACb,uDAAuD,UAAU,0GAA0G,CAC5K,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["'use client';\n\nimport { useNavigation, useRoute } from '@react-navigation/native';\nimport { isValidElement, useCallback, type ReactElement, type ReactNode } from 'react';\nimport { StyleSheet, type ImageSourcePropType } from 'react-native';\n\nimport {\n NativeTabsTriggerIcon,\n NativeTabsTriggerBadge,\n NativeTabsTriggerLabel,\n NativeTabsTriggerVectorIcon,\n type NativeTabsTriggerBadgeProps,\n type NativeTabsTriggerLabelProps,\n type NativeTabsTriggerIconProps,\n type SrcIcon,\n} from './common/elements';\nimport type { NativeTabOptions, NativeTabTriggerProps } from './types';\nimport { useIsPreview } from '../link/preview/PreviewRouteContext';\nimport { useFocusEffect } from '../useFocusEffect';\nimport { filterAllowedChildrenElements, isChildOfType } from '../utils/children';\nimport { convertComponentSrcToImageSource } from './utils/icon';\nimport { convertMaterialIconNameToImageSource } from './utils/materialIconConverter';\n\n/**\n * The component used to customize the native tab options both in the _layout file and from the tab screen.\n *\n * When used in the _layout file, you need to provide a `name` prop.\n * When used in the tab screen, the `name` prop takes no effect.\n *\n * @example\n * ```tsx\n * // In _layout file\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function Layout() {\n * return (\n * <NativeTabs>\n * <NativeTabs.Trigger name=\"home\" />\n * <NativeTabs.Trigger name=\"settings\" />\n * </NativeTabs>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // In a tab screen\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function HomeScreen() {\n * return (\n * <View>\n * <NativeTabs.Trigger>\n * <NativeTabs.Trigger.Label>Home</NativeTabs.Trigger.Label>\n * </NativeTabs.Trigger>\n * <Text>This is home screen!</Text>\n * </View>\n * );\n * }\n * ```\n *\n * > **Note:** You can use the alias `NativeTabs.Trigger` for this component.\n */\nfunction NativeTabTriggerImpl(props: NativeTabTriggerProps) {\n const route = useRoute();\n const navigation = useNavigation();\n const isInPreview = useIsPreview();\n\n useFocusEffect(\n useCallback(() => {\n // This will cause the tab to update only when it is focused.\n // As long as all tabs are loaded at the start, we don't need this check.\n // It is here to ensure similar behavior to stack\n if (!isInPreview) {\n if (navigation.getState()?.type !== 'tab') {\n throw new Error(\n `Trigger component can only be used in the tab screen. Current route: ${route.name}`\n );\n }\n const options = convertTabPropsToOptions(props, true);\n navigation.setOptions(options);\n }\n }, [props, isInPreview])\n );\n\n return null;\n}\n\nexport const NativeTabTrigger = Object.assign(NativeTabTriggerImpl, {\n Label: NativeTabsTriggerLabel,\n Icon: NativeTabsTriggerIcon,\n Badge: NativeTabsTriggerBadge,\n VectorIcon: NativeTabsTriggerVectorIcon,\n});\n\nexport function convertTabPropsToOptions(\n {\n hidden,\n children,\n role,\n disablePopToTop,\n disableScrollToTop,\n unstable_nativeProps,\n disableAutomaticContentInsets,\n contentStyle,\n }: NativeTabTriggerProps,\n isDynamic: boolean = false\n) {\n const initialOptions: NativeTabOptions = isDynamic\n ? {\n ...(unstable_nativeProps ? { nativeProps: unstable_nativeProps } : {}),\n }\n : {\n hidden: !!hidden,\n specialEffects: {\n repeatedTabSelection: {\n popToRoot: !disablePopToTop,\n scrollToTop: !disableScrollToTop,\n },\n },\n contentStyle,\n role,\n nativeProps: unstable_nativeProps,\n disableAutomaticContentInsets,\n };\n const allowedChildren = filterAllowedChildrenElements(children, [\n NativeTabsTriggerBadge,\n NativeTabsTriggerLabel,\n NativeTabsTriggerIcon,\n ]);\n return allowedChildren.reduce<NativeTabOptions>(\n (acc, child) => {\n if (isChildOfType(child, NativeTabsTriggerBadge)) {\n appendBadgeOptions(acc, child.props);\n } else if (isChildOfType(child, NativeTabsTriggerLabel)) {\n appendLabelOptions(acc, child.props);\n } else if (isChildOfType(child, NativeTabsTriggerIcon)) {\n appendIconOptions(acc, child.props);\n }\n return acc;\n },\n { ...initialOptions }\n );\n}\n\nfunction appendBadgeOptions(options: NativeTabOptions, props: NativeTabsTriggerBadgeProps) {\n if (props.children) {\n options.badgeValue = String(props.children);\n options.selectedBadgeBackgroundColor = props.selectedBackgroundColor;\n } else if (!props.hidden) {\n // If no value is provided, we set it to a space to show the badge\n // Otherwise, the `react-native-screens` will interpret it as a hidden badge\n // https://github.com/software-mansion/react-native-screens/blob/b4358fd95dd0736fc54df6bb97f210dc89edf24c/ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm#L172\n options.badgeValue = ' ';\n }\n}\n\nfunction appendLabelOptions(options: NativeTabOptions, props: NativeTabsTriggerLabelProps) {\n if (props.hidden) {\n options.title = '';\n } else {\n options.title = props.children;\n if (props.selectedStyle) {\n options.selectedLabelStyle = StyleSheet.flatten(props.selectedStyle);\n }\n }\n}\n\nexport function appendIconOptions(options: NativeTabOptions, props: NativeTabsTriggerIconProps) {\n if ('sf' in props && props.sf && process.env.EXPO_OS === 'ios') {\n if (typeof props.sf === 'string') {\n options.icon = props.sf\n ? {\n sf: props.sf,\n }\n : undefined;\n options.selectedIcon = undefined;\n } else if (props.sf) {\n options.icon = props.sf.default\n ? {\n sf: props.sf.default,\n }\n : undefined;\n options.selectedIcon = props.sf.selected\n ? {\n sf: props.sf.selected,\n }\n : undefined;\n }\n } else if ('drawable' in props && props.drawable && process.env.EXPO_OS === 'android') {\n if ('md' in props) {\n console.warn(\n 'Both `md` and `drawable` props are provided to NativeTabs.Trigger.Icon. `drawable` will take precedence on Android platform.'\n );\n }\n options.icon = { drawable: props.drawable };\n options.selectedIcon = undefined;\n } else if ('md' in props && props.md && process.env.EXPO_OS === 'android') {\n if (process.env.NODE_ENV !== 'production') {\n if ('drawable' in props) {\n console.warn(\n 'Both `md` and `drawable` props are provided to NativeTabs.Trigger.Icon. `drawable` will take precedence on Android platform.'\n );\n }\n }\n options.icon = convertMaterialIconNameToImageSource(props.md);\n } else if ('src' in props && props.src) {\n const icon = convertIconSrcToIconOption(props);\n options.icon = icon?.icon;\n options.selectedIcon = icon?.selectedIcon;\n }\n if (props.selectedColor) {\n options.selectedIconColor = props.selectedColor;\n }\n}\n\nfunction convertIconSrcToIconOption(\n icon: SrcIcon | undefined\n): Pick<NativeTabOptions, 'icon' | 'selectedIcon'> | undefined {\n if (icon && icon.src) {\n const { defaultIcon, selected } =\n typeof icon.src === 'object' && 'selected' in icon.src\n ? { defaultIcon: icon.src.default, selected: icon.src.selected }\n : { defaultIcon: icon.src };\n\n const options: Pick<NativeTabOptions, 'icon' | 'selectedIcon'> = {};\n options.icon = convertSrcOrComponentToSrc(defaultIcon);\n options.selectedIcon = convertSrcOrComponentToSrc(selected);\n return options;\n }\n\n return undefined;\n}\n\nfunction convertSrcOrComponentToSrc(src: ImageSourcePropType | ReactElement | undefined) {\n if (src) {\n if (isValidElement(src)) {\n return convertComponentSrcToImageSource(src);\n } else {\n return { src };\n }\n }\n return undefined;\n}\n\nexport function isNativeTabTrigger(\n child: ReactNode,\n contextKey?: string\n): child is ReactElement<NativeTabTriggerProps & { name: string }> {\n if (isValidElement(child) && child && child.type === NativeTabTrigger) {\n if (\n typeof child.props === 'object' &&\n child.props &&\n 'name' in child.props &&\n !child.props.name\n ) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must have a \\`name\\` prop when used as a child of a Layout Route.`\n );\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (\n ['component', 'getComponent'].some(\n (key) => child.props && typeof child.props === 'object' && key in child.props\n )\n ) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must not have a \\`component\\` or \\`getComponent\\` prop when used as a child of a Layout Route`\n );\n }\n }\n\n return true;\n }\n\n return false;\n}\n"]}
|
|
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.NativeTabsView = NativeTabsView;
|
|
40
40
|
const react_tabs_1 = require("@radix-ui/react-tabs");
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
|
-
const native_tabs_module_css_1 = __importDefault(require("
|
|
42
|
+
const native_tabs_module_css_1 = __importDefault(require("../../assets/native-tabs.module.css"));
|
|
43
43
|
function NativeTabsView(props) {
|
|
44
44
|
const { tabs, focusedIndex } = props;
|
|
45
45
|
const currentTab = tabs[focusedIndex];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTabsView.web.js","sourceRoot":"","sources":["../../src/native-tabs/NativeTabsView.web.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wCA6CC;AA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AAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACzE,CAAC;IACD,IAAI,iBAAiB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,CAAC;QACpD,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAClD,iBAAiB,EAAE,kBAAkB,EAAE,QAAQ,CAChD,CAAC;IACJ,CAAC;IACD,IAAI,iBAAiB,EAAE,cAAc,EAAE,CAAC;QACtC,IAAI,CAAC,4CAA4C,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;IAChG,CAAC;IACD,IAAI,iBAAiB,EAAE,eAAe,EAAE,CAAC;QACvC,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;IAC1F,CAAC;IACD,IAAI,iBAAiB,EAAE,oBAAoB,EAAE,CAAC;QAC5C,IAAI,CAAC,2CAA2C,CAAC,GAAG,MAAM,CACxD,iBAAiB,CAAC,oBAAoB,CACvC,CAAC;IACJ,CAAC;IACD,IAAI,iBAAiB,EAAE,cAAc,EAAE,CAAC;QACtC,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { Tabs, TabsContent, TabsList, TabsTrigger } from '@radix-ui/react-tabs';\nimport React, { useMemo } from 'react';\n\nimport type { NativeTabOptions, NativeTabsViewProps } from './types';\nimport nativeTabsStyles from '../../assets/native-tabs.module.css';\n\nexport function NativeTabsView(props: NativeTabsViewProps) {\n const { tabs, focusedIndex } = props;\n const currentTab = tabs[focusedIndex];\n const defaultTab = useMemo(\n () => currentTab,\n // We don't specify currentTab here, as we don't want to change the default tab when focusedIndex changes\n []\n );\n const value = currentTab.routeKey;\n\n const items = tabs.map((tab) => (\n <TabItem\n key={tab.routeKey}\n routeKey={tab.routeKey}\n title={tab.options.title ?? tab.name}\n badgeValue={tab.options.badgeValue}\n />\n ));\n const children = tabs.map((tab) => {\n return (\n <TabsContent\n key={tab.routeKey}\n value={tab.routeKey}\n className={nativeTabsStyles.tabContent}\n forceMount>\n {tab.contentRenderer()}\n </TabsContent>\n );\n });\n\n return (\n <Tabs\n className={nativeTabsStyles.nativeTabsContainer}\n defaultValue={defaultTab.routeKey}\n value={value}\n onValueChange={(value) => {\n props.onTabChange(value);\n }}\n style={convertNativeTabsPropsToStyleVars(props, currentTab.options)}>\n <TabsList aria-label=\"Main\" className={nativeTabsStyles.navigationMenuRoot}>\n {items}\n </TabsList>\n {children}\n </Tabs>\n );\n}\n\ninterface TabItemProps {\n title: string;\n badgeValue?: string;\n routeKey: string;\n}\n\nfunction TabItem(props: TabItemProps) {\n const { title, badgeValue, routeKey } = props;\n const isBadgeEmpty = badgeValue === ' ';\n\n return (\n <TabsTrigger value={routeKey} className={nativeTabsStyles.navigationMenuTrigger}>\n <span className={nativeTabsStyles.tabText}>{title}</span>\n {badgeValue && (\n <div\n className={`${nativeTabsStyles.tabBadge} ${isBadgeEmpty ? nativeTabsStyles.emptyTabBadge : ''}`}>\n {badgeValue}\n </div>\n )}\n </TabsTrigger>\n );\n}\n\nfunction convertNativeTabsPropsToStyleVars(\n props: NativeTabsViewProps | undefined,\n currentTabOptions: NativeTabOptions | undefined\n): Record<string, string | undefined> {\n const vars: Record<`--expo-router-tabs-${string}`, string | undefined> = {};\n if (!props) {\n return vars;\n }\n const optionsLabelStyle = currentTabOptions?.labelStyle;\n if (optionsLabelStyle?.fontFamily) {\n vars['--expo-router-tabs-font-family'] = String(optionsLabelStyle.fontFamily);\n }\n if (optionsLabelStyle?.fontSize) {\n vars['--expo-router-tabs-font-size'] = String(optionsLabelStyle.fontSize);\n }\n if (optionsLabelStyle?.fontWeight) {\n vars['--expo-router-tabs-font-weight'] = String(optionsLabelStyle.fontWeight);\n }\n if (optionsLabelStyle?.fontStyle) {\n vars['--expo-router-tabs-font-style'] = String(optionsLabelStyle.fontStyle);\n }\n if (optionsLabelStyle?.color) {\n vars['--expo-router-tabs-text-color'] = String(optionsLabelStyle.color);\n }\n if (currentTabOptions?.selectedLabelStyle?.color) {\n vars['--expo-router-tabs-active-text-color'] = String(\n currentTabOptions?.selectedLabelStyle?.color\n );\n } else if (props.tintColor) {\n vars['--expo-router-tabs-active-text-color'] = String(props.tintColor);\n }\n if (currentTabOptions?.selectedLabelStyle?.fontSize) {\n vars['--expo-router-tabs-active-font-size'] = String(\n currentTabOptions?.selectedLabelStyle?.fontSize\n );\n }\n if (currentTabOptions?.indicatorColor) {\n vars['--expo-router-tabs-active-background-color'] = String(currentTabOptions.indicatorColor);\n }\n if (currentTabOptions?.backgroundColor) {\n vars['--expo-router-tabs-background-color'] = String(currentTabOptions.backgroundColor);\n }\n if (currentTabOptions?.badgeBackgroundColor) {\n vars['--expo-router-tabs-badge-background-color'] = String(\n currentTabOptions.badgeBackgroundColor\n );\n }\n if (currentTabOptions?.badgeTextColor) {\n vars['--expo-router-tabs-badge-text-color'] = String(currentTabOptions.badgeTextColor);\n }\n return vars;\n}\n"]}
|
|
@@ -70,7 +70,10 @@ export type RouteInputParams<T extends Route> = Extract<Href, {
|
|
|
70
70
|
*/
|
|
71
71
|
export type RouteOutputParams<T extends Route> = Extract<HrefOutputParams, {
|
|
72
72
|
pathname: T;
|
|
73
|
-
}> extends never ? HrefOutputParams extends infer H ? H extends
|
|
73
|
+
}> extends never ? HrefOutputParams extends infer H ? H extends {
|
|
74
|
+
pathname: any;
|
|
75
|
+
params?: any;
|
|
76
|
+
} ? T extends H['pathname'] ? H['params'] : never : never : never : Extract<HrefOutputParams, {
|
|
74
77
|
pathname: T;
|
|
75
78
|
}>['params'];
|
|
76
79
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/typed-routes/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,yBAAiB,UAAU,CAAC;IAE1B,UAA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MAAM,KAAK,EAAE,GACpD,CAAC,KAAK,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,GAChC,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/typed-routes/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The main routing type for Expo Router.\n *\n * @internal\n * @hidden\n */\nexport namespace ExpoRouter {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-object-type\n export interface __routes {}\n}\n\nexport type HrefObject = {\n /** The path of the route. */\n pathname: string;\n /** Optional parameters for the route. */\n params?: UnknownInputParams;\n};\n\n/**\n * @hidden\n */\nexport type HrefInputParamsObject = {\n /** The path of the route. */\n pathname: string;\n /** Optional input parameters for the route. */\n params?: UnknownInputParams;\n};\n\n/**\n * @hidden\n */\nexport type HrefOutputParamsObject = {\n /** The path of the route */\n pathname: string;\n /** Optional output parameters for the route */\n params?: UnknownOutputParams;\n};\n\nexport type RelativePathString = `./${string}` | `../${string}` | '..';\nexport type SearchOrHash = `?${string}` | `#${string}`;\nexport type ExternalPathString = `${string}:${string}` | `//${string}`;\nexport type Route = Exclude<\n Extract<Href, object>['pathname'], // Use the HrefObject, as it doesn't have query params\n RelativePathString | ExternalPathString\n>;\n\n/**\n * The main routing type for Expo Router. It includes all available routes with strongly\n * typed parameters. It can either be:\n * - **string**: A full path like `/profile/settings` or a relative path like `../settings`.\n * - **object**: An object with a `pathname` and optional `params`. The `pathname` can be\n * a full path like `/profile/settings` or a relative path like `../settings`.\n * The params can be an object of key-value pairs.\n *\n * An Href can either be a string or an object.\n */\nexport type Href<T extends ExpoRouter.__routes = ExpoRouter.__routes> = T extends { href: any }\n ? T['href']\n : string | HrefObject;\n\n/*\n * @hidden\n */\nexport type HrefInputParams<T extends ExpoRouter.__routes = ExpoRouter.__routes> = T extends {\n hrefInputParams: any;\n}\n ? T['hrefInputParams']\n : HrefInputParamsObject;\n\n/*\n * @hidden\n */\nexport type HrefOutputParams<T extends ExpoRouter.__routes = ExpoRouter.__routes> = T extends {\n hrefOutputParams: any;\n}\n ? T['hrefOutputParams']\n : HrefOutputParamsObject;\n\n/**\n * @hidden\n */\nexport type RouteInputParams<T extends Route> =\n Extract<Href, { pathname: T }> extends never\n ? HrefInputParams extends infer H\n ? H extends Record<'pathname' | 'params', any>\n ? T extends H['pathname']\n ? H['params']\n : never\n : never\n : never\n : Extract<HrefInputParams, { pathname: T }>['params'];\n\n/**\n * @hidden\n */\nexport type RouteOutputParams<T extends Route> =\n Extract<HrefOutputParams, { pathname: T }> extends never\n ? HrefOutputParams extends infer H\n ? H extends
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/typed-routes/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The main routing type for Expo Router.\n *\n * @internal\n * @hidden\n */\nexport namespace ExpoRouter {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-object-type\n export interface __routes {}\n}\n\nexport type HrefObject = {\n /** The path of the route. */\n pathname: string;\n /** Optional parameters for the route. */\n params?: UnknownInputParams;\n};\n\n/**\n * @hidden\n */\nexport type HrefInputParamsObject = {\n /** The path of the route. */\n pathname: string;\n /** Optional input parameters for the route. */\n params?: UnknownInputParams;\n};\n\n/**\n * @hidden\n */\nexport type HrefOutputParamsObject = {\n /** The path of the route */\n pathname: string;\n /** Optional output parameters for the route */\n params?: UnknownOutputParams;\n};\n\nexport type RelativePathString = `./${string}` | `../${string}` | '..';\nexport type SearchOrHash = `?${string}` | `#${string}`;\nexport type ExternalPathString = `${string}:${string}` | `//${string}`;\nexport type Route = Exclude<\n Extract<Href, object>['pathname'], // Use the HrefObject, as it doesn't have query params\n RelativePathString | ExternalPathString\n>;\n\n/**\n * The main routing type for Expo Router. It includes all available routes with strongly\n * typed parameters. It can either be:\n * - **string**: A full path like `/profile/settings` or a relative path like `../settings`.\n * - **object**: An object with a `pathname` and optional `params`. The `pathname` can be\n * a full path like `/profile/settings` or a relative path like `../settings`.\n * The params can be an object of key-value pairs.\n *\n * An Href can either be a string or an object.\n */\nexport type Href<T extends ExpoRouter.__routes = ExpoRouter.__routes> = T extends { href: any }\n ? T['href']\n : string | HrefObject;\n\n/*\n * @hidden\n */\nexport type HrefInputParams<T extends ExpoRouter.__routes = ExpoRouter.__routes> = T extends {\n hrefInputParams: any;\n}\n ? T['hrefInputParams']\n : HrefInputParamsObject;\n\n/*\n * @hidden\n */\nexport type HrefOutputParams<T extends ExpoRouter.__routes = ExpoRouter.__routes> = T extends {\n hrefOutputParams: any;\n}\n ? T['hrefOutputParams']\n : HrefOutputParamsObject;\n\n/**\n * @hidden\n */\nexport type RouteInputParams<T extends Route> =\n Extract<Href, { pathname: T }> extends never\n ? HrefInputParams extends infer H\n ? H extends Record<'pathname' | 'params', any>\n ? T extends H['pathname']\n ? H['params']\n : never\n : never\n : never\n : Extract<HrefInputParams, { pathname: T }>['params'];\n\n/**\n * @hidden\n */\nexport type RouteOutputParams<T extends Route> =\n Extract<HrefOutputParams, { pathname: T }> extends never\n ? HrefOutputParams extends infer H\n ? H extends { pathname: any; params?: any }\n ? T extends H['pathname']\n ? H['params']\n : never\n : never\n : never\n : Extract<HrefOutputParams, { pathname: T }>['params'];\n\n/**\n * @hidden\n */\nexport type RouteParams<T extends Route> = RouteOutputParams<T>;\n\n/**\n * Routes can have known inputs (e.g query params).\n * Unlike outputs, inputs can be `undefined` or `null`.\n *\n * @hidden\n */\nexport type UnknownInputParams = Record<\n string,\n string | number | undefined | null | (string | number)[]\n>;\n\n/**\n * Routes can have unknown outputs (e.g query params).\n * Unlike inputs, outputs can't be undefined or null.\n *\n * @hidden\n */\nexport type UnknownOutputParams = Record<string, string | string[]>;\n\n/**\n * Return only the RoutePart of a string. If the string has multiple parts return never\n *\n * string | type\n *| ---------|------|\n *| 123 | 123 |\n *| /123/abc | never |\n *| 123?abc | never |\n *| ./123 | never |\n *| /123 | never |\n *| 123/../ | never |\n *\n * @hidden\n */\nexport type SingleRoutePart<S extends string | object> = S extends object\n ? never\n : S extends `${string}/${string}`\n ? never\n : S extends `${string}${SearchOrHash}`\n ? never\n : S extends ''\n ? never\n : S extends `(${string})`\n ? never\n : S extends `[${string}]`\n ? never\n : S;\n\n/**\n * @deprecated Use `RouteParams` or `StrictRouteParams` instead.\n *\n * @hidden\n */\nexport type SearchParams<T extends string = never> = RouteParams<T>;\n\n/**\n * @hidden\n */\nexport type RouteSegments<HrefOrSegments extends Route | string[]> = HrefOrSegments extends string[]\n ? HrefOrSegments\n : HrefOrSegments extends `.${string}`\n ? never\n : HrefOrSegments extends ``\n ? never\n : HrefOrSegments extends `/${infer PartA}`\n ? RouteSegments<PartA>\n : HrefOrSegments extends `${infer PartA}?${string}`\n ? RouteSegments<PartA>\n : HrefOrSegments extends `${infer PartA}#${string}`\n ? RouteSegments<PartA>\n : HrefOrSegments extends `${infer PartA}/${infer PartB}`\n ? [PartA, ...RouteSegments<PartB>]\n : [HrefOrSegments];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreens.d.ts","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAsB,SAAS,EAAuC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"useScreens.d.ts","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAsB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;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,WAAW,EAAE,EACpB,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,EAC7B,yBAAyB,GAAE,OAAe,GACzC,KAAK,CAAC,SAAS,EAAE,CAoBnB;AAkDD,mFAAmF;AACnF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,SAAS;sCAiCtD,GAAG;;EAiEP;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,EAChB,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,GAC/B,WAAW,CAAC,SAAS,CAAC,CAqBxB;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,EAChB,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,GAAE,OAAO,CAAC,WAAW,CAAM,qBAYxD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,UAa5E"}
|
package/build/useScreens.js
CHANGED
|
@@ -48,6 +48,7 @@ const Route_1 = require("./Route");
|
|
|
48
48
|
const storeContext_1 = require("./global-state/storeContext");
|
|
49
49
|
const import_mode_1 = __importDefault(require("./import-mode"));
|
|
50
50
|
const ZoomTransitionEnabler_1 = require("./link/zoom/ZoomTransitionEnabler");
|
|
51
|
+
const zoom_transition_context_1 = require("./link/zoom/zoom-transition-context");
|
|
51
52
|
const navigationParams_1 = require("./navigationParams");
|
|
52
53
|
const primitives_1 = require("./primitives");
|
|
53
54
|
const EmptyRoute_1 = require("./views/EmptyRoute");
|
|
@@ -223,12 +224,14 @@ function getQualifiedRouteComponent(value) {
|
|
|
223
224
|
}, [navigation]);
|
|
224
225
|
return (<Route_1.Route node={value} route={route}>
|
|
225
226
|
<ZoomTransitionEnabler_1.ZoomTransitionEnabler route={route}/>
|
|
226
|
-
<
|
|
227
|
-
<
|
|
227
|
+
<zoom_transition_context_1.ZoomTransitionTargetContextProvider route={route}>
|
|
228
|
+
<react_1.default.Suspense fallback={<SuspenseFallback_1.SuspenseFallback route={value}/>}>
|
|
229
|
+
<ScreenComponent {...props}
|
|
228
230
|
// Expose the template segment path, e.g. `(home)`, `[foo]`, `index`
|
|
229
231
|
// the intention is to make it possible to deduce shared routes.
|
|
230
232
|
segment={value.route}/>
|
|
231
|
-
|
|
233
|
+
</react_1.default.Suspense>
|
|
234
|
+
</zoom_transition_context_1.ZoomTransitionTargetContextProvider>
|
|
232
235
|
</Route_1.Route>);
|
|
233
236
|
}
|
|
234
237
|
if (__DEV__) {
|
package/build/useScreens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreens.js","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyJb,4CAwBC;AAmDD,gEAgGC;AAED,oDAwBC;AAED,sCAcC;AAED,sCAaC;AA3XD,qDAOkC;AAElC,+CAAyC;AAEzC,mCAA6F;AAC7F,8DAAiE;AACjE,gEAAoD;AACpD,6EAA0E;AAC1E,yDAI4B;AAC5B,6CAAsC;AAEtC,mDAAgD;AAChD,+DAA4D;AAC5D,qCAAkC;AAmClC,SAAS,iBAAiB,CACxB,QAAqB,EACrB,QAAuB,EAAE,EACzB,gBAAyB;IAEzB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,QAAQ;aACZ,IAAI,CAAC,IAAA,6BAAqB,EAAC,gBAAgB,CAAC,CAAC;aAC7C,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;IACD,MAAM,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC;IAE9B,MAAM,OAAO,GAAG,KAAK;SAClB,GAAG,CACF,CAAC,EACC,IAAI,EACJ,QA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,CACL,IAAI,KAAK,CAAC,CACV,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAClB,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CACjB,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,OAAO,CAAC,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAC9C,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,EACtD,CACH,CAAC;AACJ,CAAC;AAED,SAAgB,aAAa,CAAC,IAAY,EAAE,UAA+B,EAAE;IAC3E,OAAO,IAAI;SACR,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACf,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/B,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC;QACtE,CAAC;aAAM,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5D,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC;QAC3D,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC","sourcesContent":["'use client';\n\nimport {\n useStateForPath,\n type EventMapBase,\n type NavigationState,\n type ParamListBase,\n type RouteProp,\n type ScreenListeners,\n} from '@react-navigation/native';\nimport type { NativeStackNavigationEventMap } from '@react-navigation/native-stack';\nimport React, { useEffect } from 'react';\n\nimport { LoadedRoute, Route, RouteNode, sortRoutesWithInitial, useRouteNode } from './Route';\nimport { useExpoRouterStore } from './global-state/storeContext';\nimport EXPO_ROUTER_IMPORT_MODE from './import-mode';\nimport { ZoomTransitionEnabler } from './link/zoom/ZoomTransitionEnabler';\nimport {\n hasParam,\n INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME,\n removeParams,\n} from './navigationParams';\nimport { Screen } from './primitives';\nimport { UnknownOutputParams } from './types';\nimport { EmptyRoute } from './views/EmptyRoute';\nimport { SuspenseFallback } from './views/SuspenseFallback';\nimport { Try } from './views/Try';\n\nexport type ScreenProps<\n TOptions extends Record<string, any> = Record<string, any>,\n TState extends NavigationState = NavigationState,\n TEventMap extends EventMapBase = EventMapBase,\n> = {\n /** Name is required when used inside a Layout component. */\n name?: string;\n /**\n * Redirect to the nearest sibling route.\n * If all children are `redirect={true}`, the layout will render `null` as there are no children to render.\n */\n redirect?: boolean;\n initialParams?: Record<string, any>;\n options?:\n | TOptions\n | ((prop: { route: RouteProp<ParamListBase, string>; navigation: any }) => TOptions);\n\n listeners?:\n | ScreenListeners<TState, TEventMap>\n | ((prop: {\n route: RouteProp<ParamListBase, string>;\n navigation: any;\n }) => ScreenListeners<TState, TEventMap>);\n\n getId?: ({ params }: { params?: Record<string, any> }) => string | undefined;\n\n dangerouslySingular?: SingularOptions;\n};\n\nexport type SingularOptions =\n | boolean\n | ((name: string, params: UnknownOutputParams) => string | undefined);\n\nfunction getSortedChildren(\n children: RouteNode[],\n order: ScreenProps[] = [],\n initialRouteName?: string\n): { route: RouteNode; props: Partial<ScreenProps> }[] {\n if (!order?.length) {\n return children\n .sort(sortRoutesWithInitial(initialRouteName))\n .map((route) => ({ route, props: {} }));\n }\n const entries = [...children];\n\n const ordered = order\n .map(\n ({\n name,\n redirect,\n initialParams,\n listeners,\n options,\n getId,\n dangerouslySingular: singular,\n }) => {\n if (!entries.length) {\n console.warn(\n `[Layout children]: Too many screens defined. Route \"${name}\" is extraneous.`\n );\n return null;\n }\n const matchIndex = entries.findIndex((child) => child.route === name);\n if (matchIndex === -1) {\n console.warn(\n `[Layout children]: No route named \"${name}\" exists in nested children:`,\n children.map(({ route }) => route)\n );\n return null;\n } else {\n // Get match and remove from entries\n const match = entries[matchIndex];\n entries.splice(matchIndex, 1);\n\n // Ensure to return null after removing from entries.\n if (redirect) {\n if (typeof redirect === 'string') {\n throw new Error(`Redirecting to a specific route is not supported yet.`);\n }\n return null;\n }\n\n if (getId) {\n console.warn(\n `Deprecated: prop 'getId' on screen ${name} is deprecated. Please rename the prop to 'dangerouslySingular'`\n );\n if (singular) {\n console.warn(\n `Screen ${name} cannot use both getId and dangerouslySingular together.`\n );\n }\n } else if (singular) {\n // If singular is set, use it as the getId function.\n if (typeof singular === 'string') {\n getId = () => singular;\n } else if (typeof singular === 'function' && name) {\n getId = (options) => singular(name, options.params || {});\n } else if (singular === true && name) {\n getId = (options) => getSingularId(name, options);\n }\n }\n\n return {\n route: match,\n props: { initialParams, listeners, options, getId },\n };\n }\n }\n )\n .filter(Boolean) as {\n route: RouteNode;\n props: Partial<ScreenProps>;\n }[];\n\n // Add any remaining children\n ordered.push(\n ...entries.sort(sortRoutesWithInitial(initialRouteName)).map((route) => ({ route, props: {} }))\n );\n\n return ordered;\n}\n\n/**\n * @returns React Navigation screens sorted by the `route` property.\n */\nexport function useSortedScreens(\n order: ScreenProps[],\n protectedScreens: Set<string>,\n useOnlyUserDefinedScreens: boolean = false\n): React.ReactNode[] {\n const node = useRouteNode();\n\n const nodeChildren = node?.children ?? [];\n const children = useOnlyUserDefinedScreens\n ? nodeChildren.filter((child) =>\n order.some((userDefinedScreen) => userDefinedScreen.name === child.route)\n )\n : nodeChildren;\n\n const sorted = children.length ? getSortedChildren(children, order, node?.initialRouteName) : [];\n return React.useMemo(\n () =>\n sorted\n .filter((item) => !protectedScreens.has(item.route.route))\n .map((value) => {\n return routeToScreen(value.route, value.props);\n }),\n [sorted, protectedScreens]\n );\n}\n\nfunction fromImport(value: RouteNode, { ErrorBoundary, ...component }: LoadedRoute) {\n // If possible, add a more helpful display name for the component stack to improve debugging of React errors such as `Text strings must be rendered within a <Text> component.`.\n if (component?.default && __DEV__) {\n component.default.displayName ??= `${component.default.name ?? 'Route'}(${value.contextKey})`;\n }\n\n if (ErrorBoundary) {\n const Wrapped = React.forwardRef((props: any, ref: any) => {\n const children = React.createElement(component.default || EmptyRoute, {\n ...props,\n ref,\n });\n return <Try catch={ErrorBoundary}>{children}</Try>;\n });\n\n if (__DEV__) {\n Wrapped.displayName = `ErrorBoundary(${value.contextKey})`;\n }\n\n return {\n default: Wrapped,\n };\n }\n if (process.env.NODE_ENV !== 'production') {\n if (\n typeof component.default === 'object' &&\n component.default &&\n Object.keys(component.default).length === 0\n ) {\n return { default: EmptyRoute };\n }\n }\n\n return { default: component.default };\n}\n\nfunction fromLoadedRoute(value: RouteNode, res: LoadedRoute) {\n if (!(res instanceof Promise)) {\n return fromImport(value, res);\n }\n\n return res.then(fromImport.bind(null, value));\n}\n\n// TODO: Maybe there's a more React-y way to do this?\n// Without this store, the process enters a recursive loop.\nconst qualifiedStore = new WeakMap<RouteNode, React.ComponentType<any>>();\n\n/** Wrap the component with various enhancements and add access to child routes. */\nexport function getQualifiedRouteComponent(value: RouteNode) {\n if (qualifiedStore.has(value)) {\n return qualifiedStore.get(value)!;\n }\n\n let ScreenComponent:\n | React.ForwardRefExoticComponent<React.RefAttributes<unknown>>\n | React.ComponentType<any>;\n\n // TODO: This ensures sync doesn't use React.lazy, but it's not ideal.\n if (EXPO_ROUTER_IMPORT_MODE === 'lazy') {\n ScreenComponent = React.lazy(async () => {\n const res = value.loadRoute();\n return fromLoadedRoute(value, res) as Promise<{\n default: React.ComponentType<any>;\n }>;\n });\n\n if (__DEV__) {\n ScreenComponent.displayName = `AsyncRoute(${value.route})`;\n }\n } else {\n const res = value.loadRoute();\n ScreenComponent = fromImport(value, res).default!;\n }\n function BaseRoute({\n // Remove these React Navigation props to\n // enforce usage of expo-router hooks (where the query params are correct).\n route,\n navigation,\n\n // Pass all other props to the component\n ...props\n }: any) {\n const stateForPath = useStateForPath();\n const isFocused = navigation.isFocused();\n const store = useExpoRouterStore();\n\n if (isFocused) {\n const state = navigation.getState();\n const isLeaf = !('state' in state.routes[state.index]);\n if (isLeaf && stateForPath) store.setFocusedState(stateForPath);\n }\n\n useEffect(\n () =>\n navigation.addListener('focus', () => {\n const state = navigation.getState();\n const isLeaf = !('state' in state.routes[state.index]);\n // Because setFocusedState caches the route info, this call will only trigger rerenders\n // if the component itself didn’t rerender and the route info changed.\n // Otherwise, the update from the `if` above will handle it,\n // and this won’t cause a redundant second update.\n if (isLeaf && stateForPath) store.setFocusedState(stateForPath);\n }),\n [navigation]\n );\n\n useEffect(() => {\n return navigation.addListener(\n 'transitionEnd',\n (e?: NativeStackNavigationEventMap['transitionEnd']) => {\n if (!e?.data?.closing) {\n // When navigating to a screen, remove the no animation param to re-enable animations\n // Otherwise the navigation back would also have no animation\n if (hasParam(route?.params, INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME)) {\n navigation.replaceParams(\n removeParams(route?.params, [INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME])\n );\n }\n }\n }\n );\n }, [navigation]);\n\n return (\n <Route node={value} route={route}>\n <ZoomTransitionEnabler route={route} />\n <React.Suspense fallback={<SuspenseFallback route={value} />}>\n <ScreenComponent\n {...props}\n // Expose the template segment path, e.g. `(home)`, `[foo]`, `index`\n // the intention is to make it possible to deduce shared routes.\n segment={value.route}\n />\n </React.Suspense>\n </Route>\n );\n }\n\n if (__DEV__) {\n BaseRoute.displayName = `Route(${value.route})`;\n }\n\n qualifiedStore.set(value, BaseRoute);\n return BaseRoute;\n}\n\nexport function screenOptionsFactory(\n route: RouteNode,\n options?: ScreenProps['options']\n): ScreenProps['options'] {\n return (args) => {\n // Only eager load generated components\n const staticOptions = route.generated ? route.loadRoute()?.getNavOptions : null;\n const staticResult = typeof staticOptions === 'function' ? staticOptions(args) : staticOptions;\n const dynamicResult = typeof options === 'function' ? options?.(args) : options;\n const output = {\n ...staticResult,\n ...dynamicResult,\n };\n\n // Prevent generated screens from showing up in the tab bar.\n if (route.internal) {\n output.tabBarItemStyle = { display: 'none' };\n output.tabBarButton = () => null;\n // TODO: React Navigation doesn't provide a way to prevent rendering the drawer item.\n output.drawerItemStyle = { height: 0, display: 'none' };\n }\n\n return output;\n };\n}\n\nexport function routeToScreen(\n route: RouteNode,\n { options, getId, ...props }: Partial<ScreenProps> = {}\n) {\n return (\n <Screen\n {...props}\n name={route.route}\n key={route.route}\n getId={getId}\n options={screenOptionsFactory(route, options)}\n getComponent={() => getQualifiedRouteComponent(route)}\n />\n );\n}\n\nexport function getSingularId(name: string, options: Record<string, any> = {}) {\n return name\n .split('/')\n .map((segment) => {\n if (segment.startsWith('[...')) {\n return options.params?.[segment.slice(4, -1)]?.join('/') || segment;\n } else if (segment.startsWith('[') && segment.endsWith(']')) {\n return options.params?.[segment.slice(1, -1)] || segment;\n } else {\n return segment;\n }\n })\n .join('/');\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useScreens.js","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0Jb,4CAwBC;AAmDD,gEAkGC;AAED,oDAwBC;AAED,sCAcC;AAED,sCAaC;AA9XD,qDAOkC;AAElC,+CAAyC;AAEzC,mCAA6F;AAC7F,8DAAiE;AACjE,gEAAoD;AACpD,6EAA0E;AAC1E,iFAA0F;AAC1F,yDAI4B;AAC5B,6CAAsC;AAEtC,mDAAgD;AAChD,+DAA4D;AAC5D,qCAAkC;AAmClC,SAAS,iBAAiB,CACxB,QAAqB,EACrB,QAAuB,EAAE,EACzB,gBAAyB;IAEzB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,QAAQ;aACZ,IAAI,CAAC,IAAA,6BAAqB,EAAC,gBAAgB,CAAC,CA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CAAC,CAAC,IAAI,OAAO,CAAC;QAC3D,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC","sourcesContent":["'use client';\n\nimport {\n useStateForPath,\n type EventMapBase,\n type NavigationState,\n type ParamListBase,\n type RouteProp,\n type ScreenListeners,\n} from '@react-navigation/native';\nimport type { NativeStackNavigationEventMap } from '@react-navigation/native-stack';\nimport React, { useEffect } from 'react';\n\nimport { LoadedRoute, Route, RouteNode, sortRoutesWithInitial, useRouteNode } from './Route';\nimport { useExpoRouterStore } from './global-state/storeContext';\nimport EXPO_ROUTER_IMPORT_MODE from './import-mode';\nimport { ZoomTransitionEnabler } from './link/zoom/ZoomTransitionEnabler';\nimport { ZoomTransitionTargetContextProvider } from './link/zoom/zoom-transition-context';\nimport {\n hasParam,\n INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME,\n removeParams,\n} from './navigationParams';\nimport { Screen } from './primitives';\nimport { UnknownOutputParams } from './types';\nimport { EmptyRoute } from './views/EmptyRoute';\nimport { SuspenseFallback } from './views/SuspenseFallback';\nimport { Try } from './views/Try';\n\nexport type ScreenProps<\n TOptions extends Record<string, any> = Record<string, any>,\n TState extends NavigationState = NavigationState,\n TEventMap extends EventMapBase = EventMapBase,\n> = {\n /** Name is required when used inside a Layout component. */\n name?: string;\n /**\n * Redirect to the nearest sibling route.\n * If all children are `redirect={true}`, the layout will render `null` as there are no children to render.\n */\n redirect?: boolean;\n initialParams?: Record<string, any>;\n options?:\n | TOptions\n | ((prop: { route: RouteProp<ParamListBase, string>; navigation: any }) => TOptions);\n\n listeners?:\n | ScreenListeners<TState, TEventMap>\n | ((prop: {\n route: RouteProp<ParamListBase, string>;\n navigation: any;\n }) => ScreenListeners<TState, TEventMap>);\n\n getId?: ({ params }: { params?: Record<string, any> }) => string | undefined;\n\n dangerouslySingular?: SingularOptions;\n};\n\nexport type SingularOptions =\n | boolean\n | ((name: string, params: UnknownOutputParams) => string | undefined);\n\nfunction getSortedChildren(\n children: RouteNode[],\n order: ScreenProps[] = [],\n initialRouteName?: string\n): { route: RouteNode; props: Partial<ScreenProps> }[] {\n if (!order?.length) {\n return children\n .sort(sortRoutesWithInitial(initialRouteName))\n .map((route) => ({ route, props: {} }));\n }\n const entries = [...children];\n\n const ordered = order\n .map(\n ({\n name,\n redirect,\n initialParams,\n listeners,\n options,\n getId,\n dangerouslySingular: singular,\n }) => {\n if (!entries.length) {\n console.warn(\n `[Layout children]: Too many screens defined. Route \"${name}\" is extraneous.`\n );\n return null;\n }\n const matchIndex = entries.findIndex((child) => child.route === name);\n if (matchIndex === -1) {\n console.warn(\n `[Layout children]: No route named \"${name}\" exists in nested children:`,\n children.map(({ route }) => route)\n );\n return null;\n } else {\n // Get match and remove from entries\n const match = entries[matchIndex];\n entries.splice(matchIndex, 1);\n\n // Ensure to return null after removing from entries.\n if (redirect) {\n if (typeof redirect === 'string') {\n throw new Error(`Redirecting to a specific route is not supported yet.`);\n }\n return null;\n }\n\n if (getId) {\n console.warn(\n `Deprecated: prop 'getId' on screen ${name} is deprecated. Please rename the prop to 'dangerouslySingular'`\n );\n if (singular) {\n console.warn(\n `Screen ${name} cannot use both getId and dangerouslySingular together.`\n );\n }\n } else if (singular) {\n // If singular is set, use it as the getId function.\n if (typeof singular === 'string') {\n getId = () => singular;\n } else if (typeof singular === 'function' && name) {\n getId = (options) => singular(name, options.params || {});\n } else if (singular === true && name) {\n getId = (options) => getSingularId(name, options);\n }\n }\n\n return {\n route: match,\n props: { initialParams, listeners, options, getId },\n };\n }\n }\n )\n .filter(Boolean) as {\n route: RouteNode;\n props: Partial<ScreenProps>;\n }[];\n\n // Add any remaining children\n ordered.push(\n ...entries.sort(sortRoutesWithInitial(initialRouteName)).map((route) => ({ route, props: {} }))\n );\n\n return ordered;\n}\n\n/**\n * @returns React Navigation screens sorted by the `route` property.\n */\nexport function useSortedScreens(\n order: ScreenProps[],\n protectedScreens: Set<string>,\n useOnlyUserDefinedScreens: boolean = false\n): React.ReactNode[] {\n const node = useRouteNode();\n\n const nodeChildren = node?.children ?? [];\n const children = useOnlyUserDefinedScreens\n ? nodeChildren.filter((child) =>\n order.some((userDefinedScreen) => userDefinedScreen.name === child.route)\n )\n : nodeChildren;\n\n const sorted = children.length ? getSortedChildren(children, order, node?.initialRouteName) : [];\n return React.useMemo(\n () =>\n sorted\n .filter((item) => !protectedScreens.has(item.route.route))\n .map((value) => {\n return routeToScreen(value.route, value.props);\n }),\n [sorted, protectedScreens]\n );\n}\n\nfunction fromImport(value: RouteNode, { ErrorBoundary, ...component }: LoadedRoute) {\n // If possible, add a more helpful display name for the component stack to improve debugging of React errors such as `Text strings must be rendered within a <Text> component.`.\n if (component?.default && __DEV__) {\n component.default.displayName ??= `${component.default.name ?? 'Route'}(${value.contextKey})`;\n }\n\n if (ErrorBoundary) {\n const Wrapped = React.forwardRef((props: any, ref: any) => {\n const children = React.createElement(component.default || EmptyRoute, {\n ...props,\n ref,\n });\n return <Try catch={ErrorBoundary}>{children}</Try>;\n });\n\n if (__DEV__) {\n Wrapped.displayName = `ErrorBoundary(${value.contextKey})`;\n }\n\n return {\n default: Wrapped,\n };\n }\n if (process.env.NODE_ENV !== 'production') {\n if (\n typeof component.default === 'object' &&\n component.default &&\n Object.keys(component.default).length === 0\n ) {\n return { default: EmptyRoute };\n }\n }\n\n return { default: component.default };\n}\n\nfunction fromLoadedRoute(value: RouteNode, res: LoadedRoute) {\n if (!(res instanceof Promise)) {\n return fromImport(value, res);\n }\n\n return res.then(fromImport.bind(null, value));\n}\n\n// TODO: Maybe there's a more React-y way to do this?\n// Without this store, the process enters a recursive loop.\nconst qualifiedStore = new WeakMap<RouteNode, React.ComponentType<any>>();\n\n/** Wrap the component with various enhancements and add access to child routes. */\nexport function getQualifiedRouteComponent(value: RouteNode) {\n if (qualifiedStore.has(value)) {\n return qualifiedStore.get(value)!;\n }\n\n let ScreenComponent:\n | React.ForwardRefExoticComponent<React.RefAttributes<unknown>>\n | React.ComponentType<any>;\n\n // TODO: This ensures sync doesn't use React.lazy, but it's not ideal.\n if (EXPO_ROUTER_IMPORT_MODE === 'lazy') {\n ScreenComponent = React.lazy(async () => {\n const res = value.loadRoute();\n return fromLoadedRoute(value, res) as Promise<{\n default: React.ComponentType<any>;\n }>;\n });\n\n if (__DEV__) {\n ScreenComponent.displayName = `AsyncRoute(${value.route})`;\n }\n } else {\n const res = value.loadRoute();\n ScreenComponent = fromImport(value, res).default!;\n }\n function BaseRoute({\n // Remove these React Navigation props to\n // enforce usage of expo-router hooks (where the query params are correct).\n route,\n navigation,\n\n // Pass all other props to the component\n ...props\n }: any) {\n const stateForPath = useStateForPath();\n const isFocused = navigation.isFocused();\n const store = useExpoRouterStore();\n\n if (isFocused) {\n const state = navigation.getState();\n const isLeaf = !('state' in state.routes[state.index]);\n if (isLeaf && stateForPath) store.setFocusedState(stateForPath);\n }\n\n useEffect(\n () =>\n navigation.addListener('focus', () => {\n const state = navigation.getState();\n const isLeaf = !('state' in state.routes[state.index]);\n // Because setFocusedState caches the route info, this call will only trigger rerenders\n // if the component itself didn’t rerender and the route info changed.\n // Otherwise, the update from the `if` above will handle it,\n // and this won’t cause a redundant second update.\n if (isLeaf && stateForPath) store.setFocusedState(stateForPath);\n }),\n [navigation]\n );\n\n useEffect(() => {\n return navigation.addListener(\n 'transitionEnd',\n (e?: NativeStackNavigationEventMap['transitionEnd']) => {\n if (!e?.data?.closing) {\n // When navigating to a screen, remove the no animation param to re-enable animations\n // Otherwise the navigation back would also have no animation\n if (hasParam(route?.params, INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME)) {\n navigation.replaceParams(\n removeParams(route?.params, [INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME])\n );\n }\n }\n }\n );\n }, [navigation]);\n\n return (\n <Route node={value} route={route}>\n <ZoomTransitionEnabler route={route} />\n <ZoomTransitionTargetContextProvider route={route}>\n <React.Suspense fallback={<SuspenseFallback route={value} />}>\n <ScreenComponent\n {...props}\n // Expose the template segment path, e.g. `(home)`, `[foo]`, `index`\n // the intention is to make it possible to deduce shared routes.\n segment={value.route}\n />\n </React.Suspense>\n </ZoomTransitionTargetContextProvider>\n </Route>\n );\n }\n\n if (__DEV__) {\n BaseRoute.displayName = `Route(${value.route})`;\n }\n\n qualifiedStore.set(value, BaseRoute);\n return BaseRoute;\n}\n\nexport function screenOptionsFactory(\n route: RouteNode,\n options?: ScreenProps['options']\n): ScreenProps['options'] {\n return (args) => {\n // Only eager load generated components\n const staticOptions = route.generated ? route.loadRoute()?.getNavOptions : null;\n const staticResult = typeof staticOptions === 'function' ? staticOptions(args) : staticOptions;\n const dynamicResult = typeof options === 'function' ? options?.(args) : options;\n const output = {\n ...staticResult,\n ...dynamicResult,\n };\n\n // Prevent generated screens from showing up in the tab bar.\n if (route.internal) {\n output.tabBarItemStyle = { display: 'none' };\n output.tabBarButton = () => null;\n // TODO: React Navigation doesn't provide a way to prevent rendering the drawer item.\n output.drawerItemStyle = { height: 0, display: 'none' };\n }\n\n return output;\n };\n}\n\nexport function routeToScreen(\n route: RouteNode,\n { options, getId, ...props }: Partial<ScreenProps> = {}\n) {\n return (\n <Screen\n {...props}\n name={route.route}\n key={route.route}\n getId={getId}\n options={screenOptionsFactory(route, options)}\n getComponent={() => getQualifiedRouteComponent(route)}\n />\n );\n}\n\nexport function getSingularId(name: string, options: Record<string, any> = {}) {\n return name\n .split('/')\n .map((segment) => {\n if (segment.startsWith('[...')) {\n return options.params?.[segment.slice(4, -1)]?.join('/') || segment;\n } else if (segment.startsWith('[') && segment.endsWith(']')) {\n return options.params?.[segment.slice(1, -1)] || segment;\n } else {\n return segment;\n }\n })\n .join('/');\n}\n"]}
|
package/build/utils/url.d.ts
CHANGED
|
@@ -5,4 +5,5 @@
|
|
|
5
5
|
export declare function hasUrlProtocolPrefix(href: string): boolean;
|
|
6
6
|
export declare function isWellKnownUri(href: string): boolean;
|
|
7
7
|
export declare function shouldLinkExternally(href: string): boolean;
|
|
8
|
+
export declare function parseUrlUsingCustomBase(href: string): URL;
|
|
8
9
|
//# sourceMappingURL=url.d.ts.map
|
package/build/utils/url.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKpD;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG1D"}
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKpD;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG1D;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAOzD"}
|
package/build/utils/url.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.hasUrlProtocolPrefix = hasUrlProtocolPrefix;
|
|
4
4
|
exports.isWellKnownUri = isWellKnownUri;
|
|
5
5
|
exports.shouldLinkExternally = shouldLinkExternally;
|
|
6
|
+
exports.parseUrlUsingCustomBase = parseUrlUsingCustomBase;
|
|
6
7
|
/**
|
|
7
8
|
* Does the input string start with a valid URL scheme.
|
|
8
9
|
* NOTE: Additional strictness added to ensure URLs sent in query parameters for in-app navigation are not matched.
|
|
@@ -20,4 +21,12 @@ function shouldLinkExternally(href) {
|
|
|
20
21
|
// Cheap check first to avoid regex if the href is not a path fragment.
|
|
21
22
|
return !href.startsWith('.') && (hasUrlProtocolPrefix(href) || isWellKnownUri(href));
|
|
22
23
|
}
|
|
24
|
+
function parseUrlUsingCustomBase(href) {
|
|
25
|
+
// NOTE(@kitten): This used to use a dummy base URL for parsing (phony [.] example)
|
|
26
|
+
// However, this seems to get flagged since it's preserved 1:1 in the output bytecode by certain scanners
|
|
27
|
+
// Instead, we use an empty `file:` URL. This will still perform `pathname` normalization, search parameter parsing
|
|
28
|
+
// encoding, and all other logic, except the logic that applies to hostnames and protocols, and also not leave a
|
|
29
|
+
// dummy URL in the output bytecode
|
|
30
|
+
return new URL(href, 'file:');
|
|
31
|
+
}
|
|
23
32
|
//# sourceMappingURL=url.js.map
|
package/build/utils/url.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":";;AAIA,oDAEC;AAED,wCAKC;AAED,oDAGC;
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":";;AAIA,oDAEC;AAED,wCAKC;AAED,oDAGC;AAED,0DAOC;AA3BD;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,IAAY;IAC/C,OAAO,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3C,CAAC;AAED,SAAgB,cAAc,CAAC,IAAY;IACzC,mHAAmH;IACnH,8HAA8H;IAC9H,mGAAmG;IACnG,OAAO,yEAAyE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9F,CAAC;AAED,SAAgB,oBAAoB,CAAC,IAAY;IAC/C,uEAAuE;IACvE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;AACvF,CAAC;AAED,SAAgB,uBAAuB,CAAC,IAAY;IAClD,mFAAmF;IACnF,yGAAyG;IACzG,mHAAmH;IACnH,gHAAgH;IAChH,mCAAmC;IACnC,OAAO,IAAI,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAChC,CAAC","sourcesContent":["/**\n * Does the input string start with a valid URL scheme.\n * NOTE: Additional strictness added to ensure URLs sent in query parameters for in-app navigation are not matched.\n */\nexport function hasUrlProtocolPrefix(href: string): boolean {\n return /^([\\w\\d_+.-]+:)?\\/\\//.test(href);\n}\n\nexport function isWellKnownUri(href: string): boolean {\n // This is a hack and we should change this to work like the web in the future where we have full confidence in the\n // ability to match URLs and send anything unmatched to the OS. The main difference between this and `hasUrlProtocolPrefix` is\n // that we don't require `//`, e.g. `mailto:` is valid and common, and `mailto://bacon` is invalid.\n return /^(https?|mailto|tel|sms|geo|maps|market|itmss?|itms-apps|content|file):/.test(href);\n}\n\nexport function shouldLinkExternally(href: string): boolean {\n // Cheap check first to avoid regex if the href is not a path fragment.\n return !href.startsWith('.') && (hasUrlProtocolPrefix(href) || isWellKnownUri(href));\n}\n\nexport function parseUrlUsingCustomBase(href: string): URL {\n // NOTE(@kitten): This used to use a dummy base URL for parsing (phony [.] example)\n // However, this seems to get flagged since it's preserved 1:1 in the output bytecode by certain scanners\n // Instead, we use an empty `file:` URL. This will still perform `pathname` normalization, search parameter parsing\n // encoding, and all other logic, except the logic that applies to hostnames and protocols, and also not leave a\n // dummy URL in the output bytecode\n return new URL(href, 'file:');\n}\n"]}
|
package/expo-module.config.json
CHANGED
|
@@ -149,7 +149,7 @@ class LinkPreviewNativeActionView: ExpoView, LinkPreviewMenuUpdatable {
|
|
|
149
149
|
#if RCT_NEW_ARCH_ENABLED
|
|
150
150
|
override func mountChildComponentView(_ childComponentView: UIView, index: Int) {
|
|
151
151
|
if let childActionView = childComponentView as? LinkPreviewNativeActionView {
|
|
152
|
-
subActions.
|
|
152
|
+
subActions.insert(childActionView, at: index)
|
|
153
153
|
childActionView.parentMenuUpdatable = self
|
|
154
154
|
} else {
|
|
155
155
|
print(
|
|
@@ -3,6 +3,7 @@ import ExpoModulesCore
|
|
|
3
3
|
public class LinkPreviewNativeModule: Module {
|
|
4
4
|
static let moduleName: String = "ExpoRouterNativeLinkPreview"
|
|
5
5
|
lazy var zoomSourceRepository = LinkZoomTransitionsSourceRepository()
|
|
6
|
+
lazy var zoomAlignmentViewRepository = LinkZoomTransitionsAlignmentViewRepository()
|
|
6
7
|
|
|
7
8
|
public func definition() -> ModuleDefinition {
|
|
8
9
|
Name(LinkPreviewNativeModule.moduleName)
|
|
@@ -116,6 +117,16 @@ public class LinkPreviewNativeModule: Module {
|
|
|
116
117
|
view.isPreventingInteractiveDismissal = prevent
|
|
117
118
|
}
|
|
118
119
|
}
|
|
120
|
+
|
|
121
|
+
View(LinkZoomTransitionAlignmentRectDetector.self) {
|
|
122
|
+
Prop("identifier") {
|
|
123
|
+
(view: LinkZoomTransitionAlignmentRectDetector, identifier: String) in
|
|
124
|
+
view.identifier = identifier
|
|
125
|
+
}
|
|
126
|
+
Prop("disableForceFlatten") { (_: LinkZoomTransitionAlignmentRectDetector, _: Bool) in
|
|
127
|
+
// This prop is used in ExpoShadowNode in order to disable force flattening, when display: contents is used
|
|
128
|
+
}
|
|
129
|
+
}
|
|
119
130
|
}
|
|
120
131
|
}
|
|
121
132
|
|