expo-router 56.2.2 → 56.2.4
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/global-state/router.d.ts +5 -2
- package/build/global-state/router.d.ts.map +1 -1
- package/build/global-state/router.js.map +1 -1
- package/build/hooks/useRootNavigationState.d.ts +7 -2
- package/build/hooks/useRootNavigationState.d.ts.map +1 -1
- package/build/hooks/useRootNavigationState.js +7 -2
- package/build/hooks/useRootNavigationState.js.map +1 -1
- package/build/layouts/stack-utils/toolbar/StackToolbarButton/types.d.ts +3 -3
- package/build/layouts/stack-utils/toolbar/StackToolbarButton/types.d.ts.map +1 -1
- package/build/layouts/stack-utils/toolbar/StackToolbarButton/types.js.map +1 -1
- package/build/layouts/stack-utils/toolbar/StackToolbarMenu/types.d.ts +4 -4
- package/build/layouts/stack-utils/toolbar/StackToolbarMenu/types.d.ts.map +1 -1
- package/build/layouts/stack-utils/toolbar/StackToolbarMenu/types.js.map +1 -1
- package/build/link/elements.d.ts +3 -3
- package/build/link/elements.d.ts.map +1 -1
- package/build/link/elements.js.map +1 -1
- package/build/link/href.d.ts.map +1 -1
- package/build/link/href.js +4 -1
- package/build/link/href.js.map +1 -1
- package/build/link/preview/native.d.ts +2 -2
- package/build/link/preview/native.d.ts.map +1 -1
- package/build/link/preview/native.js.map +1 -1
- package/build/native-tabs/utils/materialIconConverter-not-implemented.d.ts +3 -0
- package/build/native-tabs/utils/materialIconConverter-not-implemented.d.ts.map +1 -0
- package/build/native-tabs/utils/materialIconConverter-not-implemented.js +7 -0
- package/build/native-tabs/utils/materialIconConverter-not-implemented.js.map +1 -0
- package/build/navigationEvents/types.d.ts +1 -0
- package/build/navigationEvents/types.d.ts.map +1 -1
- package/build/navigationEvents/types.js.map +1 -1
- package/build/toolbar/native.types.d.ts +2 -2
- package/build/toolbar/native.types.d.ts.map +1 -1
- package/build/toolbar/native.types.js.map +1 -1
- package/build/useFocusEffect.d.ts +5 -2
- package/build/useFocusEffect.d.ts.map +1 -1
- package/build/useFocusEffect.js +7 -4
- package/build/useFocusEffect.js.map +1 -1
- package/build/useNavigation.d.ts +6 -4
- package/build/useNavigation.d.ts.map +1 -1
- package/build/useNavigation.js +6 -4
- package/build/useNavigation.js.map +1 -1
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +8 -3
- package/build/useScreens.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.2/expo.modules.router-56.2.2.module → 56.2.4/expo.modules.router-56.2.4.module} +7 -7
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.4/expo.modules.router-56.2.4.module.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.4/expo.modules.router-56.2.4.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.4/expo.modules.router-56.2.4.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.4/expo.modules.router-56.2.4.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.2/expo.modules.router-56.2.2.pom → 56.2.4/expo.modules.router-56.2.4.pom} +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.4/expo.modules.router-56.2.4.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.4/expo.modules.router-56.2.4.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.4/expo.modules.router-56.2.4.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.4/expo.modules.router-56.2.4.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 +11 -12
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.2/expo.modules.router-56.2.2.module.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.2/expo.modules.router-56.2.2.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.2/expo.modules.router-56.2.2.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.2/expo.modules.router-56.2.2.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.2/expo.modules.router-56.2.2.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.2/expo.modules.router-56.2.2.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.2/expo.modules.router-56.2.2.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.2/expo.modules.router-56.2.2.pom.sha512 +0 -1
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.2/expo.modules.router-56.2.2-sources.jar → 56.2.4/expo.modules.router-56.2.4-sources.jar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.2/expo.modules.router-56.2.2-sources.jar.md5 → 56.2.4/expo.modules.router-56.2.4-sources.jar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.2/expo.modules.router-56.2.2-sources.jar.sha1 → 56.2.4/expo.modules.router-56.2.4-sources.jar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.2/expo.modules.router-56.2.2-sources.jar.sha256 → 56.2.4/expo.modules.router-56.2.4-sources.jar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.2/expo.modules.router-56.2.2-sources.jar.sha512 → 56.2.4/expo.modules.router-56.2.4-sources.jar.sha512} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.2/expo.modules.router-56.2.2.aar → 56.2.4/expo.modules.router-56.2.4.aar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.2/expo.modules.router-56.2.2.aar.md5 → 56.2.4/expo.modules.router-56.2.4.aar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.2/expo.modules.router-56.2.2.aar.sha1 → 56.2.4/expo.modules.router-56.2.4.aar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.2/expo.modules.router-56.2.2.aar.sha256 → 56.2.4/expo.modules.router-56.2.4.aar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.2/expo.modules.router-56.2.2.aar.sha512 → 56.2.4/expo.modules.router-56.2.4.aar.sha512} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../../src/link/preview/native.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../../src/link/preview/native.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAwDb,0DAaC;AA4BD,8CAKC;AAYD,4DAaC;AAeD,8DAcC;AAyBD,4DAaC;AASD,0FAgBC;;AAzND,+BAAyD;AACzD,iCAAyD;AACzD,+CAAqF;AAIrF,kEAAkE;AAClE,MAAM,uBAAuB,GAC3B,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,CAAC,uBAAQ,CAAC,IAAI,IAAK,MAAc,CAAC,aAAa,KAAK,IAAI,CAAC;AAyC5F,MAAM,2BAA2B,GAEtB,uBAAuB;IAChC,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,6BAA6B,CAAC;IACjF,CAAC,CAAC,IAAI,CAAC;AACT,SAAgB,uBAAuB,CAAC,KAAmC;IACzE,IAAI,CAAC,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C;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,uBAAC,mCAAmC,OAC9B,KAAK,EACT,mBAAmB,QACnB,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,GAC9B,CACH,CAAC;AACJ,CAAC;AAqBD,MAAM,kCAAkC,GACtC,uBAAuB;IACrB,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,0BAA0B,CAAC;IAC9E,CAAC,CAAC,IAAI,CAAC;AACX,SAAgB,wBAAwB,CAAC,KAAoC;IAC3E,IAAI,CAAC,kCAAkC,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,uBAAC,kCAAkC,OAC7B,KAAK,EACT,mBAAmB,QACnB,WAAW,EAAE,KAAK,EAClB,mBAAmB,EAAE,KAAK,EAC1B,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,GAC9B,CACH,CAAC;AACJ,CAAC;AACD,aAAa;AAEb,wCAAwC;AACxC,MAAM,6CAA6C,GAExC,uBAAuB;IAChC,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,yCAAyC,CAAC;IAC7F,CAAC,CAAC,gBAAQ,CAAC;AACb,SAAgB,uCAAuC,CAAC,KAGvD;IACC,IAAI,CAAC,6CAA6C,EAAE,CAAC;QACnD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,uBAAC,6CAA6C,OACxC,KAAK,EACT,mBAAmB,QACnB,WAAW,EAAE,KAAK,EAClB,mBAAmB,EAAE,KAAK,EAC1B,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,GAC9B,CACH,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { requireNativeView, type SharedRef } from 'expo';\nimport { Fragment, type PropsWithChildren } from 'react';\nimport { Platform, StyleSheet, type ViewProps, type ColorValue } from 'react-native';\n\nimport type { BasicTextStyle } from '../../utils/font';\n\n// TODO(@kitten): Replace with `globalThis`, add typings in `expo`\nconst areNativeViewsAvailable =\n process.env.EXPO_OS === 'ios' && !Platform.isTV && (global as any).RN$Bridgeless === true;\n\n// #region Action View\nexport interface NativeLinkPreviewActionProps {\n identifier: string;\n title: string;\n label?: string;\n icon?: string;\n xcassetName?: string;\n image?: SharedRef<'image'> | null;\n imageRenderingMode?: 'template' | 'original';\n children?: React.ReactNode;\n disabled?: boolean;\n destructive?: boolean;\n discoverabilityLabel?: string;\n subtitle?: string;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n // This may lead to race conditions, when two menu actions are on at the same time.\n // The logic should be enforced in the JS code, rather than in the native code.\n // singleSelection?: boolean;\n displayAsPalette?: boolean;\n displayInline?: boolean;\n preferredElementSize?: 'auto' | 'small' | 'medium' | 'large';\n isOn?: boolean;\n // There are issues with menu state updates when keep presented is set to true.\n // When updating the context menu state, it will either not update or it will recreate the menu. The latter is a problem,\n // because it will close all opened submenus and reset the scroll position.\n // TODO: (@ubax) find a way to fix this.\n keepPresented?: boolean;\n hidden?: boolean;\n tintColor?: ColorValue;\n barButtonItemStyle?: 'plain' | 'prominent';\n\n // These properties are for UIBarButtonItem compatibility but don't apply to context menus.\n // They're included for API consistency with toolbar items.\n sharesBackground?: boolean;\n hidesSharedBackground?: boolean;\n onSelected: () => void;\n titleStyle?: BasicTextStyle;\n}\nconst LinkPreviewNativeActionView: React.ComponentType<\n Omit<NativeLinkPreviewActionProps, 'image'> & { image?: number }\n> | null = areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'LinkPreviewNativeActionView')\n : null;\nexport function NativeLinkPreviewAction(props: NativeLinkPreviewActionProps) {\n if (!LinkPreviewNativeActionView) {\n return null;\n }\n // Needed to pass shared object ID to native side\n const imageObjectId = (\n props.image as\n | {\n __expo_shared_object_id__: number;\n }\n | undefined\n )?.__expo_shared_object_id__;\n return <LinkPreviewNativeActionView {...props} image={imageObjectId} />;\n}\n// #endregion\n\n// #region Preview View\nexport interface TabPath {\n oldTabKey: string;\n newTabKey: string;\n}\nexport interface NativeLinkPreviewProps extends ViewProps {\n nextScreenId: string | undefined;\n tabPath:\n | {\n path: TabPath[];\n }\n | undefined;\n disableForceFlatten?: boolean;\n onWillPreviewOpen?: () => void;\n onDidPreviewOpen?: () => void;\n onPreviewWillClose?: () => void;\n onPreviewDidClose?: () => void;\n onPreviewTapped?: () => void;\n onPreviewTappedAnimationCompleted?: () => void;\n children: React.ReactNode;\n}\nconst NativeLinkPreviewView: React.ComponentType<NativeLinkPreviewProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewView')\n : null;\nexport function NativeLinkPreview(props: NativeLinkPreviewProps) {\n if (!NativeLinkPreviewView) {\n return null;\n }\n return <NativeLinkPreviewView {...props} />;\n}\n// #endregion\n\n// #region Preview Content View\nexport interface NativeLinkPreviewContentProps extends ViewProps {\n preferredContentSize?: { width: number; height: number };\n}\nconst NativeLinkPreviewContentView: React.ComponentType<NativeLinkPreviewContentProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewContentView')\n : null;\n\nexport function NativeLinkPreviewContent(props: NativeLinkPreviewContentProps) {\n if (!NativeLinkPreviewContentView) {\n return null;\n }\n const style = StyleSheet.flatten([\n props.style,\n {\n position: 'absolute',\n top: 0,\n left: 0,\n } as const,\n ]);\n return <NativeLinkPreviewContentView {...props} style={style} />;\n}\n// #endregion\n\n// #region Zoom transition enabler\ninterface DismissalBoundsRect {\n minX?: number;\n maxX?: number;\n minY?: number;\n maxY?: number;\n}\nconst LinkZoomTransitionEnablerNativeView: React.ComponentType<\n ViewProps & { zoomTransitionSourceIdentifier: string; disableForceFlatten?: boolean }\n> | null = areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionEnabler')\n : null;\nexport function LinkZoomTransitionEnabler(props: {\n zoomTransitionSourceIdentifier: string;\n dismissalBoundsRect?: DismissalBoundsRect | null;\n}) {\n if (!LinkZoomTransitionEnablerNativeView) {\n return null;\n }\n return (\n <LinkZoomTransitionEnablerNativeView\n {...props}\n disableForceFlatten\n style={{ display: 'contents' }}\n />\n );\n}\n// #endregion\n\n// #region Zoom transition source\ninterface LinkSourceAlignmentRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\ninterface LinkZoomTransitionSourceProps extends PropsWithChildren {\n identifier: string;\n alignment?: LinkSourceAlignmentRect;\n animateAspectRatioChange?: boolean;\n}\n\ninterface LinkZoomTransitionSourceNativeProps extends ViewProps, LinkZoomTransitionSourceProps {\n disableForceFlatten?: boolean;\n}\n\nconst LinkZoomTransitionSourceNativeView: React.ComponentType<LinkZoomTransitionSourceNativeProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionSource')\n : null;\nexport function LinkZoomTransitionSource(props: LinkZoomTransitionSourceProps) {\n if (!LinkZoomTransitionSourceNativeView) {\n return null;\n }\n return (\n <LinkZoomTransitionSourceNativeView\n {...props}\n disableForceFlatten\n collapsable={false}\n collapsableChildren={false}\n style={{ display: 'contents' }}\n />\n );\n}\n// #endregion\n\n// #region Zoom transition rect detector\nconst LinkZoomTransitionAlignmentRectDetectorNative: React.ComponentType<\n ViewProps & { identifier: string; disableForceFlatten?: boolean; children?: React.ReactNode }\n> | null = areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionAlignmentRectDetector')\n : Fragment;\nexport function LinkZoomTransitionAlignmentRectDetector(props: {\n identifier: string;\n children: React.ReactNode;\n}) {\n if (!LinkZoomTransitionAlignmentRectDetectorNative) {\n return null;\n }\n return (\n <LinkZoomTransitionAlignmentRectDetectorNative\n {...props}\n disableForceFlatten\n collapsable={false}\n collapsableChildren={false}\n style={{ display: 'contents' }}\n />\n );\n}\n// #endregion\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { convertMaterialIconNameToImageSource as BaseType } from './materialIconConverter';
|
|
2
|
+
export declare function convertMaterialIconNameToImageSource(..._args: Parameters<typeof BaseType>): ReturnType<typeof BaseType>;
|
|
3
|
+
//# sourceMappingURL=materialIconConverter-not-implemented.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materialIconConverter-not-implemented.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/utils/materialIconConverter-not-implemented.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oCAAoC,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEhG,wBAAgB,oCAAoC,CAClD,GAAG,KAAK,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,GACpC,UAAU,CAAC,OAAO,QAAQ,CAAC,CAI7B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertMaterialIconNameToImageSource = convertMaterialIconNameToImageSource;
|
|
4
|
+
function convertMaterialIconNameToImageSource(..._args) {
|
|
5
|
+
throw new Error('NativeTabs `md` (Material Symbols) icons are not available. Material Symbols support was disabled via EXPO_ROUTER_DISABLE_NATIVE_TABS_MD. Use the `src` or `drawable` icon prop instead or remove the EXPO_ROUTER_DISABLE_NATIVE_TABS_MD.');
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=materialIconConverter-not-implemented.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materialIconConverter-not-implemented.js","sourceRoot":"","sources":["../../../src/native-tabs/utils/materialIconConverter-not-implemented.tsx"],"names":[],"mappings":";;AAKA,oFAMC;AAND,SAAgB,oCAAoC,CAClD,GAAG,KAAkC;IAErC,MAAM,IAAI,KAAK,CACb,2OAA2O,CAC5O,CAAC;AACJ,CAAC","sourcesContent":["// This module is the swap target when EXPO_ROUTER_DISABLE_NATIVE_TABS_MD is set on Android, which lets the\n// Metro resolver tree-shake `expo-symbols` from the Android bundle. The type-only `expo-symbols`\n// import below is erased by the compiler, so no runtime dependency is introduced.\nimport type { convertMaterialIconNameToImageSource as BaseType } from './materialIconConverter';\n\nexport function convertMaterialIconNameToImageSource(\n ..._args: Parameters<typeof BaseType>\n): ReturnType<typeof BaseType> {\n throw new Error(\n 'NativeTabs `md` (Material Symbols) icons are not available. Material Symbols support was disabled via EXPO_ROUTER_DISABLE_NATIVE_TABS_MD. Use the `src` or `drawable` icon prop instead or remove the EXPO_ROUTER_DISABLE_NATIVE_TABS_MD.'\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/navigationEvents/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC1C,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/navigationEvents/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,kBAAkB,CAAC;IACzB,8EAA8E;IAC9E,UAAU,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACrC,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACrC,KAAK,EAAE,oBAAoB,CAAC;CAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/navigationEvents/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNavigationState } from '../global-state/types';\nimport type { NavigationAction } from '../react-navigation';\n\nexport interface BasePageEvent {\n pathname: string;\n params: Record<string, string | string[]>;\n screenId: string;\n}\n\n/**\n * The page rendered as part of a preload (e.g. `router.prefetch()`) and is not\n * currently focused. If the user later navigates to this route, the matching\n * `pageFocused` will fire then; the preload may also be invalidated or the\n * route unmounted (`pageRemoved`) without a focus.\n */\nexport interface PagePreloadedEvent extends BasePageEvent {\n type: 'pagePreloaded';\n}\n\nexport interface PageFocusedEvent extends BasePageEvent {\n type: 'pageFocused';\n}\n\nexport interface PageBlurredEvent extends BasePageEvent {\n type: 'pageBlurred';\n}\n\nexport interface PageRemoved extends BasePageEvent {\n type: 'pageRemoved';\n}\n\nexport interface ActionDispatchedEvent {\n type: 'actionDispatched';\n /** The action type from the dispatched NavigationAction (e.g. `NAVIGATE`). */\n actionType: NavigationAction['type'];\n payload: NavigationAction['payload'];\n state: ReactNavigationState;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/navigationEvents/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNavigationState } from '../global-state/types';\nimport type { NavigationAction } from '../react-navigation';\n\nexport interface BasePageEvent {\n pathname: string;\n params: Record<string, string | string[]>;\n screenId: string;\n segments: string[];\n}\n\n/**\n * The page rendered as part of a preload (e.g. `router.prefetch()`) and is not\n * currently focused. If the user later navigates to this route, the matching\n * `pageFocused` will fire then; the preload may also be invalidated or the\n * route unmounted (`pageRemoved`) without a focus.\n */\nexport interface PagePreloadedEvent extends BasePageEvent {\n type: 'pagePreloaded';\n}\n\nexport interface PageFocusedEvent extends BasePageEvent {\n type: 'pageFocused';\n}\n\nexport interface PageBlurredEvent extends BasePageEvent {\n type: 'pageBlurred';\n}\n\nexport interface PageRemoved extends BasePageEvent {\n type: 'pageRemoved';\n}\n\nexport interface ActionDispatchedEvent {\n type: 'actionDispatched';\n /** The action type from the dispatched NavigationAction (e.g. `NAVIGATE`). */\n actionType: NavigationAction['type'];\n payload: NavigationAction['payload'];\n state: ReactNavigationState;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SharedRef } from 'expo';
|
|
2
2
|
import type { ColorValue, ImageSourcePropType } from 'react-native';
|
|
3
3
|
import type { SFSymbol } from 'sf-symbols-typescript';
|
|
4
4
|
import type { BasicTextStyle } from '../utils/font';
|
|
@@ -13,7 +13,7 @@ export interface RouterToolbarItemProps {
|
|
|
13
13
|
title?: string;
|
|
14
14
|
systemImageName?: SFSymbol;
|
|
15
15
|
xcassetName?: string;
|
|
16
|
-
image?:
|
|
16
|
+
image?: SharedRef<'image'> | null;
|
|
17
17
|
imageRenderingMode?: 'template' | 'original';
|
|
18
18
|
type?: 'normal' | 'fixedSpacer' | 'fluidSpacer' | 'searchBar';
|
|
19
19
|
tintColor?: ColorValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.types.d.ts","sourceRoot":"","sources":["../../src/toolbar/native.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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AAE;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,eAAe,CAAC,EAAE,UAAU,CAAC;KAC9B,GAAG,cAAc,CAAC;IACnB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.types.js","sourceRoot":"","sources":["../../src/toolbar/native.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"native.types.js","sourceRoot":"","sources":["../../src/toolbar/native.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { SharedRef } from 'expo';\nimport type { ColorValue, ImageSourcePropType } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport type { BasicTextStyle } from '../utils/font';\n\nexport interface RouterToolbarHostProps {\n children?: React.ReactNode;\n withImePadding?: boolean;\n backgroundColor?: ColorValue;\n}\n\nexport interface RouterToolbarItemProps {\n children?: React.ReactNode;\n identifier: string;\n title?: string;\n systemImageName?: SFSymbol;\n xcassetName?: string;\n image?: SharedRef<'image'> | null;\n imageRenderingMode?: 'template' | 'original';\n type?: 'normal' | 'fixedSpacer' | 'fluidSpacer' | 'searchBar';\n tintColor?: ColorValue;\n hidesSharedBackground?: boolean;\n sharesBackground?: boolean;\n barButtonItemStyle?: 'plain' | 'prominent';\n width?: number;\n hidden?: boolean;\n selected?: boolean;\n possibleTitles?: string[];\n // Right now this does not seem to work\n badgeConfiguration?: {\n value?: string;\n backgroundColor?: ColorValue;\n } & BasicTextStyle;\n titleStyle?: BasicTextStyle;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n disabled?: boolean;\n onSelected?: () => void;\n /**\n * Raw image source for Android toolbar rendering.\n * On iOS this prop is ignored — icons are resolved via `systemImageName`, `xcassetName`, or `image`.\n */\n source?: ImageSourcePropType;\n}\n"]}
|
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
export type EffectCallback = () => undefined | void | (() => void);
|
|
5
5
|
/**
|
|
6
6
|
* Hook to run an effect whenever a route is **focused**. Similar to
|
|
7
|
-
* [`React.useEffect`](https://react.dev/reference/react/useEffect)
|
|
7
|
+
* [`React.useEffect`](https://react.dev/reference/react/useEffect), but the effect re-runs
|
|
8
|
+
* each time the screen comes into focus, and the optional cleanup function runs when the
|
|
9
|
+
* screen loses focus — not on unmount. This makes it the right primitive for refetching
|
|
10
|
+
* data, restarting subscriptions, or resetting transient screen state every time a user
|
|
11
|
+
* returns to the route.
|
|
8
12
|
*
|
|
9
|
-
* This can be used to perform side-effects such as fetching data or subscribing to events.
|
|
10
13
|
* The passed callback should be wrapped in [`React.useCallback`](https://react.dev/reference/react/useCallback)
|
|
11
14
|
* to avoid running the effect too often.
|
|
12
15
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusEffect.d.ts","sourceRoot":"","sources":["../src/useFocusEffect.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;AAEnE
|
|
1
|
+
{"version":3,"file":"useFocusEffect.d.ts","sourceRoot":"","sources":["../src/useFocusEffect.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,yBAAyB,CAAC,EAAE,KAAK,QAuGvF"}
|
package/build/useFocusEffect.js
CHANGED
|
@@ -42,9 +42,12 @@ const useLoadedNavigation_1 = require("./link/useLoadedNavigation");
|
|
|
42
42
|
const useNavigation_1 = require("./useNavigation");
|
|
43
43
|
/**
|
|
44
44
|
* Hook to run an effect whenever a route is **focused**. Similar to
|
|
45
|
-
* [`React.useEffect`](https://react.dev/reference/react/useEffect)
|
|
45
|
+
* [`React.useEffect`](https://react.dev/reference/react/useEffect), but the effect re-runs
|
|
46
|
+
* each time the screen comes into focus, and the optional cleanup function runs when the
|
|
47
|
+
* screen loses focus — not on unmount. This makes it the right primitive for refetching
|
|
48
|
+
* data, restarting subscriptions, or resetting transient screen state every time a user
|
|
49
|
+
* returns to the route.
|
|
46
50
|
*
|
|
47
|
-
* This can be used to perform side-effects such as fetching data or subscribing to events.
|
|
48
51
|
* The passed callback should be wrapped in [`React.useCallback`](https://react.dev/reference/react/useCallback)
|
|
49
52
|
* to avoid running the effect too often.
|
|
50
53
|
*
|
|
@@ -85,7 +88,7 @@ function useFocusEffect(effect, do_not_pass_a_second_prop) {
|
|
|
85
88
|
' // Your code here\n' +
|
|
86
89
|
' }, [depA, depB])\n' +
|
|
87
90
|
');\n\n' +
|
|
88
|
-
'See usage guide: https://
|
|
91
|
+
'See usage guide: https://docs.expo.dev/versions/latest/sdk/router/#usefocuseffecteffect-do_not_pass_a_second_prop';
|
|
89
92
|
console.error(message);
|
|
90
93
|
}
|
|
91
94
|
React.useEffect(() => {
|
|
@@ -120,7 +123,7 @@ function useFocusEffect(effect, do_not_pass_a_second_prop) {
|
|
|
120
123
|
' fetchData();\n' +
|
|
121
124
|
' }, [someId])\n' +
|
|
122
125
|
');\n\n' +
|
|
123
|
-
'See usage guide: https://
|
|
126
|
+
'See usage guide: https://docs.expo.dev/versions/latest/sdk/router/#usefocuseffecteffect-do_not_pass_a_second_prop';
|
|
124
127
|
}
|
|
125
128
|
else {
|
|
126
129
|
message += ` You returned '${JSON.stringify(destroy)}'.`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusEffect.js","sourceRoot":"","sources":["../src/useFocusEffect.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useFocusEffect.js","sourceRoot":"","sources":["../src/useFocusEffect.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDb,wCAuGC;AAxJD,gFAAgF;AAChF,sEAAsE;AACtE,6CAA+B;AAE/B,oEAAmE;AACnE,mDAAgD;AAOhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,SAAgB,cAAc,CAAC,MAAsB,EAAE,yBAAiC;IACtF,MAAM,kBAAkB,GAAG,IAAA,2CAAqB,GAAE,CAAC;IACnD,MAAM,UAAU,GAAG,IAAA,6BAAa,GAAE,CAAC;IAEnC,IAAI,yBAAyB,KAAK,SAAS,EAAE,CAAC;QAC5C,MAAM,OAAO,GACX,sFAAsF;YACtF,8EAA8E;YAC9E,mBAAmB;YACnB,+BAA+B;YAC/B,yBAAyB;YACzB,sBAAsB;YACtB,QAAQ;YACR,mHAAmH,CAAC;QAEtH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,UAAU,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACvC,OAAO;QACT,CAAC;QAED,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,IAAI,OAAwC,CAAC;QAE7C,MAAM,QAAQ,GAAG,GAAG,EAAE;YACpB,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;YAEzB,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;gBAC3D,OAAO,OAAO,CAAC;YACjB,CAAC;YAED,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,Y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AAO,EAAE,CAAC;YACZ,CAAC;YAED,OAAO,GAAG,SAAS,CAAC;YACpB,SAAS,GAAG,KAAK,CAAC;QACpB,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,gBAAgB,EAAE,CAAC;YACnB,eAAe,EAAE,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["'use client';\n// A fork of `useFocusEffect` that waits for the navigation state to load before\n// running the effect. This is especially useful for native redirects.\nimport * as React from 'react';\n\nimport { useOptionalNavigation } from './link/useLoadedNavigation';\nimport { useNavigation } from './useNavigation';\n\n/**\n * Memoized callback containing the effect, should optionally return a cleanup function.\n */\nexport type EffectCallback = () => undefined | void | (() => void);\n\n/**\n * Hook to run an effect whenever a route is **focused**. Similar to\n * [`React.useEffect`](https://react.dev/reference/react/useEffect), but the effect re-runs\n * each time the screen comes into focus, and the optional cleanup function runs when the\n * screen loses focus — not on unmount. This makes it the right primitive for refetching\n * data, restarting subscriptions, or resetting transient screen state every time a user\n * returns to the route.\n *\n * The passed callback should be wrapped in [`React.useCallback`](https://react.dev/reference/react/useCallback)\n * to avoid running the effect too often.\n *\n * @example\n * ```tsx\n * import { useFocusEffect } from 'expo-router';\n * import { useCallback } from 'react';\n *\n * export default function Route() {\n * useFocusEffect(\n * // Callback should be wrapped in `React.useCallback` to avoid running the effect too often.\n * useCallback(() => {\n * // Invoked whenever the route is focused.\n * console.log(\"Hello, I'm focused!\");\n *\n * // Return function is invoked whenever the route gets out of focus.\n * return () => {\n * console.log('This route is now unfocused.');\n * };\n * }, []),\n * );\n *\n * return </>;\n * }\n *```\n *\n * @param effect Memoized callback containing the effect, should optionally return a cleanup function.\n * @param do_not_pass_a_second_prop\n */\nexport function useFocusEffect(effect: EffectCallback, do_not_pass_a_second_prop?: never) {\n const optionalNavigation = useOptionalNavigation();\n const navigation = useNavigation();\n\n if (do_not_pass_a_second_prop !== undefined) {\n const message =\n \"You passed a second argument to 'useFocusEffect', but it only accepts one argument. \" +\n \"If you want to pass a dependency array, you can use 'React.useCallback':\\n\\n\" +\n 'useFocusEffect(\\n' +\n ' React.useCallback(() => {\\n' +\n ' // Your code here\\n' +\n ' }, [depA, depB])\\n' +\n ');\\n\\n' +\n 'See usage guide: https://docs.expo.dev/versions/latest/sdk/router/#usefocuseffecteffect-do_not_pass_a_second_prop';\n\n console.error(message);\n }\n\n React.useEffect(() => {\n if (!navigation || !optionalNavigation) {\n return;\n }\n\n let isFocused = false;\n let cleanup: undefined | void | (() => void);\n\n const callback = () => {\n const destroy = effect();\n\n if (destroy === undefined || typeof destroy === 'function') {\n return destroy;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n let message =\n 'An effect function must not return anything besides a function, which is used for clean-up.';\n\n if (destroy === null) {\n message +=\n \" You returned 'null'. If your effect does not require clean-up, return 'undefined' (or nothing).\";\n } else if (typeof (destroy as any).then === 'function') {\n message +=\n \"\\n\\nIt looks like you wrote 'useFocusEffect(async () => ...)' or returned a Promise. \" +\n 'Instead, write the async function inside your effect ' +\n 'and call it immediately:\\n\\n' +\n 'useFocusEffect(\\n' +\n ' React.useCallback(() => {\\n' +\n ' async function fetchData() {\\n' +\n ' // You can await here\\n' +\n ' const response = await MyAPI.getData(someId);\\n' +\n ' // ...\\n' +\n ' }\\n\\n' +\n ' fetchData();\\n' +\n ' }, [someId])\\n' +\n ');\\n\\n' +\n 'See usage guide: https://docs.expo.dev/versions/latest/sdk/router/#usefocuseffecteffect-do_not_pass_a_second_prop';\n } else {\n message += ` You returned '${JSON.stringify(destroy)}'.`;\n }\n\n console.error(message);\n }\n };\n\n // We need to run the effect on initial render/dep changes if the screen is focused\n if (navigation.isFocused()) {\n cleanup = callback();\n isFocused = true;\n }\n\n const unsubscribeFocus = navigation.addListener('focus', () => {\n // If callback was already called for focus, avoid calling it again\n // The focus event may also fire on initial render, so we guard against running the effect twice\n if (isFocused) {\n return;\n }\n\n if (cleanup !== undefined) {\n cleanup();\n }\n\n cleanup = callback();\n isFocused = true;\n });\n\n const unsubscribeBlur = navigation.addListener('blur', () => {\n if (cleanup !== undefined) {\n cleanup();\n }\n\n cleanup = undefined;\n isFocused = false;\n });\n\n return () => {\n if (cleanup !== undefined) {\n cleanup();\n }\n\n unsubscribeFocus();\n unsubscribeBlur();\n };\n }, [effect, navigation, optionalNavigation]);\n}\n"]}
|
package/build/useNavigation.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { NavigationProp, NavigationState } from './react-navigation/native';
|
|
2
2
|
import type { Href } from './types';
|
|
3
3
|
/**
|
|
4
|
-
* Returns the
|
|
5
|
-
*
|
|
4
|
+
* Returns the navigation object for the current route. Mirrors the React Navigation
|
|
5
|
+
* [`navigation` object](https://reactnavigation.org/docs/navigation-object). Use it to
|
|
6
|
+
* imperatively access layout-specific functionality like `navigation.openDrawer()` in a
|
|
6
7
|
* [Drawer](/router/advanced/drawer/) layout.
|
|
7
8
|
*
|
|
8
9
|
* @example
|
|
@@ -49,8 +50,9 @@ import type { Href } from './types';
|
|
|
49
50
|
* @param parent Provide an absolute path such as `/(root)` to the parent route or a relative path like `../../` to the parent route.
|
|
50
51
|
* @returns The navigation object for the current route.
|
|
51
52
|
*
|
|
52
|
-
* @see
|
|
53
|
-
*
|
|
53
|
+
* @see The full navigation API is available directly from `expo-router` — no
|
|
54
|
+
* `@react-navigation/*` install required. For the navigator-dependent functions reference,
|
|
55
|
+
* see [navigation dependent functions](https://reactnavigation.org/docs/navigation-object/#navigator-dependent-functions).
|
|
54
56
|
*/
|
|
55
57
|
export declare function useNavigation<T = Omit<NavigationProp<ReactNavigation.RootParamList>, 'getState'> & {
|
|
56
58
|
getState(): NavigationState | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigation.d.ts","sourceRoot":"","sources":["../src/useNavigation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC
|
|
1
|
+
{"version":3,"file":"useNavigation.d.ts","sourceRoot":"","sources":["../src/useNavigation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,wBAAgB,aAAa,CAC3B,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,GAAG;IACpE,QAAQ,IAAI,eAAe,GAAG,SAAS,CAAC;CACzC,EACD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,CAAC,CAoF3B"}
|
package/build/useNavigation.js
CHANGED
|
@@ -6,8 +6,9 @@ const utils_1 = require("./global-state/utils");
|
|
|
6
6
|
const href_1 = require("./link/href");
|
|
7
7
|
const native_1 = require("./react-navigation/native");
|
|
8
8
|
/**
|
|
9
|
-
* Returns the
|
|
10
|
-
*
|
|
9
|
+
* Returns the navigation object for the current route. Mirrors the React Navigation
|
|
10
|
+
* [`navigation` object](https://reactnavigation.org/docs/navigation-object). Use it to
|
|
11
|
+
* imperatively access layout-specific functionality like `navigation.openDrawer()` in a
|
|
11
12
|
* [Drawer](/router/advanced/drawer/) layout.
|
|
12
13
|
*
|
|
13
14
|
* @example
|
|
@@ -54,8 +55,9 @@ const native_1 = require("./react-navigation/native");
|
|
|
54
55
|
* @param parent Provide an absolute path such as `/(root)` to the parent route or a relative path like `../../` to the parent route.
|
|
55
56
|
* @returns The navigation object for the current route.
|
|
56
57
|
*
|
|
57
|
-
* @see
|
|
58
|
-
*
|
|
58
|
+
* @see The full navigation API is available directly from `expo-router` — no
|
|
59
|
+
* `@react-navigation/*` install required. For the navigator-dependent functions reference,
|
|
60
|
+
* see [navigation dependent functions](https://reactnavigation.org/docs/navigation-object/#navigator-dependent-functions).
|
|
59
61
|
*/
|
|
60
62
|
function useNavigation(parent) {
|
|
61
63
|
const rnNavigation = (0, native_1.useNavigation)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigation.js","sourceRoot":"","sources":["../src/useNavigation.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"useNavigation.js","sourceRoot":"","sources":["../src/useNavigation.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AA8Db,sCAwFC;AApJD,gDAA8D;AAC9D,sCAA0C;AAE1C,sDAAoG;AAGpG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,SAAgB,aAAa,CAI3B,MAAsB;IACtB,MAAM,YAAY,GAAG,IAAA,sBAAqB,GAAO,CAAC;IAClD,IAAI,UAAU,GAAG,YAAY,CAAC;IAC9B,IAAI,KAAK,GAAG,IAAA,wBAAe,GAAE,CAAC;IAE9B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,iEAAiE;QACjE,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,uEAAuE;IACvE,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;IACrC,IAAI,SAAS,KAAK,EAAE,IAAI,SAAS,KAAK,oCAAoC,EAAE,CAAC;QAC3E,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,GAAG,IAAA,kBAAW,EAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED,IAAI,MAAM,KAAK,GAAG,EAAE,CA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AAK,CAAC,CAAC;QAEtB,iFAAiF;QACjF,wFAAwF;QACxF,IAAI,MAAM,IAAI,CAAC,IAAA,8BAAsB,GAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACzD,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;IAED,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAE1C,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;QAC1C,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,UAAU,GAAG,YAAY,CAAC;YAC1B,MAAM,GAAG,GAA2B,EAAE,CAAC;YACvC,OAAO,UAAU,EAAE,CAAC;gBAClB,IAAI,UAAU,CAAC,KAAK,EAAE;oBAAE,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;gBACrD,UAAU,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;YACtC,CAAC;YAED,MAAM,IAAI,KAAK,CACb,gDAAgD,MAAM,6BAA6B,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CACvG,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["'use client';\n\nimport { getRootStackRouteNames } from './global-state/utils';\nimport { resolveHref } from './link/href';\nimport type { NavigationProp, NavigationState } from './react-navigation/native';\nimport { useNavigation as useUpstreamNavigation, useStateForPath } from './react-navigation/native';\nimport type { Href } from './types';\n\n/**\n * Returns the navigation object for the current route. Mirrors the React Navigation\n * [`navigation` object](https://reactnavigation.org/docs/navigation-object). Use it to\n * imperatively access layout-specific functionality like `navigation.openDrawer()` in a\n * [Drawer](/router/advanced/drawer/) layout.\n *\n * @example\n * ```tsx app/index.tsx\n * import { useNavigation } from 'expo-router';\n *\n * export default function Route() {\n * // Access the current navigation object for the current route.\n * const navigation = useNavigation();\n *\n * return (\n * <View>\n * <Text onPress={() => {\n * // Open the drawer view.\n * navigation.openDrawer();\n * }}>\n * Open Drawer\n * </Text>\n * </View>\n * );\n * }\n * ```\n *\n * When using nested layouts, you can access higher-order layouts by passing a secondary argument denoting the layout route.\n * For example, `/menu/_layout.tsx` is nested inside `/app/orders/`, you can use `useNavigation('/orders/menu/')`.\n *\n * @example\n * ```tsx app/orders/menu/index.tsx\n * import { useNavigation } from 'expo-router';\n *\n * export default function MenuRoute() {\n * const rootLayout = useNavigation('/');\n * const ordersLayout = useNavigation('/orders');\n *\n * // Same as the default results of `useNavigation()` when invoked in this route.\n * const parentLayout = useNavigation('/orders/menu');\n * }\n * ```\n *\n * If you attempt to access a layout that doesn't exist, an error such as\n * `Could not find parent navigation with route \"/non-existent\"` is thrown.\n *\n *\n * @param parent Provide an absolute path such as `/(root)` to the parent route or a relative path like `../../` to the parent route.\n * @returns The navigation object for the current route.\n *\n * @see The full navigation API is available directly from `expo-router` — no\n * `@react-navigation/*` install required. For the navigator-dependent functions reference,\n * see [navigation dependent functions](https://reactnavigation.org/docs/navigation-object/#navigator-dependent-functions).\n */\nexport function useNavigation<\n T = Omit<NavigationProp<ReactNavigation.RootParamList>, 'getState'> & {\n getState(): NavigationState | undefined;\n },\n>(parent?: string | Href): T {\n const rnNavigation = useUpstreamNavigation<any>();\n let navigation = rnNavigation;\n let state = useStateForPath();\n\n if (parent === undefined) {\n // If no parent is provided, return the current navigation object\n return navigation;\n }\n\n // Check for the top-level navigator - we cannot fetch anything higher!\n const currentId = navigation.getId();\n if (currentId === '' || currentId === `/expo-router/build/views/Navigator`) {\n return navigation;\n }\n\n if (typeof parent === 'object') {\n parent = resolveHref(parent);\n }\n\n if (parent === '/') {\n // This is the root navigator\n return navigation.getParent(`/expo-router/build/views/Navigator`) ?? navigation.getParent(``);\n } else if (parent?.startsWith('../')) {\n const names: string[] = [];\n\n while (state) {\n const route = state.routes[0];\n state = route.state;\n // Don't include the last router, as thats the current route\n if (state) {\n names.push(route.name);\n }\n }\n\n // Removing the trailing slash to make splitting easier\n const originalParent = parent;\n if (parent.endsWith('/')) {\n parent = parent.slice(0, -1);\n }\n\n const segments = parent.split('/');\n if (!segments.every((segment) => segment === '..')) {\n throw new Error(\n `Invalid parent path \"${originalParent}\". Only \"../\" segments are allowed when using relative paths.`\n );\n }\n\n const levels = segments.length;\n const index = names.length - 1 - levels;\n\n if (index < 0) {\n throw new Error(\n `Invalid parent path \"${originalParent}\". Cannot go up ${levels} levels from the current route.`\n );\n }\n\n parent = names[index];\n\n // Expo Router navigators use the context key as the name which has a leading `/`\n // The exception to this are the root stack routes, and the root navigator which uses ''\n if (parent && !getRootStackRouteNames().includes(parent)) {\n parent = `/${parent}`;\n }\n }\n\n navigation = navigation.getParent(parent);\n\n if (process.env.NODE_ENV !== 'production') {\n if (!navigation) {\n navigation = rnNavigation;\n const ids: (string | undefined)[] = [];\n while (navigation) {\n if (navigation.getId()) ids.push(navigation.getId());\n navigation = navigation.getParent();\n }\n\n throw new Error(\n `Could not find parent navigation with route \"${parent}\". Available routes are: '${ids.join(\"', '\")}'`\n );\n }\n }\n\n return navigation;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreens.d.ts","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAyB,MAAM,OAAO,CAAC;AAE9C,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,SAAS,CAAC;AAgBtD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAQnD,MAAM,MA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B,GAAG,2BAA2B,CAC5D,EACD,UAAU,CACX,GAAG;YACF,QAAQ,IAAI,eAAe,GAAG,SAAS,CAAC;SACzC,CAAC;KACH;;EAuFF;AA4FD,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,2CAYxD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,UAa5E"}
|
package/build/useScreens.js
CHANGED
|
@@ -271,6 +271,7 @@ function AnalyticsListeners({ navigation, screenId, }) {
|
|
|
271
271
|
navigationEvents_1.unstable_navigationEvents.emit('pagePreloaded', {
|
|
272
272
|
pathname: routeInfo.pathname,
|
|
273
273
|
params: routeInfo.params,
|
|
274
|
+
segments: routeInfo.segments,
|
|
274
275
|
screenId,
|
|
275
276
|
});
|
|
276
277
|
}
|
|
@@ -281,12 +282,13 @@ function AnalyticsListeners({ navigation, screenId, }) {
|
|
|
281
282
|
navigationEvents_1.unstable_navigationEvents.emit('pageRemoved', {
|
|
282
283
|
pathname: routeInfo.pathname,
|
|
283
284
|
params: routeInfo.params,
|
|
285
|
+
segments: routeInfo.segments,
|
|
284
286
|
screenId,
|
|
285
287
|
});
|
|
286
288
|
};
|
|
287
289
|
}
|
|
288
290
|
return () => { };
|
|
289
|
-
}, [routeInfo?.params, routeInfo?.pathname, screenId]);
|
|
291
|
+
}, [routeInfo?.params, routeInfo?.pathname, routeInfo?.segments, screenId]);
|
|
290
292
|
// Emit `pageFocused` from an effect — not during render — so it fires after the
|
|
291
293
|
// focused screen's content has committed. `hasBlurredRef` deduplicates across both paths.
|
|
292
294
|
(0, react_2.useEffect)(() => {
|
|
@@ -294,11 +296,12 @@ function AnalyticsListeners({ navigation, screenId, }) {
|
|
|
294
296
|
navigationEvents_1.unstable_navigationEvents.emit('pageFocused', {
|
|
295
297
|
pathname: routeInfo.pathname,
|
|
296
298
|
params: routeInfo.params,
|
|
299
|
+
segments: routeInfo.segments,
|
|
297
300
|
screenId,
|
|
298
301
|
});
|
|
299
302
|
hasBlurredRef.current = false;
|
|
300
303
|
}
|
|
301
|
-
}, [isFocused, routeInfo?.pathname, routeInfo?.params, screenId]);
|
|
304
|
+
}, [isFocused, routeInfo?.pathname, routeInfo?.params, routeInfo?.segments, screenId]);
|
|
302
305
|
(0, react_2.useEffect)(() => {
|
|
303
306
|
if (routeInfo) {
|
|
304
307
|
const cleanFocus = navigation.addListener('focus', () => {
|
|
@@ -308,6 +311,7 @@ function AnalyticsListeners({ navigation, screenId, }) {
|
|
|
308
311
|
navigationEvents_1.unstable_navigationEvents.emit('pageFocused', {
|
|
309
312
|
pathname: routeInfo.pathname,
|
|
310
313
|
params: routeInfo.params,
|
|
314
|
+
segments: routeInfo.segments,
|
|
311
315
|
screenId,
|
|
312
316
|
});
|
|
313
317
|
hasBlurredRef.current = false;
|
|
@@ -317,6 +321,7 @@ function AnalyticsListeners({ navigation, screenId, }) {
|
|
|
317
321
|
navigationEvents_1.unstable_navigationEvents.emit('pageBlurred', {
|
|
318
322
|
pathname: routeInfo.pathname,
|
|
319
323
|
params: routeInfo.params,
|
|
324
|
+
segments: routeInfo.segments,
|
|
320
325
|
screenId,
|
|
321
326
|
});
|
|
322
327
|
hasBlurredRef.current = true;
|
|
@@ -327,7 +332,7 @@ function AnalyticsListeners({ navigation, screenId, }) {
|
|
|
327
332
|
};
|
|
328
333
|
}
|
|
329
334
|
return () => { };
|
|
330
|
-
}, [navigation, routeInfo?.pathname, routeInfo?.params, screenId]);
|
|
335
|
+
}, [navigation, routeInfo?.pathname, routeInfo?.params, routeInfo?.segments, screenId]);
|
|
331
336
|
return null;
|
|
332
337
|
}
|
|
333
338
|
function screenOptionsFactory(route, options) {
|
package/build/useScreens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreens.js","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuKb,4CAiCC;AAuDD,gEA+IC;AAuFD,oDAwBC;AAED,sCAcC;AAED,sCAaC;;;AA1hBD,+CAA8C;AAG9C,mCAA8F;AAC9F,8DAAiE;AACjE,gDAAqE;AACrE,2CAA2C;AAC3C,qEAAkE;AAClE,gEAAoD;AACpD,6EAA0E;AAC1E,qGAAoG;AACpG,yDAA+D;AAC/D,yDAI4B;AAC5B,6CAAsC;AAEtC,sDASmC;AAGnC,mDAAgD;AAChD,+DAGkC;AAClC,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,QAAQ,EACR,aAAa,EACb,SAAS,EACT,OAAO,EACP,KAAK,EACL,mBAAmB,EAAE,QAAQ,GAC9B,EAAE,EAAE;QACH,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CACV,uDAAuD,IAAI,kBAAkB,CAC9E,CAAC;YACF,OAAO,IAAI,CAAC;QAC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,OAAO,CACL,2BAAC,mBAAM,OACD,KAAK,EACT,IAAI,EAAE,KAAK,CAAC,KAAK,EACjB,GAAG,EAAE,KAAK,CAAC,KAAK,EAChB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,EAC7C,YAAY,EAAE,GAAG,EAAE,CAAC,0BAA0B,CAAC,KAAK,CAAC,GACrD,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 React, { use, useEffect } from 'react';\n\nimport type { LoadedRoute, RouteNode } from './Route';\nimport { SuspenseFallbackContext, Route, sortRoutesWithInitial, useRouteNode } from './Route';\nimport { useExpoRouterStore } from './global-state/storeContext';\nimport { useColorSchemeChangesIfNeeded } from './global-state/utils';\n// Direct import to prevent a require cycle\nimport { useCurrentRouteInfo } from './hooks/useCurrentRouteInfo';\nimport EXPO_ROUTER_IMPORT_MODE from './import-mode';\nimport { ZoomTransitionEnabler } from './link/zoom/ZoomTransitionEnabler';\nimport { ZoomTransitionTargetContextProvider } from './link/zoom/zoom-transition-context-providers';\nimport { unstable_navigationEvents } from './navigationEvents';\nimport {\n hasParam,\n INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME,\n removeParams,\n} from './navigationParams';\nimport { Screen } from './primitives';\nimport type { BottomTabNavigationEventMap } from './react-navigation/bottom-tabs';\nimport {\n useStateForPath,\n type EventConsumer,\n type EventMapBase,\n type NavigationProp,\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 type { UnknownOutputParams } from './types';\nimport { EmptyRoute } from './views/EmptyRoute';\nimport {\n SuspenseFallback as DefaultSuspenseFallback,\n type SuspenseFallbackProps,\n} 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(\n (child) => child.route === name || child.route === `${name}/index`\n );\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(\n (userDefinedScreen) =>\n userDefinedScreen.name === child.route ||\n `${userDefinedScreen.name}/index` === child.route\n )\n )\n : nodeChildren;\n\n const sorted = children.length ? getSortedChildren(children, order, node?.initialRouteName) : [];\n return React.useMemo(\n () =>\n sorted\n .filter((item) => {\n const route = item.route.route;\n return (\n !protectedScreens.has(route) && !protectedScreens.has(route.replace(/\\/index$/, ''))\n );\n })\n .map((value) => {\n return routeToScreen(value.route, value.props);\n }),\n [sorted, protectedScreens]\n );\n}\n\nfunction fromImport(\n value: RouteNode,\n { ErrorBoundary, SuspenseFallback, ...component }: LoadedRoute\n) {\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 SuspenseFallback,\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, SuspenseFallback };\n }\n }\n\n return { default: component.default, SuspenseFallback };\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<{ segment?: string }>;\n\n let LayoutSuspenseFallback: React.ComponentType<SuspenseFallbackProps> | undefined;\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 const result = fromImport(value, res);\n ScreenComponent = result.default!;\n LayoutSuspenseFallback = value.type === 'layout' ? result.SuspenseFallback : undefined;\n }\n const WrappedScreenComponent: typeof ScreenComponent = (props: object) => {\n useColorSchemeChangesIfNeeded();\n return <ScreenComponent {...props} />;\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 }: {\n route?: RouteProp<ParamListBase, string>;\n navigation: Omit<\n NavigationProp<\n ParamListBase,\n string,\n undefined,\n NavigationState,\n object,\n NativeStackNavigationEventMap | BottomTabNavigationEventMap\n >,\n 'getState'\n > & {\n getState(): NavigationState | undefined;\n };\n }) {\n const stateForPath = useStateForPath();\n const isFocused = navigation.isFocused();\n const store = useExpoRouterStore();\n const InheritedSuspenseFallback = use(SuspenseFallbackContext);\n\n const ResolvedSuspenseFallback =\n EXPO_ROUTER_IMPORT_MODE === 'lazy'\n ? DefaultSuspenseFallback\n : (LayoutSuspenseFallback ?? InheritedSuspenseFallback ?? DefaultSuspenseFallback);\n const providedSuspenseFallback =\n value.type === 'layout'\n ? (LayoutSuspenseFallback ?? InheritedSuspenseFallback)\n : InheritedSuspenseFallback;\n\n if (isFocused) {\n const state = navigation.getState();\n const isLeaf = !(state && '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 && '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('transitionEnd', (e) => {\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 }, [navigation]);\n\n const isRouteType = value.type === 'route';\n const hasRouteKey = !!route?.key;\n\n return (\n <Route node={value} params={route?.params}>\n <SuspenseFallbackContext value={providedSuspenseFallback}>\n {unstable_navigationEvents.isEnabled() && isRouteType && hasRouteKey && (\n <AnalyticsListeners navigation={navigation} screenId={route.key} />\n )}\n <ZoomTransitionTargetContextProvider route={route}>\n <ZoomTransitionEnabler route={route} />\n <React.Suspense\n name={route ? `Route(${route.name})` : undefined}\n fallback={\n <ResolvedSuspenseFallback\n route={value.contextKey}\n params={(route?.params ?? {}) as SuspenseFallbackProps['params']}\n />\n }>\n <WrappedScreenComponent\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 </SuspenseFallbackContext>\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\nfunction AnalyticsListeners({\n navigation,\n screenId,\n}: {\n navigation: EventConsumer<EventMapBase> & {\n isFocused(): boolean;\n };\n screenId: string;\n}) {\n const isFirstRenderRef = React.useRef(true);\n const hasBlurredRef = React.useRef(true);\n const routeInfo = useCurrentRouteInfo();\n\n const isFocused = navigation.isFocused();\n\n if (isFirstRenderRef.current) {\n isFirstRenderRef.current = false;\n if (routeInfo && !isFocused) {\n unstable_navigationEvents.emit('pagePreloaded', {\n pathname: routeInfo.pathname,\n params: routeInfo.params,\n screenId,\n });\n }\n }\n\n useEffect(() => {\n if (routeInfo) {\n return () => {\n unstable_navigationEvents.emit('pageRemoved', {\n pathname: routeInfo.pathname,\n params: routeInfo.params,\n screenId,\n });\n };\n }\n return () => {};\n }, [routeInfo?.params, routeInfo?.pathname, screenId]);\n\n // Emit `pageFocused` from an effect — not during render — so it fires after the\n // focused screen's content has committed. `hasBlurredRef` deduplicates across both paths.\n useEffect(() => {\n if (isFocused && routeInfo && hasBlurredRef.current) {\n unstable_navigationEvents.emit('pageFocused', {\n pathname: routeInfo.pathname,\n params: routeInfo.params,\n screenId,\n });\n hasBlurredRef.current = false;\n }\n }, [isFocused, routeInfo?.pathname, routeInfo?.params, screenId]);\n\n useEffect(() => {\n if (routeInfo) {\n const cleanFocus = navigation.addListener('focus', () => {\n // If the screen was not blurred, don't emit focused again\n // hasBlurredRef will be false when the screen was initially focused\n if (hasBlurredRef.current) {\n unstable_navigationEvents.emit('pageFocused', {\n pathname: routeInfo.pathname,\n params: routeInfo.params,\n screenId,\n });\n hasBlurredRef.current = false;\n }\n });\n const cleanBlur = navigation.addListener('blur', () => {\n unstable_navigationEvents.emit('pageBlurred', {\n pathname: routeInfo.pathname,\n params: routeInfo.params,\n screenId,\n });\n hasBlurredRef.current = true;\n });\n return () => {\n cleanFocus();\n cleanBlur();\n };\n }\n return () => {};\n }, [navigation, routeInfo?.pathname, routeInfo?.params, screenId]);\n\n return null;\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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuKb,4CAiCC;AAuDD,gEA+IC;AA4FD,oDAwBC;AAED,sCAcC;AAED,sCAaC;;;AA/hBD,+CAA8C;AAG9C,mCAA8F;AAC9F,8DAAiE;AACjE,gDAAqE;AACrE,2CAA2C;AAC3C,qEAAkE;AAClE,gEAAoD;AACpD,6EAA0E;AAC1E,qGAAoG;AACpG,yDAA+D;AAC/D,yDAI4B;AAC5B,6CAAsC;AAEtC,sDASmC;AAGnC,mDAAgD;AAChD,+DAGkC;AAClC,qCAAkC;AAmClC,SAAS,iBAAiB,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gB,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 React, { use, useEffect } from 'react';\n\nimport type { LoadedRoute, RouteNode } from './Route';\nimport { SuspenseFallbackContext, Route, sortRoutesWithInitial, useRouteNode } from './Route';\nimport { useExpoRouterStore } from './global-state/storeContext';\nimport { useColorSchemeChangesIfNeeded } from './global-state/utils';\n// Direct import to prevent a require cycle\nimport { useCurrentRouteInfo } from './hooks/useCurrentRouteInfo';\nimport EXPO_ROUTER_IMPORT_MODE from './import-mode';\nimport { ZoomTransitionEnabler } from './link/zoom/ZoomTransitionEnabler';\nimport { ZoomTransitionTargetContextProvider } from './link/zoom/zoom-transition-context-providers';\nimport { unstable_navigationEvents } from './navigationEvents';\nimport {\n hasParam,\n INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME,\n removeParams,\n} from './navigationParams';\nimport { Screen } from './primitives';\nimport type { BottomTabNavigationEventMap } from './react-navigation/bottom-tabs';\nimport {\n useStateForPath,\n type EventConsumer,\n type EventMapBase,\n type NavigationProp,\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 type { UnknownOutputParams } from './types';\nimport { EmptyRoute } from './views/EmptyRoute';\nimport {\n SuspenseFallback as DefaultSuspenseFallback,\n type SuspenseFallbackProps,\n} 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(\n (child) => child.route === name || child.route === `${name}/index`\n );\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(\n (userDefinedScreen) =>\n userDefinedScreen.name === child.route ||\n `${userDefinedScreen.name}/index` === child.route\n )\n )\n : nodeChildren;\n\n const sorted = children.length ? getSortedChildren(children, order, node?.initialRouteName) : [];\n return React.useMemo(\n () =>\n sorted\n .filter((item) => {\n const route = item.route.route;\n return (\n !protectedScreens.has(route) && !protectedScreens.has(route.replace(/\\/index$/, ''))\n );\n })\n .map((value) => {\n return routeToScreen(value.route, value.props);\n }),\n [sorted, protectedScreens]\n );\n}\n\nfunction fromImport(\n value: RouteNode,\n { ErrorBoundary, SuspenseFallback, ...component }: LoadedRoute\n) {\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 SuspenseFallback,\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, SuspenseFallback };\n }\n }\n\n return { default: component.default, SuspenseFallback };\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<{ segment?: string }>;\n\n let LayoutSuspenseFallback: React.ComponentType<SuspenseFallbackProps> | undefined;\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 const result = fromImport(value, res);\n ScreenComponent = result.default!;\n LayoutSuspenseFallback = value.type === 'layout' ? result.SuspenseFallback : undefined;\n }\n const WrappedScreenComponent: typeof ScreenComponent = (props: object) => {\n useColorSchemeChangesIfNeeded();\n return <ScreenComponent {...props} />;\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 }: {\n route?: RouteProp<ParamListBase, string>;\n navigation: Omit<\n NavigationProp<\n ParamListBase,\n string,\n undefined,\n NavigationState,\n object,\n NativeStackNavigationEventMap | BottomTabNavigationEventMap\n >,\n 'getState'\n > & {\n getState(): NavigationState | undefined;\n };\n }) {\n const stateForPath = useStateForPath();\n const isFocused = navigation.isFocused();\n const store = useExpoRouterStore();\n const InheritedSuspenseFallback = use(SuspenseFallbackContext);\n\n const ResolvedSuspenseFallback =\n EXPO_ROUTER_IMPORT_MODE === 'lazy'\n ? DefaultSuspenseFallback\n : (LayoutSuspenseFallback ?? InheritedSuspenseFallback ?? DefaultSuspenseFallback);\n const providedSuspenseFallback =\n value.type === 'layout'\n ? (LayoutSuspenseFallback ?? InheritedSuspenseFallback)\n : InheritedSuspenseFallback;\n\n if (isFocused) {\n const state = navigation.getState();\n const isLeaf = !(state && '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 && '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('transitionEnd', (e) => {\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 }, [navigation]);\n\n const isRouteType = value.type === 'route';\n const hasRouteKey = !!route?.key;\n\n return (\n <Route node={value} params={route?.params}>\n <SuspenseFallbackContext value={providedSuspenseFallback}>\n {unstable_navigationEvents.isEnabled() && isRouteType && hasRouteKey && (\n <AnalyticsListeners navigation={navigation} screenId={route.key} />\n )}\n <ZoomTransitionTargetContextProvider route={route}>\n <ZoomTransitionEnabler route={route} />\n <React.Suspense\n name={route ? `Route(${route.name})` : undefined}\n fallback={\n <ResolvedSuspenseFallback\n route={value.contextKey}\n params={(route?.params ?? {}) as SuspenseFallbackProps['params']}\n />\n }>\n <WrappedScreenComponent\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 </SuspenseFallbackContext>\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\nfunction AnalyticsListeners({\n navigation,\n screenId,\n}: {\n navigation: EventConsumer<EventMapBase> & {\n isFocused(): boolean;\n };\n screenId: string;\n}) {\n const isFirstRenderRef = React.useRef(true);\n const hasBlurredRef = React.useRef(true);\n const routeInfo = useCurrentRouteInfo();\n\n const isFocused = navigation.isFocused();\n\n if (isFirstRenderRef.current) {\n isFirstRenderRef.current = false;\n if (routeInfo && !isFocused) {\n unstable_navigationEvents.emit('pagePreloaded', {\n pathname: routeInfo.pathname,\n params: routeInfo.params,\n segments: routeInfo.segments,\n screenId,\n });\n }\n }\n\n useEffect(() => {\n if (routeInfo) {\n return () => {\n unstable_navigationEvents.emit('pageRemoved', {\n pathname: routeInfo.pathname,\n params: routeInfo.params,\n segments: routeInfo.segments,\n screenId,\n });\n };\n }\n return () => {};\n }, [routeInfo?.params, routeInfo?.pathname, routeInfo?.segments, screenId]);\n\n // Emit `pageFocused` from an effect — not during render — so it fires after the\n // focused screen's content has committed. `hasBlurredRef` deduplicates across both paths.\n useEffect(() => {\n if (isFocused && routeInfo && hasBlurredRef.current) {\n unstable_navigationEvents.emit('pageFocused', {\n pathname: routeInfo.pathname,\n params: routeInfo.params,\n segments: routeInfo.segments,\n screenId,\n });\n hasBlurredRef.current = false;\n }\n }, [isFocused, routeInfo?.pathname, routeInfo?.params, routeInfo?.segments, screenId]);\n\n useEffect(() => {\n if (routeInfo) {\n const cleanFocus = navigation.addListener('focus', () => {\n // If the screen was not blurred, don't emit focused again\n // hasBlurredRef will be false when the screen was initially focused\n if (hasBlurredRef.current) {\n unstable_navigationEvents.emit('pageFocused', {\n pathname: routeInfo.pathname,\n params: routeInfo.params,\n segments: routeInfo.segments,\n screenId,\n });\n hasBlurredRef.current = false;\n }\n });\n const cleanBlur = navigation.addListener('blur', () => {\n unstable_navigationEvents.emit('pageBlurred', {\n pathname: routeInfo.pathname,\n params: routeInfo.params,\n segments: routeInfo.segments,\n screenId,\n });\n hasBlurredRef.current = true;\n });\n return () => {\n cleanFocus();\n cleanBlur();\n };\n }\n return () => {};\n }, [navigation, routeInfo?.pathname, routeInfo?.params, routeInfo?.segments, screenId]);\n\n return null;\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"]}
|