From 4faa0935e9101791d9818139db31023f8e24f387 Mon Sep 17 00:00:00 2001 From: Jakub Tkacz <32908614+Ubax@users.noreply.github.com> Date: Tue, 28 Apr 2026 12:05:31 +0200 Subject: [PATCH 01/20] [bare-expo] remove expo-router from dependency list (#45156) # Why In order to improve migration path from react-navigation we added metro plugin to detect react-navigation usages alongside expo-router. This however breaks in case of bare-expo, where expo-router is a dependency only for testing native code, rather then actual usage of expo-router. # How # Test Plan # Checklist - [ ] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) --- apps/bare-expo/ios/Podfile.lock | 25 ++++++------------------- apps/bare-expo/package.json | 1 - pnpm-lock.yaml | 3 --- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/apps/bare-expo/ios/Podfile.lock b/apps/bare-expo/ios/Podfile.lock index 64bf1ce0f13767..22f22a8f3dcd16 100644 --- a/apps/bare-expo/ios/Podfile.lock +++ b/apps/bare-expo/ios/Podfile.lock @@ -638,13 +638,6 @@ PODS: - Yoga - ExpoPrint (55.0.8): - ExpoModulesCore - - ExpoRouter (55.0.2): - - ExpoModulesCore - - RNScreens - - ExpoRouter/Tests (55.0.2): - - ExpoModulesCore - - ExpoModulesTestCore - - RNScreens - ExpoScreenCapture (55.0.8): - ExpoModulesCore - ExpoScreenOrientation (55.0.8): @@ -3332,8 +3325,6 @@ DEPENDENCIES: - ExpoObserve (from `../../../packages/expo-observe/ios`) - ExpoObserve/Tests (from `../../../packages/expo-observe/ios`) - ExpoPrint (from `../../../packages/expo-print/ios`) - - ExpoRouter (from `../../../packages/expo-router/ios`) - - ExpoRouter/Tests (from `../../../packages/expo-router/ios`) - ExpoScreenCapture (from `../../../packages/expo-screen-capture/ios`) - ExpoScreenOrientation (from `../../../packages/expo-screen-orientation/ios`) - ExpoSecureStore (from `../../../packages/expo-secure-store/ios`) @@ -3660,9 +3651,6 @@ EXTERNAL SOURCES: ExpoPrint: inhibit_warnings: false :path: "../../../packages/expo-print/ios" - ExpoRouter: - inhibit_warnings: false - :path: "../../../packages/expo-router/ios" ExpoScreenCapture: inhibit_warnings: false :path: "../../../packages/expo-screen-capture/ios" @@ -3980,15 +3968,14 @@ SPEC CHECKSUMS: ExpoMaps: 94294944cff46ad1170ce4f92800adecbcdd04ac ExpoMediaLibrary: 2fbddcb06042f43076cf5e495e8237ec2ab95726 ExpoMeshGradient: 93cf09380e6d86cd7a525da26dfddab2620a8421 - ExpoModulesCore: e25604088a83936db2694ace1ca680fecf34817d + ExpoModulesCore: 0b10a40c52e82e182c70dbfc12001ec30ba74cbd ExpoModulesJSI: 16f789b94db843249981e5f550e050cc321fe554 ExpoModulesTestCore: 62ce59e8c8162b449e65467e0421240256ba6732 ExpoModulesWorklets: 3a4d6451e29822c01c397da92be1f962a0f870fe ExpoNetwork: 15d026c5c28251e0810849c8c01ebc9bc73ad007 ExpoNotifications: 58a5bf9c5a0a2ee7d1800f9ed26ff17ff3748fde - ExpoObserve: 51e1417609e00aa5496211d0248333ee2eac6ea8 + ExpoObserve: d5a52bd0670d1b2bc24a1d59cf9322f3c843a045 ExpoPrint: 884afdcfe9adea0d36f121353652d0cfa7963deb - ExpoRouter: 617b413f30eb9fa39b210e4261814b13afd0418b ExpoScreenCapture: fe37f0547515f17434b002dcda5e1725fc61fe6f ExpoScreenOrientation: 1ec7e1beaa3adf7ef0dd1f7bad278f9a96fd518c ExpoSecureStore: 2cfd2091ba612c4b53a3ab53bab7cd29f4df7448 @@ -4012,7 +3999,7 @@ SPEC CHECKSUMS: EXUpdates: a0f980531cbcf45906b2489febd4e11a5895f332 EXUpdatesInterface: 5ab8c3e8018ef533a132b9327af5b2a1926dd299 FBLazyVector: 26fd21c75314e101f280d401e97f27d54f3f7064 - hermes-engine: 725fd85144e1348879039099a6be950c471a4f2c + hermes-engine: bd2451c187da88af6812697281b68f5f94ec0d01 libavif: 5f8e715bea24debec477006f21ef9e95432e254d libdav1d: 23581a4d8ec811ff171ed5e2e05cd27bad64c39f libwebp: 02b23773aedb6ff1fd38cec7a77b81414c6842a8 @@ -4030,7 +4017,7 @@ SPEC CHECKSUMS: React: 13cf8451582adb1bb324306e1893b91d1cba28c6 React-callinvoker: 91e6a605826b684ad2e623811253b4d0c4196bef React-Core: 46818de5f211b2a2759ac823b591af8a0a95c2c1 - React-Core-prebuilt: 4016009b4cc1d669b1a2369a5d707cdb39fa12ef + React-Core-prebuilt: e4a674cb7708d81eabfeb2908618d510e1a14481 React-CoreModules: a6a37afee48d4a31ab398640b0795462647d5c67 React-cxxreact: 2ec3e2f7a8ae9303460d4ba94cde183ea90d64cd React-debug: 0d21117b897ce0359c9d2c9dfe952f237476a14a @@ -4100,7 +4087,7 @@ SPEC CHECKSUMS: ReactAppDependencyProvider: 22e2265d86a4e871e5e858f4e7ef1c8d01103680 ReactCodegen: f564776e1b15423920d439de1965d2000433dbd2 ReactCommon: a804bb8d1dcf3ecdec3a77eb8bba19b7863bbbdb - ReactNativeDependencies: a24dd0e4b4318c05556b4b7bb144738f83775e22 + ReactNativeDependencies: 166d44a54c7845b05d943b282be2f6fc683978b5 RNCAsyncStorage: 2ad919e88b8bc2cd80e8697ce66d04d006743283 RNCMaskedView: eb2b2e538afa907f05a5848a1a1ac26092e6fec9 RNCPicker: d74667bdfc08ed389a2a277d95b8faf2349290a9 @@ -4120,6 +4107,6 @@ SPEC CHECKSUMS: Yoga: 04bb4bfeb02c0000b940c1e6e89e856cd8de5a71 ZXingObjC: 8898711ab495761b2dbbdec76d90164a6d7e14c5 -PODFILE CHECKSUM: a63ddafbc2bc8dd131f1bd3f4790fd1cf3a50279 +PODFILE CHECKSUM: cded84e5ed31720829134c3bfcd1283e1d36ada7 COCOAPODS: 1.16.2 diff --git a/apps/bare-expo/package.json b/apps/bare-expo/package.json index 873b00c6b78cbd..78f8450f6f1bbc 100644 --- a/apps/bare-expo/package.json +++ b/apps/bare-expo/package.json @@ -73,7 +73,6 @@ "expo-network-addons": "workspace:*", "expo-notifications": "workspace:*", "expo-observe": "workspace:*", - "expo-router": "workspace:*", "expo-splash-screen": "workspace:*", "expo-status-bar": "workspace:*", "expo-tracking-transparency": "workspace:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6a6aed5cbd5dbe..66475b5603c05e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -181,9 +181,6 @@ importers: expo-observe: specifier: workspace:* version: link:../../packages/expo-observe - expo-router: - specifier: workspace:* - version: link:../../packages/expo-router expo-splash-screen: specifier: workspace:* version: link:../../packages/expo-splash-screen From a57b0893cb000b15c106d2005135d2cf2c7b5513 Mon Sep 17 00:00:00 2001 From: Aman Mittal Date: Tue, 28 Apr 2026 15:55:21 +0530 Subject: [PATCH 02/20] [docs] Fix missing trailing periods to BoxLink and VideoBoxLink descriptions (#45141) # Why Fix ENG-20816 # How Fix missing trailing periods to `BoxLink` and `VideoBoxLink` descriptions in multiple docs. # Test Plan N/A # Checklist - [ ] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) --- docs/pages/develop/authentication.mdx | 6 +++--- .../develop/development-builds/expo-go-to-dev-build.mdx | 4 ++-- docs/pages/develop/development-builds/introduction.mdx | 6 +++--- docs/pages/eas-update/preview.mdx | 4 ++-- docs/pages/guides/expo-ui-swift-ui/index.mdx | 6 +++--- docs/pages/versions/unversioned/sdk/keyboard-controller.mdx | 2 +- docs/pages/versions/unversioned/sdk/updates.mdx | 2 +- docs/pages/versions/v53.0.0/sdk/updates.mdx | 2 +- docs/pages/versions/v54.0.0/sdk/keyboard-controller.mdx | 2 +- docs/pages/versions/v54.0.0/sdk/updates.mdx | 2 +- docs/pages/versions/v55.0.0/sdk/keyboard-controller.mdx | 2 +- docs/pages/versions/v55.0.0/sdk/updates.mdx | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/pages/develop/authentication.mdx b/docs/pages/develop/authentication.mdx index 4ed9e30344d44b..9a5c8ed345b280 100644 --- a/docs/pages/develop/authentication.mdx +++ b/docs/pages/develop/authentication.mdx @@ -36,7 +36,7 @@ If you're using an older version of Expo Router, you can use [redirects](/router @@ -176,13 +176,13 @@ The following tutorials cover implementing OAuth on Android, iOS, and web, inclu

diff --git a/docs/pages/develop/development-builds/expo-go-to-dev-build.mdx b/docs/pages/develop/development-builds/expo-go-to-dev-build.mdx index d0290e2d914cc3..cb23e81459a147 100644 --- a/docs/pages/develop/development-builds/expo-go-to-dev-build.mdx +++ b/docs/pages/develop/development-builds/expo-go-to-dev-build.mdx @@ -78,7 +78,7 @@ Building on EAS servers is useful when: @@ -136,7 +136,7 @@ All Expo build tools (`npx expo run:android|ios` and `eas build`) will **prebuil diff --git a/docs/pages/develop/development-builds/introduction.mdx b/docs/pages/develop/development-builds/introduction.mdx index bab50825af2a31..5b93edcb36dec8 100644 --- a/docs/pages/develop/development-builds/introduction.mdx +++ b/docs/pages/develop/development-builds/introduction.mdx @@ -78,21 +78,21 @@ If you're developing on an Android Device, Android Emulator, or iOS Simulator, a diff --git a/docs/pages/eas-update/preview.mdx b/docs/pages/eas-update/preview.mdx index 9166d5c4dbbd88..8bbb1725cbf404 100644 --- a/docs/pages/eas-update/preview.mdx +++ b/docs/pages/eas-update/preview.mdx @@ -24,14 +24,14 @@ Development builds are a great way to preview updates from pull requests, direct diff --git a/docs/pages/guides/expo-ui-swift-ui/index.mdx b/docs/pages/guides/expo-ui-swift-ui/index.mdx index 6b3f0ffbdce619..8ec5b8d94b9ec9 100644 --- a/docs/pages/guides/expo-ui-swift-ui/index.mdx +++ b/docs/pages/guides/expo-ui-swift-ui/index.mdx @@ -520,21 +520,21 @@ Because React's promise of _"learn once, write anywhere"_, it now extends to Swi diff --git a/docs/pages/versions/unversioned/sdk/keyboard-controller.mdx b/docs/pages/versions/unversioned/sdk/keyboard-controller.mdx index a77a6fa5752d68..1637efab0db9f0 100644 --- a/docs/pages/versions/unversioned/sdk/keyboard-controller.mdx +++ b/docs/pages/versions/unversioned/sdk/keyboard-controller.mdx @@ -83,7 +83,7 @@ const styles = StyleSheet.create({ diff --git a/docs/pages/versions/unversioned/sdk/updates.mdx b/docs/pages/versions/unversioned/sdk/updates.mdx index b24bcad428f0e5..f1712d1e255449 100644 --- a/docs/pages/versions/unversioned/sdk/updates.mdx +++ b/docs/pages/versions/unversioned/sdk/updates.mdx @@ -40,7 +40,7 @@ The remote service must implement the [Expo Updates protocol](/technical-specs/e diff --git a/docs/pages/versions/v53.0.0/sdk/updates.mdx b/docs/pages/versions/v53.0.0/sdk/updates.mdx index 07bfea742fa593..466689f36d7f5d 100644 --- a/docs/pages/versions/v53.0.0/sdk/updates.mdx +++ b/docs/pages/versions/v53.0.0/sdk/updates.mdx @@ -40,7 +40,7 @@ The remote service must implement the [Expo Updates protocol](/technical-specs/e diff --git a/docs/pages/versions/v54.0.0/sdk/keyboard-controller.mdx b/docs/pages/versions/v54.0.0/sdk/keyboard-controller.mdx index 39f1b517aad86e..ce9db5d51943eb 100644 --- a/docs/pages/versions/v54.0.0/sdk/keyboard-controller.mdx +++ b/docs/pages/versions/v54.0.0/sdk/keyboard-controller.mdx @@ -84,7 +84,7 @@ const styles = StyleSheet.create({ diff --git a/docs/pages/versions/v54.0.0/sdk/updates.mdx b/docs/pages/versions/v54.0.0/sdk/updates.mdx index 178bd411f74a47..629d7f78018b46 100644 --- a/docs/pages/versions/v54.0.0/sdk/updates.mdx +++ b/docs/pages/versions/v54.0.0/sdk/updates.mdx @@ -40,7 +40,7 @@ The remote service must implement the [Expo Updates protocol](/technical-specs/e diff --git a/docs/pages/versions/v55.0.0/sdk/keyboard-controller.mdx b/docs/pages/versions/v55.0.0/sdk/keyboard-controller.mdx index a77a6fa5752d68..1637efab0db9f0 100644 --- a/docs/pages/versions/v55.0.0/sdk/keyboard-controller.mdx +++ b/docs/pages/versions/v55.0.0/sdk/keyboard-controller.mdx @@ -83,7 +83,7 @@ const styles = StyleSheet.create({ diff --git a/docs/pages/versions/v55.0.0/sdk/updates.mdx b/docs/pages/versions/v55.0.0/sdk/updates.mdx index b24bcad428f0e5..f1712d1e255449 100644 --- a/docs/pages/versions/v55.0.0/sdk/updates.mdx +++ b/docs/pages/versions/v55.0.0/sdk/updates.mdx @@ -40,7 +40,7 @@ The remote service must implement the [Expo Updates protocol](/technical-specs/e From 80639743b246bfafe10cece5f3ff8887b74ce11a Mon Sep 17 00:00:00 2001 From: Aman Mittal Date: Tue, 28 Apr 2026 15:55:30 +0530 Subject: [PATCH 03/20] [docs] Add Linux support for Expo Orbit and other minor updates (#45140) # Why Fix ENG-20815 # How - Update the intro sentence in `docs/pages/build/orbit.mdx`, `docs/pages/develop/tools.mdx`, `docs/pages/review/with-orbit.mdx`, `docs/pages/more/glossary-of-terms.mdx`, and `docs/pages/tutorial/eas/introduction.mdx` to read "macOS, Windows, and Linux" instead of "macOS and Windows". - Update the bullet in `docs/pages/additional-resources/index.mdx` to read "macOS menu bar, Windows task bar, or Linux system tray". - Update the "Orbit relies on the Android SDK..." info callout in `docs/pages/build/orbit.mdx` and `docs/pages/develop/tools.mdx` to include Linux. - - Add a new `` block to the `` install section in both `docs/pages/build/orbit.mdx` and `docs/pages/develop/tools.mdx`. - Remove the "Orbit for Windows is in beta and is only compatible with x64 and x86 machines" callout from the Windows tab in both pages, since the Orbit README no longer marks Windows as beta. - In `docs/pages/tutorial/eas/android-development-build.mdx`, change "Open the Orbit menu bar app." to "Open the Orbit app." since Linux + Android is a valid development combo and "menu bar app" is macOS-specific phrasing. The two iOS-context tutorial pages keep the "menu bar app" wording because iOS development requires macOS. # Test Plan Run the docs locally with `pnpm dev` and verify each updated page renders correctly: - `/build/orbit/`: install section shows three tabs (macOS, Windows, Linux). Windows tab no longer has the beta callout. Linux tab points at GitHub releases and mentions `.deb` and `.rpm`. Intro paragraph and Android SDK callout both mention Linux. - `/develop/tools/`: same three-tab install section and Linux mentions. - `/review/with-orbit/`: intro sentence mentions all three platforms. - `/more/glossary-of-terms/#expo-orbit`: glossary entry mentions all three platforms. - `/tutorial/eas/introduction/`: tools section mentions all three platforms. - `/additional-resources/`: `expo/orbit` bullet mentions Linux system tray. - `/tutorial/eas/android-development-build/`: step 87 reads "Open the Orbit app." with no "menu bar" qualifier. CleanShot 2026-04-27 at 23 28 03@2x # Checklist - [ ] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [x] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) --- docs/pages/additional-resources/index.mdx | 2 +- docs/pages/build/orbit.mdx | 12 ++++++++---- docs/pages/develop/tools.mdx | 12 ++++++++---- docs/pages/more/glossary-of-terms.mdx | 2 +- docs/pages/review/with-orbit.mdx | 2 +- .../pages/tutorial/eas/android-development-build.mdx | 2 +- docs/pages/tutorial/eas/introduction.mdx | 2 +- 7 files changed, 21 insertions(+), 13 deletions(-) diff --git a/docs/pages/additional-resources/index.mdx b/docs/pages/additional-resources/index.mdx index 46b636818d890f..74f15c28e58794 100644 --- a/docs/pages/additional-resources/index.mdx +++ b/docs/pages/additional-resources/index.mdx @@ -26,7 +26,7 @@ The following resources are useful for learning about Expo tooling and services. - [expo/vscode-expo](https://github.com/expo/vscode-expo) - VS Code extension for working with Expo tools. - [expo/vscode-expo-theme](https://github.com/expo/vscode-expo-theme) - VS Code theme created by Expo team. - [expo/fyi](https://github.com/expo/fyi) - Troubleshooting guides for Expo tools and services. -- [expo/orbit](https://github.com/expo/orbit) - Launch builds and start simulators from your macOS menu bar and Windows task bar. +- [expo/orbit](https://github.com/expo/orbit) - Launch builds and start simulators from your macOS menu bar, Windows task bar, or Linux system tray. ### Documentation diff --git a/docs/pages/build/orbit.mdx b/docs/pages/build/orbit.mdx index 04759cbfa4784e..1cfbcab94aad23 100644 --- a/docs/pages/build/orbit.mdx +++ b/docs/pages/build/orbit.mdx @@ -7,7 +7,7 @@ import { ContentSpotlight } from '~/ui/components/ContentSpotlight'; import { Terminal } from '~/ui/components/Snippet'; import { Tabs, Tab } from '~/ui/components/Tabs'; -[Expo Orbit](https://expo.dev/orbit) for macOS and Windows enables faster to install and launch builds or updates from EAS, local files, or run Snack projects, on simulators and physical devices. +[Expo Orbit](https://expo.dev/orbit) for macOS, Windows, and Linux enables faster to install and launch builds or updates from EAS, local files, or run Snack projects, on simulators and physical devices. @@ -26,7 +26,7 @@ Before Orbit, installing builds or updates from EAS (on Android and iOS physical ## Installation -> **info** Orbit relies on the Android SDK on both macOS and Windows and `xcrun` for device management only on macOS, which requires setting up both [Android Studio](/workflow/android-studio-emulator/) and [Xcode](/workflow/ios-simulator/). +> **info** Orbit relies on the Android SDK on macOS, Windows, and Linux, and `xcrun` for device management only on macOS, which requires setting up both [Android Studio](/workflow/android-studio-emulator/) and [Xcode](/workflow/ios-simulator/). @@ -42,10 +42,14 @@ If you want Orbit to start when you log in automatically, click on the Orbit ico -> **important** Orbit for Windows is in [beta](/more/release-statuses/#beta) and is only compatible with x64 and x86 machines. Compatibility for other architectures will be added in the future. - You can download Orbit for Windows directly from the [GitHub releases](https://github.com/expo/orbit/releases). + + +You can download Orbit for Linux directly from the [GitHub releases](https://github.com/expo/orbit/releases). Both `.deb` (Debian and Ubuntu) and `.rpm` (Fedora and RHEL) packages are available. + + + diff --git a/docs/pages/develop/tools.mdx b/docs/pages/develop/tools.mdx index 9c5e8904530076..05747d8bee2dd6 100644 --- a/docs/pages/develop/tools.mdx +++ b/docs/pages/develop/tools.mdx @@ -65,7 +65,7 @@ You can also use `npx expo-doctor --help` to display usage information. ## Orbit -Orbit is a macOS and Windows app that enables: +Orbit is a macOS, Windows, and Linux app that enables: - Install and launch builds from EAS on physical devices and emulators. - Install and launch updates from EAS on Android Emulators or iOS Simulators. @@ -91,15 +91,19 @@ If you want Orbit to start when you log in automatically, click on the Orbit ico -> **important** Orbit for Windows is in [beta](/more/release-statuses/#beta) and is only compatible with x64 and x86 machines. Compatibility for other architectures will be added in the future. - You can download Orbit for Windows directly from the [GitHub releases](https://github.com/expo/orbit/releases). + + +You can download Orbit for Linux directly from the [GitHub releases](https://github.com/expo/orbit/releases). Both `.deb` (Debian and Ubuntu) and `.rpm` (Fedora and RHEL) packages are available. + + + -> **info** Orbit relies on the Android SDK on both macOS and Windows and `xcrun` for device management only on macOS, which requires setting up both [Android Studio](/workflow/android-studio-emulator/) and [Xcode](/workflow/ios-simulator/). +> **info** Orbit relies on the Android SDK on macOS, Windows, and Linux, and `xcrun` for device management only on macOS, which requires setting up both [Android Studio](/workflow/android-studio-emulator/) and [Xcode](/workflow/ios-simulator/). {/* TODO: (@aman) to add update https://docs.expo.dev/build/orbit/ with instructions on how to actually use Expo Orbit with EAS Build, add link to https://docs.expo.dev/review/with-orbit/ to add the following section */} {/* ### Usage */} diff --git a/docs/pages/more/glossary-of-terms.mdx b/docs/pages/more/glossary-of-terms.mdx index 4cb46ca3e50741..8e761ed4de770c 100644 --- a/docs/pages/more/glossary-of-terms.mdx +++ b/docs/pages/more/glossary-of-terms.mdx @@ -219,7 +219,7 @@ A file named **expo-module.config.json** that lives in the root directory of a [ ### Expo Orbit -[Expo Orbit](/build/orbit/) is an application for macOS and Windows that enables faster installation and launching of builds or updates from EAS, local files, or Snack projects, on devices or emulators/simulators. +[Expo Orbit](/build/orbit/) is an application for macOS, Windows, and Linux that enables faster installation and launching of builds or updates from EAS, local files, or Snack projects, on devices or emulators/simulators. ### Expo Router diff --git a/docs/pages/review/with-orbit.mdx b/docs/pages/review/with-orbit.mdx index e1afdecc1358e7..f00ce549739fc0 100644 --- a/docs/pages/review/with-orbit.mdx +++ b/docs/pages/review/with-orbit.mdx @@ -8,7 +8,7 @@ import { Collapsible } from '~/ui/components/Collapsible'; import { ContentSpotlight } from '~/ui/components/ContentSpotlight'; import { Prerequisites, Requirement } from '~/ui/components/Prerequisites'; -[Expo Orbit](https://expo.dev/orbit) is a macOS and Windows app designed to speed up installing and running builds from EAS. It makes running your builds and updates as easy as pressing **Open in Orbit**. +[Expo Orbit](https://expo.dev/orbit) is a macOS, Windows, and Linux app designed to speed up installing and running builds from EAS. It makes running your builds and updates as easy as pressing **Open in Orbit**. diff --git a/docs/pages/tutorial/eas/android-development-build.mdx b/docs/pages/tutorial/eas/android-development-build.mdx index 75881aba05f26c..dea93f8d59de29 100644 --- a/docs/pages/tutorial/eas/android-development-build.mdx +++ b/docs/pages/tutorial/eas/android-development-build.mdx @@ -84,7 +84,7 @@ This section provides the methods available for running the development build on [Expo Orbit](https://expo.dev/orbit) allows for seamless installation of the development build on an Android device. To use this method: - Connect our Android device to our local machine using USB. -- Open the Orbit menu bar app. +- Open the Orbit app. - Select the **Device** in the Orbit app. Date: Tue, 28 Apr 2026 15:55:39 +0530 Subject: [PATCH 04/20] [docs] Infer counts in Prerequisites and Requirement components (#45139) # Why Fix ENG-20814 Follow-up @kadikraman's feedback from https://github.com/expo/expo/pull/45075 # How - Drop the `numberOfRequirements` prop from ``. The component now derives the count from `Children.toArray(children).filter(...)` so authors no longer hand-count their own children. - Drop the `number` prop from `` entirely. `` now owns the numbered row frame (border, padding, the `N.` prefix), and `` is a pure content component with `{ title, children }` only. - Add `Prerequisites.test.tsx` with two cases: single-requirement (asserts no inline `1.` and the singular "1 requirement" header counter) and multi-requirement (asserts `1.`/`2.`/`3.` and the plural "3 requirements" counter). - Strip `numberOfRequirements={N}` from 68 `` openings across 56 `.mdx` pages. - Strip `number={N}` from 154 `` openings, including the multiline `...}>` shapes. # Test Plan - Run `pnpm test` and all tests should pass. - See preview. Visually nothing has changed. CleanShot 2026-04-27 at 23 04
25@2x CleanShot 2026-04-27 at 23 04 33@2x CleanShot 2026-04-27 at 23 04
46@2x CleanShot 2026-04-27 at 23 05
00@2x # Checklist - [ ] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) --- .../pages/bare/install-dev-builds-in-bare.mdx | 4 +- docs/pages/bare/installing-updates.mdx | 4 +- docs/pages/brownfield/integrated-approach.mdx | 7 ++- docs/pages/brownfield/isolated-approach.mdx | 6 +-- docs/pages/build-reference/local-builds.mdx | 4 +- docs/pages/build-reference/npx-testflight.mdx | 8 +-- docs/pages/build-reference/repack.mdx | 6 +-- docs/pages/build-reference/variants.mdx | 4 +- docs/pages/build/building-from-github.mdx | 8 +-- docs/pages/build/building-on-ci.mdx | 4 +- docs/pages/build/setup.mdx | 6 +-- docs/pages/deploy/submit-to-app-stores.mdx | 26 +++++----- docs/pages/deploy/web.mdx | 3 +- .../development-builds/create-a-build.mdx | 24 ++++----- docs/pages/eas-update/bundle-diffing.mdx | 6 +-- docs/pages/eas-update/expo-dev-client.mdx | 5 +- docs/pages/eas-update/getting-started.mdx | 9 ++-- .../integration-in-existing-native-apps.mdx | 15 +++--- .../migrate-from-classic-updates.mdx | 4 +- docs/pages/eas/ai/mcp.mdx | 8 +-- docs/pages/eas/hosting/custom-domain.mdx | 8 ++- docs/pages/eas/hosting/get-started.mdx | 6 +-- docs/pages/eas/metadata/getting-started.mdx | 4 +- .../examples/create-development-builds.mdx | 6 +-- .../examples/deploy-to-production.mdx | 8 +-- .../examples/publish-preview-update.mdx | 6 +-- docs/pages/eas/workflows/get-started.mdx | 10 ++-- .../pages/eas/workflows/pre-packaged-jobs.mdx | 24 ++++----- docs/pages/guides/building-for-tv.mdx | 20 ++++---- docs/pages/guides/dom-components.mdx | 6 +-- .../guides/expo-ui-swift-ui/extending.mdx | 8 +-- docs/pages/guides/facebook-authentication.mdx | 4 +- docs/pages/guides/google-authentication.mdx | 4 +- docs/pages/guides/ios-developer-mode.mdx | 4 +- docs/pages/guides/keyboard-handling.mdx | 5 +- docs/pages/guides/local-app-development.mdx | 6 +-- docs/pages/guides/local-app-overview.mdx | 6 +-- docs/pages/guides/local-app-production.mdx | 14 +++--- docs/pages/guides/local-https-development.mdx | 3 +- docs/pages/guides/server-components.mdx | 6 +-- docs/pages/guides/tailwind.mdx | 4 +- docs/pages/guides/using-bun.mdx | 6 +-- docs/pages/guides/using-firebase.mdx | 4 +- docs/pages/guides/using-resend.mdx | 12 ++--- docs/pages/guides/using-supabase.mdx | 6 +-- docs/pages/modules/existing-library.mdx | 4 +- .../push-notifications-setup.mdx | 4 +- docs/pages/review/with-orbit.mdx | 6 +-- docs/pages/router/installation.mdx | 4 +- docs/pages/submit/android.mdx | 34 ++++++------- docs/pages/submit/ios.mdx | 22 ++++---- docs/pages/tutorial/create-your-first-app.mdx | 10 ++-- .../tutorial/eas/android-production-build.mdx | 8 +-- docs/pages/tutorial/eas/introduction.mdx | 4 +- .../eas/ios-development-build-for-devices.mdx | 6 +-- .../tutorial/eas/ios-production-build.mdx | 6 +-- .../Prerequisites/Prerequisites.test.tsx | 50 +++++++++++++++++++ .../components/Prerequisites/Requirement.tsx | 16 +++--- docs/ui/components/Prerequisites/index.tsx | 36 +++++++++---- 59 files changed, 305 insertions(+), 256 deletions(-) create mode 100644 docs/ui/components/Prerequisites/Prerequisites.test.tsx diff --git a/docs/pages/bare/install-dev-builds-in-bare.mdx b/docs/pages/bare/install-dev-builds-in-bare.mdx index d1b7f4fe201613..6527dd7d0d4a55 100644 --- a/docs/pages/bare/install-dev-builds-in-bare.mdx +++ b/docs/pages/bare/install-dev-builds-in-bare.mdx @@ -25,8 +25,8 @@ To use `expo-dev-client` in a project that uses [CNG](/workflow/continuous-nativ - - + + If you created your project with `npx @react-native-community/cli@latest init` and do not have any other Expo libraries installed, you will need to [install Expo modules](/bare/installing-expo-modules) before proceeding. diff --git a/docs/pages/bare/installing-updates.mdx b/docs/pages/bare/installing-updates.mdx index 389bd66f2f0dbc..67d32f8ce9d298 100644 --- a/docs/pages/bare/installing-updates.mdx +++ b/docs/pages/bare/installing-updates.mdx @@ -16,8 +16,8 @@ You may be reading the wrong guide. To use `expo-updates` in a project that uses - - + + If you created your project with `npx @react-native-community/cli@latest init` and do not have any other Expo libraries installed, you will need to [install Expo modules](/bare/installing-expo-modules) before proceeding. diff --git a/docs/pages/brownfield/integrated-approach.mdx b/docs/pages/brownfield/integrated-approach.mdx index 4f5ec9b5eaa104..aa52ba29b6e593 100644 --- a/docs/pages/brownfield/integrated-approach.mdx +++ b/docs/pages/brownfield/integrated-approach.mdx @@ -18,15 +18,14 @@ This guide will walk you through the steps to add a React Native view into an ex > **info** Another popular technique is what we call the "isolated" approach, where your Expo app is packaged as a library and treated as a black box by the main existing application. See the [isolated approach guide](/brownfield/isolated-approach/) for details. - - + + Install [Node.js](https://nodejs.org/en/) to run JavaScript code and Expo CLI. - + Install [Yarn](https://yarnpkg.com/) as a package manager for JavaScript dependencies. CocoaPods diff --git a/docs/pages/brownfield/isolated-approach.mdx b/docs/pages/brownfield/isolated-approach.mdx index 1d86f6e49109ef..0c1435765bc592 100644 --- a/docs/pages/brownfield/isolated-approach.mdx +++ b/docs/pages/brownfield/isolated-approach.mdx @@ -19,11 +19,11 @@ This approach is ideal when you want to minimize the impact of React Native on y > **info** For an alternative approach where React Native is integrated directly into your native project, see the [integrated approach guide](/brownfield/integrated-approach/). - - + + Install [Node.js](https://nodejs.org/en/) to run JavaScript code and Expo CLI. - + Install [Yarn](https://yarnpkg.com/) as a package manager for JavaScript dependencies. diff --git a/docs/pages/build-reference/local-builds.mdx b/docs/pages/build-reference/local-builds.mdx index c314c5314d381e..5f5f424e1150b8 100644 --- a/docs/pages/build-reference/local-builds.mdx +++ b/docs/pages/build-reference/local-builds.mdx @@ -16,8 +16,8 @@ You can run the same build process that is typically run on the EAS Build server cmd={['$ eas build --platform android --local', '# or', '$ eas build --platform ios --local']} /> - - + + Run `eas login`, or alternatively, set `EXPO_TOKEN` [using token-based authentication](/accounts/programmatic-access). diff --git a/docs/pages/build-reference/npx-testflight.mdx b/docs/pages/build-reference/npx-testflight.mdx index 60802a4b2ce976..3ab0ba303900e3 100644 --- a/docs/pages/build-reference/npx-testflight.mdx +++ b/docs/pages/build-reference/npx-testflight.mdx @@ -11,15 +11,15 @@ import { CODE } from '~/ui/components/Text'; [`npx testflight`](https://www.npmjs.com/package/testflight) is a CLI tool that walks you through building, signing, and submitting your iOS app to TestFlight. - - + + A React Native iOS project you want to deploy to TestFlight. - + A paid [Apple Developer account](https://developer.apple.com/account/) is required for TestFlight distribution. - + Sign up for an [Expo](https://expo.dev/signup) account, if you haven't already. diff --git a/docs/pages/build-reference/repack.mdx b/docs/pages/build-reference/repack.mdx index 70db127b989533..62c558415c079a 100644 --- a/docs/pages/build-reference/repack.mdx +++ b/docs/pages/build-reference/repack.mdx @@ -11,12 +11,12 @@ import { Tabs, Tab } from '~/ui/components/Tabs'; To learn more about how fingerprint and repack work together to accelerate CI, see [Accelerating Continuous Integration with Fingerprint and Repack in EAS Workflows](https://expo.dev/blog/accelerating-continuous-integration-with-fingerprint-repack-in-eas-workflows) blog post. - - + + A build artifact produced from your Expo project: an APK for Android, or an IPA or **.app** bundle for iOS. - + Required if the repacked artifact needs to be installable on a device. For more information, see [Signing](#signing). diff --git a/docs/pages/build-reference/variants.mdx b/docs/pages/build-reference/variants.mdx index d3b5b428fe79cd..9dc1da05e2f0fa 100644 --- a/docs/pages/build-reference/variants.mdx +++ b/docs/pages/build-reference/variants.mdx @@ -12,8 +12,8 @@ When creating [development, preview, and production builds](/build/eas-json/#com This guide provides the steps required to configure multiple (development and production) variants to install and use them on the same device. - - + + To have multiple variants of an app installed on your device, each variant must have a unique [Application ID (Android)](/versions/latest/config/app/#package) or [Bundle Identifier (iOS)](/versions/latest/config/app/#bundleidentifier). diff --git a/docs/pages/build/building-from-github.mdx b/docs/pages/build/building-from-github.mdx index 80a39c2a4a73b0..777d7751dc4a69 100644 --- a/docs/pages/build/building-from-github.mdx +++ b/docs/pages/build/building-from-github.mdx @@ -10,8 +10,8 @@ import { Prerequisites, Requirement } from '~/ui/components/Prerequisites'; This guide explains how to trigger builds directly from your GitHub repository using the Expo GitHub App. - - + + For the build profiles you want to use with GitHub, specify an [`image`](/eas/json/#image) to use for the native platform in **eas.json**. Use the `latest` image if your project's configuration does not rely on a specific [build image](/build-reference/infrastructure/). For example: ```json eas.json @@ -31,10 +31,10 @@ This guide explains how to trigger builds directly from your GitHub repository u ``` - + To trigger EAS builds from a GitHub repository, you'll need to configure your project for EAS Build and successfully run a build from your computer for each platform that you'd like to support on GitHub. If you haven't successfully run `eas build -p [all|ios|android]` yet, see [Create your first build](/build/setup/) for more information. - + - An Expo user in the organization must have a linked GitHub user with access to the target repository. Check **Account settings** > **Overview** > **User settings** > [**Connections**](https://expo.dev/settings#connections) and verify that your GitHub user account is linked. - You must accept the permissions requested by the [Expo GitHub app](https://github.com/settings/installations). diff --git a/docs/pages/build/building-on-ci.mdx b/docs/pages/build/building-on-ci.mdx index c8cfd68c2c908e..25bc4688a07327 100644 --- a/docs/pages/build/building-on-ci.mdx +++ b/docs/pages/build/building-on-ci.mdx @@ -9,8 +9,8 @@ import { Terminal } from '~/ui/components/Snippet'; This document outlines how to trigger builds on EAS for your app from a CI environment such as GitHub Actions, Travis CI, and more. - - + + To trigger EAS builds from a CI environment, your app needs to be set up to use EAS Build in non-interactive mode. Run `eas build -p [all|android|ios]` from your local terminal for each platform you want to support on CI, so the `eas build` command can prompt for any additional configuration it needs. That configuration will then be available for future non-interactive runs. Running a build locally accomplishes the following critical configuration steps: diff --git a/docs/pages/build/setup.mdx b/docs/pages/build/setup.mdx index c56305c2bf5636..13709df5fc6286 100644 --- a/docs/pages/build/setup.mdx +++ b/docs/pages/build/setup.mdx @@ -18,8 +18,8 @@ For a small app, builds for Android and iOS platforms trigger within a few minut > **info** EAS Build is a rapidly evolving service. Before you set out to create a build for your project we recommend consulting the [limitations](/build-reference/limitations) and the other prerequisites below. - - + + Don't have a project yet? It's quick and easy to create a "Hello world" app you can use with this guide: @@ -27,7 +27,7 @@ For a small app, builds for Android and iOS platforms trigger within a few minut EAS Build also works well with projects created by `npx create-react-native-app`, `npx react-native`, `ignite-cli`, and other project bootstrapping tools. - + EAS Build is available to anyone with an Expo account, regardless of whether you pay for EAS or use the Free plan. You can sign up at [expo.dev](https://expo.dev/signup). Paid subscribers get quality improvements such as additional build concurrencies, priority access to minimize the time your builds spend queueing, and increased limits on build timeouts. Learn more about different plans and benefits at [EAS pricing](https://expo.dev/pricing). diff --git a/docs/pages/deploy/submit-to-app-stores.mdx b/docs/pages/deploy/submit-to-app-stores.mdx index c70580e743ee71..7c0f432fb01c46 100644 --- a/docs/pages/deploy/submit-to-app-stores.mdx +++ b/docs/pages/deploy/submit-to-app-stores.mdx @@ -23,11 +23,11 @@ import { VideoBoxLink } from '~/ui/components/VideoBoxLink'; ## Apple App Store - - + + An Apple Developer account is required to submit your app to the Apple App Store. You can sign up for an Apple Developer account on the [Apple Developer Portal](https://developer.apple.com/account/). - + Include your app's bundle identifier in **app.json**: ```json app.json @@ -39,13 +39,13 @@ import { VideoBoxLink } from '~/ui/components/VideoBoxLink'; ``` - + Install EAS CLI and login with your Expo account: - + You'll need a production build ready for store submission. You can create one using [EAS Build](/build/introduction/): @@ -65,23 +65,23 @@ The command will lead you step by step through the process of submitting the app ## Google Play Store - - + + A Google Play Developer account is required to submit your app to the Google Play Store. You can sign up for a Google Play Developer account on the [Google Play Console sign-up page](https://play.google.com/apps/publish/signup/). - + EAS requires you to upload and configure a Google Service Account Key to submit your Android app to the Google Play Store. You can create one with the [uploading a Google Service Account Key for Play Store submissions with EAS](https://github.com/expo/fyi/blob/main/creating-google-service-account.md) guide. - + Create an app by clicking **Create app** in the [Google Play Console](https://play.google.com/apps/publish/). - + Install EAS CLI and login with your Expo account: - + Include your app's package name in **app.json**: ```json app.json @@ -93,7 +93,7 @@ The command will lead you step by step through the process of submitting the app ``` - + You'll need a production build ready for store submission. You can create one using [EAS Build](/build/introduction/): @@ -101,7 +101,7 @@ The command will lead you step by step through the process of submitting the app Alternatively, you can build the app on your own computer with `eas build --platform android --profile production --local` or with Android Studio. - + You have to upload your app manually at least once. This is a limitation of the Google Play Store API. Learn how with the [first submission of an Android app](https://expo.fyi/first-android-submission) guide. diff --git a/docs/pages/deploy/web.mdx b/docs/pages/deploy/web.mdx index df9d62b5e65cfe..34d91d72a49743 100644 --- a/docs/pages/deploy/web.mdx +++ b/docs/pages/deploy/web.mdx @@ -10,9 +10,8 @@ import { CODE } from '~/ui/components/Text'; If you are building a universal app, you can quickly deploy your web app using [EAS Hosting](/eas/hosting/introduction/). It is a service for deploying web apps built with Expo Router and React. - + Set expo.web.output in app.json diff --git a/docs/pages/develop/development-builds/create-a-build.mdx b/docs/pages/develop/development-builds/create-a-build.mdx index a44b6849a89b66..89c6f7da71b754 100644 --- a/docs/pages/develop/development-builds/create-a-build.mdx +++ b/docs/pages/develop/development-builds/create-a-build.mdx @@ -95,15 +95,15 @@ Apps that don't use [Continuous Native Generation](/workflow/continuous-native-g ### Build the native app (Android) - - + + Sign up for an [Expo](https://expo.dev/signup) account, if you haven't already. - + The [EAS CLI](/build/setup/#install-the-latest-eas-cli) installed and logged in. - + An [Android Emulator](/workflow/android-studio-emulator/) is optional if you want to test your app on an emulator. @@ -119,15 +119,15 @@ Read more about [Android builds on EAS](/tutorial/eas/android-development-build) ### Build the native app (iOS Simulator) - - + + Sign up for an [Expo](https://expo.dev/signup) account, if you haven't already. - + The [EAS CLI](/build/setup/#install-the-latest-eas-cli) installed and logged in. - + iOS Simulators are available only on macOS. Make sure you have the [iOS Simulator](/workflow/ios-simulator/) installed. @@ -158,15 +158,15 @@ Read more about [iOS Simulator builds on EAS](/tutorial/eas/ios-development-buil ### Build the native app (iOS device) - - + + Sign up for an [Expo](https://expo.dev/signup) account, if you haven't already. - + The [EAS CLI](/build/setup/#install-the-latest-eas-cli) installed and logged in. - + A paid [Apple Developer](https://developer.apple.com/) account for creating [signing credentials](/app-signing/managed-credentials/#generating-app-signing-credentials) so the app could be installed on an iOS device. diff --git a/docs/pages/eas-update/bundle-diffing.mdx b/docs/pages/eas-update/bundle-diffing.mdx index d140c7b909ff54..bcd6b92b54d864 100644 --- a/docs/pages/eas-update/bundle-diffing.mdx +++ b/docs/pages/eas-update/bundle-diffing.mdx @@ -11,10 +11,8 @@ import { ContentSpotlight } from '~/ui/components/ContentSpotlight'; Enable bundle diffing to let EAS Update deliver a **bundle patch** when possible. When you publish a new update, EAS Update can generate a smaller file containing only the differences between the bundle currently running on the device and the new bundle. This often reduces update download size significantly. - - - Your app must be on Expo SDK 55 or later. - + + Your app must be on Expo SDK 55 or later. ## Enable bundle diffing diff --git a/docs/pages/eas-update/expo-dev-client.mdx b/docs/pages/eas-update/expo-dev-client.mdx index dd9f718a77b0b3..b95cecf12a0aeb 100644 --- a/docs/pages/eas-update/expo-dev-client.mdx +++ b/docs/pages/eas-update/expo-dev-client.mdx @@ -17,13 +17,12 @@ import { CODE } from '~/ui/components/Text'; This guide walks through the steps required to load and preview a published update inside a development build using the **Extensions** tab or constructing a specific Update URL. - - + + [Create a development build and install it](/develop/development-builds/create-a-build/) on your device, Android Emulator, or iOS Simulator. expo-updates installed diff --git a/docs/pages/eas-update/getting-started.mdx b/docs/pages/eas-update/getting-started.mdx index 6fab4adcc9e18c..f6d40563ee0a28 100644 --- a/docs/pages/eas-update/getting-started.mdx +++ b/docs/pages/eas-update/getting-started.mdx @@ -17,14 +17,14 @@ Setting up EAS Update allows you to push critical bug fixes and improvements tha > **info** If you plan to use EAS Update with EAS Build, we recommend following the [EAS Build setup guide](/build/setup/) before proceeding here. That said, [you can use EAS Update without any other EAS services](/eas-update/standalone-service/). - - + + EAS Update is available to anyone with an Expo account, regardless of whether you pay for EAS or use the Free plan. You can sign up at [expo.dev/signup](https://expo.dev/signup). Paid subscribers can publish updates to more users and use more bandwidth and storage. Learn more about different plans and benefits at [EAS pricing](https://expo.dev/pricing). - + Don't have a project yet? It's quick and easy to create a "Hello world" app you can use with this guide. Run the following command to create a new project: @@ -32,7 +32,7 @@ Setting up EAS Update allows you to push critical bug fixes and improvements tha EAS Update also works well with projects created by `npx create-react-native-app`, `npx react-native`, `ignite-cli`, and other project bootstrapping tools. - + If you already run your project with `npx expo [command]` (for example, if you created it with `npx create-expo-app`), you're all set. If you don't have the `expo` package in your project yet, install it by running the command below and [opt in to using Expo CLI and Metro Config](/bare/installing-expo-modules/#configure-expo-cli-for-bundling-on-android-and-ios): @@ -43,7 +43,6 @@ Setting up EAS Update allows you to push critical bug fixes and improvements tha Use registerRootComponent instead of registerComponent diff --git a/docs/pages/eas-update/integration-in-existing-native-apps.mdx b/docs/pages/eas-update/integration-in-existing-native-apps.mdx index 657aa71e46228b..88c213aae43f24 100644 --- a/docs/pages/eas-update/integration-in-existing-native-apps.mdx +++ b/docs/pages/eas-update/integration-in-existing-native-apps.mdx @@ -19,36 +19,35 @@ Instructions are not available for older Expo SDK and React Native versions. Add > **warning** The following instructions may not work for all projects. The specifics of integrating EAS Update into existing projects depend heavily on the specifics of your app, and so you may need to adapt the instructions to your unique setup. If you encounter issues, [create an issue on GitHub](https://github.com/expo/expo/issues) or open a pull request to suggest improvements to this guide. - - + + You should have a brownfield native project with React Native installed and configured to render a root view. If you don't have this yet, follow the [Integration with Existing Apps](https://reactnative.dev/docs/integration-with-existing-apps) guide from the React Native documentation and then come back here. - + Your app must be using the [latest Expo SDK version and its supported React Native version](/versions/latest/#each-expo-sdk-version-depends-on-a-react-native-version). - + Remove any other update library integration from your app, such as `react-native-code-push`, and ensure that your app compiles and runs successfully in both debug and release on your supported platforms. - + Support for Expo modules (through the `expo` package) must be installed and configured in your project. See [Integrating Expo tools into existing native apps](/brownfield/overview/) for more information. - + Your **metro.config.js** [must extend `expo/metro-config`](/guides/customizing-metro/#customizing). - + Your **babel.config.js** [must extend `babel-preset-expo`](/versions/latest/config/babel/). npx expo export runs successfully diff --git a/docs/pages/eas-update/migrate-from-classic-updates.mdx b/docs/pages/eas-update/migrate-from-classic-updates.mdx index e00900f86bf506..dd2df66c8509b3 100644 --- a/docs/pages/eas-update/migrate-from-classic-updates.mdx +++ b/docs/pages/eas-update/migrate-from-classic-updates.mdx @@ -12,8 +12,8 @@ import { A } from '~/ui/components/Text'; EAS Update is the next generation of Expo's updates service. If you're using Classic Updates, this guide will help you upgrade to EAS Update. - - + + EAS Update requires the following versions or greater: - Expo SDK 45.0.0 and later diff --git a/docs/pages/eas/ai/mcp.mdx b/docs/pages/eas/ai/mcp.mdx index 864d294b35efb0..ecc3b7428b7699 100644 --- a/docs/pages/eas/ai/mcp.mdx +++ b/docs/pages/eas/ai/mcp.mdx @@ -61,15 +61,15 @@ Your AI-assisted tools can autonomously write the code, capture screenshots to v The complete table of [MCP capabilities](#available-mcp-capabilities) documents the tools and prompts Expo MCP Server provides to AI-assisted tools. - - + + An [EAS paid plan](https://expo.dev/pricing) is required to use Expo MCP Server. - + Create a project with `npx create-expo-app@latest --template default@sdk-55`, or ensure your existing project has the latest `expo` package installed. - + Claude Code, Cursor, VS Code, or any other tool with remote MCP server support. diff --git a/docs/pages/eas/hosting/custom-domain.mdx b/docs/pages/eas/hosting/custom-domain.mdx index 16ccc77f715a67..0ed71cc5081eed 100644 --- a/docs/pages/eas/hosting/custom-domain.mdx +++ b/docs/pages/eas/hosting/custom-domain.mdx @@ -12,14 +12,12 @@ Each project can have exactly one custom domain, which is assigned to the produc > **info** **Note**: Setting up a custom domain is a premium feature and isn't available on the free plan. Learn more about different plans and benefits at [EAS pricing](https://expo.dev/pricing). - - + + The custom domain will always load the production deployment. To add a custom domain to your project, you need a deployment that's been promoted to production first. - - You need to own a domain name you want to use. - + You need to own a domain name you want to use. ## Assigning a custom domain diff --git a/docs/pages/eas/hosting/get-started.mdx b/docs/pages/eas/hosting/get-started.mdx index 9beaa4c9c29136..bbeead466c1838 100644 --- a/docs/pages/eas/hosting/get-started.mdx +++ b/docs/pages/eas/hosting/get-started.mdx @@ -23,14 +23,14 @@ This guide will walk you through the process of creating your first web deployme --- - - + + EAS Hosting is available to anyone with an Expo account, regardless of whether you pay for EAS or use the Free plan. You can sign up at [expo.dev/signup](https://expo.dev/signup). Paid subscribers can create more deployments, have more bandwidth, storage, and requests, and may set up a custom domain. Learn more about different plans and benefits at [EAS pricing](https://expo.dev/pricing#host). - + Don't have a project yet? It's quick and easy to create a "Hello world" app you can use with this guide. Run the following command to create a new project: diff --git a/docs/pages/eas/metadata/getting-started.mdx b/docs/pages/eas/metadata/getting-started.mdx index f7e8ee6b8e15a0..802787cc5b16f6 100644 --- a/docs/pages/eas/metadata/getting-started.mdx +++ b/docs/pages/eas/metadata/getting-started.mdx @@ -14,8 +14,8 @@ import { Terminal } from '~/ui/components/Snippet'; EAS Metadata enables you to automate and maintain your app store presence from the command line. It uses a [**store.config.json**](./config.mdx#static-store-config) file containing all required app information instead of going through multiple different forms. It also tries to find common pitfalls that could cause app rejections with built-in validation. - - + + EAS Metadata currently only supports the Apple App Store. You need an app registered with Apple to manage metadata for. diff --git a/docs/pages/eas/workflows/examples/create-development-builds.mdx b/docs/pages/eas/workflows/examples/create-development-builds.mdx index c908d9a01e2782..e433cf587ce65a 100644 --- a/docs/pages/eas/workflows/examples/create-development-builds.mdx +++ b/docs/pages/eas/workflows/examples/create-development-builds.mdx @@ -29,8 +29,8 @@ import { VideoBoxLink } from '~/ui/components/VideoBoxLink'; ## Get started - - + + To get started, you'll need to configure your project and devices to build and run development builds. Learn how to set up your environment for development builds with the following guides: - + After you've configured your project and devices, add the following build profiles to your **eas.json** file. ```json eas.json diff --git a/docs/pages/eas/workflows/examples/deploy-to-production.mdx b/docs/pages/eas/workflows/examples/deploy-to-production.mdx index e7f29e1cfb5b79..9375ddff2e1461 100644 --- a/docs/pages/eas/workflows/examples/deploy-to-production.mdx +++ b/docs/pages/eas/workflows/examples/deploy-to-production.mdx @@ -29,8 +29,8 @@ When you're ready to deliver changes to your users, you can build and submit to ## Get started - - + + To set up EAS Build, follow this guide: - + To set up EAS Submit, follow the Google Play Store and Apple App Store submissions guides: - + And finally, you'll need to set up EAS Update, which you can do with: diff --git a/docs/pages/eas/workflows/examples/publish-preview-update.mdx b/docs/pages/eas/workflows/examples/publish-preview-update.mdx index 8a4032836f9676..c16debe89da328 100644 --- a/docs/pages/eas/workflows/examples/publish-preview-update.mdx +++ b/docs/pages/eas/workflows/examples/publish-preview-update.mdx @@ -28,14 +28,14 @@ You can access preview updates in the development build UI and through scannable ## Get started - - + + Your project needs to have [EAS Update](/eas-update/introduction/) setup to publish preview updates. You can set up your project with: - + After you've configured your project, create new [development builds](/develop/development-builds/create-a-build/) for each platform. diff --git a/docs/pages/eas/workflows/get-started.mdx b/docs/pages/eas/workflows/get-started.mdx index bdad3caa98af8d..c2df70c6ede9fd 100644 --- a/docs/pages/eas/workflows/get-started.mdx +++ b/docs/pages/eas/workflows/get-started.mdx @@ -14,23 +14,23 @@ This page walks you through the process of creating your first EAS Workflows for ## Get started - - + + You'll need to [sign up](https://expo.dev/signup) for an Expo account. - + You'll need to create a project with the following command: - + You'll need to sync the project with EAS with the following command. This will create an EAS project and link it to your local project: - + You'll need to add an `eas.json` file to the root of your project if it doesn't already exist: eas.json']} /> diff --git a/docs/pages/eas/workflows/pre-packaged-jobs.mdx b/docs/pages/eas/workflows/pre-packaged-jobs.mdx index a410a71c7d93cb..cb38f1c3919a5f 100644 --- a/docs/pages/eas/workflows/pre-packaged-jobs.mdx +++ b/docs/pages/eas/workflows/pre-packaged-jobs.mdx @@ -16,8 +16,8 @@ Build your project into an Android or iOS app. Build jobs can be customized so that you can execute custom commands during the build process. See [Custom builds](/custom-builds/get-started/) for more information. - - + + Complete a build with EAS CLI using the same platform and profile as the pre-packaged job. Learn how to [create your first build](/build/setup/) to get started. @@ -183,8 +183,8 @@ jobs: Deploy your application using [EAS Hosting](/eas/hosting/introduction). - - + + See [Get started with EAS Hosting](/eas/hosting/get-started/#prerequisites) for setup instructions. @@ -502,8 +502,8 @@ jobs: Submit an Android or iOS build to the app store using EAS Submit. - - + + Submission jobs require additional configuration to run within a CI/CD process. See the [Google Play Store CI/CD submission guide](/submit/android/#submitting-your-app-using-cicd-services) and [Apple App Store CI/CD submission guide](/submit/ios/#submitting-your-app-using-cicd-services) @@ -602,8 +602,8 @@ jobs: Distribute iOS builds to TestFlight internal and external testing groups. This is an alternative to the iOS submit job for when you need more advanced TestFlight features. If you need to control test groups, changelog, or Beta App Review submission, use the `testflight` job instead of submit. - - + + TestFlight jobs require an iOS build created with `distribution: store` and an Apple Developer account configured. See the [TestFlight submission guide](/submit/ios/#submitting-your-app-using-cicd-services) for more information. @@ -708,8 +708,8 @@ jobs: Publish an update using [EAS Update](/eas-update/introduction/). - - + + To publish update previews and to send over-the-air updates. Run `npx eas-cli@latest update:configure`, then create new builds. Learn more about [configuring EAS Update](/eas-update/getting-started/#prerequisites). @@ -1242,8 +1242,8 @@ jobs: Automatically post reports of your workflow's completed builds, updates, and deployments to GitHub pull requests. It's particularly useful for providing instant feedback on PR builds, sharing test builds with QR codes for easy device testing, displaying EAS Hosting deployment previews, and automating deployment notifications. You can also override the comment contents by providing the `payload` parameter. - - + + To use the GitHub Comment job, your project must have a GitHub repository connected. Learn how to [connect your GitHub repository](/build/building-from-github/) to get started. diff --git a/docs/pages/guides/building-for-tv.mdx b/docs/pages/guides/building-for-tv.mdx index e238f5a70c16e7..080ab4f2cd5d36 100644 --- a/docs/pages/guides/building-for-tv.mdx +++ b/docs/pages/guides/building-for-tv.mdx @@ -39,19 +39,19 @@ The necessary changes to the native Android and iOS files are minimal and can be ### Android TV - - + + Install [Node.js (LTS)](https://nodejs.org/en/) on macOS or Linux. - + Install Android Studio Iguana or later. - + In the Android Studio SDK manager, select the dropdown for the Android SDK you are using (API version 31 or later), and make sure an Android TV system image is selected for installation. For Apple silicon, choose the ARM 64 image. Otherwise, choose the Intel x86_64 image. - + After installing the Android TV system image, create an Android TV emulator using that image (the process is the same as creating an Android phone emulator). @@ -59,14 +59,12 @@ The necessary changes to the native Android and iOS files are minimal and can be ### Apple TV - - + + Install [Node.js (LTS)](https://nodejs.org/en/) on macOS. - - Install Xcode 16 or later. - - + Install Xcode 16 or later. + tvOS SDK 17 or later is not installed automatically with Xcode. You can install it later with `xcodebuild -downloadAllPlatforms`. diff --git a/docs/pages/guides/dom-components.mdx b/docs/pages/guides/dom-components.mdx index d5bfa166de1c13..b652915a625256 100644 --- a/docs/pages/guides/dom-components.mdx +++ b/docs/pages/guides/dom-components.mdx @@ -14,8 +14,8 @@ Expo offers a novel approach to work with modern web code directly in a native a While the Expo native runtime generally does not support elements like `
` or ``, there may be instances where you need to quickly incorporate web components. In such cases, DOM components provide a useful solution. - - + + If you already run your project with `npx expo [command]` (for example, if you created it with `npx create-expo-app`), you're all set. If you don't have the `expo` package in your project yet, install it by running the command below and [opt in to using Expo CLI and Metro Config](/bare/installing-expo-modules/#configure-expo-cli-for-bundling-on-android-and-ios): @@ -25,7 +25,7 @@ While the Expo native runtime generally does not support elements like `
` o If the command fails, refer to the [Installing Expo modules](/bare/installing-expo-modules/#manual-installation) guide. - + If you are using Expo Router and Expo Web, you can skip this step. Otherwise, install the following packages: diff --git a/docs/pages/guides/expo-ui-swift-ui/extending.mdx b/docs/pages/guides/expo-ui-swift-ui/extending.mdx index ff5175afb2d9c9..a7c92c3b022c7e 100644 --- a/docs/pages/guides/expo-ui-swift-ui/extending.mdx +++ b/docs/pages/guides/expo-ui-swift-ui/extending.mdx @@ -12,17 +12,17 @@ import { CODE } from '~/ui/components/Text'; This guide explains how to create custom SwiftUI components and modifiers that integrate seamlessly with Expo UI. - - @expo/ui installed}> + + @expo/ui installed}> Install `@expo/ui` in your project. See [Building SwiftUI apps with Expo UI](/guides/expo-ui-swift-ui/) for more information. - + Expo UI is not available in Expo Go. Create a [development build](/develop/development-builds/introduction/) of your app. - + Basic familiarity with [Expo Modules API](/modules/overview/) and [SwiftUI](https://developer.apple.com/swiftui/) is recommended. diff --git a/docs/pages/guides/facebook-authentication.mdx b/docs/pages/guides/facebook-authentication.mdx index 947782b4cfb516..a582782e29e358 100644 --- a/docs/pages/guides/facebook-authentication.mdx +++ b/docs/pages/guides/facebook-authentication.mdx @@ -11,8 +11,8 @@ The [`react-native-fbsdk-next`](https://github.com/thebergamo/react-native-fbsdk This guide provides additional information on configuring the library with Expo for Android. - - + + The `react-native-fbsdk-next` library can't be used in Expo Go because it requires custom native code. Learn more about [adding custom native code to your app](/workflow/customizing/). diff --git a/docs/pages/guides/google-authentication.mdx b/docs/pages/guides/google-authentication.mdx index 775cbc4596f9dd..8f7e76892f17bf 100644 --- a/docs/pages/guides/google-authentication.mdx +++ b/docs/pages/guides/google-authentication.mdx @@ -10,8 +10,8 @@ The [`@react-native-google-signin/google-signin`](https://github.com/react-nativ This guide provides information on how to configure the library for your project. - - + + The `@react-native-google-signin/google-signin` library can't be used in Expo Go because it requires custom native code. Learn more about [adding custom native code to your app](/workflow/customizing/). diff --git a/docs/pages/guides/ios-developer-mode.mdx b/docs/pages/guides/ios-developer-mode.mdx index 6911162f8c41ff..6a55eda3c2dd4a 100644 --- a/docs/pages/guides/ios-developer-mode.mdx +++ b/docs/pages/guides/ios-developer-mode.mdx @@ -16,8 +16,8 @@ There are two ways you can enable Developer Mode on your device: - Directly on an iOS device - By connecting an iOS device with a Mac that has Xcode installed - - + + Developer Mode is only required on devices running iOS 16 and later. diff --git a/docs/pages/guides/keyboard-handling.mdx b/docs/pages/guides/keyboard-handling.mdx index f61e0e81530812..d8fd6cd8bbb0d8 100644 --- a/docs/pages/guides/keyboard-handling.mdx +++ b/docs/pages/guides/keyboard-handling.mdx @@ -122,13 +122,12 @@ export default function HomeScreen() { For more complex keyboard interactions, such as larger scrollable entry forms with several text input fields, consider using the [`react-native-keyboard-controller` (Keyboard Controller)](https://kirillzyusko.github.io/react-native-keyboard-controller) library. It offers additional functionality beyond the built-in React Native keyboard APIs, providing consistency across Android and iOS with minimal configuration and offering the native feel users expect. - - + + The Keyboard Controller library is not included in Expo Go. See [Create a development build](/develop/development-builds/create-a-build/) for more information. react-native-reanimated installed diff --git a/docs/pages/guides/local-app-development.mdx b/docs/pages/guides/local-app-development.mdx index 6c91aee46b755d..8c6259ccfd55ba 100644 --- a/docs/pages/guides/local-app-development.mdx +++ b/docs/pages/guides/local-app-development.mdx @@ -14,13 +14,13 @@ import { CODE } from '~/ui/components/Text'; To build your project into an app locally using your machine, you have to manually generate native code before testing the debug build or creating a production build for it to submit to the app store. There are two ways you can build your app locally. This guide provides a brief introduction to both methods and references to other guides that are necessary to create this workflow. - - + + [Set up Android Studio](/get-started/set-up-your-environment/?platform=android&device=physical&mode=development-build&buildEnv=local#set-up-an-android-device-with-a-development-build) to compile and run Android projects on your local machine. - + [Set up Xcode](/get-started/set-up-your-environment/?platform=ios&device=physical&mode=development-build&buildEnv=local#set-up-an-ios-device-with-a-development-build) to compile and run iOS projects on your local machine. diff --git a/docs/pages/guides/local-app-overview.mdx b/docs/pages/guides/local-app-overview.mdx index df071c90040276..889510463c1bbe 100644 --- a/docs/pages/guides/local-app-overview.mdx +++ b/docs/pages/guides/local-app-overview.mdx @@ -26,13 +26,13 @@ There are different scenarios when you want to build your app on your developer > **Note**: Building your app locally complements EAS Build. You can keep using the build service for cloud automation and fall back to local builds for development. - - + + [Set up Android Studio](/get-started/set-up-your-environment/?platform=android&device=physical&mode=development-build&buildEnv=local#set-up-an-android-device-with-a-development-build) to compile and run Android projects on your local machine. - + [Set up Xcode](/get-started/set-up-your-environment/?platform=ios&device=physical&mode=development-build&buildEnv=local#set-up-an-ios-device-with-a-development-build) to compile and run iOS projects on your local machine. diff --git a/docs/pages/guides/local-app-production.mdx b/docs/pages/guides/local-app-production.mdx index 71b070ec25a6f3..5c6d9cb2c68bc0 100644 --- a/docs/pages/guides/local-app-production.mdx +++ b/docs/pages/guides/local-app-production.mdx @@ -18,13 +18,13 @@ To create your app's release build (also known as production build) locally, you Creating a release build locally for Android requires signing it with an [upload key](https://developer.android.com/studio/publish/app-signing#certificates-keystores) and generating an Android Application Bundle (**.aab**). Follow the steps below: - - + + Install an [OpenJDK distribution](/get-started/set-up-your-environment/?mode=development-build&buildEnv=local#install-watchman-and-jdk) to access the `keytool` command. - + If you are using [Continuous Native Generation (CNG)](/workflow/continuous-native-generation/), run `npx expo prebuild` to generate it. @@ -130,16 +130,16 @@ Google Play Store requires manual app submission when submitting the **.aab** fi To create an iOS release build locally for Apple App Store, you need to use Xcode which handles the signing and submission process via App Store Connect. - - + + A paid Apple Developer membership is required to sign and submit iOS apps. - + [Install Xcode](/get-started/set-up-your-environment/?platform=ios&device=physical&mode=development-build&buildEnv=local#set-up-xcode-and-watchman) on your computer. - + If you are using [Continuous Native Generation (CNG)](/workflow/continuous-native-generation/), run `npx expo prebuild` to generate it. diff --git a/docs/pages/guides/local-https-development.mdx b/docs/pages/guides/local-https-development.mdx index 00e4d290b14bdb..62ac4224974bd7 100644 --- a/docs/pages/guides/local-https-development.mdx +++ b/docs/pages/guides/local-https-development.mdx @@ -11,9 +11,8 @@ import { CODE } from '~/ui/components/Text'; When developing Expo web apps locally, you may need to use HTTPS with your local development environment for testing secure browser APIs. This guide shows you how to set up local HTTPS for Expo web apps. - + mkcert installed diff --git a/docs/pages/guides/server-components.mdx b/docs/pages/guides/server-components.mdx index 0baf65014a5143..d4a5b47240593e 100644 --- a/docs/pages/guides/server-components.mdx +++ b/docs/pages/guides/server-components.mdx @@ -21,11 +21,11 @@ React Server Components enable a number of exciting capabilities, including: Expo Router enables support for [React Server Components](https://react.dev/reference/rsc/server-components) on all platforms. This is an early [preview](/more/release-statuses/#preview) of a feature that will be enabled by default in Expo Router. - - + + See [Expo Router installation](/router/installation/) if you don't have one yet. - + React Native New Architecture is required, and is enabled by default from SDK 52. diff --git a/docs/pages/guides/tailwind.mdx b/docs/pages/guides/tailwind.mdx index 713b080105e61f..a765ebcb3d89c9 100644 --- a/docs/pages/guides/tailwind.mdx +++ b/docs/pages/guides/tailwind.mdx @@ -14,8 +14,8 @@ import { Tabs, Tab } from '~/ui/components/Tabs'; [Tailwind CSS](https://tailwindcss.com/) is a utility-first CSS framework and can be used with Metro for web projects. This guide explains how to configure your Expo project to use the framework. - - + + Ensure your project is using Metro for web. Verify this by checking that `web.bundler` is set to `metro` in **app.json**: ```json app.json diff --git a/docs/pages/guides/using-bun.mdx b/docs/pages/guides/using-bun.mdx index 3bca884eb15bf7..87460752b54573 100644 --- a/docs/pages/guides/using-bun.mdx +++ b/docs/pages/guides/using-bun.mdx @@ -8,11 +8,11 @@ import { Terminal } from '~/ui/components/Snippet'; [Bun](https://bun.sh/) is a JavaScript runtime and a drop-in alternative for [Node.js](https://nodejs.org/en). In Expo projects, Bun can be used to install npm packages and run Node.js scripts. The benefits of using Bun are faster package installation than npm, pnpm, or Yarn and [at least 4x faster startup time compared to Node.js](https://bun.sh/docs#design-goals), which gives a huge boost to your local development experience. - - + + [Install Bun](https://bun.sh/docs/installation#installing) to create a new app. - + A [Node.js (LTS) version](https://nodejs.org/) is still required for the `bun create expo` and `bun expo prebuild` commands, which use `npm pack` to download project templates. diff --git a/docs/pages/guides/using-firebase.mdx b/docs/pages/guides/using-firebase.mdx index 44d0bbd0412dd3..1898a146de447e 100644 --- a/docs/pages/guides/using-firebase.mdx +++ b/docs/pages/guides/using-firebase.mdx @@ -27,8 +27,8 @@ There are two different ways you can use Firebase in your projects: React Native supports both the JS SDK and the native SDK. The following sections will guide you through when to use which SDK and all the configuration steps required to use Firebase in your Expo projects. - - + + Create a new Firebase project or use an existing one in the [Firebase console](https://console.firebase.google.com/). diff --git a/docs/pages/guides/using-resend.mdx b/docs/pages/guides/using-resend.mdx index c950232572fc47..af60f9595789cb 100644 --- a/docs/pages/guides/using-resend.mdx +++ b/docs/pages/guides/using-resend.mdx @@ -20,20 +20,18 @@ This guide demonstrates the **essential steps to integrate Resend with your Expo --- - - + + See [Expo Router installation](/router/installation/) if you don't have one yet. - + An [Expo account](https://expo.dev/signup) is required to deploy the API route using EAS Hosting. - + Install [EAS CLI](/eas/cli/) with `npm install -g eas-cli`. - - Sign up at [resend.com](https://resend.com/). - + Sign up at [resend.com](https://resend.com/). diff --git a/docs/pages/guides/using-supabase.mdx b/docs/pages/guides/using-supabase.mdx index a2328f83e5e175..7df9cba1ee551f 100644 --- a/docs/pages/guides/using-supabase.mdx +++ b/docs/pages/guides/using-supabase.mdx @@ -14,11 +14,11 @@ Supabase automatically [generates a REST API](https://supabase.com/docs/guides/a Supabase provides a TypeScript client library called [`supabase-js`](https://supabase.com/docs/reference/javascript/introduction?utm_source=expo&utm_medium=referral&utm_term=expo-react-native) to interact with the REST API. Alternatively, Supabase also exposes a [GraphQL API](https://supabase.com/docs/guides/database/extensions/pg_graphql?utm_source=expo&utm_medium=referral&utm_term=expo-react-native) allowing you to use your favorite GraphQL client (for example, [Apollo Client](https://supabase.github.io/pg_graphql/usage_with_apollo/)) should you wish to. - - + + Head over to [database.new](https://database.new?utm_source=expo&utm_medium=referral&utm_term=expo-react-native) to create a new Supabase project. - + Get the **Project URL** from the API settings and **Publishable key** from the API Keys: 1. Go to the [API Settings](https://supabase.com/dashboard/project/_/settings/api) page in the Dashboard. diff --git a/docs/pages/modules/existing-library.mdx b/docs/pages/modules/existing-library.mdx index 8a2a454041b9e1..2e30d69b8bc234 100644 --- a/docs/pages/modules/existing-library.mdx +++ b/docs/pages/modules/existing-library.mdx @@ -11,8 +11,8 @@ There are cases where you may want to integrate the Expo Modules API into an exi This guide will help you set up your existing React Native library to access Expo Modules API. - - + + Create the [**expo-module.config.json**](/modules/module-config/) file at the root of your project and add an empty object `{}` inside it. You will update it later to enable specific features. This file is required for [Expo Autolinking](/modules/autolinking/) to recognize your library as an Expo module and automatically link your native code. diff --git a/docs/pages/push-notifications/push-notifications-setup.mdx b/docs/pages/push-notifications/push-notifications-setup.mdx index 426ca00d715a77..9b0574f06774fc 100644 --- a/docs/pages/push-notifications/push-notifications-setup.mdx +++ b/docs/pages/push-notifications/push-notifications-setup.mdx @@ -35,8 +35,8 @@ If you need finer-grained control over your notifications, communicating directl - - + + Push notifications are not supported on Android Emulators or iOS Simulators. You will need a real device to test. diff --git a/docs/pages/review/with-orbit.mdx b/docs/pages/review/with-orbit.mdx index f00ce549739fc0..e4a22475c68c4b 100644 --- a/docs/pages/review/with-orbit.mdx +++ b/docs/pages/review/with-orbit.mdx @@ -18,12 +18,12 @@ If you don't have any development builds available, either because they have all - - + + Download Orbit directly from [GitHub releases](https://github.com/expo/orbit/releases), or see the [alternative installation method](/build/orbit/#installation). - + After installing the app, sign in to your Expo account from **Settings**. diff --git a/docs/pages/router/installation.mdx b/docs/pages/router/installation.mdx index f8f50db58b1913..cf6fbe7189b867 100644 --- a/docs/pages/router/installation.mdx +++ b/docs/pages/router/installation.mdx @@ -13,8 +13,8 @@ import { Step } from '~/ui/components/Step'; Follow the steps below if you have an existing project and want to add Expo Router. For new projects, see the [Quick start](/router/introduction/#quick-start) in the introduction guide. - - + + Make sure your computer is [set up for running an Expo app](/get-started/create-a-project/). diff --git a/docs/pages/submit/android.mdx b/docs/pages/submit/android.mdx index d2516a6126373a..78cb33e860a279 100644 --- a/docs/pages/submit/android.mdx +++ b/docs/pages/submit/android.mdx @@ -12,23 +12,23 @@ This guide outlines how to submit your app to the Google Play Store from your co ## Submitting your app from your computer - - + + A Google Play Developer account is required to submit your app to the Google Play Store. You can sign up for a Google Play Developer account on the [Google Play Console sign-up page](https://play.google.com/apps/publish/signup/). - + Create an app by clicking **Create app** in the [Google Play Console](https://play.google.com/apps/publish/). - + EAS requires you to upload and configure a Google Service Account Key to submit your Android app to the Google Play Store. You can create one with the [uploading a Google Service Account Key for Play Store submissions with EAS](https://github.com/expo/fyi/blob/main/creating-google-service-account.md) guide. - + Install EAS CLI and login with your Expo account: - + Include your app's package name in **app.json**: ```json app.json @@ -40,7 +40,7 @@ This guide outlines how to submit your app to the Google Play Store from your co ``` - + You'll need a production build ready for store submission. You can create one using [EAS Build](/build/introduction/): @@ -48,7 +48,7 @@ This guide outlines how to submit your app to the Google Play Store from your co Alternatively, you can build the app on your own computer with `eas build --platform android --profile production --local` or with Android Studio. - + You have to upload your app manually at least once. This is a limitation of the Google Play Store API. Learn how with the [first submission of an Android app](https://expo.fyi/first-android-submission) guide. @@ -72,23 +72,23 @@ Learn more about the `--auto-submit` flag in the [automate submissions](/build/a ## Submitting your app using CI/CD services - - + + A Google Play Developer account is required to submit your app to the Google Play Store. You can sign up for a Google Play Developer account on the [Google Play Console sign-up page](https://play.google.com/apps/publish/signup/). - + Create an app by clicking **Create app** in the [Google Play Console](https://play.google.com/apps/publish/). - + EAS requires you to upload and configure a Google Service Account Key to submit your Android app to the Google Play Store. You can create one with the [uploading a Google Service Account Key for Play Store submissions with EAS](https://github.com/expo/fyi/blob/main/creating-google-service-account.md) guide. - + Install EAS CLI and login with your Expo account: - + Include your app's package name in **app.json**: ```json app.json @@ -100,7 +100,7 @@ Learn more about the `--auto-submit` flag in the [automate submissions](/build/a ``` - + Then, you need to upload your Google Service Account key to EAS dashboard under project's credentials. @@ -131,7 +131,7 @@ Learn more about the `--auto-submit` flag in the [automate submissions](/build/a - + You'll need a production build ready for store submission. You can create one using [EAS Build](/build/introduction/): @@ -139,7 +139,7 @@ Learn more about the `--auto-submit` flag in the [automate submissions](/build/a Alternatively, you can build the app on your own computer with `eas build --platform android --profile production --local` or with Android Studio. - + You have to upload your app manually at least once. This is a limitation of the Google Play Store API. Learn how with the [first submission of an Android app](https://expo.fyi/first-android-submission) guide. diff --git a/docs/pages/submit/ios.mdx b/docs/pages/submit/ios.mdx index 60f4d7b99590c1..32b573d0e720f4 100644 --- a/docs/pages/submit/ios.mdx +++ b/docs/pages/submit/ios.mdx @@ -13,11 +13,11 @@ This guide outlines how to submit your app to the Apple App Store from your comp ## Submitting your app from your computer - - + + An Apple Developer account is required to submit your app to the Apple App Store. You can sign up for an Apple Developer account on the [Apple Developer Portal](https://developer.apple.com/account/). - + Include your app's bundle identifier in **app.json**: ```json app.json @@ -29,12 +29,12 @@ This guide outlines how to submit your app to the Apple App Store from your comp ``` - + Install EAS CLI and login with your Expo account: - + You'll need a production build ready for store submission. You can create one using [EAS Build](/build/introduction/): @@ -89,11 +89,11 @@ Learn more about the `--auto-submit` flag in the [automate submissions](/build/a ## Submitting your app using CI/CD services - - + + An Apple Developer account is required to submit your app to the Apple App Store. You can sign up for an Apple Developer account on the [Apple Developer Portal](https://developer.apple.com/account/). - + Include your app's bundle identifier in **app.json**: ```json app.json @@ -105,7 +105,7 @@ Learn more about the `--auto-submit` flag in the [automate submissions](/build/a ``` - + Run the following command to configure your App Store Connect API Key: @@ -125,7 +125,7 @@ Learn more about the `--auto-submit` flag in the [automate submissions](/build/a - + Then, you'll need to provide a submission profile in **eas.json** that includes the following fields: ```json eas.json @@ -158,7 +158,7 @@ Learn more about the `--auto-submit` flag in the [automate submissions](/build/a Learn about all the options you can provide in the [eas.json reference](/eas/json/#ios-specific-options-1). - + You'll need a production build ready for store submission. You can create one using [EAS Build](/build/introduction/): diff --git a/docs/pages/tutorial/create-your-first-app.mdx b/docs/pages/tutorial/create-your-first-app.mdx index 6349743a3b1d07..a0b29ea5bf7459 100644 --- a/docs/pages/tutorial/create-your-first-app.mdx +++ b/docs/pages/tutorial/create-your-first-app.mdx @@ -26,17 +26,17 @@ In this chapter, let's learn how to create a new Expo project and how to get it --- - - + + Install [Expo Go](https://expo.dev/go) on a physical Android or iOS device. - + Install [Node.js (LTS version)](https://nodejs.org/en) on your machine. - + Install [VS Code](https://code.visualstudio.com/) or any other preferred code editor or IDE. - + A macOS, Linux, or Windows (PowerShell and WSL2) with a terminal window open. diff --git a/docs/pages/tutorial/eas/android-production-build.mdx b/docs/pages/tutorial/eas/android-production-build.mdx index c91681cbbc2779..25a2f53f378b5e 100644 --- a/docs/pages/tutorial/eas/android-production-build.mdx +++ b/docs/pages/tutorial/eas/android-production-build.mdx @@ -24,16 +24,16 @@ In this chapter, we'll create our example app's production version and submit it --- - - + + A paid Google Play Developer account is required. For details on setting one up, visit the [Google Play sign-up page](https://play.google.com/apps/publish/signup/). - + Ensure that a `production` build profile is present in your **eas.json**, which is added by default. - + A Google Service Account email and JSON key is required to [automate the release process](#automated-release). Follow the detailed instructions in [creating a Google Service Account key or downloading it from an existing diff --git a/docs/pages/tutorial/eas/introduction.mdx b/docs/pages/tutorial/eas/introduction.mdx index 6ced4df857a031..e805213c692b96 100644 --- a/docs/pages/tutorial/eas/introduction.mdx +++ b/docs/pages/tutorial/eas/introduction.mdx @@ -27,8 +27,8 @@ These topics will give us the foundation needed to use EAS effectively and to ap This tutorial is hands-on and designed to be completed in about two hours. - - + + Pick one of the following options to follow along: - Continue with the Sticker Smash app from the previous tutorial. If new, download it from [GitHub](https://github.com/expo/examples/tree/master/stickersmash). diff --git a/docs/pages/tutorial/eas/ios-development-build-for-devices.mdx b/docs/pages/tutorial/eas/ios-development-build-for-devices.mdx index 4b506c8c28907e..e220661cbd7fd2 100644 --- a/docs/pages/tutorial/eas/ios-development-build-for-devices.mdx +++ b/docs/pages/tutorial/eas/ios-development-build-for-devices.mdx @@ -25,13 +25,13 @@ Development builds for iOS devices are generated in the **.ipa** format, which i --- - - + + Required to access [necessary credentials](/app-signing/app-credentials/#ios) for signing our app, as each build needs to be signed to verify that the app comes from a trusted source. EAS Build helps manage these credentials. - + Installing development builds on your device requires Developer Mode to be enabled. If this is your first time or if it's currently disabled, see [activate Developer Mode](/guides/ios-developer-mode/). diff --git a/docs/pages/tutorial/eas/ios-production-build.mdx b/docs/pages/tutorial/eas/ios-production-build.mdx index d54a61450231c4..d98e6dc4b38f50 100644 --- a/docs/pages/tutorial/eas/ios-production-build.mdx +++ b/docs/pages/tutorial/eas/ios-production-build.mdx @@ -23,11 +23,11 @@ In this chapter, we'll create our example app's production version and submit it --- - - + + To create one, see the [Apple Developer Portal](https://developer.apple.com/account/). - + Ensure that a `production` build profile is present in your **eas.json**, which is added by default. diff --git a/docs/ui/components/Prerequisites/Prerequisites.test.tsx b/docs/ui/components/Prerequisites/Prerequisites.test.tsx new file mode 100644 index 00000000000000..47bd799a143a32 --- /dev/null +++ b/docs/ui/components/Prerequisites/Prerequisites.test.tsx @@ -0,0 +1,50 @@ +import { render, screen } from '@testing-library/react'; +import GithubSlugger from 'github-slugger'; +import { PropsWithChildren } from 'react'; + +import { createHeadingManager } from '~/common/headingManager'; +import { HeadingsContext } from '~/common/withHeadingManager'; + +import { Prerequisites, Requirement } from '.'; + +const WrapWithContext = ({ children }: PropsWithChildren) => { + const headingManager = createHeadingManager(new GithubSlugger(), { headings: [] }); + return {children}; +}; + +describe('Prerequisites', () => { + it('renders a single requirement without the numeric prefix', () => { + render( + + + Body content. + + + ); + + expect(screen.getByText('Only requirement')).toBeVisible(); + expect(screen.getByText('Body content.')).toBeVisible(); + expect(screen.getByText('1 requirement')).toBeVisible(); + expect(screen.queryByText('1.')).not.toBeInTheDocument(); + }); + + it('renders numbered prefixes when there are multiple requirements', () => { + render( + + + Step one body. + Step two body. + Step three body. + + + ); + + expect(screen.getByText('First')).toBeVisible(); + expect(screen.getByText('Second')).toBeVisible(); + expect(screen.getByText('Third')).toBeVisible(); + expect(screen.getByText('3 requirements')).toBeVisible(); + expect(screen.getByText('1.')).toBeVisible(); + expect(screen.getByText('2.')).toBeVisible(); + expect(screen.getByText('3.')).toBeVisible(); + }); +}); diff --git a/docs/ui/components/Prerequisites/Requirement.tsx b/docs/ui/components/Prerequisites/Requirement.tsx index 7e7c8821684adc..458b8b33f4e23c 100644 --- a/docs/ui/components/Prerequisites/Requirement.tsx +++ b/docs/ui/components/Prerequisites/Requirement.tsx @@ -1,20 +1,16 @@ import { mergeClasses } from '@expo/styleguide'; import { type PropsWithChildren, type ReactNode } from 'react'; -type RequirementProps = PropsWithChildren<{ +export type RequirementProps = PropsWithChildren<{ title: ReactNode; - number: number; }>; -export function Requirement({ title, number, children }: RequirementProps) { +export function Requirement({ title, children }: RequirementProps) { return ( -
-

{number}.

-
-
{title}
-
pre]:mt-0 [&>*:last-child]:mb-0!')}> - {children} -
+
+
{title}
+
pre]:mt-0 [&>*:last-child]:mb-0!')}> + {children}
); diff --git a/docs/ui/components/Prerequisites/index.tsx b/docs/ui/components/Prerequisites/index.tsx index 6ff85aea98bf71..a4200f77db716e 100644 --- a/docs/ui/components/Prerequisites/index.tsx +++ b/docs/ui/components/Prerequisites/index.tsx @@ -3,7 +3,15 @@ import { TriangleDownIcon } from '@expo/styleguide-icons/custom/TriangleDownIcon import { ListIcon } from '@expo/styleguide-icons/outline/ListIcon'; import { motion } from 'framer-motion'; import { useRouter } from 'next/compat/router'; -import { type ComponentType, type PropsWithChildren, useEffect, useRef, useState } from 'react'; +import { + Children, + isValidElement, + type ComponentType, + type PropsWithChildren, + useEffect, + useRef, + useState, +} from 'react'; import withHeadingManager, { HeadingManagerProps } from '~/common/withHeadingManager'; import { PermalinkIcon } from '~/ui/components/Permalink'; @@ -11,10 +19,6 @@ import { PermalinkIcon } from '~/ui/components/Permalink'; import { Requirement } from './Requirement'; type PrerequisitesProps = PropsWithChildren<{ - /** - * The number of requirements for the prerequisites. - */ - numberOfRequirements: number; /** * If the prerequisites should be rendered "open" by default. */ @@ -24,12 +28,15 @@ type PrerequisitesProps = PropsWithChildren<{ const Prerequisites: ComponentType = withHeadingManager( ({ - numberOfRequirements = 1, children, className, headingManager, open = false, }: PrerequisitesProps & HeadingManagerProps) => { + const requirementChildren = Children.toArray(children).filter( + child => isValidElement(child) && child.type === Requirement + ); + const numberOfRequirements = requirementChildren.length; const router = useRouter(); const [isOpen, setIsOpen] = useState(open); const detailsRef = useRef(null); @@ -61,7 +68,7 @@ const Prerequisites: ComponentType = withHeadingManager( id={heading.current.slug} className={mergeClasses( 'border-default mb-3 scroll-m-4 rounded-md border p-0', - '[&[open]]:shadow-xs', + '[[open]]:shadow-xs', '[h4+&]:mt-3 [li>&]:mt-3 [p+&]:mt-3', className )} @@ -77,7 +84,7 @@ const Prerequisites: ComponentType = withHeadingManager( 'hocus:bg-subtle' )}>
-
+
= withHeadingManager( height: isOpen ? 'auto' : 0, }} className="overflow-hidden"> -
{children}
+
+ {requirementChildren.map((child, index) => ( +
+ {numberOfRequirements > 1 && ( +

{index + 1}.

+ )} + {child} +
+ ))} +
); From ca1613238dec130ef70bc49b552a1483bc33eded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Dr=C3=B3=C5=BCd=C5=BC?= <31368152+behenate@users.noreply.github.com> Date: Tue, 28 Apr 2026 13:04:26 +0200 Subject: [PATCH 05/20] [docs][create-expo-module] Add docs page for `create-expo-module` (#45047) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Łukasz Kosmaty Co-authored-by: Aman Mittal --- docs/constants/navigation.js | 1 + docs/pages/modules/get-started.mdx | 2 +- docs/pages/modules/overview.mdx | 7 + docs/pages/more/create-expo-module.mdx | 353 +++++++++++++++++++++++++ docs/pages/more/glossary-of-terms.mdx | 4 + 5 files changed, 366 insertions(+), 1 deletion(-) create mode 100644 docs/pages/more/create-expo-module.mdx diff --git a/docs/constants/navigation.js b/docs/constants/navigation.js index 8e68994c99aab1..2a362b733e23ce 100644 --- a/docs/constants/navigation.js +++ b/docs/constants/navigation.js @@ -730,6 +730,7 @@ const versionsReference = VERSIONS.reduce( [ makePage('more/expo-cli.mdx'), makePage('more/create-expo.mdx'), + makePage('more/create-expo-module.mdx'), makePage('more/qr-codes.mdx'), makePage('more/release-statuses.mdx'), makePage('more/glossary-of-terms.mdx'), diff --git a/docs/pages/modules/get-started.mdx b/docs/pages/modules/get-started.mdx index 393a4e7901508f..8ad27e02bc3c48 100644 --- a/docs/pages/modules/get-started.mdx +++ b/docs/pages/modules/get-started.mdx @@ -11,7 +11,7 @@ import { FileTree } from '~/ui/components/FileTree'; import { Terminal } from '~/ui/components/Snippet'; import { Step } from '~/ui/components/Step'; -**There are two ways to get started with the Expo Modules API:** you can either initialize a new module from scratch or add the Expo Modules API to an existing module. This guide will walk you through creating a new module from scratch, and the [Integrating in an existing library](/modules/existing-library) covers the latter. +**There are two ways to get started with the Expo Modules API:** you can either initialize a new module from scratch or add the Expo Modules API to an existing module. This guide will walk you through creating a new module from scratch, and the [Integrating in an existing library](/modules/existing-library) covers the latter. For a full list of available options, see the [`create-expo-module` reference](/more/create-expo-module/). The two recommended flows to create a new module with Expo Modules API: diff --git a/docs/pages/modules/overview.mdx b/docs/pages/modules/overview.mdx index 5b1300a351e1b5..5f877fcf8eafd3 100644 --- a/docs/pages/modules/overview.mdx +++ b/docs/pages/modules/overview.mdx @@ -101,6 +101,13 @@ Learn more about this in the [Integrate an existing library](/modules/existing-l Icon={Grid01Icon} /> + + + +Running the above command will prompt you to enter the local module name, native module name, target platforms, and feature examples to include. + +Local modules are created in the **modules** directory by default. If your project's **package.json** defines `expo.autolinking.nativeModulesDir`, the module is created in that directory instead. + +A local module includes the module config, JavaScript or TypeScript source files, and native files for the selected platforms. For example, a module with Android and Apple support includes: + + + +## Create a standalone module + +To create a standalone Expo module, run the following command: + + + +Running the above command will prompt you for the package name, native module name, target platforms, feature examples, package metadata, and package manager. It generates the module and an **example** app that you can use to build and test the module on Android and iOS. + +The generated module includes package metadata, TypeScript configuration, native platform files, module source files, and an **example** app. For example, a module with Android and Apple support includes: + + + +If the module is not created inside an existing Git repository, the command initializes a new Git repository and creates an initial commit. + +When the **example** app is created, the command installs dependencies and runs Prebuild for the app. On macOS, it also installs CocoaPods for the generated iOS project. + +## Develop a standalone module + +After creating a standalone module, navigate to the module directory and open the generated native projects: + + + +> **Note:** The `open:ios` script requires macOS and Xcode. On Windows, open the generated **android** directory in Android Studio. + +Then start the development server from the **example** directory: + + + +Standalone modules include the following scripts: + +| Script | Description | +| -------------- | ---------------------------------------------------- | +| `build` | Compiles TypeScript source files. | +| `clean` | Removes generated build output. | +| `test` | Runs module tests. | +| `prepare` | Builds package targets before publishing or packing. | +| `open:ios` | Opens the generated iOS example project. | +| `open:android` | Opens the generated Android example project. | + +When you change native code, rebuild the example app to see the changes. JavaScript and TypeScript changes are picked up by the development server. + +## Options + +Use the following options to customize the command's behavior. + +### `[path]` + +Creates the module at the provided path. If omitted, the command uses the name from the prompt. + +### `--local` + +Creates a local module inside the current Expo project. Local modules skip installing module dependencies and do not create an example app. + +### `--platform` + +Selects the platforms the module should support. Available values are `android`, `apple`, and `web`. + +For local modules, the interactive prompt preselects platforms from the app config's [`platforms`](/versions/latest/config/app/#platforms) property when it is available. For standalone modules, all platforms are preselected by default. In non-interactive mode, all platforms are used unless this option is provided. + +For example, to create an Android and Apple module: + + + +### `--features` + +Selects which feature examples to include in the generated module. Feature examples are small, working snippets in the generated files that show how to define common Expo Modules API features. They are meant to give you a starting point for your own implementation, not to declare what your module is allowed to support. + +Available feature examples are: + +| Feature | Description | +| --------------- | ---------------------------------------------------------------------------------- | +| `Constant` | Adds a native constant exported by the module. | +| `Function` | Adds a synchronous native function. | +| `AsyncFunction` | Adds an asynchronous native function. | +| `Event` | Adds a module-level event emitter example. | +| `View` | Adds a native view component example. | +| `ViewEvent` | Adds an event emitted from the native view. This also includes the `View` example. | +| `SharedObject` | Adds an example of a native object shared with JavaScript. | + +For example: + + + +Use `all` to include every feature example: + + + +If you do not select any feature examples, the command creates a minimal module. + +### `--full-example` + +Includes all available feature examples. This is equivalent to passing `--features all`. + +### `--package-manager` + +Selects the package manager used for standalone modules. Available values are `npm`, `pnpm`, `yarn`, and `bun`. + +If omitted, the command detects the package manager from the current process or from the package managers available on your system. In interactive mode, the detected package manager is preselected. + +### `--no-example` + +Skips creating the **example** app for a standalone module. + +### `--barrel` + +Generates an **index.ts** barrel file for local modules. This option only applies with `--local`. + +By default, local modules do not generate a barrel file, so imports point directly to files in the module's **src** directory. + +### `--source` + +Uses a local template directory instead of downloading **expo-module-template** from npm. Pass the root directory of an **expo-module-template** package. + +### `--with-readme` + +Includes a **README.md** file in a standalone module. + +### `--with-changelog` + +Includes a **CHANGELOG.md** file in a standalone module. + +### `--name` + +Sets the native module name, for example `MyModule`. If the name conflicts with an Apple framework, the command renames it to avoid native build errors. + +### `--description` + +Sets the module description used in package metadata. + +### `--package` + +Sets the Android package name, for example `expo.modules.mymodule`. + +### `--author-name` + +Sets the package author name. + +### `--author-email` + +Sets the package author email address. + +### `--author-url` + +Sets the package author profile URL. + +### `--repo` + +Sets the package repository URL. + +### `--license` + +Sets the package license. The default is `MIT`. + +### `--module-version` + +Sets the initial package version. The default is `0.1.0`. + +### `--version` + +Prints the version number and exits. + +### `--help` + +Prints the list of available options and exits. + +## Non-interactive mode + +`create-expo-module` skips prompts when it runs in a non-interactive environment. This includes CI, `EXPO_NONINTERACTIVE`, and terminals where stdin is not a TTY. + +In non-interactive mode, values that are not passed explicitly are filled with defaults and printed as warnings. For example, the command can derive the package name from the target path and use defaults for the native module name, Android package name, description, license, and initial version. + +Pass options explicitly when you need stable generated values: + + + +For local modules, non-interactive mode also defaults to all platforms unless `--platform` is provided. + +The `add-platform-support` command requires `--platform` in non-interactive mode: + + + +## Add platform support + +The `add-platform-support` command adds new platform files to an existing Expo module and updates **expo-module.config.json**. + +> **Note:** The command scans the existing native module definition and tries to detect feature examples such as `Function`, `AsyncFunction`, `View`, and `SharedObject`. Feature detection is best effort. It works well for modules that follow the usual Expo Modules API patterns, but it may not detect features correctly in unusual modules, modules with generated code, or large modules with definitions spread across multiple files. Use `--features` to override the detected feature examples. + +For native modules, the existing implementation needs to use the Expo Modules API DSL so the command can find the module definition file. Older module formats are not supported. + +Run the command from the module root: + + + +The command will prompt you to choose from the platforms that are not already supported by the module. + +You can also pass the path to the module: + + + +The command only adds platforms that are not already listed in **expo-module.config.json**. It does not overwrite existing native platform directories, such as **android** or **ios**. + +### `add-platform-support --platform` + +Selects the platforms to add. Available values are `apple`, `android`, and `web`. + +In non-interactive mode, this option is required. In interactive mode, the command prompts you to choose from the platforms that are not already supported by the module. + +For example, to add Android support without a prompt: + + + +### `add-platform-support --features` + +Overrides the feature examples used when generating files for the new platform. + +If the generated files do not match your module, pass `--features` explicitly: + + + +If no features are detected or provided, the command generates a minimal scaffold for the new platform. + +### `add-platform-support --source` + +Uses a local template directory instead of downloading **expo-module-template** from npm. + +## Template versions + +By default, `create-expo-module` downloads **expo-module-template** from npm. + +Standalone modules use the latest template. Local modules try to use the template version that matches the Expo SDK version installed in the current project, and fall back to the latest template when the SDK version cannot be detected. + +To test beta releases, set `EXPO_BETA=1` before running the command: + + + +## Environment variables + +### `EXPO_BETA` + +Uses the next version of the module and example app templates. + +### `EXPO_DEBUG` + +Enables debug logs for the command. + +### `EXPO_NO_TELEMETRY` + +Disables telemetry. + +### `EXPO_NONINTERACTIVE` + +Runs the command in non-interactive mode and skips prompts. + +## Learn more + + + + + + diff --git a/docs/pages/more/glossary-of-terms.mdx b/docs/pages/more/glossary-of-terms.mdx index 8e761ed4de770c..0b6e436dd9f866 100644 --- a/docs/pages/more/glossary-of-terms.mdx +++ b/docs/pages/more/glossary-of-terms.mdx @@ -88,6 +88,10 @@ An abstract concept that describes the process of generating native projects fro A standalone command-line tool (CLI) for bootstrapping new React Native apps with the `expo` package installed. See [`create-expo-app` reference](/more/create-expo/) for more information. +### create-expo-module + +A standalone command line tool (CLI) for creating Expo modules and adding platform support to existing modules. See [`create-expo-module` reference](/more/create-expo-module/) for more information. + ### create-react-native-app A standalone command-line tool (CLI) for bootstrapping new React Native apps with the `expo` package installed and the native code generated. This CLI also enables the use of bootstrapping from an example project in [expo/examples](https://github.com/expo/examples). From 23479054cc4f76f80b8f98f8b78258987033c2ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Dr=C3=B3=C5=BCd=C5=BC?= <31368152+behenate@users.noreply.github.com> Date: Tue, 28 Apr 2026 13:04:39 +0200 Subject: [PATCH 06/20] [create-expo-module] Add `addPlatformSupport` subcommand (#44881) --- .../e2e/__tests__/index-test.ts | 334 ++++++++++ .../src/__tests__/featureDetection-test.ts | 202 ++++++ .../src/__tests__/templateUtils-test.ts | 75 +++ .../src/addPlatformSupport.ts | 608 ++++++++++++++++++ .../src/create-expo-module.ts | 364 ++--------- .../src/featureDetection.ts | 148 +++++ packages/create-expo-module/src/snippets.ts | 36 +- .../create-expo-module/src/templateUtils.ts | 375 +++++++++++ packages/create-expo-module/src/utils/env.ts | 18 + 9 files changed, 1829 insertions(+), 331 deletions(-) create mode 100644 packages/create-expo-module/src/__tests__/featureDetection-test.ts create mode 100644 packages/create-expo-module/src/__tests__/templateUtils-test.ts create mode 100644 packages/create-expo-module/src/addPlatformSupport.ts create mode 100644 packages/create-expo-module/src/featureDetection.ts create mode 100644 packages/create-expo-module/src/templateUtils.ts diff --git a/packages/create-expo-module/e2e/__tests__/index-test.ts b/packages/create-expo-module/e2e/__tests__/index-test.ts index 61f1f474ad73c6..8a1dbe7e01309e 100644 --- a/packages/create-expo-module/e2e/__tests__/index-test.ts +++ b/packages/create-expo-module/e2e/__tests__/index-test.ts @@ -1,10 +1,13 @@ import fs from 'fs'; import path from 'path'; +import os from 'os'; + import { createFakeProject, createTestPath, ensureFolderExists, + execute, executePassing, expectFileExists, expectFileNotExists, @@ -557,3 +560,334 @@ describe('non-interactive defaults warning', () => { expect(packageJson.version).toBe('2.0.0'); }); }); + +describe('add-platform-support', () => { + const localTemplatePath = path.resolve(__dirname, '../../../expo-module-template'); + + /** + * Creates a local module inside a fake Expo project using --local. + * Returns the absolute path to the created module directory. + */ + async function createLocalModule( + projectPath: string, + slug: string, + platforms: string[], + features: string[] = [] + ): Promise { + const moduleName = + slug.charAt(0).toUpperCase() + + slug.slice(1).replace(/-./g, (m) => (m[1] ?? '').toUpperCase()); + const args = [ + '--local', + slug, + '--name', + moduleName, + '--package', + `expo.modules.${slug.replace(/-/g, '')}`, + '--platform', + ...platforms, + '--source', + localTemplatePath, + ]; + if (features.length > 0) { + args.push('--features', ...features); + } + await executePassing(args, { cwd: projectPath }); + return path.join(projectPath, 'modules', slug); + } + + it('adds android support to an apple-only module with Function and AsyncFunction', async () => { + const project = createFakeProject('aps-fn-project'); + const modulePath = await createLocalModule(project, 'aps-fn', ['apple'], [ + 'Function', + 'AsyncFunction', + ]); + + await executePassing([ + 'add-platform-support', + modulePath, + '--platform', + 'android', + '--source', + localTemplatePath, + ]); + + expect(fs.existsSync(path.join(modulePath, 'android'))).toBe(true); + + const config = JSON.parse( + fs.readFileSync(path.join(modulePath, 'expo-module.config.json'), 'utf-8') + ); + expect(config.platforms).toContain('android'); + expect(config.android).toBeDefined(); + + // Find the Kotlin module file and check it has the expected snippets + const pkgDir = path.join( + modulePath, + 'android', + 'src', + 'main', + 'java', + 'expo', + 'modules', + 'apsfn' + ); + const ktFiles = fs.readdirSync(pkgDir); + const moduleKt = ktFiles.find((f) => f.endsWith('Module.kt'))!; + const ktContent = fs.readFileSync(path.join(pkgDir, moduleKt), 'utf-8'); + expect(ktContent).toContain('Function('); + expect(ktContent).toContain('AsyncFunction('); + }); + + it('adds apple support to an android-only module with View and ViewEvent', async () => { + const project = createFakeProject('aps-view-project'); + const modulePath = await createLocalModule(project, 'aps-view', ['android'], [ + 'View', + 'ViewEvent', + ]); + + await executePassing([ + 'add-platform-support', + modulePath, + '--platform', + 'apple', + '--source', + localTemplatePath, + ]); + + expect(fs.existsSync(path.join(modulePath, 'ios'))).toBe(true); + + const config = JSON.parse( + fs.readFileSync(path.join(modulePath, 'expo-module.config.json'), 'utf-8') + ); + expect(config.platforms).toContain('apple'); + expect(config.apple).toBeDefined(); + + const swiftContent = fs.readFileSync( + path.join(modulePath, 'ios', 'ApsViewModule.swift'), + 'utf-8' + ); + expect(swiftContent).toContain('View('); + }); + + it('adds android support to an apple-only module with SharedObject', async () => { + const project = createFakeProject('aps-so-project'); + const modulePath = await createLocalModule(project, 'aps-so', ['apple'], ['SharedObject']); + + await executePassing([ + 'add-platform-support', + modulePath, + '--platform', + 'android', + '--source', + localTemplatePath, + ]); + + expect(fs.existsSync(path.join(modulePath, 'android'))).toBe(true); + + const config = JSON.parse( + fs.readFileSync(path.join(modulePath, 'expo-module.config.json'), 'utf-8') + ); + expect(config.platforms).toContain('android'); + + const pkgDir = path.join( + modulePath, + 'android', + 'src', + 'main', + 'java', + 'expo', + 'modules', + 'apsso' + ); + const ktFiles = fs.readdirSync(pkgDir); + const soKt = ktFiles.find((f) => f.includes('SharedObject')); + expect(soKt).toBeDefined(); + }); + + it('adds web support to an apple-only module and updates .web.ts from stub to implementation', async () => { + const project = createFakeProject('aps-web-project'); + const modulePath = await createLocalModule(project, 'aps-web', ['apple'], ['Function']); + + await executePassing([ + 'add-platform-support', + modulePath, + '--platform', + 'web', + '--source', + localTemplatePath, + ]); + + const config = JSON.parse( + fs.readFileSync(path.join(modulePath, 'expo-module.config.json'), 'utf-8') + ); + expect(config.platforms).toContain('web'); + + const webContent = fs.readFileSync( + path.join(modulePath, 'src', 'ApsWebModule.web.ts'), + 'utf-8' + ); + expect(webContent).not.toContain('not available on the web platform'); + }); + + it('does not overwrite existing wrapper files when adding a native platform to a web-enabled module', async () => { + const project = createFakeProject('aps-preserve-project'); + const modulePath = await createLocalModule(project, 'aps-preserve', ['apple', 'web'], ['View']); + const wrapperPath = path.join(modulePath, 'src', 'ApsPreserveView.tsx'); + const webViewPath = path.join(modulePath, 'src', 'ApsPreserveView.web.tsx'); + const wrapperSentinel = '// custom wrapper change'; + const webViewSentinel = '// custom web view change'; + + fs.writeFileSync(wrapperPath, `${wrapperSentinel}\n`); + fs.writeFileSync(webViewPath, `${webViewSentinel}\n`); + + await executePassing([ + 'add-platform-support', + modulePath, + '--platform', + 'android', + '--source', + localTemplatePath, + ]); + + expect(fs.readFileSync(wrapperPath, 'utf-8')).toBe(`${wrapperSentinel}\n`); + expect(fs.readFileSync(webViewPath, 'utf-8')).toBe(`${webViewSentinel}\n`); + }); + + it('uses the module source declaration as the public module name when no native implementation exists', async () => { + const project = createFakeProject('aps-name-fallback-project'); + const modulePath = await createLocalModule(project, 'aps-name-fallback', ['web']); + const moduleTsPath = path.join(modulePath, 'src', 'ApsNameFallbackModule.ts'); + + fs.writeFileSync( + moduleTsPath, + `import { requireNativeModule } from 'expo'; + +type NativeModuleShape = { + hello(): string; +}; + +export default requireNativeModule('ExpoImage'); +`, + 'utf8' + ); + + await executePassing([ + 'add-platform-support', + modulePath, + '--platform', + 'apple', + '--source', + localTemplatePath, + ]); + + const swiftContent = fs.readFileSync( + path.join(modulePath, 'ios', 'ApsNameFallbackModule.swift'), + 'utf-8' + ); + expect(swiftContent).toContain('Name("ExpoImage")'); + }); + + it('aborts when the requested platform is already supported', async () => { + const project = createFakeProject('aps-conflict-project'); + const modulePath = await createLocalModule(project, 'aps-conflict', ['apple', 'android']); + + let thrownError: any; + try { + await execute([ + 'add-platform-support', + modulePath, + '--platform', + 'android', + '--source', + localTemplatePath, + ]); + } catch (e) { + thrownError = e; + } + expect(thrownError?.status).not.toBe(0); + // android should not be duplicated in config + const config = JSON.parse( + fs.readFileSync(path.join(modulePath, 'expo-module.config.json'), 'utf-8') + ); + expect(config.platforms.filter((p: string) => p === 'android')).toHaveLength(1); + }); + + it('aborts all-or-nothing when one of the requested platforms already exists', async () => { + const project = createFakeProject('aps-partial-project'); + const modulePath = await createLocalModule(project, 'aps-partial', ['apple']); + + let thrownError: any; + try { + await execute([ + 'add-platform-support', + modulePath, + '--platform', + 'android', + 'apple', + '--source', + localTemplatePath, + ]); + } catch (e) { + thrownError = e; + } + expect(thrownError?.status).not.toBe(0); + // android must NOT have been added (all-or-nothing) + expect(fs.existsSync(path.join(modulePath, 'android'))).toBe(false); + }); + + it('throws in non-interactive (CI) mode when --platform is not provided', async () => { + const project = createFakeProject('aps-noninteractive-project'); + const modulePath = await createLocalModule(project, 'aps-ni', ['apple']); + + let thrownError: any; + try { + // execute() already sets CI=1, so non-interactive mode is active + await execute([ + 'add-platform-support', + modulePath, + '--source', + localTemplatePath, + ]); + } catch (e) { + thrownError = e; + } + expect(thrownError?.status).not.toBe(0); + }); + + it('uses --features flag to override auto-detected features', async () => { + const project = createFakeProject('aps-features-flag-project'); + // Module has Function + AsyncFunction in native source + const modulePath = await createLocalModule(project, 'aps-ff', ['apple'], [ + 'Function', + 'AsyncFunction', + ]); + + // But we override with just View when adding android + await executePassing([ + 'add-platform-support', + modulePath, + '--platform', + 'android', + '--features', + 'View', + '--source', + localTemplatePath, + ]); + + const pkgDir = path.join( + modulePath, + 'android', + 'src', + 'main', + 'java', + 'expo', + 'modules', + 'apsff' + ); + const ktFiles = fs.readdirSync(pkgDir); + const moduleKt = ktFiles.find((f) => f.endsWith('Module.kt'))!; + const ktContent = fs.readFileSync(path.join(pkgDir, moduleKt), 'utf-8'); + expect(ktContent).toContain('View('); + expect(ktContent).not.toContain('AsyncFunction('); + }); +}); diff --git a/packages/create-expo-module/src/__tests__/featureDetection-test.ts b/packages/create-expo-module/src/__tests__/featureDetection-test.ts new file mode 100644 index 00000000000000..c125ea0f9b9321 --- /dev/null +++ b/packages/create-expo-module/src/__tests__/featureDetection-test.ts @@ -0,0 +1,202 @@ +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; + +import { detectFeaturesFromContent, findModuleDefinitionFile } from '../featureDetection'; + +describe('detectFeaturesFromContent', () => { + it('detects Constant', () => { + const { features } = detectFeaturesFromContent(` + public func definition() -> ModuleDefinition { + Constant("PI") { + } + `); + expect(features).toContain('Constant'); + expect(features).not.toContain('Function'); + }); + + it('detects Function without also detecting AsyncFunction', () => { + const { features } = detectFeaturesFromContent(` + Function("hello") { return "Hello world!" } + `); + expect(features).toContain('Function'); + expect(features).not.toContain('AsyncFunction'); + }); + + it('detects AsyncFunction without also detecting Function', () => { + const { features } = detectFeaturesFromContent(` + AsyncFunction("setValueAsync") { (value: String) in } + `); + expect(features).toContain('AsyncFunction'); + expect(features).not.toContain('Function'); + }); + + it('detects DSL calls when there is whitespace before the opening parenthesis', () => { + const { features, sharedObjectName } = detectFeaturesFromContent(` + Constant ("PI") { } + AsyncFunction ("setValueAsync") { (value: String) in } + Events ("onChange") + Class (MyModuleModuleSharedObject.self) { } + `); + expect(features).toContain('Constant'); + expect(features).toContain('AsyncFunction'); + expect(features).toContain('Event'); + expect(features).toContain('SharedObject'); + expect(sharedObjectName).toBe('MyModuleModuleSharedObject'); + }); + + it('detects Event at module level', () => { + const { features } = detectFeaturesFromContent(` + Events("onChange") + `); + expect(features).toContain('Event'); + expect(features).not.toContain('ViewEvent'); + }); + + it('detects View without ViewEvent when no Events inside', () => { + const { features } = detectFeaturesFromContent(` + View(MyModuleView.self) { + } + `); + expect(features).toContain('View'); + expect(features).not.toContain('ViewEvent'); + expect(features).not.toContain('Event'); + }); + + it('detects ViewEvent from Events inside a View block', () => { + const { features } = detectFeaturesFromContent(` + View(MyModuleView.self) { + Events("onTap") + } + `); + expect(features).toContain('View'); + expect(features).toContain('ViewEvent'); + expect(features).not.toContain('Event'); + }); + + it('detects Event at module level and ViewEvent inside View block simultaneously', () => { + const { features } = detectFeaturesFromContent(` + Events("onChange") + View(MyModuleView.self) { + Events("onTap") + } + `); + expect(features).toContain('Event'); + expect(features).toContain('View'); + expect(features).toContain('ViewEvent'); + }); + + it('detects SharedObject and extracts class name from Swift syntax', () => { + const { features, sharedObjectName } = detectFeaturesFromContent(` + Class(MyModuleModuleSharedObject.self) { + Constructor { () -> MyModuleModuleSharedObject in + return MyModuleModuleSharedObject() + } + } + `); + expect(features).toContain('SharedObject'); + expect(sharedObjectName).toBe('MyModuleModuleSharedObject'); + }); + + it('detects SharedObject and extracts class name from Kotlin syntax', () => { + const { features, sharedObjectName } = detectFeaturesFromContent(` + Class(MyModuleModuleSharedObject::class) { + } + `); + expect(features).toContain('SharedObject'); + expect(sharedObjectName).toBe('MyModuleModuleSharedObject'); + }); + + it('ignores commented-out keywords', () => { + const { features } = detectFeaturesFromContent(` + // Function("commented") { } + // Constants(["PI": 3.14]) + AsyncFunction("real") { (value: String) in } + `); + expect(features).not.toContain('Constant'); + expect(features).not.toContain('Function'); + expect(features).toContain('AsyncFunction'); + }); + + it('returns empty results for empty content', () => { + const { features, sharedObjectName } = detectFeaturesFromContent(''); + expect(features).toHaveLength(0); + expect(sharedObjectName).toBeNull(); + }); + + it('does not treat UIView( as a View feature', () => { + const { features } = detectFeaturesFromContent(` + let v = UIView(frame: .zero) + `); + expect(features).not.toContain('View'); + }); + + it('detects ViewEvent when View opening brace is on same line as a prior closing brace', () => { + const { features } = detectFeaturesFromContent(` + } View(MyModuleView.self) { + Events("onTap") + } + `); + expect(features).toContain('View'); + expect(features).toContain('ViewEvent'); + expect(features).not.toContain('Event'); + }); +}); + +describe('findModuleDefinitionFile', () => { + let tmpDir: string; + + beforeEach(async () => { + tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'feat-detect-')); + }); + + afterEach(async () => { + await fs.promises.rm(tmpDir, { recursive: true, force: true }); + }); + + it('finds ModuleDefinition file in ios/ for apple platform', async () => { + const iosDir = path.join(tmpDir, 'ios'); + await fs.promises.mkdir(iosDir); + await fs.promises.writeFile( + path.join(iosDir, 'MyModule.swift'), + 'public func definition() -> ModuleDefinition { Name("MyModule") }' + ); + const result = await findModuleDefinitionFile(tmpDir, 'apple'); + expect(result).toBe(path.join(iosDir, 'MyModule.swift')); + }); + + it('finds ModuleDefinition file nested in android/src/ for android platform', async () => { + const srcDir = path.join(tmpDir, 'android', 'src', 'main', 'java', 'expo', 'modules', 'mymod'); + await fs.promises.mkdir(srcDir, { recursive: true }); + await fs.promises.writeFile( + path.join(srcDir, 'MyModModule.kt'), + 'override fun definition() = ModuleDefinition { Name("MyMod") }' + ); + const result = await findModuleDefinitionFile(tmpDir, 'android'); + expect(result).toBe(path.join(srcDir, 'MyModModule.kt')); + }); + + it('returns null when no file contains ModuleDefinition', async () => { + await fs.promises.mkdir(path.join(tmpDir, 'ios')); + await fs.promises.writeFile(path.join(tmpDir, 'ios', 'Other.swift'), 'class Other {}'); + const result = await findModuleDefinitionFile(tmpDir, 'apple'); + expect(result).toBeNull(); + }); + + it('returns null when platform directory does not exist', async () => { + const result = await findModuleDefinitionFile(tmpDir, 'apple'); + expect(result).toBeNull(); + }); + + it('skips generated directories when searching for module definitions', async () => { + const iosDir = path.join(tmpDir, 'ios'); + await fs.promises.mkdir(path.join(iosDir, 'build'), { recursive: true }); + await fs.promises.writeFile( + path.join(iosDir, 'build', 'StaleModule.swift'), + 'public func definition() -> ModuleDefinition { Name("StaleModule") }' + ); + + const result = await findModuleDefinitionFile(tmpDir, 'apple'); + expect(result).toBeNull(); + }); +}); diff --git a/packages/create-expo-module/src/__tests__/templateUtils-test.ts b/packages/create-expo-module/src/__tests__/templateUtils-test.ts new file mode 100644 index 00000000000000..525e08bbbf21bc --- /dev/null +++ b/packages/create-expo-module/src/__tests__/templateUtils-test.ts @@ -0,0 +1,75 @@ +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; + +import { getGeneratedWebStubSentinel, updateWebStub } from '../templateUtils'; +import type { SubstitutionData } from '../types'; + +const mockData: SubstitutionData = { + project: { + slug: 'my-module', + name: 'MyModule', + version: '0.1.0', + description: 'Test', + package: 'expo.modules.mymodule', + moduleName: 'MyModuleModule', + viewName: 'MyModuleView', + sharedObjectName: 'MyModuleModuleSharedObject', + platforms: ['apple', 'web'], + features: [], + }, + author: 'Test', + license: 'MIT', + repo: 'https://github.com/test/test', + type: 'standalone', +}; + +async function writeMinimalWebTemplate(templateDir: string) { + await fs.promises.mkdir(path.join(templateDir, 'src'), { recursive: true }); + await fs.promises.mkdir(path.join(templateDir, 'snippets'), { recursive: true }); + await fs.promises.writeFile( + path.join(templateDir, 'src', '{%- project.moduleName %}.web.ts'), + 'export default class <%- project.moduleName %> {}\n' + ); +} + +describe('updateWebStub', () => { + let tmpDir: string; + let templateDir: string; + let targetDir: string; + + beforeEach(async () => { + tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'template-utils-')); + templateDir = path.join(tmpDir, 'template'); + targetDir = path.join(tmpDir, 'target'); + await writeMinimalWebTemplate(templateDir); + await fs.promises.mkdir(path.join(targetDir, 'src'), { recursive: true }); + }); + + afterEach(async () => { + await fs.promises.rm(tmpDir, { recursive: true, force: true }); + }); + + it('refuses to overwrite a custom web implementation', async () => { + const webFile = path.join(targetDir, 'src', 'MyModuleModule.web.ts'); + await fs.promises.writeFile(webFile, 'export default class CustomWebModule {}\n'); + + await expect(updateWebStub(templateDir, targetDir, mockData)).rejects.toThrow( + 'does not look like the generated web stub' + ); + }); + + it('overwrites the generated web stub', async () => { + const webFile = path.join(targetDir, 'src', 'MyModuleModule.web.ts'); + await fs.promises.writeFile( + webFile, + `// ${getGeneratedWebStubSentinel(mockData.project.moduleName)}.\n` + ); + + await updateWebStub(templateDir, targetDir, mockData); + + await expect(fs.promises.readFile(webFile, 'utf8')).resolves.toBe( + 'export default class MyModuleModule {}\n' + ); + }); +}); diff --git a/packages/create-expo-module/src/addPlatformSupport.ts b/packages/create-expo-module/src/addPlatformSupport.ts new file mode 100644 index 00000000000000..f2ed7d0b217bb0 --- /dev/null +++ b/packages/create-expo-module/src/addPlatformSupport.ts @@ -0,0 +1,608 @@ +import chalk from 'chalk'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; +import prompts from 'prompts'; + +import { detectFeaturesFromFile, findModuleDefinitionFile } from './featureDetection'; +import { resolveFeatures, type Feature } from './features'; +import { formatRunCommand, resolvePackageManager } from './packageManager'; +import { ALL_PLATFORMS, type Platform } from './prompts'; +import { copyNativeFileSnippets, copyWebFileSnippets } from './snippets'; +import { + buildAugmentedData, + copyTemplateFiles, + downloadPackageAsync, + handleSuffix, + slugToAndroidPackage, + updateWebStub, +} from './templateUtils'; +import type { LocalSubstitutionData, SubstitutionData } from './types'; +import { isInteractive } from './utils/env'; +import { newStep } from './utils/ora'; + +const CWD = process.env.INIT_CWD || process.cwd(); + +type ExistingModuleInfo = { + slug: string; + /** Base name without "Module" suffix, e.g. "ApsView" */ + name: string; + /** Full module name, e.g. "ApsViewModule" */ + moduleName: string; + /** Android package, e.g. "expo.modules.apsview" */ + packageName: string; + platforms: Platform[]; + isLocal: boolean; + version: string; + description: string; + author: string; + license: string; + repo: string; +}; + +const nativeModuleNamePattern = /Name\s*\(\s*["']([^"']+)["']\s*\)/; +const moduleSourceNamePatterns = [ + /globalThis\.expo\?\.\s*modules\?\.\s*\[\s*(["'`])([^"'`]+)\1\s*\]/, + /requireNativeModule(?:<[\s\S]*?>)?\(\s*(["'`])([^"'`]+)\1\s*\)/, + /requireOptionalNativeModule(?:<[\s\S]*?>)?\(\s*(["'`])([^"'`]+)\1\s*\)/, + /registerWebModule\s*\(\s*[^,]+,\s*(["'`])([^"'`]+)\1\s*\)/, +] as const; + +export function detectPublicModuleNameFromNativeContent(content: string): string | null { + const moduleDefinitionIndex = content.indexOf('ModuleDefinition'); + const searchContent = moduleDefinitionIndex >= 0 ? content.slice(moduleDefinitionIndex) : content; + return searchContent.match(nativeModuleNamePattern)?.[1] ?? null; +} + +export function detectPublicModuleNameFromModuleSourceContent(content: string): string | null { + for (const pattern of moduleSourceNamePatterns) { + const match = content.match(pattern); + if (match?.[2]) { + return match[2]; + } + } + return null; +} + +async function findModuleSourceFiles(moduleRoot: string): Promise { + const srcRoot = path.join(moduleRoot, 'src'); + const sourceFiles: string[] = []; + + async function visit(dir: string): Promise { + let entries: fs.Dirent[]; + try { + entries = await fs.promises.readdir(dir, { withFileTypes: true }); + } catch { + return; + } + + for (const entry of entries) { + const entryPath = path.join(dir, entry.name); + if (entry.isDirectory()) { + if (entry.name === '__tests__') { + continue; + } + await visit(entryPath); + continue; + } + + if ( + !/\.(ts|tsx|js|jsx)$/.test(entry.name) || + entry.name.endsWith('.d.ts') || + entry.name.includes('.test.') || + entry.name.includes('.spec.') || + entry.name.endsWith('.types.ts') + ) { + continue; + } + sourceFiles.push(entryPath); + } + } + + await visit(srcRoot); + return sourceFiles.sort((left, right) => { + const leftRelative = path.relative(srcRoot, left); + const rightRelative = path.relative(srcRoot, right); + const leftDepth = leftRelative.split(path.sep).length; + const rightDepth = rightRelative.split(path.sep).length; + if (leftDepth !== rightDepth) { + return leftDepth - rightDepth; + } + return leftRelative.localeCompare(rightRelative); + }); +} + +async function detectPublicModuleNameFromModuleSourceFiles( + moduleRoot: string +): Promise { + const sourceFiles = await findModuleSourceFiles(moduleRoot); + + for (const filePath of sourceFiles) { + const content = await fs.promises.readFile(filePath, 'utf8'); + const moduleName = detectPublicModuleNameFromModuleSourceContent(content); + if (moduleName) { + return moduleName; + } + } + + return null; +} + +async function readExistingModuleInfo(moduleRoot: string): Promise { + const configPath = path.join(moduleRoot, 'expo-module.config.json'); + const config = JSON.parse(await fs.promises.readFile(configPath, 'utf-8')); + + const platforms: Platform[] = ((config.platforms ?? []) as string[]).filter((p): p is Platform => + (ALL_PLATFORMS as readonly string[]).includes(p) + ); + + const appleModule: string | undefined = config.apple?.modules?.[0]; + const androidClass: string | undefined = config.android?.modules?.[0]; + + let moduleName: string; + if (appleModule) { + moduleName = appleModule; + } else if (androidClass) { + moduleName = androidClass.split('.').pop()!; + } else { + // Web-only module: derive a conventional module name from the directory name + const base = path.basename(moduleRoot); + moduleName = + base.charAt(0).toUpperCase() + + base.slice(1).replace(/-./g, (m) => (m[1] ?? '').toUpperCase()) + + 'Module'; + } + + // Determine project.name from the *.types.ts file in src/. + let name: string; + try { + const srcFiles = await fs.promises.readdir(path.join(moduleRoot, 'src')); + const typesFile = srcFiles.find((f) => f.endsWith('.types.ts')); + name = typesFile ? typesFile.replace(/\.types\.ts$/, '') : moduleName; + } catch { + name = moduleName; + } + + let packageName: string; + if (androidClass) { + packageName = androidClass.split('.').slice(0, -1).join('.'); + } else { + packageName = slugToAndroidPackage(path.basename(moduleRoot)); + } + + const packageJsonPath = path.join(moduleRoot, 'package.json'); + const isLocal = !fs.existsSync(packageJsonPath); + + let pkgJson: any = null; + if (!isLocal) { + pkgJson = JSON.parse(await fs.promises.readFile(packageJsonPath, 'utf-8')); + } + + const slug = isLocal ? path.basename(moduleRoot) : (pkgJson?.name ?? path.basename(moduleRoot)); + + let version = '0.1.0'; + let description = ''; + let author = ''; + let license = 'MIT'; + let repo = ''; + + if (pkgJson) { + version = pkgJson.version ?? '0.1.0'; + description = pkgJson.description ?? ''; + license = pkgJson.license ?? 'MIT'; + repo = + typeof pkgJson.repository === 'string' ? pkgJson.repository : (pkgJson.repository?.url ?? ''); + if (typeof pkgJson.author === 'string') { + author = pkgJson.author; + } else if (pkgJson.author?.name) { + const a = pkgJson.author; + author = `${a.name}${a.email ? ` <${a.email}>` : ''}${a.url ? ` (${a.url})` : ''}`; + } + } + + return { + slug, + name, + moduleName, + packageName, + platforms, + isLocal, + version, + description, + author, + license, + repo, + }; +} + +function buildSubstitutionData( + info: ExistingModuleInfo, + newPlatforms: Platform[], + features: Feature[], + sharedObjectName: string | null +): SubstitutionData | LocalSubstitutionData { + const allPlatforms = [...info.platforms, ...newPlatforms]; + const resolvedSharedObjectName = sharedObjectName ?? `${info.moduleName}SharedObject`; + + const project = { + slug: info.slug, + name: info.name, + package: info.packageName, + moduleName: info.moduleName, + viewName: handleSuffix(info.name, 'View'), + sharedObjectName: resolvedSharedObjectName, + platforms: allPlatforms, + features, + }; + + if (info.isLocal) { + return { project, type: 'local' }; + } + + return { + project: { ...project, version: info.version, description: info.description }, + author: info.author, + license: info.license, + repo: info.repo, + type: 'standalone', + }; +} + +async function updateModuleConfig( + configPath: string, + newPlatforms: Platform[], + data: SubstitutionData | LocalSubstitutionData +): Promise { + const config = JSON.parse(await fs.promises.readFile(configPath, 'utf-8')); + config.platforms = [...(config.platforms ?? []), ...newPlatforms]; + + for (const platform of newPlatforms) { + if (platform === 'apple') { + config.apple = { modules: [data.project.moduleName] }; + } else if (platform === 'android') { + config.android = { modules: [`${data.project.package}.${data.project.moduleName}`] }; + } + // web: no native config block needed + } + + await fs.promises.writeFile(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8'); +} + +export type AddPlatformSupportOptions = { + platform?: string[]; + features?: string[]; + source?: string; +}; + +type TemplatePathInfo = { + templatePath: string; + templateTempDir: string | null; +}; + +function exitWithError(message: string): never { + console.error(chalk.red(message)); + process.exit(1); +} + +async function readModuleInfoOrExit( + moduleRoot: string, + configPath: string +): Promise { + if (!fs.existsSync(configPath)) { + exitWithError( + `❌ Could not find expo-module.config.json in ${moduleRoot}.\n` + + ` Run this command from the module's root directory, or pass the path as an argument:\n` + + ` npx create-expo-module add-platform-support ` + ); + } + + try { + return await readExistingModuleInfo(moduleRoot); + } catch (e: any) { + exitWithError(`❌ Failed to read module configuration: ${e.message}`); + } +} + +async function findExistingModuleDefinitionFile( + moduleRoot: string, + moduleInfo: ExistingModuleInfo +): Promise { + const existingNativePlatform = moduleInfo.platforms.find( + (p): p is 'apple' | 'android' => p === 'apple' || p === 'android' + ); + + if (existingNativePlatform) { + const moduleDefinitionFile = await findModuleDefinitionFile(moduleRoot, existingNativePlatform); + if (!moduleDefinitionFile) { + exitWithError( + `❌ Could not find a module definition file in ` + + `${existingNativePlatform === 'apple' ? 'ios/' : 'android/src/'}.\n` + + ` This command only works with modules using the Expo Modules API DSL.\n` + + ` Older module formats are not supported.` + ); + } + return moduleDefinitionFile; + } + + return null; +} + +async function resolvePlatformsToAdd( + moduleInfo: ExistingModuleInfo, + options: AddPlatformSupportOptions +): Promise { + const availablePlatforms = ALL_PLATFORMS.filter((p) => !moduleInfo.platforms.includes(p)); + + if (availablePlatforms.length === 0) { + console.log(chalk.yellow('ℹ️ All platforms are already supported by this module.')); + return null; + } + + if (options.platform && options.platform.length > 0) { + const invalid = options.platform.filter( + (p) => !(ALL_PLATFORMS as readonly string[]).includes(p) + ); + if (invalid.length > 0) { + exitWithError( + `❌ Invalid platform(s): ${invalid.join(', ')}. Valid values: ${ALL_PLATFORMS.join(', ')}.` + ); + } + const conflicts = options.platform.filter((p) => moduleInfo.platforms.includes(p as Platform)); + if (conflicts.length > 0) { + exitWithError( + `❌ The following platform(s) are already supported: ${conflicts.join(', ')}.\n` + + ` No changes were made.` + ); + } + return options.platform as Platform[]; + } + + if (!isInteractive()) { + exitWithError( + `❌ --platform is required in non-interactive mode.\n` + + ` Available: ${availablePlatforms.join(', ')}\n` + + ` Example: npx create-expo-module add-platform-support --platform ${availablePlatforms[0]}` + ); + } + + const result = await prompts( + { + type: 'multiselect', + name: 'platforms', + message: 'Which platforms would you like to add?', + choices: availablePlatforms.map((p) => ({ title: p, value: p, selected: false })), + min: 1, + hint: '- Space to select. Enter to confirm.', + }, + { onCancel: () => process.exit(0) } + ); + return result.platforms; +} + +function ensureNativePlatformTargetsAvailable( + moduleRoot: string, + platformsToAdd: Platform[] +): void { + for (const platform of platformsToAdd) { + if (platform === 'web') continue; + const dir = path.join(moduleRoot, platform === 'apple' ? 'ios' : 'android'); + if (fs.existsSync(dir)) { + const stat = fs.statSync(dir); + exitWithError( + `❌ ${dir} already exists as a ${stat.isDirectory() ? 'directory' : 'file'}.\n` + + ` Cannot add ${platform === 'apple' ? 'Apple' : 'Android'} platform support without overwriting existing files.\n` + + ` No changes were made.` + ); + } + } +} + +async function resolveDetectedFeatures( + moduleDefinitionFile: string | null, + options: AddPlatformSupportOptions +): Promise<{ detectedFeatures: Feature[]; sharedObjectName: string | null }> { + if (options.features && options.features.length > 0) { + return { detectedFeatures: resolveFeatures(options.features), sharedObjectName: null }; + } + + if (moduleDefinitionFile) { + const { features, sharedObjectName } = await detectFeaturesFromFile(moduleDefinitionFile); + if (features.length === 0) { + console.warn( + chalk.yellow( + '⚠️ No features detected in the module definition. Generating a minimal scaffold.' + ) + ); + } else { + console.log( + chalk.dim( + `Detected features from ${path.relative(CWD, moduleDefinitionFile)} (best effort). ` + + 'Use --features to override.' + ) + ); + } + return { detectedFeatures: features, sharedObjectName }; + } + + // Web-only module adding a native platform: no ModuleDefinition to scan. + console.log(chalk.dim('No native module definition found. Generating minimal scaffold.')); + return { detectedFeatures: [], sharedObjectName: null }; +} + +async function updatePublicModuleNameFromSources( + moduleInfo: ExistingModuleInfo, + moduleRoot: string, + moduleDefinitionFile: string | null +): Promise { + const detectedPublicModuleName = + (moduleDefinitionFile + ? detectPublicModuleNameFromNativeContent( + await fs.promises.readFile(moduleDefinitionFile, 'utf8') + ) + : null) ?? (await detectPublicModuleNameFromModuleSourceFiles(moduleRoot)); + + if (detectedPublicModuleName) { + moduleInfo.name = detectedPublicModuleName; + } +} + +async function resolveTemplatePath( + options: AddPlatformSupportOptions, + moduleInfo: ExistingModuleInfo +): Promise { + if (options.source) { + const templatePath = path.resolve(CWD, options.source); + if (!fs.existsSync(templatePath)) { + exitWithError( + `❌ Template source directory does not exist: ${templatePath}.\n` + + ` Check the --source path and try again.` + ); + } + if (!fs.statSync(templatePath).isDirectory()) { + exitWithError( + `❌ Template source is not a directory: ${templatePath}.\n` + + ` Pass the root directory of an expo-module-template package.` + ); + } + return { templatePath, templateTempDir: null }; + } + + const templateTempDir = await fs.promises.mkdtemp( + path.join(os.tmpdir(), 'add-platform-support-') + ); + const templatePath = await downloadPackageAsync(templateTempDir, moduleInfo.isLocal); + return { templatePath, templateTempDir }; +} + +async function addNativePlatformFiles( + templatePath: string, + moduleRoot: string, + moduleInfo: ExistingModuleInfo, + platformsToAdd: Platform[], + detectedFeatures: Feature[], + data: SubstitutionData | LocalSubstitutionData +): Promise { + const nativePlatforms = platformsToAdd.filter( + (p): p is 'apple' | 'android' => p === 'apple' || p === 'android' + ); + if (nativePlatforms.length === 0) { + return; + } + + const snippetsDir = path.join(templatePath, 'snippets'); + const augmentedData = await buildAugmentedData(snippetsDir, data); + await newStep('Adding platform files', async (step) => { + await copyTemplateFiles(templatePath, moduleRoot, augmentedData, { + platforms: nativePlatforms, + platformsOnly: true, + moduleType: moduleInfo.isLocal ? 'local' : 'standalone', + }); + const dataForNewPlatforms = { + ...data, + project: { ...data.project, platforms: nativePlatforms }, + } as SubstitutionData | LocalSubstitutionData; + await copyNativeFileSnippets(snippetsDir, detectedFeatures, dataForNewPlatforms, moduleRoot); + step.succeed('Added platform files'); + }); +} + +async function addWebPlatformFiles( + templatePath: string, + moduleRoot: string, + platformsToAdd: Platform[], + detectedFeatures: Feature[], + data: SubstitutionData | LocalSubstitutionData +): Promise { + if (!platformsToAdd.includes('web')) { + return; + } + + const snippetsDir = path.join(templatePath, 'snippets'); + await newStep('Updating web implementation', async (step) => { + await updateWebStub(templatePath, moduleRoot, data); + const dataWithWeb = { + ...data, + project: { ...data.project, platforms: ['web'] as Platform[] }, + } as SubstitutionData | LocalSubstitutionData; + await copyWebFileSnippets(snippetsDir, detectedFeatures, dataWithWeb, moduleRoot); + step.succeed('Updated web implementation'); + }); +} + +function getNativeOpenCommands(platformsToAdd: Platform[]): string[] { + const packageManager = resolvePackageManager(); + return platformsToAdd + .filter( + (platform): platform is 'apple' | 'android' => platform === 'apple' || platform === 'android' + ) + .map((platform) => + platform === 'apple' + ? formatRunCommand(packageManager, 'open:ios') + : formatRunCommand(packageManager, 'open:android') + ); +} + +export async function addPlatformSupport( + modulePathArg: string | undefined, + options: AddPlatformSupportOptions +): Promise { + const moduleRoot = modulePathArg ? path.resolve(CWD, modulePathArg) : CWD; + const configPath = path.join(moduleRoot, 'expo-module.config.json'); + const moduleInfo = await readModuleInfoOrExit(moduleRoot, configPath); + const moduleDefinitionFile = await findExistingModuleDefinitionFile(moduleRoot, moduleInfo); + const platformsToAdd = await resolvePlatformsToAdd(moduleInfo, options); + if (!platformsToAdd) { + return; + } + + ensureNativePlatformTargetsAvailable(moduleRoot, platformsToAdd); + + const { detectedFeatures, sharedObjectName } = await resolveDetectedFeatures( + moduleDefinitionFile, + options + ); + + await updatePublicModuleNameFromSources(moduleInfo, moduleRoot, moduleDefinitionFile); + + const data = buildSubstitutionData( + moduleInfo, + platformsToAdd, + detectedFeatures, + sharedObjectName + ); + const { templatePath, templateTempDir } = await resolveTemplatePath(options, moduleInfo); + + try { + await addNativePlatformFiles( + templatePath, + moduleRoot, + moduleInfo, + platformsToAdd, + detectedFeatures, + data + ); + await addWebPlatformFiles(templatePath, moduleRoot, platformsToAdd, detectedFeatures, data); + + await newStep('Updating expo-module.config.json', async (step) => { + await updateModuleConfig(configPath, platformsToAdd, data); + step.succeed('Updated expo-module.config.json'); + }); + } finally { + if (templateTempDir) { + await fs.promises.rm(templateTempDir, { recursive: true, force: true }); + } + } + + console.log(); + console.log(`✅ Successfully added ${platformsToAdd.join(', ')} support to the module.`); + if (detectedFeatures.length > 0) { + console.log(chalk.dim(` Scaffolded features: ${detectedFeatures.join(', ')}`)); + } + + const nativeOpenCommands = getNativeOpenCommands(platformsToAdd); + if (nativeOpenCommands.length > 0) { + console.log( + chalk.dim(` To write the native implementation, use ${nativeOpenCommands.join(' or ')}.`) + ); + } +} diff --git a/packages/create-expo-module/src/create-expo-module.ts b/packages/create-expo-module/src/create-expo-module.ts index 725d92da043472..a0d9bf739638d2 100644 --- a/packages/create-expo-module/src/create-expo-module.ts +++ b/packages/create-expo-module/src/create-expo-module.ts @@ -1,13 +1,12 @@ import spawnAsync from '@expo/spawn-async'; import chalk from 'chalk'; import { Command, Option } from 'commander'; -import ejs from 'ejs'; import fs from 'node:fs'; -import os from 'node:os'; import path from 'node:path'; import prompts from 'prompts'; import validateNpmPackage from 'validate-npm-package-name'; +import { addPlatformSupport } from './addPlatformSupport'; import { ensureSafeModuleName } from './appleFrameworks'; import { createExampleApp } from './createExampleApp'; import { ALL_FEATURES, resolveFeatures } from './features'; @@ -29,21 +28,21 @@ import { getSubstitutionDataPrompts, type Platform, } from './prompts'; -import { - buildAppSnippets, - buildModuleSnippets, - buildViewSnippets, - buildWebModuleSnippets, - copyFileSnippets, -} from './snippets'; +import { copyFileSnippets } from './snippets'; import { eventCreateExpoModule, getTelemetryClient, logEventAsync } from './telemetry'; +import { + buildAugmentedData, + copyTemplateFiles, + downloadPackageAsync, + handleSuffix, + slugToAndroidPackage, +} from './templateUtils'; import type { CommandOptions, Feature, LocalSubstitutionData, SubstitutionData } from './types'; import { buildDefaultsWarning } from './utils/defaults'; -import { env } from './utils/env'; +import { isInteractive } from './utils/env'; import { findGitHubEmail, findMyName } from './utils/git'; import { findGitHubUserFromEmail, guessRepoUrl } from './utils/github'; import { newStep } from './utils/ora'; -import { extractLocalTarball } from './utils/tar'; const debug = require('debug')('create-expo-module:main') as typeof console.log; const packageJson = require('../package.json'); @@ -51,60 +50,11 @@ const packageJson = require('../package.json'); // `yarn run` may change the current working dir, then we should use `INIT_CWD` env. const CWD = process.env.INIT_CWD || process.cwd(); -// Ignore some paths. Especially `package.json` as it is rendered -// from `$package.json` file instead of the original one. -const IGNORES_PATHS = [ - '.DS_Store', - 'build', - 'node_modules', - 'package.json', - '.npmignore', - '.gitignore', - 'snippets', -]; - -// Files and top-level directories that only belong in standalone npm modules. -// When generating a local module, these are skipped so the host project's tooling is used instead. -const LOCAL_EXCLUDED_FILES = new Set([ - '$package.json', - '$CHANGELOG.md', - '$.gitignore', - '$.npmignore', - '$.prettierrc', - 'babel.config.js', - 'eslint.config.cjs', - 'tsconfig.json', - 'README.md', - path.join('src', 'index.ts'), -]); -const LOCAL_EXCLUDED_DIRS = new Set(['example', 'internal']); - // Url to the documentation on Expo Modules const DOCS_URL = 'https://docs.expo.dev/modules'; const FYI_LOCAL_DIR = 'https://expo.fyi/expo-module-local-autolinking.md'; -/** - * Determines if we're in an interactive environment. - * Non-interactive when: CI=1/true or non-TTY stdin. - */ -function isInteractive(): boolean { - const ci = process.env.CI; - if (ci === '1' || ci?.toLowerCase() === 'true') { - return false; - } - // Check for Expo's own non-interactive flag, used across expo-module-scripts and @expo/cli - // to force non-interactive mode in sub-processes (e.g. during `prepare` or `prepublishOnly`) - if (process.env.EXPO_NONINTERACTIVE) { - return false; - } - // Check for TTY - if (!process.stdin.isTTY) { - return false; - } - return true; -} - /** * Converts a slug to a native module name (PascalCase). */ @@ -115,17 +65,6 @@ function slugToModuleName(slug: string): string { .replace(/\W+(\w)/g, (_, p1) => p1.toUpperCase()); } -/** - * Converts a slug to an Android package name. - */ -function slugToAndroidPackage(slug: string): string { - const namespace = slug - .replace(/\W/g, '') - .replace(/^(expo|reactnative)/, '') - .toLowerCase(); - return `expo.modules.${namespace}`; -} - /** * Resolves the target directory for a new local module given the project's `package.json` path. * Respects `expo.autolinking.nativeModulesDir` when present; falls back to `modules/`. @@ -485,158 +424,6 @@ async function resolvePackageManagerAsync( return packageManager ?? defaultPackageManager; } -/** - * Recursively scans for the files within the directory. Returned paths are relative to the `root` path. - */ -async function getFilesAsync(root: string, dir: string | null = null): Promise { - const files: string[] = []; - const baseDir = dir ? path.join(root, dir) : root; - - for (const file of await fs.promises.readdir(baseDir)) { - const relativePath = dir ? path.join(dir, file) : file; - - if (IGNORES_PATHS.includes(relativePath) || IGNORES_PATHS.includes(file)) { - continue; - } - - const fullPath = path.join(baseDir, file); - const stat = await fs.promises.lstat(fullPath); - if (stat.isDirectory()) { - files.push(...(await getFilesAsync(root, relativePath))); - } else { - files.push(relativePath); - } - } - return files; -} - -/** - * Downloads a package tarball using `npm pack` and returns the filename. - */ -async function npmPackAsync(packageName: string, cwd: string): Promise { - const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm'; - const cmd = ['pack', packageName, '--json']; - const cmdString = `${npm} ${cmd.join(' ')}`; - debug('Run:', cmdString, `(cwd: ${cwd})`); - - let results: string; - try { - results = (await spawnAsync(npm, cmd, { cwd })).stdout?.trim(); - } catch (error: any) { - if (error?.stderr?.match(/npm ERR! code E404/)) { - const pkg = - error.stderr.match(/npm ERR! 404\s+'(.*)' is not in this registry\./)?.[1] ?? error.stderr; - throw new Error(`NPM package not found: ` + pkg); - } - throw error; - } - - if (!results) { - throw new Error(`No output from "${cmdString}"`); - } - - try { - const json = JSON.parse(results); - if (!Array.isArray(json) || !json[0]?.filename) { - throw new Error(`Invalid response from npm: ${results}`); - } - return json[0].filename; - } catch (error: any) { - throw new Error( - `Could not parse JSON returned from "${cmdString}".\n\n${results}\n\nError: ${error.message}` - ); - } -} - -/** - * Gets expo SDK version major from the local package.json. - */ -async function getLocalSdkMajorVersion(): Promise { - const path = require.resolve('expo/package.json', { paths: [process.cwd()] }); - if (!path) { - return null; - } - const { version } = require(path) ?? {}; - return version?.split('.')[0] ?? null; -} - -/** - * Selects correct version of the template based on the SDK version for local modules and EXPO_BETA flag. - */ -async function getTemplateVersion(isLocal: boolean) { - if (env.EXPO_BETA) { - return 'next'; - } - if (!isLocal) { - return 'latest'; - } - try { - const sdkVersionMajor = await getLocalSdkMajorVersion(); - return sdkVersionMajor ? `sdk-${sdkVersionMajor}` : 'latest'; - } catch { - console.log(); - console.warn( - chalk.yellow( - "Couldn't determine the SDK version from the local project, using `latest` as the template version." - ) - ); - return 'latest'; - } -} - -/** - * Downloads the template from NPM registry. - */ -async function downloadPackageAsync(targetDir: string, isLocal = false): Promise { - return await newStep('Downloading module template from npm', async (step) => { - const templateVersion = await getTemplateVersion(isLocal); - const packageName = 'expo-module-template'; - const tmpDir = path.join(os.tmpdir(), '.create-expo-module'); - - await fs.promises.mkdir(tmpDir, { recursive: true }); - - let filename: string; - try { - filename = await npmPackAsync(`${packageName}@${templateVersion}`, tmpDir); - } catch { - console.log(); - console.warn( - chalk.yellow( - "Couldn't download the versioned template from npm, falling back to the latest version." - ) - ); - filename = await npmPackAsync(`${packageName}@latest`, tmpDir); - } - - await extractLocalTarball({ - filePath: path.join(tmpDir, filename), - dir: targetDir, - }); - - await fs.promises.rm(tmpDir, { recursive: true, force: true }); - - step.succeed('Downloaded module template from npm registry.'); - - return path.join(targetDir, 'package'); - }); -} - -function handleSuffix(name: string, suffix: string): string { - if (name.endsWith(suffix)) { - return name; - } - return `${name}${suffix}`; -} - -/** - * Maps template top-level directory names to the platform name in `expo-module.config.json`. - * Files under these directories are only copied when the corresponding platform is selected. - */ -const TEMPLATE_DIR_TO_PLATFORM: Record = { - ios: 'apple', - android: 'android', -}; - /** * Creates the module based on the `ejs` template (e.g. `expo-module-template` package). */ @@ -646,107 +433,13 @@ async function createModuleFromTemplate( data: SubstitutionData | LocalSubstitutionData ) { const snippetsDir = path.join(templatePath, 'snippets'); - const features = data.project.features; - - // Build view-level snippets first (used inside the View() block) - const [viewSnippetsSwift, viewSnippetsKt] = await Promise.all([ - buildViewSnippets(snippetsDir, features, data, 'swift'), - buildViewSnippets(snippetsDir, features, data, 'kt'), - ]); - - // Build module-level snippets, passing the view snippets for injection - const [moduleSnippetsSwift, moduleSnippetsKt] = await Promise.all([ - buildModuleSnippets(snippetsDir, features, data, 'swift', viewSnippetsSwift), - buildModuleSnippets(snippetsDir, features, data, 'kt', viewSnippetsKt), - ]); - - // Build web module snippets and helpers - const webEventImport = features.includes('Event') - ? `\nimport { ${data.project.moduleName}Events } from './${data.project.name}.types';\n` - : ''; - const webEventType = features.includes('Event') ? `${data.project.moduleName}Events` : '{}'; - const webModuleSnippets = await buildWebModuleSnippets(snippetsDir, features, data); - - // Build combined module import line for App.tsx - const needsDefaultImport = features.some((f) => - (['Constant', 'Function', 'AsyncFunction', 'Event'] as string[]).includes(f) - ); - const moduleNamedImports: string[] = []; - if (features.includes('View')) moduleNamedImports.push(data.project.viewName); - if (features.includes('SharedObject')) - moduleNamedImports.push(`use${data.project.sharedObjectName}`); - - let appModuleCombinedImport = ''; - if (needsDefaultImport || moduleNamedImports.length > 0) { - const parts: string[] = []; - if (needsDefaultImport) parts.push(data.project.name); - if (moduleNamedImports.length > 0) parts.push(`{ ${moduleNamedImports.join(', ')} }`); - appModuleCombinedImport = `import ${parts.join(', ')} from '${data.project.slug}';\n`; - } - - const [appReactImportSnippets, appExternalImportSnippets, appHookSnippets, appJSXSnippets] = - await Promise.all([ - buildAppSnippets(snippetsDir, features, data, 'react-imports'), - buildAppSnippets(snippetsDir, features, data, 'external-imports'), - buildAppSnippets(snippetsDir, features, data, 'hooks'), - buildAppSnippets(snippetsDir, features, data, 'jsx'), - ]); - - const augmentedData = { - ...data, - moduleSnippetsSwift, - moduleSnippetsKt, - viewSnippetsSwift, - viewSnippetsKt, - webEventImport, - webEventType, - webModuleSnippets, - appModuleCombinedImport, - appExternalImportSnippets, - appReactImportSnippets, - appHookSnippets, - appJSXSnippets, - }; - - const files = await getFilesAsync(templatePath); - - for (const file of files) { - // Skip platform-specific directories when the platform was not selected. - const topLevelDir = file.split(path.sep)[0] ?? ''; - const requiredPlatform = TEMPLATE_DIR_TO_PLATFORM[topLevelDir]; - if (requiredPlatform && !data.project.platforms.includes(requiredPlatform)) { - continue; - } - - // Skip standalone-only files and directories for local modules. - if (data.type === 'local') { - if (LOCAL_EXCLUDED_FILES.has(file) || LOCAL_EXCLUDED_DIRS.has(topLevelDir)) { - continue; - } - } - - const renderedRelativePath = ejs.render(file.replace(/^\$/, ''), augmentedData, { - openDelimiter: '{', - closeDelimiter: '}', - escape: (value: string) => value.replace(/\./g, path.sep), - }); - const fromPath = path.join(templatePath, file); - const toPath = path.join(targetPath, renderedRelativePath); - const template = await fs.promises.readFile(fromPath, 'utf8'); - const renderedContent = ejs.render(template, augmentedData); - - if (!fs.existsSync(path.dirname(toPath))) { - await fs.promises.mkdir(path.dirname(toPath), { recursive: true }); - } - await fs.promises.writeFile(toPath, renderedContent, 'utf8'); - } - - await copyFileSnippets( - snippetsDir, - features, - augmentedData as SubstitutionData | LocalSubstitutionData, - targetPath - ); + const augmentedData = await buildAugmentedData(snippetsDir, data); + await copyTemplateFiles(templatePath, targetPath, augmentedData, { + platforms: data.project.platforms, + platformsOnly: false, + moduleType: data.type, + }); + await copyFileSnippets(snippetsDir, data.project.features, data, targetPath); } async function createGitRepositoryAsync(targetDir: string) { @@ -1140,6 +833,8 @@ function printFurtherLocalInstructions( const program = new Command(); +program.enablePositionalOptions(); + program .name(packageJson.name) .version(packageJson.version) @@ -1189,6 +884,27 @@ program ) .action(main); +program + .command('add-platform-support [path]') + .description( + 'Add platform support to an existing Expo module. ' + + 'For example, add Android to an iOS-only module. ' + + 'Run from the module root, or pass the path as the first argument.' + ) + .option( + '-p, --platform ', + `Platforms to add. Available values: ${ALL_PLATFORMS.join(', ')}.` + ) + .option( + '--features ', + `Override best-effort feature detection. Values: ${ALL_FEATURES.join(', ')}.` + ) + .option( + '-s, --source ', + 'Local path to the template. By default it downloads `expo-module-template` from NPM.' + ) + .action(addPlatformSupport); + program.hook('postAction', async () => { await getTelemetryClient().flush?.(); }); diff --git a/packages/create-expo-module/src/featureDetection.ts b/packages/create-expo-module/src/featureDetection.ts new file mode 100644 index 00000000000000..3a5436d247c063 --- /dev/null +++ b/packages/create-expo-module/src/featureDetection.ts @@ -0,0 +1,148 @@ +import fs from 'node:fs'; +import path from 'node:path'; + +import type { Feature } from './features'; + +const asyncFunctionPattern = /(?:^|\s)AsyncFunction\s*\(/; +const functionPattern = /(?:^|\s)Function\s*\(/; +const eventsPattern = /(?:^|\s)Events\s*\(/; +const classPattern = /(?:^|\s)Class\s*\(/; +const classNamePattern = /Class\s*\((\w+)(?:\.self|::class)/; +const IGNORED_SEARCH_DIRS = new Set(['build', 'Pods', '.gradle', 'node_modules', 'DerivedData']); + +export type DetectedFeatures = { + features: Feature[]; + /** Class name extracted from `Class(Name.self)` or `Class(Name::class)`, or null. */ + sharedObjectName: string | null; +}; + +/** + * Reads a native module definition file and detects which Expo Modules API + * features it uses. + */ +export async function detectFeaturesFromFile(filePath: string): Promise { + const content = await fs.promises.readFile(filePath, 'utf-8'); + return detectFeaturesFromContent(content); +} + +/** + * Parses module definition content to detect features. + * Exported for unit testing. + */ +export function detectFeaturesFromContent(content: string): DetectedFeatures { + const lines = content.split('\n'); + const features = new Set(); + let sharedObjectName: string | null = null; + + type ViewBlockState = 'NOT_IN_VIEW' | 'WAITING_FOR_OPEN' | 'IN_VIEW'; + + let braceDepth = 0; + let viewBlockState: ViewBlockState = 'NOT_IN_VIEW'; + let viewBlockEntryBraceDepth = -1; // braceDepth when View block { was seen + + for (const line of lines) { + // Strip inline comments and surrounding whitespace. + const stripped = line.replace(/\/\/.*$/, '').trim(); + if (!stripped) continue; + + // The DSL uses `Constant("name") { ... }` (singular) per snippet templates. + // Match only at statement position to avoid false positives. + if (/(?:^|\s)Constant\s*\(/.test(stripped)) { + features.add('Constant'); + } + // AsyncFunction must be checked before Function to avoid false positives. + if (asyncFunctionPattern.test(stripped)) { + features.add('AsyncFunction'); + } else if (functionPattern.test(stripped)) { + features.add('Function'); + } + + // Require View( to be at the start of a statement or preceded by whitespace + // to avoid false positives from UIView(, NSView(, ScrollView(, etc. + if (/(?:^|\s)View\s*\(/.test(stripped)) { + features.add('View'); + viewBlockState = 'WAITING_FOR_OPEN'; + } + + if (eventsPattern.test(stripped)) { + if (viewBlockState === 'IN_VIEW') { + features.add('ViewEvent'); + } else { + features.add('Event'); + } + } + + if (classPattern.test(stripped)) { + features.add('SharedObject'); + // Extract: Class(MyName.self) or Class(MyName::class) + const match = stripped.match(classNamePattern); + if (match?.[1]) { + sharedObjectName = match[1]; + } + } + + // ── Update brace depth ─────────────────────────────────────────────── + const opens = (stripped.match(/\{/g) ?? []).length; + const closes = (stripped.match(/\}/g) ?? []).length; + braceDepth += opens - closes; + + // Transition from WAITING_FOR_OPEN to IN_VIEW once we see a { on this line. + if (viewBlockState === 'WAITING_FOR_OPEN' && opens > 0) { + viewBlockState = 'IN_VIEW'; + viewBlockEntryBraceDepth = braceDepth; + } + + // Exit view block when depth drops below where it was when the block opened. + if (viewBlockState === 'IN_VIEW' && braceDepth < viewBlockEntryBraceDepth) { + viewBlockState = 'NOT_IN_VIEW'; + viewBlockEntryBraceDepth = -1; + } + } + + return { features: Array.from(features), sharedObjectName }; +} + +/** + * Searches a module's platform directory for the file containing `ModuleDefinition`. + * Returns the absolute path or null if not found. + * + * apple → scans ios/**\/*.swift + * android → scans android/src/**\/*.kt + */ +export async function findModuleDefinitionFile( + moduleRoot: string, + platform: 'apple' | 'android' +): Promise { + const searchDir = + platform === 'apple' ? path.join(moduleRoot, 'ios') : path.join(moduleRoot, 'android', 'src'); + + const ext = platform === 'apple' ? '.swift' : '.kt'; + return findFileWithContent(searchDir, ext, 'ModuleDefinition'); +} + +async function findFileWithContent( + dir: string, + ext: string, + needle: string +): Promise { + let entries: fs.Dirent[]; + try { + entries = await fs.promises.readdir(dir, { withFileTypes: true }); + } catch { + return null; + } + for (const entry of entries) { + const fullPath = path.join(dir, entry.name); + if (entry.isDirectory()) { + if (IGNORED_SEARCH_DIRS.has(entry.name)) { + continue; + } + const result = await findFileWithContent(fullPath, ext, needle); + if (result) return result; + } else if (entry.name.endsWith(ext)) { + const content = await fs.promises.readFile(fullPath, 'utf-8'); + if (content.includes(needle)) return fullPath; + } + } + return null; +} diff --git a/packages/create-expo-module/src/snippets.ts b/packages/create-expo-module/src/snippets.ts index a547a1c2e3eabe..1c6c32f79c173d 100644 --- a/packages/create-expo-module/src/snippets.ts +++ b/packages/create-expo-module/src/snippets.ts @@ -192,21 +192,19 @@ const FILE_SNIPPET_SPECS: FileSnippetSpec[] = [ }, ]; -/** - * Copies whole-file snippets (view classes, SharedObject classes) to the target directory. - */ -export async function copyFileSnippets( +async function copySnippetsInternal( snippetsDir: string, features: string[], data: AnySubstitutionData, - targetDir: string + targetDir: string, + filter: (spec: (typeof FILE_SNIPPET_SPECS)[0]) => boolean ): Promise { const selectedPlatforms: string[] = data.project.platforms; for (const spec of FILE_SNIPPET_SPECS) { if (!features.includes(spec.feature)) continue; - if (spec.platform === 'apple' && !selectedPlatforms.includes('apple')) continue; - if (spec.platform === 'android' && !selectedPlatforms.includes('android')) continue; + if (spec.platform && !selectedPlatforms.includes(spec.platform)) continue; + if (!filter(spec)) continue; const template = await readSnippet(snippetsDir, spec.feature, spec.source); if (!template) continue; @@ -218,3 +216,27 @@ export async function copyFileSnippets( await fs.promises.writeFile(destPath, rendered, 'utf8'); } } + +export const copyFileSnippets = ( + snippetsDir: string, + features: string[], + data: AnySubstitutionData, + targetDir: string +) => copySnippetsInternal(snippetsDir, features, data, targetDir, () => true); + +export const copyNativeFileSnippets = ( + snippetsDir: string, + features: string[], + data: AnySubstitutionData, + targetDir: string +) => copySnippetsInternal(snippetsDir, features, data, targetDir, (spec) => !!spec.platform); + +export const copyWebFileSnippets = ( + snippetsDir: string, + features: string[], + data: AnySubstitutionData, + targetDir: string +) => + copySnippetsInternal(snippetsDir, features, data, targetDir, (spec) => + spec.source.includes('.web.') + ); diff --git a/packages/create-expo-module/src/templateUtils.ts b/packages/create-expo-module/src/templateUtils.ts new file mode 100644 index 00000000000000..34c1e860ad91bb --- /dev/null +++ b/packages/create-expo-module/src/templateUtils.ts @@ -0,0 +1,375 @@ +import spawnAsync from '@expo/spawn-async'; +import chalk from 'chalk'; +import ejs from 'ejs'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; + +import type { Platform } from './prompts'; +import { + buildAppSnippets, + buildModuleSnippets, + buildViewSnippets, + buildWebModuleSnippets, +} from './snippets'; +import type { LocalSubstitutionData, SubstitutionData } from './types'; +import { env } from './utils/env'; +import { newStep } from './utils/ora'; +import { extractLocalTarball } from './utils/tar'; + +const debug = require('debug')('create-expo-module:main') as typeof console.log; + +// Ignore some paths. Especially `package.json` as it is rendered +// from `$package.json` file instead of the original one. +export const IGNORES_PATHS = [ + '.DS_Store', + 'build', + 'node_modules', + 'package.json', + '.npmignore', + '.gitignore', + 'snippets', +]; + +// Files and top-level directories that only belong in standalone npm modules. +// When generating a local module, these are skipped so the host project's tooling is used instead. +export const LOCAL_EXCLUDED_FILES = new Set([ + '$package.json', + '$CHANGELOG.md', + '$.gitignore', + '$.npmignore', + '$.prettierrc', + 'babel.config.js', + 'eslint.config.cjs', + 'tsconfig.json', + 'README.md', + path.join('src', 'index.ts'), +]); +export const LOCAL_EXCLUDED_DIRS = new Set(['example', 'internal']); + +/** + * Maps template top-level directory names to the platform name in `expo-module.config.json`. + * Files under these directories are only copied when the corresponding platform is selected. + */ +export const TEMPLATE_DIR_TO_PLATFORM: Record = { + ios: 'apple', + android: 'android', +}; + +export function getGeneratedWebStubSentinel(moduleName: string): string { + return `${moduleName} is not available on the web platform`; +} + +export function handleSuffix(name: string, suffix: string): string { + if (name.endsWith(suffix)) { + return name; + } + return `${name}${suffix}`; +} + +/** + * Converts a slug to an Android package name. + */ +export function slugToAndroidPackage(slug: string): string { + const namespace = slug + .replace(/\W/g, '') + .replace(/^(expo|reactnative)/, '') + .toLowerCase(); + return `expo.modules.${namespace}`; +} + +/** + * Recursively scans for the files within the directory. Returned paths are relative to the `root` path. + */ +export async function getFilesAsync(root: string, dir: string | null = null): Promise { + const files: string[] = []; + const baseDir = dir ? path.join(root, dir) : root; + + for (const file of await fs.promises.readdir(baseDir)) { + const relativePath = dir ? path.join(dir, file) : file; + + if (IGNORES_PATHS.includes(relativePath) || IGNORES_PATHS.includes(file)) { + continue; + } + + const fullPath = path.join(baseDir, file); + const stat = await fs.promises.lstat(fullPath); + if (stat.isDirectory()) { + files.push(...(await getFilesAsync(root, relativePath))); + } else { + files.push(relativePath); + } + } + return files; +} + +/** + * Downloads a package tarball using `npm pack` and returns the filename. + */ +async function npmPackAsync(packageName: string, cwd: string): Promise { + const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm'; + const cmd = ['pack', packageName, '--json']; + const cmdString = `${npm} ${cmd.join(' ')}`; + debug('Run:', cmdString, `(cwd: ${cwd})`); + + let results: string; + try { + results = (await spawnAsync(npm, cmd, { cwd })).stdout?.trim(); + } catch (error: any) { + if (error?.stderr?.match(/npm ERR! code E404/)) { + const pkg = + error.stderr.match(/npm ERR! 404\s+'(.*)' is not in this registry\./)?.[1] ?? error.stderr; + throw new Error(`NPM package not found: ` + pkg); + } + throw error; + } + + if (!results) { + throw new Error(`No output from "${cmdString}"`); + } + + try { + const json = JSON.parse(results); + if (!Array.isArray(json) || !json[0]?.filename) { + throw new Error(`Invalid response from npm: ${results}`); + } + return json[0].filename; + } catch (error: any) { + throw new Error( + `Could not parse JSON returned from "${cmdString}".\n\n${results}\n\nError: ${error.message}` + ); + } +} + +/** + * Gets expo SDK version major from the local package.json. + */ +async function getLocalSdkMajorVersion(): Promise { + const path = require.resolve('expo/package.json', { paths: [process.cwd()] }); + if (!path) { + return null; + } + const { version } = require(path) ?? {}; + return version?.split('.')[0] ?? null; +} + +/** + * Selects correct version of the template based on the SDK version for local modules and EXPO_BETA flag. + */ +async function getTemplateVersion(isLocal: boolean) { + if (env.EXPO_BETA) { + return 'next'; + } + if (!isLocal) { + return 'latest'; + } + try { + const sdkVersionMajor = await getLocalSdkMajorVersion(); + return sdkVersionMajor ? `sdk-${sdkVersionMajor}` : 'latest'; + } catch { + console.log(); + console.warn( + chalk.yellow( + "Couldn't determine the SDK version from the local project, using `latest` as the template version." + ) + ); + return 'latest'; + } +} + +/** + * Downloads the template from NPM registry. + */ +export async function downloadPackageAsync(targetDir: string, isLocal = false): Promise { + return await newStep('Downloading module template from npm', async (step) => { + const templateVersion = await getTemplateVersion(isLocal); + const packageName = 'expo-module-template'; + const tmpDir = path.join(os.tmpdir(), '.create-expo-module'); + + await fs.promises.mkdir(tmpDir, { recursive: true }); + + let filename: string; + try { + filename = await npmPackAsync(`${packageName}@${templateVersion}`, tmpDir); + } catch { + console.log(); + console.warn( + chalk.yellow( + "Couldn't download the versioned template from npm, falling back to the latest version." + ) + ); + filename = await npmPackAsync(`${packageName}@latest`, tmpDir); + } + + await extractLocalTarball({ + filePath: path.join(tmpDir, filename), + dir: targetDir, + }); + + await fs.promises.rm(tmpDir, { recursive: true, force: true }); + + step.succeed('Downloaded module template from npm registry.'); + + return path.join(targetDir, 'package'); + }); +} + +/** + * Builds the augmented substitution data object by rendering all snippet slots. + * Extracted from `createModuleFromTemplate` for reuse. + */ +export async function buildAugmentedData( + snippetsDir: string, + data: SubstitutionData | LocalSubstitutionData +) { + const features = data.project.features; + + // Build view-level snippets first (used inside the View() block) + const [viewSnippetsSwift, viewSnippetsKt] = await Promise.all([ + buildViewSnippets(snippetsDir, features, data, 'swift'), + buildViewSnippets(snippetsDir, features, data, 'kt'), + ]); + + // Build module-level snippets, passing the view snippets for injection + const [moduleSnippetsSwift, moduleSnippetsKt] = await Promise.all([ + buildModuleSnippets(snippetsDir, features, data, 'swift', viewSnippetsSwift), + buildModuleSnippets(snippetsDir, features, data, 'kt', viewSnippetsKt), + ]); + + // Build web module snippets and helpers + const webEventImport = features.includes('Event') + ? `\nimport { ${data.project.moduleName}Events } from './${data.project.name}.types';\n` + : ''; + const webEventType = features.includes('Event') ? `${data.project.moduleName}Events` : '{}'; + const webModuleSnippets = await buildWebModuleSnippets(snippetsDir, features, data); + + // Build combined module import line for App.tsx + const needsDefaultImport = features.some((f) => + (['Constant', 'Function', 'AsyncFunction', 'Event'] as string[]).includes(f) + ); + const moduleNamedImports: string[] = []; + if (features.includes('View')) moduleNamedImports.push(data.project.viewName); + if (features.includes('SharedObject')) + moduleNamedImports.push(`use${data.project.sharedObjectName}`); + + let appModuleCombinedImport = ''; + if (needsDefaultImport || moduleNamedImports.length > 0) { + const parts: string[] = []; + if (needsDefaultImport) parts.push(data.project.name); + if (moduleNamedImports.length > 0) parts.push(`{ ${moduleNamedImports.join(', ')} }`); + appModuleCombinedImport = `import ${parts.join(', ')} from '${data.project.slug}';\n`; + } + + const [appReactImportSnippets, appExternalImportSnippets, appHookSnippets, appJSXSnippets] = + await Promise.all([ + buildAppSnippets(snippetsDir, features, data, 'react-imports'), + buildAppSnippets(snippetsDir, features, data, 'external-imports'), + buildAppSnippets(snippetsDir, features, data, 'hooks'), + buildAppSnippets(snippetsDir, features, data, 'jsx'), + ]); + + return { + ...data, + moduleSnippetsSwift, + moduleSnippetsKt, + viewSnippetsSwift, + viewSnippetsKt, + webEventImport, + webEventType, + webModuleSnippets, + appModuleCombinedImport, + appExternalImportSnippets, + appReactImportSnippets, + appHookSnippets, + appJSXSnippets, + }; +} + +/** + * Copies template files to the target directory. + */ +export async function copyTemplateFiles( + templatePath: string, + targetPath: string, + augmentedData: Awaited>, + options: { + platforms: Platform[]; + platformsOnly?: boolean; + moduleType: 'standalone' | 'local'; + } +): Promise { + const { platforms, platformsOnly = false, moduleType } = options; + const files = await getFilesAsync(templatePath); + + for (const file of files) { + // Skip platform-specific directories when the platform was not selected. + const topLevelDir = file.split(path.sep)[0] ?? ''; + const requiredPlatform = TEMPLATE_DIR_TO_PLATFORM[topLevelDir]; + + if (platformsOnly) { + if (!requiredPlatform || !platforms.includes(requiredPlatform)) continue; + } else { + if (requiredPlatform && !platforms.includes(requiredPlatform)) continue; + if (moduleType === 'local') { + if (LOCAL_EXCLUDED_FILES.has(file) || LOCAL_EXCLUDED_DIRS.has(topLevelDir)) continue; + } + } + + const renderedRelativePath = ejs.render(file.replace(/^\$/, ''), augmentedData, { + openDelimiter: '{', + closeDelimiter: '}', + escape: (value: string) => value.replace(/\./g, path.sep), + }); + const fromPath = path.join(templatePath, file); + const toPath = path.join(targetPath, renderedRelativePath); + const template = await fs.promises.readFile(fromPath, 'utf8'); + const renderedContent = ejs.render(template, augmentedData); + + if (!fs.existsSync(path.dirname(toPath))) { + await fs.promises.mkdir(path.dirname(toPath), { recursive: true }); + } + await fs.promises.writeFile(toPath, renderedContent, 'utf8'); + } +} + +/** + * Re-renders the .web.ts stub as a full web implementation using the provided data. + * Called when adding `web` to a module that already has native platforms. + */ +export async function updateWebStub( + templatePath: string, + targetDir: string, + data: SubstitutionData | LocalSubstitutionData +): Promise { + const snippetsDir = path.join(templatePath, 'snippets'); + const augmentedData = await buildAugmentedData(snippetsDir, data); + + // Template filename uses EJS: src/{%- project.moduleName %}.web.ts + const templateRelFile = path.join('src', `{%- project.moduleName %}.web.ts`); + const renderedFileName = ejs.render(templateRelFile.replace(/^\$/, ''), augmentedData, { + openDelimiter: '{', + closeDelimiter: '}', + escape: (value: string) => value.replace(/\./g, path.sep), + }); + + const fromPath = path.join(templatePath, templateRelFile); + const toPath = path.join(targetDir, renderedFileName); + if (fs.existsSync(toPath)) { + const currentContent = await fs.promises.readFile(toPath, 'utf8'); + const sentinel = getGeneratedWebStubSentinel(data.project.moduleName); + if (!currentContent.includes(sentinel)) { + throw new Error( + `Refusing to overwrite ${toPath} because it does not look like the generated web stub.\n` + + `Move your custom web implementation or restore the generated "${sentinel}" stub before running this command.` + ); + } + } + + const template = await fs.promises.readFile(fromPath, 'utf8'); + const renderedContent = ejs.render(template, augmentedData); + + if (!fs.existsSync(path.dirname(toPath))) { + await fs.promises.mkdir(path.dirname(toPath), { recursive: true }); + } + await fs.promises.writeFile(toPath, renderedContent, 'utf8'); +} diff --git a/packages/create-expo-module/src/utils/env.ts b/packages/create-expo-module/src/utils/env.ts index ae595d5a0707c3..ef1a0a3300b835 100644 --- a/packages/create-expo-module/src/utils/env.ts +++ b/packages/create-expo-module/src/utils/env.ts @@ -22,3 +22,21 @@ export const env = { return boolish('EXPO_LOCAL', false); }, }; + +/** + * Determines if we're in an interactive environment. + * Non-interactive when: CI=1/true, Expo's non-interactive flag is set, or stdin is non-TTY. + */ +export function isInteractive(): boolean { + const ci = process.env.CI; + if (ci === '1' || ci?.toLowerCase() === 'true') { + return false; + } + if (process.env.EXPO_NONINTERACTIVE) { + return false; + } + if (!process.stdin.isTTY) { + return false; + } + return true; +} From e17fa0c0f03f119a1048228eedc1c90df6498ce2 Mon Sep 17 00:00:00 2001 From: Aman Mittal Date: Tue, 28 Apr 2026 17:27:04 +0530 Subject: [PATCH 07/20] [docs] Serve markdown at `/page.md` sibling paths (#45077) --- docs/common/routes.ts | 9 +++++++++ docs/components/DocumentationHead.tsx | 16 ++++++++++++++-- docs/components/DocumentationPage.tsx | 7 ++++++- docs/public/_redirects | 11 ++++++++++- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/docs/common/routes.ts b/docs/common/routes.ts index 1d43a1f2099afe..8f4b23569a6d20 100644 --- a/docs/common/routes.ts +++ b/docs/common/routes.ts @@ -87,6 +87,15 @@ export const getCanonicalUrl = (path: string) => { } }; +export const getMarkdownPath = (asPath: string) => { + const path = asPath.split('?')[0].split('#')[0]; + if (path === '' || path === '/') { + return '/index.md'; + } + const stripped = path.endsWith('/') ? path.slice(0, -1) : path; + return stripped + '.md'; +}; + export const isRouteActive = ( info?: NavigationRoute | NavigationRouteWithSection, asPath?: string, diff --git a/docs/components/DocumentationHead.tsx b/docs/components/DocumentationHead.tsx index 6ea7ddc4969764..7027c46b61d655 100644 --- a/docs/components/DocumentationHead.tsx +++ b/docs/components/DocumentationHead.tsx @@ -1,14 +1,25 @@ import NextHead from 'next/head'; import type { PropsWithChildren } from 'react'; -type HeadProps = PropsWithChildren<{ title?: string; description?: string; canonicalUrl?: string }>; +type HeadProps = PropsWithChildren<{ + title?: string; + description?: string; + canonicalUrl?: string; + markdownPath?: string; +}>; const BASE_OG_URL = 'https://og.expo.dev/?theme=docs'; const BASE_TITLE = 'Expo Documentation'; const BASE_DESCRIPTION = `Expo is an open-source platform for making universal native apps for Android, iOS, and the web with JavaScript and React.`; -const DocumentationHead = ({ title, description, canonicalUrl, children }: HeadProps) => { +const DocumentationHead = ({ + title, + description, + canonicalUrl, + markdownPath, + children, +}: HeadProps) => { const OGImageURL = `${BASE_OG_URL}&title=${encodeURIComponent(title ?? BASE_TITLE)}&description=${encodeURIComponent(description ?? BASE_DESCRIPTION)}`; return ( @@ -19,6 +30,7 @@ const DocumentationHead = ({ title, description, canonicalUrl, children }: HeadP {canonicalUrl && } + {markdownPath && } diff --git a/docs/components/DocumentationPage.tsx b/docs/components/DocumentationPage.tsx index 269276e84fa90a..a8ad97eb6aae32 100644 --- a/docs/components/DocumentationPage.tsx +++ b/docs/components/DocumentationPage.tsx @@ -75,6 +75,7 @@ export default function DocumentationPage({ : null; const sidebarScrollPosition = process?.browser ? window.__sidebarScroll : 0; const currentPath = router?.asPath ?? ''; + const markdownPath = RoutesUtils.getMarkdownPath(currentPath); const isLatestSdkPage = currentPath.startsWith('/versions/latest/sdk/'); const isLatestConfigPage = currentPath.startsWith('/versions/latest/config/'); const isAskAIEligiblePage = isLatestSdkPage || isLatestConfigPage; @@ -324,7 +325,11 @@ export default function DocumentationPage({ isChatExpanded={isAskAIExpanded}> {breadcrumbSchema && } {techArticleSchema && } - + {hideFromSearch !== true && ( .md path that AI agents typically request, +# rewriting to the canonical //index.md the build script writes. +# The first two rules are pass-throughs that preserve canonical URLs (root /index.md +# and nested //index.md). Without them, the wildcard would catch those paths +# and rewrite them to /index/index.md or //index/index.md (404). +/index.md /index.md 200 +/*/index.md /:splat/index.md 200 +/*.md /:splat/index.md 200 \ No newline at end of file From c7097f3a543b224ef98aa5497f0c32aee48d6a69 Mon Sep 17 00:00:00 2001 From: Tomasz Sapeta Date: Tue, 28 Apr 2026 14:29:44 +0200 Subject: [PATCH 08/20] [app-metrics][ios] Capture and attribute MetricKit crash reports (#45112) --- .../expo-app-metrics/ios/AppMetrics.swift | 16 ++ .../ios/CrashReporting/CrashReport.swift | 176 ++++++++++++++++++ .../ios/MetricKitSubscriber.swift | 37 ++-- .../ios/Sessions/MainSession.swift | 42 +++++ .../ios/Sessions/Session.swift | 11 ++ .../ios/Tests/CrashReportTests.swift | 119 ++++++++++++ 6 files changed, 386 insertions(+), 15 deletions(-) create mode 100644 packages/expo-app-metrics/ios/CrashReporting/CrashReport.swift create mode 100644 packages/expo-app-metrics/ios/Tests/CrashReportTests.swift diff --git a/packages/expo-app-metrics/ios/AppMetrics.swift b/packages/expo-app-metrics/ios/AppMetrics.swift index eac9b467e6e68c..87225f9953608c 100644 --- a/packages/expo-app-metrics/ios/AppMetrics.swift +++ b/packages/expo-app-metrics/ios/AppMetrics.swift @@ -1,9 +1,25 @@ // Copyright 2025-present 650 Industries. All rights reserved. import ExpoModulesCore +#if !os(tvOS) +import MetricKit +#endif + public struct AppMetrics { #if !os(tvOS) static let metricKitSubscriber = MetricKitSubscriber() + + /** + Registers the MetricKit subscriber to receive diagnostic and performance payloads. + Even though MetricKit doesn't work on the simulator, it prints some logs (probably once a day) + that are piped to the terminal when using the `expo run:ios` command. + To avoid them, we explicitly don't register the subscriber on the simulator. + */ + static func registerMetricKitSubscriber() { + #if !targetEnvironment(simulator) + MXMetricManager.shared.add(metricKitSubscriber) + #endif + } #endif public static let storage = MetricsStorage() diff --git a/packages/expo-app-metrics/ios/CrashReporting/CrashReport.swift b/packages/expo-app-metrics/ios/CrashReporting/CrashReport.swift new file mode 100644 index 00000000000000..cb66ef3aa043c7 --- /dev/null +++ b/packages/expo-app-metrics/ios/CrashReporting/CrashReport.swift @@ -0,0 +1,176 @@ +// Copyright 2025-present 650 Industries. All rights reserved. + +/** + Structured crash report extracted from MetricKit's `MXCrashDiagnostic`. + */ +public struct CrashReport: Codable, Sendable { + /** Mach exception type (e.g. EXC_BAD_ACCESS, EXC_CRASH). */ + public let exceptionType: Int? + + /** Processor-specific exception code. */ + public let exceptionCode: Int? + + /** Unix signal number (e.g. SIGSEGV = 11, SIGABRT = 6). */ + public let signal: Int? + + /** Human-readable description of the termination reason. */ + public let terminationReason: String? + + /** Memory region info for bad-access crashes. */ + public let virtualMemoryRegionInfo: String? + + /** Objective-C exception details, available when the crash was caused by an unhandled NSException. */ + public let exceptionReason: ExceptionReason? + + /** Call stack tree as a JSON string, suitable for off-device symbolication. */ + public let callStackTree: String? + + /** App version at the time of the crash. */ + public let appVersion: String + + /** Timestamp range start of the diagnostic payload. */ + public let timestampBegin: Date + + /** Timestamp range end of the diagnostic payload. */ + public let timestampEnd: Date + + /** + Picks the most likely `MainSession` that this crash report belongs to. + + MetricKit only gives us the diagnostic payload's time window (`timestampBegin` to + `timestampEnd`, typically a 24-hour bucket), not an exact crash time. We approximate + the match in two passes: + + 1. Among sessions started within the window, prefer the one that never finished + (`endDate == nil`) — an unfinished main session is a strong signal of a crash. + 2. If none match, fall back to the session with the latest `startDate` still within + the window. Returns `nil` if no session falls within the window at all. + */ + func findMatchingSession(in mainSessions: [MainSession]) -> MainSession? { + let candidates = mainSessions.filter { session in + return session.startDate >= timestampBegin && session.startDate <= timestampEnd + } + if candidates.isEmpty { + return nil + } + let unfinished = candidates.filter({ $0.endDate == nil }) + if let session = unfinished.max(by: { $0.startDate < $1.startDate }) { + return session + } + return candidates.max(by: { $0.startDate < $1.startDate }) + } + + /** + Objective-C exception details from `MXCrashDiagnosticObjectiveCExceptionReason`. + */ + public struct ExceptionReason: Codable, Sendable { + /** Human-readable exception summary. */ + public let composedMessage: String + + /** Exception message template before argument substitution. */ + public let formatString: String + + /** Arguments substituted into the format string. */ + public let arguments: [String] + + /** Human-readable exception type (e.g. "NSInvalidArgumentException"). */ + public let exceptionType: String + + /** Exception class name (e.g. "NSException"). */ + public let className: String + + /** Exception name field. */ + public let exceptionName: String + } +} + +// MARK: - MetricKit + +#if !os(tvOS) +import MetricKit + +extension CrashReport { + init(diagnostic: MXCrashDiagnostic, payload: MXDiagnosticPayload) { + self.exceptionType = diagnostic.exceptionType?.intValue + self.exceptionCode = diagnostic.exceptionCode?.intValue + self.signal = diagnostic.signal?.intValue + self.terminationReason = diagnostic.terminationReason as String? + self.virtualMemoryRegionInfo = diagnostic.virtualMemoryRegionInfo as String? + self.callStackTree = String(data: diagnostic.callStackTree.jsonRepresentation(), encoding: .utf8) + self.appVersion = diagnostic.applicationVersion + self.timestampBegin = payload.timeStampBegin + self.timestampEnd = payload.timeStampEnd + + if #available(iOS 17.0, *), let reason = diagnostic.exceptionReason { + self.exceptionReason = ExceptionReason( + composedMessage: reason.composedMessage as String, + formatString: reason.formatString as String, + arguments: reason.arguments.map { $0 as String }, + exceptionType: reason.exceptionType as String, + className: reason.className as String, + exceptionName: reason.exceptionName as String + ) + } else { + self.exceptionReason = nil + } + } +} +#endif + +// MARK: - CustomStringConvertible + +extension CrashReport: CustomStringConvertible { + public var description: String { + var lines: [String] = ["[CrashReport] App version: \(appVersion)"] + + if let exceptionType { + lines.append(" Exception: type=\(exceptionName(for: exceptionType)) code=\(exceptionCode.map(String.init) ?? "unknown")") + } + if let signal { + lines.append(" Signal: \(signalName(for: signal)) (\(signal))") + } + if let terminationReason { + lines.append(" Termination reason: \(terminationReason)") + } + if let virtualMemoryRegionInfo { + lines.append(" VM region: \(virtualMemoryRegionInfo)") + } + if let exceptionReason { + lines.append(" ObjC exception: \(exceptionReason.exceptionType) (\(exceptionReason.className))") + lines.append(" \(exceptionReason.composedMessage)") + } + + let formatter = ISO8601DateFormatter() + lines.append(" Time window: \(formatter.string(from: timestampBegin)) – \(formatter.string(from: timestampEnd))") + + return lines.joined(separator: "\n") + } +} + +private func exceptionName(for type: Int) -> String { + switch type { + case 1: return "EXC_BAD_ACCESS" + case 2: return "EXC_BAD_INSTRUCTION" + case 3: return "EXC_ARITHMETIC" + case 4: return "EXC_EMULATION" + case 5: return "EXC_SOFTWARE" + case 6: return "EXC_BREAKPOINT" + case 10: return "EXC_CRASH" + case 11: return "EXC_RESOURCE" + case 12: return "EXC_GUARD" + default: return "EXC_\(type)" + } +} + +private func signalName(for signal: Int) -> String { + switch signal { + case 4: return "SIGILL" + case 5: return "SIGTRAP" + case 6: return "SIGABRT" + case 8: return "SIGFPE" + case 9: return "SIGKILL" + case 10: return "SIGBUS" + case 11: return "SIGSEGV" + default: return "SIG\(signal)" + } +} diff --git a/packages/expo-app-metrics/ios/MetricKitSubscriber.swift b/packages/expo-app-metrics/ios/MetricKitSubscriber.swift index 8465976088c3c2..45c42d8714dbce 100644 --- a/packages/expo-app-metrics/ios/MetricKitSubscriber.swift +++ b/packages/expo-app-metrics/ios/MetricKitSubscriber.swift @@ -10,20 +10,6 @@ import MetricKit // We could use it as a source for metrics that we can't measure in other ways, e.g. CPU usage. final class MetricKitSubscriber: NSObject, MXMetricManagerSubscriber, Sendable { - override init() { - super.init() - - // Even though MetricKit doesn't work on the simulator, it prints some logs (probably once a day) - // that are piped to the terminal when using the `expo run:ios` command. - // To avoid them, we explicitly don't register the subscriber on the simulator. - // Example of the log: - // [libapp_launch_measurement.dylib] Failed to send CA Event tor app launch measurements tor ca_event_type: o event_name: com.apple.app_launch_measurement.FirstFramePresentationMetric - #if !targetEnvironment(simulator) - // Auto registration - MXMetricManager.shared.add(self) - #endif - } - /** Receives payloads with performance metrics like CPU and memory usage. Sent periodically (usually every 24 hours), or when your app gets steady usage. @@ -34,10 +20,31 @@ final class MetricKitSubscriber: NSObject, MXMetricManagerSubscriber, Sendable { /** Receives payloads with diagnostic data like crash logs, hang reports, and more. - Sent immediately when something critical happens — like a crash. + Delivered on the next app launch after the event occurs. */ func didReceive(_ payloads: [MXDiagnosticPayload]) { prettyPrintPayloads(payloads) + + let crashReports = payloads.flatMap { payload in + return (payload.crashDiagnostics ?? []).map { diagnostic in + return CrashReport(diagnostic: diagnostic, payload: payload) + } + } + AppMetricsActor.isolated { + let mainSessions = AppMetrics.storage.getAllMainSessions() + var didStoreAny = false + for crashReport in crashReports { + if let session = crashReport.findMatchingSession(in: mainSessions) { + session.storeCrashReport(crashReport) + didStoreAny = true + } else { + logger.warn("[AppMetrics] Received crash report with no matching session:\n\(crashReport)") + } + } + if didStoreAny { + try? AppMetrics.storage.commit() + } + } } } diff --git a/packages/expo-app-metrics/ios/Sessions/MainSession.swift b/packages/expo-app-metrics/ios/Sessions/MainSession.swift index 37896792bbe0fd..169fcb53cc92c1 100644 --- a/packages/expo-app-metrics/ios/Sessions/MainSession.swift +++ b/packages/expo-app-metrics/ios/Sessions/MainSession.swift @@ -9,6 +9,12 @@ public final class MainSession: Session, @unchecked Sendable { let updatesMonitor = UpdatesMonitoring() let frameMetricsRecorder = FrameMetricsRecorder() + /** + Crash report associated with this session, if the app crashed during it. + Mutations go through `storeCrashReport(_:)` so they happen on the actor. + */ + nonisolated(unsafe) public private(set) var crashReport: CrashReport? + // MARK: - Metrics init() { @@ -16,14 +22,50 @@ public final class MainSession: Session, @unchecked Sendable { self.appStartupMonitor.addReceiver(self) self.updatesMonitor.addReceiver(self) + #if !os(tvOS) + AppMetrics.registerMetricKitSubscriber() + #endif + AppMetricsActor.isolated { [self] in self.frameMetricsRecorder.start() } } + /** + Test-only initializer that builds a session with explicit values and skips registering it + with the global storage. Do not use from production code. + */ + init(id: String, startDate: Date, endDate: Date?) { + super.init(id: id, type: .main, startDate: startDate, endDate: endDate) + } + + // MARK: - Crash reports + + /** + Stores a crash report on this session and logs it. The caller is responsible for + committing the storage. + */ + @AppMetricsActor + func storeCrashReport(_ crashReport: CrashReport) { + logger.warn("[AppMetrics] Received crash report:\n\(crashReport)") + self.crashReport = crashReport + } + // MARK: - Codable + private enum CodingKeys: String, CodingKey { + case crashReport + } + required init(from decoder: any Decoder) throws { + let values = try decoder.container(keyedBy: CodingKeys.self) + crashReport = try values.decodeIfPresent(CrashReport.self, forKey: .crashReport) try super.init(from: decoder) } + + public override func encode(to encoder: any Encoder) throws { + try super.encode(to: encoder) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(crashReport, forKey: .crashReport) + } } diff --git a/packages/expo-app-metrics/ios/Sessions/Session.swift b/packages/expo-app-metrics/ios/Sessions/Session.swift index ef9285fc557853..421d5e2e49b9d4 100644 --- a/packages/expo-app-metrics/ios/Sessions/Session.swift +++ b/packages/expo-app-metrics/ios/Sessions/Session.swift @@ -35,6 +35,17 @@ public class Session: Codable, MetricsReceiver { AppMetrics.storage.currentEntry.add(session: self) } + /** + Test-only initializer that builds a session with explicit values and skips registering it + with the global storage. Do not use from production code. + */ + init(id: String, type: SessionType, startDate: Date, endDate: Date?) { + self.id = id + self.type = type + self.startDate = startDate + self.endDate = endDate + } + /** Whether the session is still running, i.e. did not end yet. */ diff --git a/packages/expo-app-metrics/ios/Tests/CrashReportTests.swift b/packages/expo-app-metrics/ios/Tests/CrashReportTests.swift new file mode 100644 index 00000000000000..7f1bbec287acca --- /dev/null +++ b/packages/expo-app-metrics/ios/Tests/CrashReportTests.swift @@ -0,0 +1,119 @@ +import Testing + +@testable import ExpoAppMetrics + +@AppMetricsActor +@Suite("CrashReport") +struct CrashReportTests { + @AppMetricsActor + @Suite("findMatchingSession") + struct FindMatchingSessionTests { + @Test + func `prefers an unfinished session inside the window`() { + let windowEnd = Date.now + let windowStart = windowEnd.addingTimeInterval(-3600) + + let unfinished = MainSession( + id: "unfinished", + startDate: windowEnd.addingTimeInterval(-1800), + endDate: nil + ) + let finished = MainSession( + id: "finished", + startDate: windowEnd.addingTimeInterval(-1200), + endDate: windowEnd.addingTimeInterval(-600) + ) + + let report = makeCrashReport(timestampBegin: windowStart, timestampEnd: windowEnd) + let match = report.findMatchingSession(in: [finished, unfinished]) + #expect(match?.id == "unfinished") + } + + @Test + func `picks the latest unfinished session when multiple are in the window`() { + let windowEnd = Date.now + let windowStart = windowEnd.addingTimeInterval(-3600) + + let earlier = MainSession( + id: "earlier", + startDate: windowEnd.addingTimeInterval(-2400), + endDate: nil + ) + let later = MainSession( + id: "later", + startDate: windowEnd.addingTimeInterval(-1200), + endDate: nil + ) + + let report = makeCrashReport(timestampBegin: windowStart, timestampEnd: windowEnd) + let match = report.findMatchingSession(in: [earlier, later]) + #expect(match?.id == "later") + } + + @Test + func `falls back to the latest finished session in the window`() { + let windowEnd = Date.now + let windowStart = windowEnd.addingTimeInterval(-3600) + + let earlier = MainSession( + id: "earlier", + startDate: windowEnd.addingTimeInterval(-2400), + endDate: windowEnd.addingTimeInterval(-2000) + ) + let later = MainSession( + id: "later", + startDate: windowEnd.addingTimeInterval(-1200), + endDate: windowEnd.addingTimeInterval(-600) + ) + + let report = makeCrashReport(timestampBegin: windowStart, timestampEnd: windowEnd) + let match = report.findMatchingSession(in: [earlier, later]) + #expect(match?.id == "later") + } + + @Test + func `returns nil when no session is in the window`() { + let windowEnd = Date.now + let windowStart = windowEnd.addingTimeInterval(-3600) + + let beforeWindow = MainSession( + id: "before", + startDate: windowStart.addingTimeInterval(-1000), + endDate: nil + ) + let afterWindow = MainSession( + id: "after", + startDate: windowEnd.addingTimeInterval(1000), + endDate: nil + ) + + let report = makeCrashReport(timestampBegin: windowStart, timestampEnd: windowEnd) + let match = report.findMatchingSession(in: [beforeWindow, afterWindow]) + #expect(match == nil) + } + + @Test + func `returns nil when the input is empty`() { + let report = makeCrashReport( + timestampBegin: Date.now.addingTimeInterval(-3600), + timestampEnd: Date.now + ) + #expect(report.findMatchingSession(in: []) == nil) + } + } +} + +private func makeCrashReport(timestampBegin: Date, timestampEnd: Date) -> CrashReport { + return CrashReport( + exceptionType: 1, + exceptionCode: 1, + signal: 11, + terminationReason: nil, + virtualMemoryRegionInfo: nil, + exceptionReason: nil, + callStackTree: nil, + appVersion: "1.0.0", + timestampBegin: timestampBegin, + timestampEnd: timestampEnd + ) +} From 21c2ec3f8b59faa17757ef11a1ef735e31d896e7 Mon Sep 17 00:00:00 2001 From: Jakub Tkacz <32908614+Ubax@users.noreply.github.com> Date: Tue, 28 Apr 2026 14:33:47 +0200 Subject: [PATCH 09/20] [expo-observe] fix dispatchInDebug (#45137) # Why https://github.com/expo/expo/pull/45008 was merged without essential code which was lost during the rebase. # How Add the `dispatchInDebug` logic back # Test Plan 1. CI 2. Manual testing # Checklist - [ ] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) --- apps/observability-tester/app.config.ts | 1 - apps/observability-tester/app/_layout.tsx | 1 + .../modules/observe/ObservabilityManager.kt | 5 +- .../expo/modules/observe/ObserveModule.kt | 2 + .../modules/observe/ObservePreferences.kt | 1 + .../observe/BaseObservabilityManagerTest.kt | 145 ++++++++++++++++-- packages/expo-observe/build/types.d.ts | 17 +- packages/expo-observe/build/types.d.ts.map | 2 +- packages/expo-observe/build/types.js.map | 2 +- packages/expo-observe/ios/Observability.swift | 9 +- packages/expo-observe/ios/ObserveModule.swift | 2 + .../ios/ObserveUserDefaults.swift | 1 + .../ios/Tests/ObserveUserDefaultsTests.swift | 25 +++ packages/expo-observe/src/types.ts | 17 +- 14 files changed, 203 insertions(+), 27 deletions(-) diff --git a/apps/observability-tester/app.config.ts b/apps/observability-tester/app.config.ts index ddd611faffa7a1..a7312b34f82c6a 100644 --- a/apps/observability-tester/app.config.ts +++ b/apps/observability-tester/app.config.ts @@ -10,7 +10,6 @@ const config = ({ config }: ConfigContext): ExpoConfig => ({ eas: { ...config.extra?.eas, observe: { - enableInDebug: true, endpointUrl: process.env.OBSERVE_ENV === 'staging' ? 'https://staging-o.expo.dev/' diff --git a/apps/observability-tester/app/_layout.tsx b/apps/observability-tester/app/_layout.tsx index 0f5da3f18e205a..0d1485b0ed0a15 100644 --- a/apps/observability-tester/app/_layout.tsx +++ b/apps/observability-tester/app/_layout.tsx @@ -14,6 +14,7 @@ if (IS_ROUTER_INTEGRATION_ENABLED) { ExpoObserve.configure({ environment: 'custom-env', dispatchingEnabled: true, + dispatchInDebug: true, }); export default function RootLayout() { diff --git a/packages/expo-observe/android/src/main/java/expo/modules/observe/ObservabilityManager.kt b/packages/expo-observe/android/src/main/java/expo/modules/observe/ObservabilityManager.kt index 292379cf74af8c..50d95cae11a471 100644 --- a/packages/expo-observe/android/src/main/java/expo/modules/observe/ObservabilityManager.kt +++ b/packages/expo-observe/android/src/main/java/expo/modules/observe/ObservabilityManager.kt @@ -85,8 +85,9 @@ class BaseObservabilityManager( return } - val dispatchingEnabled = ObservePreferences.getConfig(context)?.dispatchingEnabled ?: !isDebugBuild - val shouldDispatch = dispatchingEnabled && isInSample() + val dispatchingEnabled = ObservePreferences.getConfig(context)?.dispatchingEnabled ?: true + val dispatchInDebug = ObservePreferences.getConfig(context)?.dispatchInDebug ?: false + val shouldDispatch = dispatchingEnabled && isInSample() && (!isDebugBuild || dispatchInDebug) if (!shouldDispatch) { pendingMetricsManager.removePendingMetrics(pendingIds) return diff --git a/packages/expo-observe/android/src/main/java/expo/modules/observe/ObserveModule.kt b/packages/expo-observe/android/src/main/java/expo/modules/observe/ObserveModule.kt index c13172e6fee631..23e87a8f6a24c6 100644 --- a/packages/expo-observe/android/src/main/java/expo/modules/observe/ObserveModule.kt +++ b/packages/expo-observe/android/src/main/java/expo/modules/observe/ObserveModule.kt @@ -13,6 +13,7 @@ import expo.modules.kotlin.records.Record class Config( @Field val environment: String? = null, @Field val dispatchingEnabled: Boolean? = null, + @Field val dispatchInDebug: Boolean? = null, @Field val sampleRate: Double? = null ) : Record @@ -50,6 +51,7 @@ class ObserveModule : Module() { context, PersistedConfig( dispatchingEnabled = config.dispatchingEnabled, + dispatchInDebug = config.dispatchInDebug, sampleRate = config.sampleRate ) ) diff --git a/packages/expo-observe/android/src/main/java/expo/modules/observe/ObservePreferences.kt b/packages/expo-observe/android/src/main/java/expo/modules/observe/ObservePreferences.kt index b6e7a7dc050734..1caef5ae6a1436 100644 --- a/packages/expo-observe/android/src/main/java/expo/modules/observe/ObservePreferences.kt +++ b/packages/expo-observe/android/src/main/java/expo/modules/observe/ObservePreferences.kt @@ -14,6 +14,7 @@ private const val KEY_CONFIG = "config" @Serializable data class PersistedConfig( val dispatchingEnabled: Boolean? = null, + val dispatchInDebug: Boolean? = null, val sampleRate: Double? = null ) diff --git a/packages/expo-observe/android/src/test/java/expo/modules/observe/BaseObservabilityManagerTest.kt b/packages/expo-observe/android/src/test/java/expo/modules/observe/BaseObservabilityManagerTest.kt index 72afb06e6dd04d..b6ddcdf751755d 100644 --- a/packages/expo-observe/android/src/test/java/expo/modules/observe/BaseObservabilityManagerTest.kt +++ b/packages/expo-observe/android/src/test/java/expo/modules/observe/BaseObservabilityManagerTest.kt @@ -78,31 +78,45 @@ class BaseObservabilityManagerTest { } @Test - fun `when dispatchingEnabled is unset and isDebugBuild is true, pending metrics are removed without dispatching`() = + fun `when dispatchingEnabled is null on a stored config and isDebugBuild is false, metrics are dispatched`() = runTest { - // Arrange — debug builds default to off so dev metrics don't ship without explicit opt-in. - every { ObservePreferences.getConfig(any()) } returns null - coEvery { mockPendingMetricsManager.getAllPendingMetricIds() } returns listOf("id1", "id2") + // Arrange — a stored config without an explicit dispatchingEnabled doesn't suppress dispatch on release builds. + every { ObservePreferences.getConfig(any()) } returns PersistedConfig(dispatchingEnabled = null) + val devMetric = createMetric("metric1", metricId = "dev-metric-id") + val devSession = createSessionWithMetrics( + sessionId = "dev-session", + environment = "development", + metrics = listOf(devMetric) + ) + + coEvery { mockPendingMetricsManager.getAllPendingMetricIds() } returns listOf("dev-metric-id") + coEvery { mockSessionManager.getSessionsWithMetrics(any()) } returns listOf(devSession) + coEvery { mockEventDispatcher.dispatch(any()) } returns true val removedIds = mutableListOf() coEvery { mockPendingMetricsManager.removePendingMetrics(any()) } answers { removedIds.addAll(firstArg>()) } - val manager = createManager(isDebugBuild = true) + val manager = createManager(isDebugBuild = false) // Act manager.dispatchUnsentMetrics() - // Assert — short-circuit: no session lookup, no dispatch, single removePendingMetrics call. - coVerify(exactly = 0) { mockEventDispatcher.dispatch(any()) } - coVerify(exactly = 0) { mockSessionManager.getSessionsWithMetrics(any()) } - coVerify(exactly = 1) { mockPendingMetricsManager.removePendingMetrics(listOf("id1", "id2")) } - assertEquals(2, removedIds.size) + // Assert + coVerify { + mockEventDispatcher.dispatch( + match { events -> + events.size == 1 && events[0].metadata.environment == "development" + } + ) + } + assertEquals(1, removedIds.size) + assertTrue(removedIds.contains("dev-metric-id")) } @Test - fun `when dispatchingEnabled is true and isDebugBuild is true, metrics are dispatched`() = + fun `when dispatchingEnabled is true, and isDebugBuild is false, metrics are dispatched`() = runTest { // Arrange — explicit opt-in lifts the debug default. every { ObservePreferences.getConfig(any()) } returns PersistedConfig(dispatchingEnabled = true) @@ -122,7 +136,7 @@ class BaseObservabilityManagerTest { removedIds.addAll(firstArg>()) } - val manager = createManager(isDebugBuild = true) + val manager = createManager(isDebugBuild = false) // Act manager.dispatchUnsentMetrics() @@ -140,7 +154,7 @@ class BaseObservabilityManagerTest { } @Test - fun `when dispatchingEnabled is unset and isDebugBuild is false, metrics are dispatched`() = + fun `when stored config is absent and isDebugBuild is false, metrics are dispatched`() = runTest { // Arrange — release builds default to on. every { ObservePreferences.getConfig(any()) } returns null @@ -172,6 +186,111 @@ class BaseObservabilityManagerTest { // endregion + // region dispatchInDebug tests + + @Test + fun `when dispatchInDebug is true on debug build, metrics are dispatched`() = + runTest { + // Arrange — explicit opt-in lifts the debug-build gate. + every { ObservePreferences.getConfig(any()) } returns PersistedConfig(dispatchInDebug = true) + val devMetric = createMetric("metric1", metricId = "dev-metric-id") + val devSession = createSessionWithMetrics( + sessionId = "dev-session", + environment = "development", + metrics = listOf(devMetric) + ) + + coEvery { mockPendingMetricsManager.getAllPendingMetricIds() } returns listOf("dev-metric-id") + coEvery { mockSessionManager.getSessionsWithMetrics(any()) } returns listOf(devSession) + coEvery { mockEventDispatcher.dispatch(any()) } returns true + + val removedIds = mutableListOf() + coEvery { mockPendingMetricsManager.removePendingMetrics(any()) } answers { + removedIds.addAll(firstArg>()) + } + + val manager = createManager(isDebugBuild = true) + + // Act + manager.dispatchUnsentMetrics() + + // Assert + coVerify(exactly = 1) { mockEventDispatcher.dispatch(any()) } + assertEquals(listOf("dev-metric-id"), removedIds) + } + + @Test + fun `when dispatchInDebug is false explicitly on debug build, pending metrics are removed without dispatching`() = + runTest { + // Arrange — explicit opt-out behaves like the default on debug builds. + every { ObservePreferences.getConfig(any()) } returns PersistedConfig(dispatchInDebug = false) + coEvery { mockPendingMetricsManager.getAllPendingMetricIds() } returns listOf("id1", "id2") + + val removedIds = mutableListOf() + coEvery { mockPendingMetricsManager.removePendingMetrics(any()) } answers { + removedIds.addAll(firstArg>()) + } + + val manager = createManager(isDebugBuild = true) + + // Act + manager.dispatchUnsentMetrics() + + // Assert — short-circuit: no session lookup, no dispatch, single removePendingMetrics call. + coVerify(exactly = 0) { mockEventDispatcher.dispatch(any()) } + coVerify(exactly = 0) { mockSessionManager.getSessionsWithMetrics(any()) } + coVerify(exactly = 1) { mockPendingMetricsManager.removePendingMetrics(listOf("id1", "id2")) } + assertEquals(2, removedIds.size) + } + + @Test + fun `when dispatchInDebug is true on release build, metrics dispatch normally`() = + runTest { + // Arrange — dispatchInDebug is a no-op on release builds; release always dispatches (subject to other gates). + every { ObservePreferences.getConfig(any()) } returns PersistedConfig(dispatchInDebug = true) + val prodMetric = createMetric("metric1", metricId = "prod-metric-id") + val prodSession = createSessionWithMetrics( + sessionId = "prod-session", + environment = "production", + metrics = listOf(prodMetric) + ) + + coEvery { mockPendingMetricsManager.getAllPendingMetricIds() } returns listOf("prod-metric-id") + coEvery { mockSessionManager.getSessionsWithMetrics(any()) } returns listOf(prodSession) + coEvery { mockEventDispatcher.dispatch(any()) } returns true + + val manager = createManager(isDebugBuild = false) + + // Act + manager.dispatchUnsentMetrics() + + // Assert + coVerify(exactly = 1) { mockEventDispatcher.dispatch(any()) } + } + + @Test + fun `when dispatchingEnabled is false, dispatchInDebug being true has no effect`() = + runTest { + // Arrange — dispatchingEnabled=false wins over dispatchInDebug=true. + every { ObservePreferences.getConfig(any()) } returns PersistedConfig( + dispatchingEnabled = false, + dispatchInDebug = true + ) + coEvery { mockPendingMetricsManager.getAllPendingMetricIds() } returns listOf("id1") + coEvery { mockPendingMetricsManager.removePendingMetrics(any()) } just runs + + val manager = createManager(isDebugBuild = true) + + // Act + manager.dispatchUnsentMetrics() + + // Assert + coVerify(exactly = 0) { mockEventDispatcher.dispatch(any()) } + coVerify(exactly = 1) { mockPendingMetricsManager.removePendingMetrics(listOf("id1")) } + } + + // endregion + // region sampleRate tests @Test diff --git a/packages/expo-observe/build/types.d.ts b/packages/expo-observe/build/types.d.ts index 0462878295ccff..f6116646dad278 100644 --- a/packages/expo-observe/build/types.d.ts +++ b/packages/expo-observe/build/types.d.ts @@ -11,10 +11,23 @@ export type Config = { * When `false`, any pending metrics are marked as sent without being dispatched * and no further metrics are dispatched until this is set back to `true`. * - * When unset, defaults to `false` for debug builds and `true` for release builds - * so dev metrics aren't shipped without explicit opt-in. + * @default true */ dispatchingEnabled?: boolean; + /** + * Whether to dispatch metrics that were collected in a debug build of the host app. + * + * When `false`, metrics produced by debug builds are marked as sent without being dispatched. + * When `true`, debug-build metrics are dispatched alongside release-build metrics. + * + * Has no effect on release builds. + * + * If `dispatchingEnabled` is `false` or this device is out-of-sample for `sampleRate`, nothing + * is dispatched regardless of `dispatchInDebug`. + * + * @default false + */ + dispatchInDebug?: boolean; /** * Fraction of installations that should dispatch metrics, in `[0, 1]`. Values outside that range * are clamped. diff --git a/packages/expo-observe/build/types.d.ts.map b/packages/expo-observe/build/types.d.ts.map index 5dc04ecb4885fe..6d8506568f13a6 100644 --- a/packages/expo-observe/build/types.d.ts.map +++ b/packages/expo-observe/build/types.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC"} \ No newline at end of file +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC"} \ No newline at end of file diff --git a/packages/expo-observe/build/types.js.map b/packages/expo-observe/build/types.js.map index 9cf5e34facde9f..87f766d54d6f3c 100644 --- a/packages/expo-observe/build/types.js.map +++ b/packages/expo-observe/build/types.js.map @@ -1 +1 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type Config = {\n /**\n * The environment for observability events\n *\n * @default process.env.NODE_ENV\n */\n environment?: string;\n /**\n * Whether to dispatch observability events to the server.\n *\n * When `false`, any pending metrics are marked as sent without being dispatched\n * and no further metrics are dispatched until this is set back to `true`.\n *\n * When unset, defaults to `false` for debug builds and `true` for release builds\n * so dev metrics aren't shipped without explicit opt-in.\n */\n dispatchingEnabled?: boolean;\n /**\n * Fraction of installations that should dispatch metrics, in `[0, 1]`. Values outside that range\n * are clamped.\n *\n * The decision is **deterministic per installation** — a device is either permanently in-sample\n * or out-of-sample for a given rate, so the choice is stable across app launches.\n *\n * Interaction with `dispatchingEnabled`:\n * - If `dispatchingEnabled` is `false`, metrics are never dispatched\n * - If `dispatchingEnabled` is `true` (or unset), metrics are dispatched only when this device\n * is in-sample.\n *\n * > Note: Devices that end up out-of-sample drop pending metrics rather than accumulating them.\n *\n * @default undefined - metrics from all devices are sent\n */\n sampleRate?: number;\n};\n\nexport interface ExpoObserveModuleType {\n dispatchEvents(): Promise;\n /**\n * Configures observability settings.\n */\n configure(config: Config): void;\n}\n"]} \ No newline at end of file +{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type Config = {\n /**\n * The environment for observability events\n *\n * @default process.env.NODE_ENV\n */\n environment?: string;\n /**\n * Whether to dispatch observability events to the server.\n *\n * When `false`, any pending metrics are marked as sent without being dispatched\n * and no further metrics are dispatched until this is set back to `true`.\n *\n * @default true\n */\n dispatchingEnabled?: boolean;\n /**\n * Whether to dispatch metrics that were collected in a debug build of the host app.\n *\n * When `false`, metrics produced by debug builds are marked as sent without being dispatched.\n * When `true`, debug-build metrics are dispatched alongside release-build metrics.\n *\n * Has no effect on release builds.\n *\n * If `dispatchingEnabled` is `false` or this device is out-of-sample for `sampleRate`, nothing\n * is dispatched regardless of `dispatchInDebug`.\n *\n * @default false\n */\n dispatchInDebug?: boolean;\n /**\n * Fraction of installations that should dispatch metrics, in `[0, 1]`. Values outside that range\n * are clamped.\n *\n * The decision is **deterministic per installation** — a device is either permanently in-sample\n * or out-of-sample for a given rate, so the choice is stable across app launches.\n *\n * Interaction with `dispatchingEnabled`:\n * - If `dispatchingEnabled` is `false`, metrics are never dispatched\n * - If `dispatchingEnabled` is `true` (or unset), metrics are dispatched only when this device\n * is in-sample.\n *\n * > Note: Devices that end up out-of-sample drop pending metrics rather than accumulating them.\n *\n * @default undefined - metrics from all devices are sent\n */\n sampleRate?: number;\n};\n\nexport interface ExpoObserveModuleType {\n dispatchEvents(): Promise;\n /**\n * Configures observability settings.\n */\n configure(config: Config): void;\n}\n"]} \ No newline at end of file diff --git a/packages/expo-observe/ios/Observability.swift b/packages/expo-observe/ios/Observability.swift index 112d8275d0c8c2..dc3e5d4d9d4d76 100644 --- a/packages/expo-observe/ios/Observability.swift +++ b/packages/expo-observe/ios/Observability.swift @@ -44,12 +44,11 @@ internal struct ObservabilityManager { return } do { - // All entries were filtered out, dispatching is disabled, or this device is out-of-sample — - // mark as dispatched so they don't accumulate. - let dispatchingEnabled = ObserveUserDefaults.config?.dispatchingEnabled ?? true - let shouldDispatch = dispatchingEnabled && isInSample() + let config = ObserveUserDefaults.config + let dispatchingEnabled = config?.dispatchingEnabled ?? true + let dispatchInDebug = config?.dispatchInDebug ?? false + let shouldDispatch = dispatchingEnabled && isInSample() && (!isDebugBuild || dispatchInDebug) if !shouldDispatch { - // Mark all pending entries as dispatched without sending them ObserveUserDefaults.lastDispatchedEntryId = entries.first?.id ?? -1 return } diff --git a/packages/expo-observe/ios/ObserveModule.swift b/packages/expo-observe/ios/ObserveModule.swift index 554a84df47c625..e814a41310083e 100644 --- a/packages/expo-observe/ios/ObserveModule.swift +++ b/packages/expo-observe/ios/ObserveModule.swift @@ -8,6 +8,7 @@ internal let observeLogger = Logger(logHandlers: [createOSLogHandler(category: L internal struct Config: Record { @Field var environment: String? @Field var dispatchingEnabled: Bool? + @Field var dispatchInDebug: Bool? @Field var sampleRate: Double? } @@ -37,6 +38,7 @@ public final class ObserveModule: Module { ObserveUserDefaults.setConfig( PersistedConfig( dispatchingEnabled: config.dispatchingEnabled, + dispatchInDebug: config.dispatchInDebug, sampleRate: config.sampleRate ) ) diff --git a/packages/expo-observe/ios/ObserveUserDefaults.swift b/packages/expo-observe/ios/ObserveUserDefaults.swift index 334f381ddd9a43..6a85e0a8b2854b 100644 --- a/packages/expo-observe/ios/ObserveUserDefaults.swift +++ b/packages/expo-observe/ios/ObserveUserDefaults.swift @@ -7,6 +7,7 @@ import ExpoAppMetrics */ internal struct PersistedConfig: Codable { var dispatchingEnabled: Bool? + var dispatchInDebug: Bool? var sampleRate: Double? } diff --git a/packages/expo-observe/ios/Tests/ObserveUserDefaultsTests.swift b/packages/expo-observe/ios/Tests/ObserveUserDefaultsTests.swift index 18e9f06f24726d..6772020e910507 100644 --- a/packages/expo-observe/ios/Tests/ObserveUserDefaultsTests.swift +++ b/packages/expo-observe/ios/Tests/ObserveUserDefaultsTests.swift @@ -63,4 +63,29 @@ struct ObserveUserDefaultsTests { ObserveUserDefaults.setConfig(PersistedConfig(sampleRate: nil)) #expect(ObserveUserDefaults.config?.sampleRate == nil) } + + @Test + func `dispatchInDebug defaults to nil`() { + #expect(ObserveUserDefaults.config?.dispatchInDebug == nil) + } + + @Test + func `setConfig with dispatchInDebug true persists true`() { + ObserveUserDefaults.setConfig(PersistedConfig(dispatchInDebug: true)) + #expect(ObserveUserDefaults.config?.dispatchInDebug == true) + } + + @Test + func `setConfig with dispatchInDebug false persists false`() { + ObserveUserDefaults.setConfig(PersistedConfig(dispatchInDebug: false)) + #expect(ObserveUserDefaults.config?.dispatchInDebug == false) + } + + @Test + func `setConfig dispatchInDebug nil clears previously set value`() { + ObserveUserDefaults.setConfig(PersistedConfig(dispatchInDebug: true)) + #expect(ObserveUserDefaults.config?.dispatchInDebug == true) + ObserveUserDefaults.setConfig(PersistedConfig(dispatchInDebug: nil)) + #expect(ObserveUserDefaults.config?.dispatchInDebug == nil) + } } diff --git a/packages/expo-observe/src/types.ts b/packages/expo-observe/src/types.ts index 05f1aa2e80653f..a0e2ce3447d933 100644 --- a/packages/expo-observe/src/types.ts +++ b/packages/expo-observe/src/types.ts @@ -11,10 +11,23 @@ export type Config = { * When `false`, any pending metrics are marked as sent without being dispatched * and no further metrics are dispatched until this is set back to `true`. * - * When unset, defaults to `false` for debug builds and `true` for release builds - * so dev metrics aren't shipped without explicit opt-in. + * @default true */ dispatchingEnabled?: boolean; + /** + * Whether to dispatch metrics that were collected in a debug build of the host app. + * + * When `false`, metrics produced by debug builds are marked as sent without being dispatched. + * When `true`, debug-build metrics are dispatched alongside release-build metrics. + * + * Has no effect on release builds. + * + * If `dispatchingEnabled` is `false` or this device is out-of-sample for `sampleRate`, nothing + * is dispatched regardless of `dispatchInDebug`. + * + * @default false + */ + dispatchInDebug?: boolean; /** * Fraction of installations that should dispatch metrics, in `[0, 1]`. Values outside that range * are clamped. From 3182a7d1f4b5564d2e715e60899025e01508be19 Mon Sep 17 00:00:00 2001 From: Jakub Tkacz <32908614+Ubax@users.noreply.github.com> Date: Tue, 28 Apr 2026 14:48:46 +0200 Subject: [PATCH 10/20] [expo-cli] add EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK flag (#45162) # Why We need a way to disable the react-navigation check in metro plugin for two reasons: - in case of custom/weird setup, some users may want to disable the check - to fix bare-expo app # How 1. Add check for `EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK` 2. Add the `EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK=1` to bare-expo commands to fix the CI # Test Plan CI # Checklist - [ ] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) --- apps/bare-expo/package.json | 10 +++---- .../server/metro/withMetroMultiPlatform.ts | 26 ++++++++++--------- packages/@expo/cli/src/utils/env.ts | 5 ++++ 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/apps/bare-expo/package.json b/apps/bare-expo/package.json index 78f8450f6f1bbc..6f3a7fe1edf57f 100644 --- a/apps/bare-expo/package.json +++ b/apps/bare-expo/package.json @@ -4,14 +4,14 @@ "private": true, "main": "index.js", "scripts": { - "android": "export NODE_ENV=\"development\" && ./scripts/start-emulator.sh", + "android": "export NODE_ENV=\"development\" EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK=1 && ./scripts/start-emulator.sh", "android:clean": "pushd android; rm -rf ./.gradle && ./gradlew --configure-on-demand; popd", - "ios": "export NODE_ENV=\"development\" && ./scripts/start-simulator.sh", - "test:ios": "export NODE_ENV=\"test\" && ./scripts/start-simulator.sh", - "test:android": "export NODE_ENV=\"test\" && ./scripts/start-emulator.sh", + "ios": "export NODE_ENV=\"development\" EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK=1 && ./scripts/start-simulator.sh", + "test:ios": "export NODE_ENV=\"test\" EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK=1 && ./scripts/start-simulator.sh", + "test:android": "export NODE_ENV=\"test\" EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK=1 && ./scripts/start-emulator.sh", "edit:android": "open -a /Applications/Android\\ Studio.app ./android", "edit:ios": "xed ./ios/BareExpo.xcworkspace", - "start": "expo start --reset-cache", + "start": "EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK=1 expo start --reset-cache", "clear-metro": "watchman watch-del-all && rm -rf /tmp/metro-bundler-cache-* && rm -rf /tmp/haste-map-react-native-packager-*", "clear-ios-build": "rm -rf ios/build/; kill $(lsof -t -i:8081)", "test": "jest", diff --git a/packages/@expo/cli/src/start/server/metro/withMetroMultiPlatform.ts b/packages/@expo/cli/src/start/server/metro/withMetroMultiPlatform.ts index de14d282952706..854b31e2b1306f 100644 --- a/packages/@expo/cli/src/start/server/metro/withMetroMultiPlatform.ts +++ b/packages/@expo/cli/src/start/server/metro/withMetroMultiPlatform.ts @@ -683,18 +683,20 @@ export function withExtendedResolver( } } - // TODO(@ubax): Remove this rewrite once we published migration guide for library authors - if (moduleName.startsWith('@react-navigation/') && isExpoRouterResolvable) { - const filePath = context.originModulePath; - if (!filePath.includes('node_modules')) { - // TODO(@ubax): Add link to migration guide, once it is published - throw new Error( - 'As of SDK 56, expo-router is no longer compatible with react-navigation. For more information, see [MIGRATION_GUIDE_URL].' - ); - } - if (moduleName === '@react-navigation/core') { - // We already checked if expo-router resolves - return doResolve('expo-router'); + if (!env.EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK) { + // TODO(@ubax): Remove this rewrite once we published migration guide for library authors + if (moduleName.startsWith('@react-navigation/') && isExpoRouterResolvable) { + const filePath = context.originModulePath; + if (!filePath.includes('node_modules')) { + // TODO(@ubax): Add link to migration guide, once it is published + throw new Error( + 'As of SDK 56, expo-router is no longer compatible with react-navigation. For more information, see [MIGRATION_GUIDE_URL]. You can disable this check by setting the environment variable EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK=1.' + ); + } + if (moduleName === '@react-navigation/core') { + // We already checked if expo-router resolves + return doResolve('expo-router'); + } } } diff --git a/packages/@expo/cli/src/utils/env.ts b/packages/@expo/cli/src/utils/env.ts index 511a6d14e619dd..7e17c52c19be40 100644 --- a/packages/@expo/cli/src/utils/env.ts +++ b/packages/@expo/cli/src/utils/env.ts @@ -271,6 +271,11 @@ class Env { return boolish('EXPO_UNSTABLE_WEB_MODAL', false); } + /** Disable @react-navigation checks for expo-router projects */ + get EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK(): boolean { + return boolish('EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK', false); + } + /** Disable by falsy value live binding in experimental import export support. Enabled by default. */ get EXPO_UNSTABLE_LIVE_BINDINGS(): boolean { return boolish('EXPO_UNSTABLE_LIVE_BINDINGS', true); From 08d1d8d2645c5474962443046fe0fdb5d35ad13c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Klocek?= Date: Tue, 28 Apr 2026 14:49:06 +0200 Subject: [PATCH 11/20] [core][ios] Rework JSI <-> Record conversion (#45085) # Why Follow-up to #44337. On iOS, the JSI-based `Record` conversion eagerly materialized whole JS objects through `getAny()`, which could crash on extra JS-only properties like `AbortSignal`. This PR also restores the pre-JSI object-hydration behavior for `undefined` properties. # How - Reworked typed `Record` argument hydration to read only declared `@Field`s from `JavaScriptObject` instead of materializing the whole object through `getAny()`. - Added direct JS emission for typed `Record` and `FormattedRecord` returns so they no longer go through `toDictionary() -> JavaScriptValue`. - Restored the old object-conversion behavior for `undefined` values during typed hydration, including nested dictionary values. # Test Plan - iOS unit tests - Added new regression tests - `echoObject` benchmark: ~16% improvement - `File.downloadFileAsync()` no longer crashes on `AbortSignal` being passed # Checklist - [x] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) --- packages/expo-modules-core/CHANGELOG.md | 1 + .../Core/DynamicTypes/AnyDynamicType.swift | 12 +++ .../Core/DynamicTypes/DynamicArrayType.swift | 22 ++++- .../DynamicTypes/DynamicConvertibleType.swift | 63 ++++++++++-- .../DynamicTypes/DynamicDictionaryType.swift | 32 ++++++- .../ios/Core/MainValueConverter.swift | 3 +- .../ios/Core/Records/AnyField.swift | 5 + .../ios/Core/Records/Field.swift | 46 +++++++-- .../ios/Core/Records/FormattedRecord.swift | 25 ++++- .../ios/Core/Records/Record.swift | 66 +++++++++++++ .../ios/Tests/AsyncFunctionTests.swift | 20 ++++ .../ios/Tests/ConvertiblesTests.swift | 10 ++ .../ios/Tests/DynamicTypeTests.swift | 95 +++++++++++++++++++ .../ios/Tests/FunctionTests.swift | 95 +++++++++++++++++++ 14 files changed, 470 insertions(+), 25 deletions(-) diff --git a/packages/expo-modules-core/CHANGELOG.md b/packages/expo-modules-core/CHANGELOG.md index 5a0cefbe677177..fadc3a597c2f00 100644 --- a/packages/expo-modules-core/CHANGELOG.md +++ b/packages/expo-modules-core/CHANGELOG.md @@ -40,6 +40,7 @@ - [iOS] Fix finding EXConstants.bundle inside framework bundle for brownfield ([#44810](https://github.com/expo/expo/pull/44810) by [@gabrieldonadel](https://github.com/gabrieldonadel)) - [iOS] Fix missing jsi headers when building static frameworks ([#44865](https://github.com/expo/expo/pull/44865) by [@gabrieldonadel](https://github.com/gabrieldonadel)) - Fixed runtime crash when missing `Host` component for SwiftUI or Jetpack Compose components. ([#44118](https://github.com/expo/expo/pull/44118) by [@kudo](https://github.com/kudo)) +- [iOS] Restore pre-ExpoModulesJSI `Record` conversion behavior by hydrating only declared fields, preserving `undefined` handling for object properties, and emitting typed records directly to JS. ([#45085](https://github.com/expo/expo/pull/45085) by [@barthap](https://github.com/barthap)) ### 💡 Others diff --git a/packages/expo-modules-core/ios/Core/DynamicTypes/AnyDynamicType.swift b/packages/expo-modules-core/ios/Core/DynamicTypes/AnyDynamicType.swift index 37de75411ff07c..90e8cc82618f8c 100644 --- a/packages/expo-modules-core/ios/Core/DynamicTypes/AnyDynamicType.swift +++ b/packages/expo-modules-core/ios/Core/DynamicTypes/AnyDynamicType.swift @@ -33,6 +33,13 @@ public protocol AnyDynamicType: CustomStringConvertible, Sendable { func castToJS(_ value: ValueType, appContext: AppContext) throws -> JavaScriptValue + /** + Converts the given native value directly to `JavaScriptValue`. + The default implementation uses `convertResult` and then `castToJS`, but dynamic types + can override it to avoid unnecessary intermediate representations. + */ + func convertToJS(_ value: ValueType, appContext: AppContext) throws -> JavaScriptValue + /** Converts function's result to the type that can later be converted to a JS value. For instance, types such as records, enumerables and shared objects need special handling @@ -54,6 +61,11 @@ extension AnyDynamicType { return try Conversions.unknownToJavaScriptValue(value, appContext: appContext) } + public func convertToJS(_ value: ValueType, appContext: AppContext) throws -> JavaScriptValue { + let result = Conversions.convertFunctionResult(value, appContext: appContext, dynamicType: self) + return try castToJS(result, appContext: appContext) + } + func convertResult(_ result: ResultType, appContext: AppContext) throws -> Any { return result } diff --git a/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicArrayType.swift b/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicArrayType.swift index ebfdcf58d7eebc..aa5fb0e47f5ba4 100644 --- a/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicArrayType.swift +++ b/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicArrayType.swift @@ -50,9 +50,9 @@ internal struct DynamicArrayType: AnyDynamicType { } /** - Type-aware conversion: converts each element using `elementType.castToJS` so types like - `SharedObject` — which need per-type JS representations — are handled correctly when - nested inside an array. + Type-aware conversion for arrays that were already normalized by `convertResult`. + Elements must use `castToJS` here to avoid re-entering `convertResult` for values that + are already in their post-conversion shape, such as `JavaScriptValue.undefined`. */ func castToJS(_ value: ValueType, appContext: AppContext) throws -> JavaScriptValue { guard let array = value as? [Any] else { @@ -66,6 +66,22 @@ internal struct DynamicArrayType: AnyDynamicType { return jsArray.asValue() } + /** + Converts original native arrays directly to JavaScript, allowing nested elements + to use their own direct conversion paths before any array-level normalization. + */ + func convertToJS(_ value: ValueType, appContext: AppContext) throws -> JavaScriptValue { + guard let array = value as? [Any] else { + return try Conversions.anyToJavaScriptValue(value, appContext: appContext) + } + let runtime = try appContext.runtime + let jsArray = runtime.createArray(length: array.count) + for (index, element) in array.enumerated() { + try jsArray.set(value: try elementType.convertToJS(element, appContext: appContext), at: index) + } + return jsArray.asValue() + } + var description: String { "[\(elementType.description)]" } diff --git a/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicConvertibleType.swift b/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicConvertibleType.swift index b498c7480be26c..4b106b9bcc9371 100644 --- a/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicConvertibleType.swift +++ b/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicConvertibleType.swift @@ -1,5 +1,7 @@ // Copyright 2021-present 650 Industries. All rights reserved. +import ExpoModulesJSI + /** A dynamic type that wraps any type conforming to `Convertible` protocol. */ @@ -17,19 +19,38 @@ internal struct DynamicConvertibleType: AnyDynamicType { return false } + @JavaScriptActor + func cast(jsValue: JavaScriptValue, appContext: AppContext) throws -> Any { + if let recordType = innerType as? any Record.Type { + let record = recordType.init() + try record.update(withObject: try jsValue.asObject(), appContext: appContext) + return record + } + return jsValue.getAny() + } + func cast(_ value: ValueType, appContext: AppContext) throws -> Any { return try innerType.convert(from: value, appContext: appContext) } func castToJS(_ value: ValueType, appContext: AppContext) throws -> JavaScriptValue { - let result = try innerType.convertResult(value, appContext: appContext) - if let result = result as? JavaScriptValue { - return result + if let directJSValue = try directJSValueIfPossible(value, appContext: appContext) { + return directJSValue } - if let result = result as? AnyArgument { - return try type(of: result).getDynamicType().castToJS(result, appContext: appContext) + if let jsValue = value as? JavaScriptValue { + return jsValue + } + if value is AnyArgument { + return try convertOriginalValueToJS(value, appContext: appContext) + } + return try serializeConvertedValue(value, appContext: appContext) + } + + func convertToJS(_ value: ValueType, appContext: AppContext) throws -> JavaScriptValue { + if let directJSValue = try directJSValueIfPossible(value, appContext: appContext) { + return directJSValue } - return try Conversions.unknownToJavaScriptValue(result, appContext: appContext) + return try convertOriginalValueToJS(value, appContext: appContext) } func convertResult(_ result: ResultType, appContext: AppContext) throws -> Any { @@ -39,4 +60,34 @@ internal struct DynamicConvertibleType: AnyDynamicType { var description: String { String(describing: innerType.self) } + + private func directJSValueIfPossible(_ value: ValueType, appContext: AppContext) throws -> JavaScriptValue? { + if let value = value as? any Record { + return try JavaScriptActor.assumeIsolated { + try value.toJSValue(appContext: appContext) + } + } + // `FormattedRecord` isn't a `Record`, so it needs this separate branch to preserve the direct path. + if let value = value as? any RecordJavaScriptValueConvertible { + return try JavaScriptActor.assumeIsolated { + try value.toJSValue(appContext: appContext) + } + } + return nil + } + + private func convertOriginalValueToJS(_ value: ValueType, appContext: AppContext) throws -> JavaScriptValue { + let result = try innerType.convertResult(value, appContext: appContext) + return try serializeConvertedValue(result, appContext: appContext) + } + + private func serializeConvertedValue(_ value: Any, appContext: AppContext) throws -> JavaScriptValue { + if let result = value as? JavaScriptValue { + return result + } + if let result = value as? AnyArgument { + return try type(of: result).getDynamicType().castToJS(result, appContext: appContext) + } + return try Conversions.unknownToJavaScriptValue(value, appContext: appContext) + } } diff --git a/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicDictionaryType.swift b/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicDictionaryType.swift index a52a21b4da16a7..6a50be4d376085 100644 --- a/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicDictionaryType.swift +++ b/packages/expo-modules-core/ios/Core/DynamicTypes/DynamicDictionaryType.swift @@ -27,7 +27,14 @@ internal struct DynamicDictionaryType: AnyDynamicType { if let jsObject = try? jsValue.asObject() { var result: [AnyHashable: Any] = [:] for key in jsObject.getPropertyNames() { - result[key] = try appContext.converter.toNative(jsObject.getProperty(key), valueType) + let property = jsObject.getProperty(key) + + // Match `JavaScriptValue.getAny()` semantics by treating `undefined` + // object values as absent entries during recursive hydration. + if property.isUndefined() { + continue + } + result[key] = try appContext.converter.toNative(property, valueType) } return result } @@ -49,9 +56,9 @@ internal struct DynamicDictionaryType: AnyDynamicType { } /** - Type-aware conversion: converts each value using `valueType.castToJS` so types like - `SharedObject` — which need per-type JS representations — are handled correctly when - nested inside a dictionary. + Type-aware conversion for dictionaries that were already normalized by `convertResult`. + Values must use `castToJS` here to avoid re-entering `convertResult` for values that + are already in their post-conversion shape, such as `JavaScriptValue.undefined`. */ func castToJS(_ value: ValueType, appContext: AppContext) throws -> JavaScriptValue { guard let dict = value as? [AnyHashable: Any] else { @@ -66,6 +73,23 @@ internal struct DynamicDictionaryType: AnyDynamicType { return jsObject.asValue() } + /** + Converts original native dictionaries directly to JavaScript, allowing nested values + to use their own direct conversion paths before any dictionary-level normalization. + */ + func convertToJS(_ value: ValueType, appContext: AppContext) throws -> JavaScriptValue { + guard let dict = value as? [AnyHashable: Any] else { + return try Conversions.anyToJavaScriptValue(value, appContext: appContext) + } + let runtime = try appContext.runtime + let jsObject = runtime.createObject() + for (key, element) in dict { + guard let key = key as? String else { continue } + jsObject.setProperty(key, value: try valueType.convertToJS(element, appContext: appContext)) + } + return jsObject.asValue() + } + var description: String { "[Hashable: \(valueType.description)]" } diff --git a/packages/expo-modules-core/ios/Core/MainValueConverter.swift b/packages/expo-modules-core/ios/Core/MainValueConverter.swift index 3826037f136518..031e9337e58f1e 100644 --- a/packages/expo-modules-core/ios/Core/MainValueConverter.swift +++ b/packages/expo-modules-core/ios/Core/MainValueConverter.swift @@ -41,7 +41,6 @@ public struct MainValueConverter: ~Copyable { */ @JavaScriptActor public func toJS(_ value: Any, _ type: AnyDynamicType) throws -> JavaScriptValue { - let result = Conversions.convertFunctionResult(value, appContext: appContext, dynamicType: type) - return try type.castToJS(result, appContext: appContext) + return try type.convertToJS(value, appContext: appContext) } } diff --git a/packages/expo-modules-core/ios/Core/Records/AnyField.swift b/packages/expo-modules-core/ios/Core/Records/AnyField.swift index 4802e67ff76679..57e3707d54d1cd 100644 --- a/packages/expo-modules-core/ios/Core/Records/AnyField.swift +++ b/packages/expo-modules-core/ios/Core/Records/AnyField.swift @@ -1,3 +1,5 @@ +import ExpoModulesJSI + /** Protocol for type-erased record fields. */ @@ -21,4 +23,7 @@ internal protocol AnyFieldInternal: AnyField { var isRequired: Bool { get } func set(_ newValue: Any?, appContext: AppContext) throws + + @JavaScriptActor + func set(jsValue: JavaScriptValue, appContext: AppContext) throws } diff --git a/packages/expo-modules-core/ios/Core/Records/Field.swift b/packages/expo-modules-core/ios/Core/Records/Field.swift index 0ca85321fdea6a..911a91731d2270 100644 --- a/packages/expo-modules-core/ios/Core/Records/Field.swift +++ b/packages/expo-modules-core/ios/Core/Records/Field.swift @@ -24,13 +24,6 @@ public final class Field: AnyFieldInternal, @unchecked Sendab */ internal var options: Set = Set() - /** - Whether the generic field type accepts `nil` values. - */ - internal var isOptional: Bool { - return fieldType is DynamicOptionalType - } - internal var isRequired: Bool { options.contains(.required) } @@ -76,17 +69,52 @@ public final class Field: AnyFieldInternal, @unchecked Sendab Sets the wrapped value with a value of `Any` type. */ internal func set(_ newValue: Any?, appContext: AppContext) throws { - if newValue == nil && (!isOptional || isRequired) { + if newValue == nil && isRequired { throw FieldRequiredException(key!) } do { - if let value = try fieldType.cast(newValue, appContext: appContext) as? Type { + if let value = try castValue(newValue, appContext: appContext) { wrappedValue = value + } else if newValue == nil { + throw FieldRequiredException(key!) } } catch { + if newValue == nil { + throw FieldRequiredException(key!) + } throw FieldInvalidTypeException((fieldKey: key!, value: newValue, desiredType: Type.self)).causedBy(error) } } + + @JavaScriptActor + internal func set(jsValue: JavaScriptValue, appContext: AppContext) throws { + if jsValue.isNull() && isRequired { + throw FieldRequiredException(key!) + } + do { + if let value = try castValue(jsValue: jsValue, appContext: appContext) { + wrappedValue = value + } else if jsValue.isNull() { + throw FieldRequiredException(key!) + } + } catch { + if jsValue.isNull() { + throw FieldRequiredException(key!) + } + throw FieldInvalidTypeException((fieldKey: key!, value: jsValue, desiredType: Type.self)).causedBy(error) + } + } + + internal func castValue(_ newValue: Any?, appContext: AppContext) throws -> Type? { + return try fieldType.cast(newValue, appContext: appContext) as? Type + } + + @JavaScriptActor + internal func castValue(jsValue: JavaScriptValue, appContext: AppContext) throws -> Type? { + let rawValue = try fieldType.cast(jsValue: jsValue, appContext: appContext) + let convertedValue = try fieldType.cast(rawValue, appContext: appContext) + return convertedValue as? Type + } } internal final class FieldRequiredException: GenericException, @unchecked Sendable { diff --git a/packages/expo-modules-core/ios/Core/Records/FormattedRecord.swift b/packages/expo-modules-core/ios/Core/Records/FormattedRecord.swift index df7b09c8cb3bcb..1560f9471bfd52 100644 --- a/packages/expo-modules-core/ios/Core/Records/FormattedRecord.swift +++ b/packages/expo-modules-core/ios/Core/Records/FormattedRecord.swift @@ -2,7 +2,7 @@ Class that binds a formatter with a record. It can be converted to JS, but it can't be converted from a JS value. */ -public struct FormattedRecord: Convertible { +public struct FormattedRecord: Convertible, RecordJavaScriptValueConvertible { internal final class FormattedRecordCannotBeUsedAsParameterException: Exception, @unchecked Sendable { override var reason: String { "FormattedRecord cannot be used as a parameter" @@ -37,4 +37,27 @@ public struct FormattedRecord: Convertible { public static func convert(from value: Any?, appContext: AppContext) throws -> FormattedRecord { throw FormattedRecordCannotBeUsedAsParameterException() } + + @JavaScriptActor + func toJSValue(appContext: AppContext) throws -> JavaScriptValue { + let object = try appContext.runtime.createObject() + + for field in fieldsOf(record) { + guard let key = field.key else { + continue + } + let value = if let action = formatter.selectors.first(where: { $0.name == key })?.action { + action(record, field.get()) + } else { + field.get() + } + + if value is Skip { + continue + } + let jsValue = try recordFieldValueToJSValue(value, appContext: appContext) + object.setProperty(key, value: jsValue) + } + return object.asValue() + } } diff --git a/packages/expo-modules-core/ios/Core/Records/Record.swift b/packages/expo-modules-core/ios/Core/Records/Record.swift index d3ca655c446679..8aa18ce439e6ea 100644 --- a/packages/expo-modules-core/ios/Core/Records/Record.swift +++ b/packages/expo-modules-core/ios/Core/Records/Record.swift @@ -26,6 +26,11 @@ public protocol Record: Convertible { func toDictionary(appContext: AppContext?) -> Dict } +internal protocol RecordJavaScriptValueConvertible { + @JavaScriptActor + func toJSValue(appContext: AppContext) throws -> JavaScriptValue +} + /** Provides the default implementation of `Record` protocol. */ @@ -61,6 +66,31 @@ public extension Record { } } + @JavaScriptActor + func update(withObject object: borrowing JavaScriptObject, appContext: AppContext) throws { + // Using a set keeps declared-field lookups O(1) when selectively hydrating the record. + let propertyNames = Set(object.getPropertyNames()) + + try fieldsOf(self).forEach { field in + guard let key = field.key else { + return + } + if propertyNames.contains(key) { + let property = object.getProperty(key) + + if property.isUndefined() { + if field.isRequired { + try field.set(nil, appContext: appContext) + } + return + } + try field.set(jsValue: property, appContext: appContext) + } else if field.isRequired { + try field.set(nil, appContext: appContext) + } + } + } + func toDictionary(appContext: AppContext? = nil) -> Dict { return fieldsOf(self).reduce(into: Dict()) { result, field in if let key = field.key { @@ -75,6 +105,20 @@ public extension Record { } return result } + + @JavaScriptActor + func toJSValue(appContext: AppContext) throws -> JavaScriptValue { + let object = try appContext.runtime.createObject() + + for field in fieldsOf(self) { + guard let key = field.key else { + continue + } + let value = try recordFieldValueToJSValue(field.get(), dynamicType: field.fieldType, appContext: appContext) + object.setProperty(key, value: value) + } + return object.asValue() + } } /** @@ -110,3 +154,25 @@ internal func fieldsOf(_ record: Record) -> [AnyFieldInternal] { internal func convertLabelToKey(_ label: String?) -> String? { return (label != nil && label!.starts(with: "_")) ? String(label!.dropFirst()) : label } + +@JavaScriptActor +internal func recordFieldValueToJSValue( + _ value: Any, + dynamicType: AnyDynamicType? = nil, + appContext: AppContext +) throws -> JavaScriptValue { + let convertedValue: Any + + if let dynamicType { + return try dynamicType.convertToJS(value, appContext: appContext) + } + + convertedValue = Conversions.convertFunctionResult(value, appContext: appContext) + if Optional.isNil(convertedValue) { + return .null + } + if let jsValue = convertedValue as? JavaScriptValue { + return jsValue + } + return try Conversions.unknownToJavaScriptValue(convertedValue, appContext: appContext) +} diff --git a/packages/expo-modules-core/ios/Tests/AsyncFunctionTests.swift b/packages/expo-modules-core/ios/Tests/AsyncFunctionTests.swift index f1b9600698cf08..368dd5e0f3fb64 100644 --- a/packages/expo-modules-core/ios/Tests/AsyncFunctionTests.swift +++ b/packages/expo-modules-core/ios/Tests/AsyncFunctionTests.swift @@ -27,6 +27,10 @@ struct AsyncFunctionTests { promise.resolve(record) } + AsyncFunction("resolvesRecordWithUndefined") { + return WithUndefinedRecord() + } + AsyncFunction("returnsOptionalString") { (returnNil: Bool) -> String? in return returnNil ? nil : "present" } @@ -63,6 +67,17 @@ struct AsyncFunctionTests { try await expect(equals: "resolved") } + @Test + func `converts a Record with undefined fields returned from async function`() async throws { + let result = try await runtime.evalAsync("expo.modules.TestModule.resolvesRecordWithUndefined()") + let object = try result.asObject() + + #expect(object.hasProperty("a") == true) + #expect(try object.getProperty("a").asDouble() == 1.0) + #expect(object.hasProperty("b") == true) + #expect(object.getProperty("b").isUndefined() == true) + } + @Test func `returns null when the optional return value is nil`() async throws { let result = try await runtime.evalAsync("expo.modules.TestModule.returnsOptionalString(true)") @@ -95,3 +110,8 @@ fileprivate struct TestRecord: Record { @Field var message: String = "" } + +fileprivate struct WithUndefinedRecord: Record { + @Field var a: ValueOrUndefined = .value(unwrapped: 1.0) + @Field var b: ValueOrUndefined = .undefined +} diff --git a/packages/expo-modules-core/ios/Tests/ConvertiblesTests.swift b/packages/expo-modules-core/ios/Tests/ConvertiblesTests.swift index 05330b91180794..b577983d13111f 100644 --- a/packages/expo-modules-core/ios/Tests/ConvertiblesTests.swift +++ b/packages/expo-modules-core/ios/Tests/ConvertiblesTests.swift @@ -246,6 +246,16 @@ struct ConvertiblesTests { #expect(Double(size.height) == height) } + @Test + @JavaScriptActor + func `converts from JS array and object through the value converter`() throws { + let arrayValue = try appContext.runtime.eval("[4, 3]") + let objectValue = try appContext.runtime.eval("({ width: 4, height: 3 })") + + #expect(try appContext.converter.toNative(arrayValue, ~CGSize.self) as? CGSize == CGSize(width: 4, height: 3)) + #expect(try appContext.converter.toNative(objectValue, ~CGSize.self) as? CGSize == CGSize(width: 4, height: 3)) + } + @Test func `throws when array size is unexpected`() { #expect(throws: Conversions.ConvertingException.self) { diff --git a/packages/expo-modules-core/ios/Tests/DynamicTypeTests.swift b/packages/expo-modules-core/ios/Tests/DynamicTypeTests.swift index b4e0923d811e40..71c6a7ca85890e 100644 --- a/packages/expo-modules-core/ios/Tests/DynamicTypeTests.swift +++ b/packages/expo-modules-core/ios/Tests/DynamicTypeTests.swift @@ -269,6 +269,17 @@ struct DynamicTypeTests { #expect(try jsArray[jsArray.length - 1].isArrayBuffer() == true) } + @Test + func `returns convertible elements to JS`() throws { + let sizes = [CGSize(width: 4, height: 3)] + let jsValue = try (~[CGSize].self).castToJS(sizes, appContext: appContext) + let jsArray = try jsValue.asArray() + let sizeObject = try jsArray[0].asObject() + + #expect(try sizeObject.getProperty("width").asDouble() == 4) + #expect(try sizeObject.getProperty("height").asDouble() == 3) + } + @Test func `wraps is true`() { #expect((~[Double].self ~> [Double].self) == true) @@ -352,6 +363,17 @@ struct DynamicTypeTests { #expect(jsObject.getProperty("buf").isArrayBuffer() == true) } + @Test + func `returns convertible values to JS`() throws { + let sizes: [String: CGSize] = ["size": CGSize(width: 4, height: 3)] + let jsValue = try (~[String: CGSize].self).castToJS(sizes, appContext: appContext) + let jsObject = try jsValue.asObject() + let sizeObject = try jsObject.getProperty("size").asObject() + + #expect(try sizeObject.getProperty("width").asDouble() == 4) + #expect(try sizeObject.getProperty("height").asDouble() == 3) + } + @Test func `throws CastingException`() { #expect(throws: Conversions.CastingException<[AnyHashable: Any]>.self) { @@ -392,6 +414,7 @@ struct DynamicTypeTests { // MARK: - DynamicConvertibleType @Suite("DynamicConvertibleType") + @JavaScriptActor struct DynamicConvertibleTypeTests { let appContext: AppContext @@ -414,6 +437,78 @@ struct DynamicTypeTests { #expect(try (~URL.self).cast("/test/path", appContext: appContext) as? URL == URL(fileURLWithPath: "/test/path")) } + @Test + func `casts record from JS value while ignoring extra function-valued properties`() throws { + struct TestRecord: Record { + @Field var property: String = "" + } + + let jsValue = try appContext.runtime.eval(""" + ({ + property: "expo", + signal: { + addEventListener() {} + } + }) + """) + + let record = try (~TestRecord.self).cast(jsValue: jsValue, appContext: appContext) as? TestRecord + #expect(record?.property == "expo") + } + + @Test + func `returns record directly to JS while preserving null and undefined`() throws { + struct NestedRecord: Record { + @Field var label: String = "nested" + } + + struct TestRecord: Record { + @Field var nested: NestedRecord = NestedRecord() + @Field var optional: String? + @Field var maybeNumber: ValueOrUndefined = .undefined + } + + let result = try (~TestRecord.self).castToJS(TestRecord(), appContext: appContext) + let object = try result.asObject() + + #expect(object.hasProperty("nested") == true) + #expect(try object.getProperty("nested").asObject().getProperty("label").asString() == "nested") + #expect(object.hasProperty("optional") == true) + #expect(object.getProperty("optional").isNull() == true) + #expect(object.hasProperty("maybeNumber") == true) + #expect(object.getProperty("maybeNumber").isUndefined() == true) + } + + @Test + func `returns convertible directly to JS without double-converting convertResult`() throws { + let result = try (~CGColor.self).convertToJS(UIColor.red.cgColor, appContext: appContext) + + #expect(result.kind == .string) + #expect(result.getString() == "#ff0000ff") + } + + @Test + func `returns formatted record directly to JS while preserving formatter behavior`() throws { + struct TestRecord: Record { + @Field var a: String = "a" + @Field var b: String? = nil + @Field var c: String = "c" + } + + let formatted = TestRecord().format { formatter in + formatter.property("a", keyPath: \.a).map { $0.uppercased() } + formatter.property("b", keyPath: \.b).map { $0 ?? "default" } + formatter.property("c", keyPath: \.c).skip() + } + + let result = try (~FormattedRecord.self).castToJS(formatted, appContext: appContext) + let object = try result.asObject() + + #expect(try object.getProperty("a").asString() == "A") + #expect(try object.getProperty("b").asString() == "default") + #expect(object.hasProperty("c") == false) + } + @Test func `throws ConvertingException`() { #expect(throws: Conversions.ConvertingException.self) { diff --git a/packages/expo-modules-core/ios/Tests/FunctionTests.swift b/packages/expo-modules-core/ios/Tests/FunctionTests.swift index 56b2ce7e207979..31db50c98660a3 100644 --- a/packages/expo-modules-core/ios/Tests/FunctionTests.swift +++ b/packages/expo-modules-core/ios/Tests/FunctionTests.swift @@ -37,6 +37,10 @@ struct FunctionTests { @Field var a: ValueOrUndefined = .value(unwrapped: 1.0) } + struct TestRecordWithHeaders: Record { + @Field var headers: [String: String] = [:] + } + struct TestEncodable: Encodable { let name: String let version: Int @@ -85,6 +89,10 @@ struct FunctionTests { return "\(f.property)" } + Function("withRecordWithHeaders") { (f: TestRecordWithHeaders) in + return "\(f.headers.count)" + } + Function("withURL") { return TestURLRecord.defaultURL } @@ -109,6 +117,17 @@ struct FunctionTests { // Expectations captured via side effects are not ideal, but works for migration } + Function("returnArrayOfUndefinedValues") { + return [ValueOrUndefined.value(unwrapped: 1.0), .undefined] + } + + Function("returnDictionaryOfUndefinedValues") { + return [ + "present": ValueOrUndefined.value(unwrapped: 1.0), + "missing": .undefined + ] + } + Function("returnEncodable") { return TestEncodable(name: "Expo SDK", version: 55) } @@ -222,6 +241,60 @@ struct FunctionTests { #expect(try runtime.eval("expo.modules.TestModule.withRecord({property: \"123\"})").asString() == "123") } + @Test + func `accepts record while ignoring extra function-valued properties`() throws { + #expect( + try runtime.eval(""" + expo.modules.TestModule.withRecord({ + property: "123", + signal: { + addEventListener() {} + } + }) + """).asString() == "123" + ) + } + + @Test + func `accepts record while treating undefined field values as missing`() throws { + #expect( + try runtime.eval(""" + expo.modules.TestModule.withRecord({ + property: undefined + }) + """).asString() == "expo" + ) + } + + @Test + func `throws FieldRequiredException when a non-optional record field is null`() throws { + #expect { + try runtime.eval(""" + expo.modules.TestModule.withRecord({ + property: null + }) + """) + } throws: { error in + guard let evalError = error as? ScriptEvaluationError else { + return false + } + return evalError.message.contains("FieldRequiredException: Value for field 'property' is required, got nil") + } + } + + @Test + func `accepts record while dropping undefined values from nested dictionaries`() throws { + #expect( + try runtime.eval(""" + expo.modules.TestModule.withRecordWithHeaders({ + headers: { + authorization: undefined + } + }) + """).asString() == "0" + ) + } + @Test func `accepts no optional record`() throws { #expect(try runtime.eval("expo.modules.TestModule.withOptionalRecord()").asString() == "no value") @@ -242,6 +315,28 @@ struct FunctionTests { try runtime.eval("expo.modules.TestModule.withNullableValueOrUndefindedInArray([null, undefined])") } + @Test + func `returns array with ValueOrUndefined without double-converting`() throws { + try runtime.eval(""" + globalThis.result = expo.modules.TestModule.returnArrayOfUndefinedValues() + """) + + #expect(try runtime.eval("result.length").asInt() == 2) + #expect(try runtime.eval("result[0]").asDouble() == 1.0) + #expect(try runtime.eval("result[1]").isUndefined() == true) + } + + @Test + func `returns dictionary with ValueOrUndefined without double-converting`() throws { + try runtime.eval(""" + globalThis.result = expo.modules.TestModule.returnDictionaryOfUndefinedValues() + """) + + #expect(try runtime.eval("result.present").asDouble() == 1.0) + #expect(try runtime.eval("result.missing").isUndefined() == true) + #expect(try runtime.eval("Object.prototype.hasOwnProperty.call(result, 'missing')").asBool() == true) + } + @Test func `returns encodable struct`() throws { let result = try runtime.eval("expo.modules.TestModule.returnEncodable()") From 473647e8893bb11ee6d44f2a4f57c2c3eb22575e Mon Sep 17 00:00:00 2001 From: Aman Mittal Date: Tue, 28 Apr 2026 18:28:01 +0530 Subject: [PATCH 12/20] [docs] Fix Vale Consistency rule false positives on link URLs (#45158) # Why The `expo-docs.Consistency` Vale rule flagged the substring `nodejs` inside link URLs like `https://nodejs.org/en`, producing six false-positive errors that failed CI on otherwise correct pages: CleanShot 2026-04-28 at 16 12
21@2x # How - Add `nodejs.org, ` explicitly in `TokenIgnore` list. # Test Plan Run `pnpm run lint-prose` and confirm below: CleanShot 2026-04-28 at 16 12 36@2x # Checklist - [ ] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) --- docs/.vale.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/.vale.ini b/docs/.vale.ini index 10503c631590dc..9e49e8827e826b 100644 --- a/docs/.vale.ini +++ b/docs/.vale.ini @@ -18,7 +18,7 @@ CommentDelimiters = {/*, */} # Ignore code surrounded by backticks or plus sign, parameters defaults, URLs and so on. BlockIgnores = (?s), -TokenIgnores = (\x60[^\n\x60]+\x60), ([^\n]+=[^\n]*), (\+[^\n]+\+), (http[^\n]+\[), .github, .gitlab, vscode-, Signing & Capabilities, eas.json, eas-json, yarn: "# yarn", eas+, eas-cli, npx+, Build & deploy, OAuth & Permissions, Languages & Frameworks, typescript, Privacy & Security, Certificates, IDs & Profiles, application/javascript, Motion & Orientation Access, Show devices and ask me again, my-app, Still having trouble?, "my app runs well locally by crashes immediately when I run a build", my-app, MY_CUSTOM_API_KEY, withMyApiKey, My App, com.my., myFunction, my app, my-plugin, my-module, 'Hello from my TypeScript function!', my-scheme, my-root, Change my environment variables, my custom plugin, my, cocoapods, javascript, Ink & Switch, macos-medium, macos-large, yarn +TokenIgnores = (\x60[^\n\x60]+\x60), ([^\n]+=[^\n]*), (\+[^\n]+\+), (http[^\n]+\[), .github, .gitlab, nodejs.org, vscode-, Signing & Capabilities, eas.json, eas-json, yarn: "# yarn", eas+, eas-cli, npx+, Build & deploy, OAuth & Permissions, Languages & Frameworks, typescript, Privacy & Security, Certificates, IDs & Profiles, application/javascript, Motion & Orientation Access, Show devices and ask me again, my-app, Still having trouble?, "my app runs well locally by crashes immediately when I run a build", my-app, MY_CUSTOM_API_KEY, withMyApiKey, My App, com.my., myFunction, my app, my-plugin, my-module, 'Hello from my TypeScript function!', my-scheme, my-root, Change my environment variables, my custom plugin, my, cocoapods, javascript, Ink & Switch, macos-medium, macos-large, yarn # Ignore internal test fixtures and generated output. # Using **/ prefix so patterns match whether vale runs from docs/ or the repo root. From 3f47519b108618ac0588f058b9391cdc5af3df49 Mon Sep 17 00:00:00 2001 From: Christian Falch <875252+chrfalch@users.noreply.github.com> Date: Tue, 28 Apr 2026 15:29:31 +0200 Subject: [PATCH 13/20] fix(ios): gate precompiled modules on prebuilt Expo dependencies (#45160) ## Why Expo modules could be linked as precompiled xcframeworks even when an upstream Expo dependency, like ExpoModulesCore, was unavailable as prebuilt or configured to build from source. That produced inconsistent installs and build failures where downstream modules used prebuilt artifacts while their parent dependency built from source. ## How Track Expo prebuilt dependency pods from spm.config.json and resolve prebuilt availability recursively before linking a module as precompiled. When a parent dependency is unavailable or configured with buildFromSource, keep the downstream module source-built too, and show the concrete fallback reason in the precompiled summary. Also: Exclude ExpoModulesJSI from this dependency check because it is always provided through its own custom xcframework path rather than the Expo precompiled tarball pipeline. # Test Plan Tested in reproduction project that had this failure. Created new expo project and tried running `pod install` which failed. After this fix it does no longer fail. NOTE: This fixes part one of the above failure, next PR will fix the resolving of the package. # Checklist - [x] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [x] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). --------- Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com> --- .../expo-modules-autolinking/CHANGELOG.md | 1 + .../scripts/ios/precompiled_modules.rb | 110 +++++++++++++++--- 2 files changed, 96 insertions(+), 15 deletions(-) diff --git a/packages/expo-modules-autolinking/CHANGELOG.md b/packages/expo-modules-autolinking/CHANGELOG.md index 2bb01c8ceb80af..7c27ea9fc3b174 100644 --- a/packages/expo-modules-autolinking/CHANGELOG.md +++ b/packages/expo-modules-autolinking/CHANGELOG.md @@ -12,6 +12,7 @@ ### 🐛 Bug fixes +- [iOS] Build precompiled Expo modules from source when a required upstream Expo dependency is unavailable as prebuilt. ([#45160](https://github.com/expo/expo/pull/45160) by [@chrfalch](https://github.com/chrfalch)) - [iOS] Add support for optionally downloading external precompiled XCFramework tarballs from during `pod install`. ([#45067](https://github.com/expo/expo/pull/45067) by [@chrfalch](https://github.com/chrfalch)) - [iOS] Resolve 3rd-party prebuilt xcframework packages via `@react-native-community/cli` autolinking output instead of guessing `node_modules/`, fixing pnpm non-hoisted layouts, transitive native deps, yarn resolutions/PnP, and aliased specifiers ([#45004](https://github.com/expo/expo/pull/45004) by [@chrfalch](https://github.com/chrfalch)) - [iOS] Fixed precompiled modules use_frameworks! override running when only prebuilt React Native is active. ([#44554](https://github.com/expo/expo/pull/44554) by [@chrfalch](https://github.com/chrfalch)) diff --git a/packages/expo-modules-autolinking/scripts/ios/precompiled_modules.rb b/packages/expo-modules-autolinking/scripts/ios/precompiled_modules.rb index bbc8a173ce712b..40fe66cd72e504 100644 --- a/packages/expo-modules-autolinking/scripts/ios/precompiled_modules.rb +++ b/packages/expo-modules-autolinking/scripts/ios/precompiled_modules.rb @@ -29,6 +29,7 @@ require 'fileutils' require 'json' require 'net/http' +require 'set' require 'uri' module Expo @@ -60,6 +61,10 @@ module PrecompiledModules # Regex to strip `framework module React { ... }` from modulemaps FRAMEWORK_MODULE_REACT_REGEX = /framework module React \{.*?\n\}\s*/m + # ExpoModulesJSI is always provided as an xcframework by its own podspec/npm package, + # so it is not resolved through the Expo precompiled tarball pipeline. + CUSTOM_XCFRAMEWORK_DEPENDENCIES = %w[ExpoModulesJSI].freeze + # Module-level caches (initialized lazily) @pod_lookup_map = nil @repo_root = nil @@ -235,7 +240,7 @@ def clear_cocoapods_cache def has_prebuilt_xcframework?(pod_name) return false unless enabled? - !resolve_prebuilt_info(pod_name).nil? + resolve_prebuilt_status(pod_name)[:available] end # Returns whether test specs should be included for a pod. @@ -478,13 +483,13 @@ def read_podfile_properties(_project_directory) def try_link_with_prebuilt_xcframework(spec) return false unless enabled? - resolved = resolve_prebuilt_info(spec.name) - unless resolved - log_linking_status(spec.name, false, "no prebuilt xcframework available") + resolution = resolve_prebuilt_status(spec.name) + unless resolution[:available] + log_linking_status(spec.name, false, resolution) return false end - pod_info, product_name, default_tarball = resolved + pod_info, product_name, default_tarball = resolution[:resolved] log_linking_status(spec.name, true, default_tarball) @@ -513,10 +518,13 @@ def try_link_with_prebuilt_xcframework(spec) # @param spec [Pod::Specification] The podspec to patch # @return [Pod::Specification] A new patched specification (or original on failure) def patch_spec_for_prebuilt(spec) - resolved = resolve_prebuilt_info(spec.name) - return spec unless resolved + resolution = resolve_prebuilt_status(spec.name) + unless resolution[:available] + log_linking_status(spec.name, false, resolution) if resolution[:reason] == :dependency_unavailable + return spec + end - pod_info, product_name, default_tarball = resolved + pod_info, product_name, default_tarball = resolution[:resolved] log_linking_status(spec.name, true, default_tarball) @@ -590,7 +598,8 @@ def print_linking_summary if info[:found] Pod::UI.info "#{prefix} 📦 #{pod_name.green}#{version_suffix}" else - Pod::UI.info "#{prefix} ⚠️ #{pod_name}#{version_suffix} #{"(Build from source: framework not found #{info[:path]})".yellow}" + reason = format_prebuilt_unavailable_reason(info) + Pod::UI.info "#{prefix} ⚠️ #{pod_name}#{version_suffix} #{"(#{reason})".dark}" end spm_versions = pod_lookup_map.dig(pod_name, :spm_dependency_versions) || {} info[:spm_deps].each do |dep_name| @@ -1380,6 +1389,7 @@ def process_external_config(config_path, npm_package, effective_root) targets: targets, spm_dependency_frameworks: spm_dependency_frameworks, spm_dependency_versions: spm_dependency_versions, + prebuilt_dependency_pods: prebuilt_dependency_pods(product['externalDependencies']), autolink_when: product['autolinkWhen'] } end @@ -1461,10 +1471,30 @@ def build_pod_info(product, pod_name, npm_package, package_dir, type, repo_root) targets: targets, spm_dependency_frameworks: spm_dependency_frameworks, spm_dependency_versions: spm_dependency_versions, + prebuilt_dependency_pods: prebuilt_dependency_pods(product['externalDependencies']), autolink_when: product['autolinkWhen'] } end + # Returns local Expo product dependencies whose prebuilt availability must + # match this product's availability. Runtime deps like React/Hermes are not + # encoded as package/product strings and are ignored here. + def prebuilt_dependency_pods(external_dependencies) + (external_dependencies || []).filter_map do |dep| + next unless dep.is_a?(String) && dep.include?('/') + + parts = dep.split('/') + is_scoped = parts[0].start_with?('@') + package_name = is_scoped ? "#{parts[0]}/#{parts[1]}" : parts[0] + product_name = is_scoped ? parts[2] : parts[1] + + next unless package_name&.start_with?('expo-', '@expo/') + next if CUSTOM_XCFRAMEWORK_DEPENDENCIES.include?(product_name) + + product_name + end.uniq + end + # Resolves the codegen module name. For external packages, prefers codegenConfig.name # from the installed package.json over spm.config.json's codegenName. def resolve_codegen_name(product, pod_name, npm_package, type, repo_root) @@ -1698,16 +1728,49 @@ def version_prefix_for_external_package(package_version) # Resolves prebuilt xcframework info for a pod. # @return [Array, nil] [pod_info, product_name, tarball_path] or nil def resolve_prebuilt_info(pod_name) - return nil if build_from_source?(pod_name) + resolution = resolve_prebuilt_status(pod_name) + resolution[:available] ? resolution[:resolved] : nil + end + # Resolves only this pod's own prebuilt artifact without checking parent dependencies. + # @return [Hash] Availability information with :available, :resolved, :reason, and :path. + def resolve_own_prebuilt_info(pod_name) pod_info = pod_lookup_map[pod_name] - return nil unless pod_info + return { available: false, reason: :missing_config } unless pod_info product_name = pod_info[:product_name] || pod_name tarball = resolve_prebuilt_tarball(pod_info, product_name, build_flavor, pod_name) - return nil unless File.exist?(tarball) + return { available: false, reason: :missing_tarball, path: tarball } unless File.exist?(tarball) + + { available: true, resolved: [pod_info, product_name, tarball] } + end + + # A pod may use a prebuilt xcframework only when its own prebuilt artifact + # exists and every local Expo dependency also uses prebuilt. + def resolve_prebuilt_status(pod_name, visiting = Set.new) + return { available: false, reason: :build_from_source } if build_from_source?(pod_name) + return { available: true } if visiting.include?(pod_name) + + own_resolution = resolve_own_prebuilt_info(pod_name) + return own_resolution unless own_resolution[:available] + + pod_info = own_resolution[:resolved][0] + next_visiting = visiting.dup.add(pod_name) + + (pod_info[:prebuilt_dependency_pods] || []).each do |dep_name| + dep_resolution = resolve_prebuilt_status(dep_name, next_visiting) + next if dep_resolution[:available] - [pod_info, product_name, tarball] + return { + available: false, + reason: :dependency_unavailable, + dependency: dep_name, + dependency_reason: dep_resolution[:reason], + dependency_path: dep_resolution[:path] + } + end + + own_resolution end def resolve_prebuilt_tarball(pod_info, product_name, flavor, pod_name = nil) @@ -1979,10 +2042,27 @@ def collect_xcframework_header_paths(xcframework_path) # ────────────────────────────────────────────────────────────────────── # Records the linking status for a pod (only once per pod to avoid duplicates). - def log_linking_status(pod_name, found, path) + def log_linking_status(pod_name, found, info = nil) @linked_pods ||= {} return if @linked_pods[pod_name] - @linked_pods[pod_name] = { found: found, path: path, spm_deps: [] } + status = info.is_a?(Hash) ? info.dup : { path: info } + @linked_pods[pod_name] = status.merge(found: found, spm_deps: []) + end + + def format_prebuilt_unavailable_reason(info) + case info[:reason] + when :build_from_source + 'configured by buildFromSource' + when :missing_config + 'prebuilt config not found' + when :missing_tarball + 'prebuilt tarball not found' + when :dependency_unavailable + reason = format_prebuilt_unavailable_reason(reason: info[:dependency_reason], path: info[:dependency_path]) + "dependency #{info[:dependency]} is not using prebuilt: #{reason}" + else + info[:path] || 'prebuilt unavailable' + end end # Records an SPM dependency xcframework bundled inside a precompiled pod. From 862b814c8fef6345662fe6c6bd0b7b6c448889a2 Mon Sep 17 00:00:00 2001 From: Phil Pluckthun Date: Tue, 28 Apr 2026 15:08:42 +0100 Subject: [PATCH 14/20] chore(expo-router): Enable `noUncheckedIndexedAccess` (#45161) # Summary Related to #44445, #44292, etc This updates the `expo-router` codebase to comply with `noUncheckedIndexedAccess` to align it back with the rest of the monorepo. To comply with type files too, since this is a really large package, I've also updated the test files, by temporarily including them in the checks. I've also fixed one issue related to `verbatimModuleSyntax` (in `src/link/Link.tsx`) although this won't be turned on until `expo-router` is converted to ESM. > [!NOTE] > The changes have largely been AI-written and manually edited and reviewed # Test Plan - CI should pass unchanged # Checklist - [ ] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) --- packages/expo-router/build/ExpoRoot.js.map | 2 +- .../build/LocationProvider.d.ts.map | 2 +- .../expo-router/build/LocationProvider.js | 12 +- .../expo-router/build/LocationProvider.js.map | 2 +- .../build/fork/createMemoryHistory.d.ts | 2 +- .../build/fork/createMemoryHistory.d.ts.map | 2 +- .../build/fork/createMemoryHistory.js.map | 2 +- .../build/fork/findFocusedRoute.d.ts.map | 2 +- .../build/fork/findFocusedRoute.js | 2 +- .../build/fork/findFocusedRoute.js.map | 2 +- .../build/fork/getPathFromState.d.ts.map | 2 +- .../build/fork/getPathFromState.js | 7 +- .../build/fork/getPathFromState.js.map | 2 +- .../fork/getStateFromPath-forks.d.ts.map | 2 +- .../build/fork/getStateFromPath-forks.js | 19 ++- .../build/fork/getStateFromPath-forks.js.map | 2 +- .../build/fork/getStateFromPath.js | 4 +- .../build/fork/getStateFromPath.js.map | 2 +- .../CompositionOptionsContext.js | 2 +- .../CompositionOptionsContext.js.map | 2 +- .../composition-options/mergeOptions.js.map | 2 +- .../createNativeStackNavigator.js.map | 2 +- .../expo-router/build/fork/useLinking.js.map | 2 +- .../expo-router/build/getRoutesCore.d.ts.map | 2 +- packages/expo-router/build/getRoutesCore.js | 6 +- .../expo-router/build/getRoutesCore.js.map | 2 +- .../build/getRoutesRedirects.js.map | 2 +- .../getRouteInfoFromState.d.ts.map | 2 +- .../global-state/getRouteInfoFromState.js | 1 + .../global-state/getRouteInfoFromState.js.map | 2 +- .../build/global-state/stateUtils.d.ts.map | 2 +- .../build/global-state/stateUtils.js | 5 +- .../build/global-state/stateUtils.js.map | 2 +- .../build/head/ExpoHead.ios.js.map | 2 +- .../build/layouts/StackClient.d.ts.map | 2 +- .../expo-router/build/layouts/StackClient.js | 1 + .../build/layouts/StackClient.js.map | 2 +- .../native.ios.js.map | 2 +- packages/expo-router/build/link/Link.d.ts | 2 +- packages/expo-router/build/link/Link.d.ts.map | 2 +- packages/expo-router/build/link/Link.js.map | 2 +- .../build/link/preview/HrefPreview.js | 1 + .../build/link/preview/HrefPreview.js.map | 2 +- .../build/link/preview/utils.js.map | 2 +- .../build/modal/web/ModalStack.d.ts.map | 2 +- .../build/modal/web/ModalStack.js.map | 2 +- .../modal/web/ModalStackRouteDrawer.js.map | 2 +- .../expo-router/build/modal/web/utils.js.map | 2 +- .../NativeBottomTabsNavigator.d.ts.map | 2 +- .../native-tabs/NativeBottomTabsNavigator.js | 3 +- .../NativeBottomTabsNavigator.js.map | 2 +- .../build/native-tabs/NativeTabsView.js.map | 2 +- .../native-tabs/NativeTabsView.web.js.map | 2 +- .../bottom-tabs/views/BottomTabBar.js.map | 2 +- .../bottom-tabs/views/BottomTabView.js.map | 2 +- .../core/BaseNavigationContainer.js.map | 2 +- .../core/findFocusedRoute.js.map | 2 +- .../core/getActionFromState.d.ts.map | 2 +- .../core/getActionFromState.js | 5 +- .../core/getActionFromState.js.map | 2 +- .../core/getPathFromState.d.ts.map | 2 +- .../react-navigation/core/getPathFromState.js | 4 +- .../core/getPathFromState.js.map | 2 +- .../react-navigation/core/getStateFromPath.js | 3 + .../core/getStateFromPath.js.map | 2 +- .../core/useCurrentRender.js.map | 2 +- .../core/useDescriptors.js.map | 2 +- .../core/useEventEmitter.js.map | 2 +- .../core/useFocusEvents.js.map | 2 +- .../core/useNavigationBuilder.js.map | 2 +- .../core/useNavigationCache.js.map | 2 +- .../core/useOnAction.d.ts.map | 2 +- .../react-navigation/core/useOnAction.js.map | 2 +- .../drawer/views/DrawerContent.js.map | 2 +- .../drawer/views/DrawerItemList.js.map | 2 +- .../drawer/views/DrawerView.js.map | 2 +- .../views/MaterialTopTabView.d.ts.map | 2 +- .../views/MaterialTopTabView.js | 3 +- .../views/MaterialTopTabView.js.map | 2 +- .../utils/useInvalidPreventRemoveError.js.map | 2 +- .../native-stack/views/NativeStackView.js | 3 +- .../native-stack/views/NativeStackView.js.map | 2 +- .../views/NativeStackView.native.js | 2 +- .../views/NativeStackView.native.js.map | 2 +- .../__stubs__/createStackNavigator.js.map | 2 +- .../native/__stubs__/window.js.map | 2 +- .../native/extractPathFromURL.js.map | 2 +- .../native/useScrollToTop.js.map | 2 +- .../routers/StackRouter.js.map | 2 +- .../react-navigation/routers/TabRouter.js.map | 2 +- .../stack/utils/findLastIndex.js.map | 2 +- .../stack/views/Stack/CardStack.js | 2 +- .../stack/views/Stack/CardStack.js.map | 2 +- .../stack/views/Stack/StackView.d.ts.map | 2 +- .../stack/views/Stack/StackView.js | 4 +- .../stack/views/Stack/StackView.js.map | 2 +- packages/expo-router/build/sortRoutes.js.map | 2 +- .../build/testing-library/context-stubs.d.ts | 4 +- .../expo-router/build/ui/TabRouter.js.map | 2 +- packages/expo-router/build/ui/TabSlot.js.map | 2 +- .../expo-router/build/ui/TabTrigger.js.map | 2 +- packages/expo-router/build/ui/common.d.ts.map | 2 +- packages/expo-router/build/ui/common.js | 3 +- packages/expo-router/build/ui/common.js.map | 2 +- packages/expo-router/build/useScreens.js.map | 2 +- .../expo-router/build/views/Navigator.d.ts | 2 +- .../build/views/Navigator.d.ts.map | 2 +- .../expo-router/build/views/Navigator.js.map | 2 +- packages/expo-router/src/ExpoRoot.tsx | 2 +- packages/expo-router/src/LocationProvider.tsx | 11 +- .../experimentalModalStack.test.web.tsx | 6 +- .../src/__tests__/headless-tabs.test.ios.tsx | 2 +- .../src/__tests__/hooks.test.ios.tsx | 2 +- .../src/__tests__/navigation.test.ios.tsx | 22 +-- .../src/__tests__/prefetch.test.ios.tsx | 12 +- .../src/__tests__/protected.test.ios.tsx | 8 +- .../src/__tests__/sitemap.test.ios.tsx | 12 +- .../src/__tests__/stacks.test.ios.tsx | 12 +- .../__tests__/getPathFromState.test.web.ts | 4 +- .../__tests__/getStateFromPath.test.web.ts | 46 ++--- .../src/fork/createMemoryHistory.ts | 7 +- .../expo-router/src/fork/findFocusedRoute.tsx | 5 +- .../expo-router/src/fork/getPathFromState.ts | 21 +-- .../src/fork/getStateFromPath-forks.ts | 25 +-- .../expo-router/src/fork/getStateFromPath.ts | 16 +- .../usePreviewTransition.test.ios.tsx | 2 +- .../CompositionOptionsContext.tsx | 2 +- .../__tests__/mergeOptions.test.ts | 36 ++-- .../__tests__/registryReducer.test.ts | 10 +- .../composition-options/mergeOptions.ts | 2 +- .../createNativeStackNavigator.tsx | 2 +- packages/expo-router/src/fork/useLinking.ts | 4 +- packages/expo-router/src/getRoutesCore.ts | 21 +-- .../expo-router/src/getRoutesRedirects.tsx | 2 +- .../__tests__/stateUtils.test.ios.ts | 12 +- .../src/global-state/getRouteInfoFromState.ts | 5 +- .../src/global-state/stateUtils.ts | 13 +- .../expo-router/src/head/ExpoHead.ios.tsx | 2 +- .../expo-router/src/layouts/StackClient.tsx | 11 +- ...ckComposition.renderCount.test.android.tsx | 26 +-- .../StackComposition.renderCount.test.ios.tsx | 26 +-- .../StackComposition.unmount.test.android.tsx | 16 +- .../StackComposition.unmount.test.ios.tsx | 24 +-- .../__tests__/StackScreen.test.ios.tsx | 4 +- .../StackToolbar.integration.test.android.tsx | 6 +- .../StackToolbar.integration.test.ios.tsx | 10 +- ...tackToolbar.placement-changes.test.ios.tsx | 70 ++++---- .../StackToolbarButton.test.android.tsx | 28 +-- .../StackToolbarMenu.test.android.tsx | 4 +- .../StackToolbarView.test.android.tsx | 8 +- .../StackToolbarSearchBarSlot/native.ios.tsx | 2 +- packages/expo-router/src/link/Link.tsx | 2 +- .../src/link/preview/HrefPreview.tsx | 5 +- .../__tests__/HrefPreview.test.ios.tsx | 4 +- .../expo-router/src/link/preview/utils.ts | 6 +- .../ZoomTransitionEnabler.e2e.test.ios.tsx | 2 +- ...-transition-context-providers.test.ios.tsx | 56 +++--- .../expo-router/src/modal/web/ModalStack.tsx | 8 +- .../src/modal/web/ModalStackRouteDrawer.tsx | 4 +- packages/expo-router/src/modal/web/utils.ts | 4 +- .../native-tabs/NativeBottomTabsNavigator.tsx | 11 +- .../src/native-tabs/NativeTabsView.tsx | 4 +- .../src/native-tabs/NativeTabsView.web.tsx | 2 +- .../__tests__/NativeTabsView.test.ios.tsx | 10 +- .../native-tabs/__tests__/events.test.ios.tsx | 16 +- .../__tests__/listeners.test.ios.tsx | 14 +- .../__tests__/navigation.test.ios.tsx | 16 +- .../__tests__/options.e2e.test.android.tsx | 116 ++++++------- .../__tests__/options.e2e.test.ios.tsx | 106 ++++++------ .../__tests__/options.test.android.tsx | 30 ++-- .../__tests__/options.test.ios.tsx | 160 +++++++++--------- .../native-tabs/__tests__/render.test.ios.tsx | 78 ++++----- .../bottom-tabs/views/BottomTabBar.tsx | 18 +- .../bottom-tabs/views/BottomTabView.tsx | 22 +-- .../core/BaseNavigationContainer.tsx | 4 +- .../BaseNavigationContainer.test.ios.tsx | 54 +++--- .../__tests__/__fixtures__/MockRouter.tsx | 6 +- .../createNavigationContainerRef.test.ios.tsx | 2 +- .../core/__tests__/index.test.ios.tsx | 82 ++++----- .../core/__tests__/theming.test.ios.tsx | 10 +- .../__tests__/useDescriptors.test.ios.tsx | 30 ++-- .../__tests__/useEventEmitter.test.ios.tsx | 16 +- .../__tests__/useFocusEffect.test.ios.tsx | 26 +-- .../core/__tests__/useIsFocused.test.ios.tsx | 4 +- .../core/__tests__/useNavigation.test.ios.tsx | 8 +- .../__tests__/useNavigationCache.test.ios.tsx | 4 +- .../__tests__/useNavigationState.test.ios.tsx | 32 ++-- .../core/__tests__/useOnAction.test.ios.tsx | 30 ++-- .../__tests__/usePreventRemove.test.ios.tsx | 14 +- .../core/__tests__/useRoute.test.ios.tsx | 2 +- .../__tests__/useStateForPath.test.ios.tsx | 6 +- .../core/findFocusedRoute.tsx | 4 +- .../core/getActionFromState.tsx | 37 ++-- .../core/getPathFromState.tsx | 12 +- .../core/getStateFromPath.tsx | 25 +-- .../core/useCurrentRender.tsx | 2 +- .../react-navigation/core/useDescriptors.tsx | 12 +- .../react-navigation/core/useEventEmitter.tsx | 2 +- .../react-navigation/core/useFocusEvents.tsx | 2 +- .../core/useNavigationBuilder.tsx | 14 +- .../core/useNavigationCache.tsx | 4 +- .../src/react-navigation/core/useOnAction.tsx | 3 +- .../drawer/views/DrawerContent.tsx | 4 +- .../drawer/views/DrawerItemList.tsx | 6 +- .../drawer/views/DrawerView.tsx | 6 +- .../views/MaterialTopTabView.tsx | 12 +- .../useHeaderConfigProps.test.ios.tsx | 6 +- .../utils/useInvalidPreventRemoveError.tsx | 2 +- .../views/NativeStackView.native.tsx | 2 +- .../native-stack/views/NativeStackView.tsx | 4 +- .../native/__stubs__/createStackNavigator.tsx | 2 +- .../native/__stubs__/window.tsx | 2 +- .../createMemoryHistory.test.web.tsx | 8 +- .../native/__tests__/useLinking.test.ios.tsx | 4 +- .../native/extractPathFromURL.tsx | 2 +- .../native/useScrollToTop.tsx | 2 +- .../react-navigation/routers/StackRouter.tsx | 24 +-- .../react-navigation/routers/TabRouter.tsx | 30 ++-- .../routers/__tests__/TabRouter.test.tsx | 24 +-- .../stack/utils/findLastIndex.tsx | 2 +- .../stack/views/Stack/CardStack.tsx | 30 ++-- .../stack/views/Stack/StackView.tsx | 11 +- .../Stack/__tests__/StackView.test.ios.tsx | 2 +- packages/expo-router/src/sortRoutes.ts | 4 +- packages/expo-router/src/ui/TabRouter.tsx | 2 +- packages/expo-router/src/ui/TabSlot.tsx | 4 +- packages/expo-router/src/ui/TabTrigger.tsx | 2 +- packages/expo-router/src/ui/common.tsx | 7 +- packages/expo-router/src/useScreens.tsx | 4 +- .../src/utils/__tests__/children.test.tsx | 12 +- packages/expo-router/src/views/Navigator.tsx | 4 +- .../src/views/__tests__/Screen.test.ios.tsx | 8 +- packages/expo-router/tsconfig.json | 5 +- 233 files changed, 1118 insertions(+), 1089 deletions(-) diff --git a/packages/expo-router/build/ExpoRoot.js.map b/packages/expo-router/build/ExpoRoot.js.map index 5c6ccef9304953..5fa8c7a36b5220 100644 --- a/packages/expo-router/build/ExpoRoot.js.map +++ b/packages/expo-router/build/ExpoRoot.js.map @@ -1 +1 @@ -{"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDb,4BA0BC;;AAjFD,iCAAsF;AACtF,+CAAwC;AACxC,mFAAkE;AAElE,2CAA2F;AAC3F,yFAAsF;AACtF,oEAAgG;AAEhG,8DAA8D;AAE9D,gFAAqE;AACrE,8DAA2D;AAC3D,gDAAiF;AACjF,0EAA+E;AAC/E,6CAAsC;AAEtC,sDAA8E;AAC9E,+DAAgE;AAEhE,qCAAsD;AACtD,6CAA0C;AAC1C,6DAA+C;AAC/C,iDAA8C;AAgB9C,MAAM,SA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,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC;KAAM,CAAC;IACN,iBAAiB,GAAG,cAAa,CAAC,CAAC;AACrC,CAAC","sourcesContent":["'use client';\n\nimport { type PropsWithChildren, Fragment, type ComponentType, useMemo } from 'react';\nimport { Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport { INTERNAL_SLOT_NAME, NOT_FOUND_ROUTE_NAME, SITEMAP_ROUTE_NAME } from './constants';\nimport { useDomComponentNavigation } from './domComponents/useDomComponentNavigation';\nimport { NavigationContainer as UpstreamNavigationContainer } from './fork/NavigationContainer';\nimport type { ExpoLinkingOptions } from './getLinkingConfig';\nimport { store, useStore } from './global-state/router-store';\nimport type { ServerContextType } from './global-state/serverLocationContext';\nimport { ServerContext } from './global-state/serverLocationContext';\nimport { StoreContext } from './global-state/storeContext';\nimport { shouldAppendNotFound, shouldAppendSitemap } from './global-state/utils';\nimport { LinkPreviewContextProvider } from './link/preview/LinkPreviewContext';\nimport { Screen } from './primitives';\nimport type { LinkingOptions, NavigationAction } from './react-navigation/native';\nimport { StackRouter, useNavigationBuilder } from './react-navigation/native';\nimport { initScreensFeatureFlags } from './screensFeatureFlags';\nimport type { RequireContext } from './types';\nimport { parseUrlUsingCustomBase } from './utils/url';\nimport { Sitemap } from './views/Sitemap';\nimport * as SplashScreen from './views/Splash';\nimport { Unmatched } from './views/Unmatched';\n\nexport type ExpoRootProps = {\n context: RequireContext;\n location?: URL | string;\n wrapper?: ComponentType;\n linking?: Partial;\n};\n\nexport type NativeIntent = {\n redirectSystemPath?: (event: {\n path: string | null;\n initial: boolean;\n }) => Promise | string | null | undefined;\n};\n\nconst isTestEnv = process.env.NODE_ENV === 'test';\n\nconst INITIAL_METRICS =\n Platform.OS === 'web' || isTestEnv\n ? {\n frame: { x: 0, y: 0, width: 0, height: 0 },\n insets: { top: 0, left: 0, right: 0, bottom: 0 },\n }\n : undefined;\n\nconst documentTitle = {\n enabled: false,\n};\n\n/**\n * @hidden\n */\nexport function ExpoRoot({ wrapper: ParentWrapper = Fragment, ...props }: ExpoRootProps) {\n initScreensFeatureFlags();\n /*\n * Due to static rendering we need to wrap these top level views in second wrapper\n * View's like generate a
so if the parent wrapper\n * is a HTML document, we need to ensure its inside the \n */\n const wrapper = useMemo(\n () =>\n ({ children }: PropsWithChildren) => {\n return (\n \n \n \n {children}\n \n \n \n );\n },\n [ParentWrapper]\n );\n\n return ;\n}\n\nconst initialUrl =\n Platform.OS === 'web' && typeof window !== 'undefined'\n ? new URL(window.location.href)\n : undefined;\n\nfunction ContextNavigator({\n context,\n location: initialLocation = initialUrl,\n wrapper: WrapperComponent = Fragment,\n linking = {},\n}: ExpoRootProps) {\n // location and linking.getInitialURL are both used to initialize the router state\n // - location is used on web and during static rendering\n // - linking.getInitialURL is used on native\n const serverContext = useMemo(() => {\n let contextType: ServerContextType = {};\n\n const url =\n typeof initialLocation === 'string'\n ? parseUrlUsingCustomBase(initialLocation)\n : initialLocation;\n\n if (url && url instanceof URL) {\n contextType = {\n location: {\n pathname: url.pathname,\n search: url.search,\n hash: url.hash,\n },\n };\n }\n\n return contextType;\n }, []);\n\n /*\n * The serverUrl is an initial URL used in server rendering environments.\n * e.g Static renders, units tests, etc\n */\n const serverUrl = serverContext.location\n ? `${serverContext.location.pathname}${serverContext.location.search}${serverContext.location.hash ?? ''}`\n : undefined;\n\n const store = useStore(context, linking, serverUrl);\n\n useDomComponentNavigation();\n\n if (store.shouldShowTutorial()) {\n SplashScreen.hideAsync();\n if (process.env.NODE_ENV === 'development') {\n const Tutorial = require('./onboard/Tutorial').Tutorial;\n return (\n \n \n \n );\n } else {\n // Ensure tutorial styles are stripped in production.\n return null;\n }\n }\n\n return (\n \n }\n onUnhandledAction={onUnhandledAction}\n onStateChange={store.onStateChange}\n documentTitle={documentTitle}\n onReady={store.onReady}>\n \n \n \n \n \n \n \n );\n}\n\nfunction Content() {\n const children = [];\n if (shouldAppendNotFound()) {\n children.push();\n }\n if (shouldAppendSitemap()) {\n children.push();\n }\n const { state, descriptors, NavigationContent } = useNavigationBuilder(StackRouter, {\n children,\n id: INTERNAL_SLOT_NAME,\n });\n\n return (\n {descriptors[state.routes[state.index].key].render()}\n );\n}\n\nlet onUnhandledAction: (action: NavigationAction) => void;\n\nif (process.env.NODE_ENV !== 'production') {\n onUnhandledAction = (action: NavigationAction) => {\n const payload: Record | undefined = action.payload;\n\n let message = `The action '${action.type}'${\n payload ? ` with payload ${JSON.stringify(action.payload)}` : ''\n } was not handled by any navigator.`;\n\n switch (action.type) {\n case 'NAVIGATE':\n case 'PUSH':\n case 'REPLACE':\n case 'JUMP_TO':\n if (payload?.name) {\n message += `\\n\\nDo you have a route named '${payload.name}'?`;\n } else {\n message += `\\n\\nYou need to pass the name of the screen to navigate to. This may be a bug.`;\n }\n\n break;\n case 'GO_BACK':\n case 'POP':\n case 'POP_TO_TOP':\n message += `\\n\\nIs there any screen to go back to?`;\n break;\n case 'OPEN_DRAWER':\n case 'CLOSE_DRAWER':\n case 'TOGGLE_DRAWER':\n message += `\\n\\nIs your screen inside a Drawer navigator?`;\n break;\n }\n\n message += `\\n\\nThis is a development-only warning and won't be shown in production.`;\n\n if (process.env.NODE_ENV === 'test') {\n throw new Error(message);\n }\n console.error(message);\n };\n} else {\n onUnhandledAction = function () {};\n}\n"]} \ No newline at end of file +{"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDb,4BA0BC;;AAjFD,iCAAsF;AACtF,+CAAwC;AACxC,mFAAkE;AAElE,2CAA2F;AAC3F,yFAAsF;AACtF,oEAAgG;AAEhG,8DAA8D;AA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pD,MAAM;YACR,KAAK,aAAa,CAAC;YACnB,KAAK,cAAc,CAAC;YACpB,KAAK,eAAe;gBAClB,OAAO,IAAI,+CAA+C,CAAC;gBAC3D,MAAM;QACV,CAAC;QAED,OAAO,IAAI,0EAA0E,CAAC;QAEtF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC;KAAM,CAAC;IACN,iBAAiB,GAAG,cAAa,CAAC,CAAC;AACrC,CAAC","sourcesContent":["'use client';\n\nimport { type PropsWithChildren, Fragment, type ComponentType, useMemo } from 'react';\nimport { Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport { INTERNAL_SLOT_NAME, NOT_FOUND_ROUTE_NAME, SITEMAP_ROUTE_NAME } from './constants';\nimport { useDomComponentNavigation } from './domComponents/useDomComponentNavigation';\nimport { NavigationContainer as UpstreamNavigationContainer } from './fork/NavigationContainer';\nimport type { ExpoLinkingOptions } from './getLinkingConfig';\nimport { store, useStore } from './global-state/router-store';\nimport type { ServerContextType } from './global-state/serverLocationContext';\nimport { ServerContext } from './global-state/serverLocationContext';\nimport { StoreContext } from './global-state/storeContext';\nimport { shouldAppendNotFound, shouldAppendSitemap } from './global-state/utils';\nimport { LinkPreviewContextProvider } from './link/preview/LinkPreviewContext';\nimport { Screen } from './primitives';\nimport type { LinkingOptions, NavigationAction } from './react-navigation/native';\nimport { StackRouter, useNavigationBuilder } from './react-navigation/native';\nimport { initScreensFeatureFlags } from './screensFeatureFlags';\nimport type { RequireContext } from './types';\nimport { parseUrlUsingCustomBase } from './utils/url';\nimport { Sitemap } from './views/Sitemap';\nimport * as SplashScreen from './views/Splash';\nimport { Unmatched } from './views/Unmatched';\n\nexport type ExpoRootProps = {\n context: RequireContext;\n location?: URL | string;\n wrapper?: ComponentType;\n linking?: Partial;\n};\n\nexport type NativeIntent = {\n redirectSystemPath?: (event: {\n path: string | null;\n initial: boolean;\n }) => Promise | string | null | undefined;\n};\n\nconst isTestEnv = process.env.NODE_ENV === 'test';\n\nconst INITIAL_METRICS =\n Platform.OS === 'web' || isTestEnv\n ? {\n frame: { x: 0, y: 0, width: 0, height: 0 },\n insets: { top: 0, left: 0, right: 0, bottom: 0 },\n }\n : undefined;\n\nconst documentTitle = {\n enabled: false,\n};\n\n/**\n * @hidden\n */\nexport function ExpoRoot({ wrapper: ParentWrapper = Fragment, ...props }: ExpoRootProps) {\n initScreensFeatureFlags();\n /*\n * Due to static rendering we need to wrap these top level views in second wrapper\n * View's like generate a
so if the parent wrapper\n * is a HTML document, we need to ensure its inside the \n */\n const wrapper = useMemo(\n () =>\n ({ children }: PropsWithChildren) => {\n return (\n \n \n \n {children}\n \n \n \n );\n },\n [ParentWrapper]\n );\n\n return ;\n}\n\nconst initialUrl =\n Platform.OS === 'web' && typeof window !== 'undefined'\n ? new URL(window.location.href)\n : undefined;\n\nfunction ContextNavigator({\n context,\n location: initialLocation = initialUrl,\n wrapper: WrapperComponent = Fragment,\n linking = {},\n}: ExpoRootProps) {\n // location and linking.getInitialURL are both used to initialize the router state\n // - location is used on web and during static rendering\n // - linking.getInitialURL is used on native\n const serverContext = useMemo(() => {\n let contextType: ServerContextType = {};\n\n const url =\n typeof initialLocation === 'string'\n ? parseUrlUsingCustomBase(initialLocation)\n : initialLocation;\n\n if (url && url instanceof URL) {\n contextType = {\n location: {\n pathname: url.pathname,\n search: url.search,\n hash: url.hash,\n },\n };\n }\n\n return contextType;\n }, []);\n\n /*\n * The serverUrl is an initial URL used in server rendering environments.\n * e.g Static renders, units tests, etc\n */\n const serverUrl = serverContext.location\n ? `${serverContext.location.pathname}${serverContext.location.search}${serverContext.location.hash ?? ''}`\n : undefined;\n\n const store = useStore(context, linking, serverUrl);\n\n useDomComponentNavigation();\n\n if (store.shouldShowTutorial()) {\n SplashScreen.hideAsync();\n if (process.env.NODE_ENV === 'development') {\n const Tutorial = require('./onboard/Tutorial').Tutorial;\n return (\n \n \n \n );\n } else {\n // Ensure tutorial styles are stripped in production.\n return null;\n }\n }\n\n return (\n \n }\n onUnhandledAction={onUnhandledAction}\n onStateChange={store.onStateChange}\n documentTitle={documentTitle}\n onReady={store.onReady}>\n \n \n \n \n \n \n \n );\n}\n\nfunction Content() {\n const children = [];\n if (shouldAppendNotFound()) {\n children.push();\n }\n if (shouldAppendSitemap()) {\n children.push();\n }\n const { state, descriptors, NavigationContent } = useNavigationBuilder(StackRouter, {\n children,\n id: INTERNAL_SLOT_NAME,\n });\n\n return (\n {descriptors[state.routes[state.index]!.key]!.render()}\n );\n}\n\nlet onUnhandledAction: (action: NavigationAction) => void;\n\nif (process.env.NODE_ENV !== 'production') {\n onUnhandledAction = (action: NavigationAction) => {\n const payload: Record | undefined = action.payload;\n\n let message = `The action '${action.type}'${\n payload ? ` with payload ${JSON.stringify(action.payload)}` : ''\n } was not handled by any navigator.`;\n\n switch (action.type) {\n case 'NAVIGATE':\n case 'PUSH':\n case 'REPLACE':\n case 'JUMP_TO':\n if (payload?.name) {\n message += `\\n\\nDo you have a route named '${payload.name}'?`;\n } else {\n message += `\\n\\nYou need to pass the name of the screen to navigate to. This may be a bug.`;\n }\n\n break;\n case 'GO_BACK':\n case 'POP':\n case 'POP_TO_TOP':\n message += `\\n\\nIs there any screen to go back to?`;\n break;\n case 'OPEN_DRAWER':\n case 'CLOSE_DRAWER':\n case 'TOGGLE_DRAWER':\n message += `\\n\\nIs your screen inside a Drawer navigator?`;\n break;\n }\n\n message += `\\n\\nThis is a development-only warning and won't be shown in production.`;\n\n if (process.env.NODE_ENV === 'test') {\n throw new Error(message);\n }\n console.error(message);\n };\n} else {\n onUnhandledAction = function () {};\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/LocationProvider.d.ts.map b/packages/expo-router/build/LocationProvider.d.ts.map index 89d161fcbbdf50..1de052050f8c78 100644 --- a/packages/expo-router/build/LocationProvider.d.ts.map +++ b/packages/expo-router/build/LocationProvider.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"LocationProvider.d.ts","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGrD,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAEtD,MAAM,MAAM,SAAS,GAAG;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,gBAAgB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,KAAK;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,EAClF,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,MAAM,GACf,SAAS,CAWX;AA0BD,wBAAgB,sBAAsB,CACpC,EACE,IAAI,EAAE,SAAS,EACf,MAAM,GACP,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;CACb,EACD,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,QAAQ,CAAC,CASxC"} \ No newline at end of file +{"version":3,"file":"LocationProvider.d.ts","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGrD,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAEtD,MAAM,MAAM,SAAS,GAAG;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,gBAAgB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,KAAK;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,EAClF,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,MAAM,GACf,SAAS,CAWX;AA4BD,wBAAgB,sBAAsB,CACpC,EACE,IAAI,EAAE,SAAS,EACf,MAAM,GACP,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;CACb,EACD,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,QAAQ,CAAC,CAYxC"} \ No newline at end of file diff --git a/packages/expo-router/build/LocationProvider.js b/packages/expo-router/build/LocationProvider.js index a901dadad70bda..2b08dc0ab505e3 100644 --- a/packages/expo-router/build/LocationProvider.js +++ b/packages/expo-router/build/LocationProvider.js @@ -9,14 +9,17 @@ function getRouteInfoFromState(getPathFromState, state, baseUrl) { return { // TODO: This may have a predefined origin attached in the future. unstable_globalHref: path, - pathname: (0, getStateFromPath_forks_1.stripBaseUrl)(path, baseUrl).split('?')['0'], + pathname: (0, getStateFromPath_forks_1.stripBaseUrl)(path, baseUrl).split('?')[0], isIndex: isIndexPath(state), ...getNormalizedStatePath(qualified, baseUrl), }; } function isIndexPath(state) { const route = state.routes[state.index ?? state.routes.length - 1]; - if (route.state) { + if (!route) { + return false; + } + else if (route.state) { return isIndexPath(route.state); } // Index routes on the same level as a layout do not have `index` in their name @@ -38,7 +41,10 @@ function getNormalizedStatePath({ path: statePath, params, }, baseUrl) { const [pathname] = statePath.split('?'); return { // Strip empty path at the start - segments: (0, getStateFromPath_forks_1.stripBaseUrl)(pathname, baseUrl).split('/').filter(Boolean).map(decodeURIComponent), + segments: (0, getStateFromPath_forks_1.stripBaseUrl)(pathname, baseUrl) + .split('/') + .filter((x) => !!x) + .map(decodeURIComponent), // TODO: This is not efficient, we should generate based on the state instead // of converting to string then back to object params: decodeParams(params), diff --git a/packages/expo-router/build/LocationProvider.js.map b/packages/expo-router/build/LocationProvider.js.map index 0e1cbdb4152787..8764cbf81d10fd 100644 --- a/packages/expo-router/build/LocationProvider.js.map +++ b/packages/expo-router/build/LocationProvider.js.map @@ -1 +1 @@ -{"version":3,"file":"LocationProvider.js","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":";;AAaA,sDAeC;AA0BD,wDAkBC;AAvED,0EAA6D;AAY7D,SAAgB,qBAAqB,CACnC,gBAAkF,EAClF,KAAY,EACZ,OAAgB;IAEhB,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEhD,OAAO;QACL,kEAAkE;QAClE,mBAAmB,EAAE,IAAI;QACzB,QAAQ,EAAE,IAAA,qCAAY,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;QACrD,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC;QAC3B,GAAG,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC;KAC9C,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,KAAY;IAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnE,IAAI,KAAK,CAAC,K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AAC,CAAC;YACpC,CAAC;iBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;YACxD,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { State } from './fork/getPathFromState';\nimport { stripBaseUrl } from './fork/getStateFromPath-forks';\n\ntype SearchParams = Record;\n\nexport type UrlObject = {\n unstable_globalHref: string;\n pathname: string;\n readonly params: SearchParams;\n segments: string[];\n isIndex: boolean;\n};\n\nexport function getRouteInfoFromState(\n getPathFromState: (state: State, asPath: boolean) => { path: string; params: any },\n state: State,\n baseUrl?: string\n): UrlObject {\n const { path } = getPathFromState(state, false);\n const qualified = getPathFromState(state, true);\n\n return {\n // TODO: This may have a predefined origin attached in the future.\n unstable_globalHref: path,\n pathname: stripBaseUrl(path, baseUrl).split('?')['0'],\n isIndex: isIndexPath(state),\n ...getNormalizedStatePath(qualified, baseUrl),\n };\n}\n\nfunction isIndexPath(state: State) {\n const route = state.routes[state.index ?? state.routes.length - 1];\n if (route.state) {\n return isIndexPath(route.state);\n }\n\n // Index routes on the same level as a layout do not have `index` in their name\n if (route.params && 'screen' in route.params) {\n return route.params.screen === 'index';\n }\n\n // The `params` key will not exist if there are no params\n // So we need to do a positive lookahead to check if the route ends with /index\n // Nested routes that are hoisted will have a name ending with /index\n // e.g name could be /user/[id]/index\n if (route.name.match(/.+\\/index$/)) return true;\n\n // The state will either have params (because there are multiple _layout) or it will be hoisted with a name\n // If we don't match the above cases, then it's not an index route\n\n return false;\n}\n\n// TODO: Split up getPathFromState to return all this info at once.\nexport function getNormalizedStatePath(\n {\n path: statePath,\n params,\n }: {\n path: string;\n params: any;\n },\n baseUrl?: string\n): Pick {\n const [pathname] = statePath.split('?');\n return {\n // Strip empty path at the start\n segments: stripBaseUrl(pathname, baseUrl).split('/').filter(Boolean).map(decodeURIComponent),\n // TODO: This is not efficient, we should generate based on the state instead\n // of converting to string then back to object\n params: decodeParams(params),\n };\n}\n\nfunction decodeParams(params: Record) {\n const parsed: Record = {};\n\n for (const [key, value] of Object.entries(params)) {\n try {\n if (key === 'params' && typeof value === 'object') {\n parsed[key] = decodeParams(value);\n } else if (Array.isArray(value)) {\n parsed[key] = value.map((v) => decodeURIComponent(v));\n } else {\n parsed[key] = decodeURIComponent(value);\n }\n } catch {\n parsed[key] = value;\n }\n }\n\n return parsed;\n}\n"]} \ No newline at end of file +{"version":3,"file":"LocationProvider.js","sourceRoot":"","sources":["../src/LocationProvider.tsx"],"names":[],"mappings":";;AAaA,sDAeC;AA4BD,wDAqBC;AA5ED,0EAA6D;AAY7D,SAAgB,qBAAqB,CACnC,gBAAkF,EAClF,KAAY,EACZ,OAAgB;IAEhB,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEhD,OAAO;QACL,kEAAkE;QAClE,mBAAmB,EAAE,IAAI;QACzB,QAAQ,EAAE,IAAA,qCAAY,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE;QACpD,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC;QAC3B,GAAG,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC;KAC9C,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,KAAY;IAC/B,MAAM,KAAK,GA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K,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,IAAI,CAAC;YACH,IAAI,GAAG,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAClD,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;YACpC,CAAC;iBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;YACxD,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { State } from './fork/getPathFromState';\nimport { stripBaseUrl } from './fork/getStateFromPath-forks';\n\ntype SearchParams = Record;\n\nexport type UrlObject = {\n unstable_globalHref: string;\n pathname: string;\n readonly params: SearchParams;\n segments: string[];\n isIndex: boolean;\n};\n\nexport function getRouteInfoFromState(\n getPathFromState: (state: State, asPath: boolean) => { path: string; params: any },\n state: State,\n baseUrl?: string\n): UrlObject {\n const { path } = getPathFromState(state, false);\n const qualified = getPathFromState(state, true);\n\n return {\n // TODO: This may have a predefined origin attached in the future.\n unstable_globalHref: path,\n pathname: stripBaseUrl(path, baseUrl).split('?')[0]!,\n isIndex: isIndexPath(state),\n ...getNormalizedStatePath(qualified, baseUrl),\n };\n}\n\nfunction isIndexPath(state: State) {\n const route = state.routes[state.index ?? state.routes.length - 1];\n if (!route) {\n return false;\n } else if (route.state) {\n return isIndexPath(route.state);\n }\n\n // Index routes on the same level as a layout do not have `index` in their name\n if (route.params && 'screen' in route.params) {\n return route.params.screen === 'index';\n }\n\n // The `params` key will not exist if there are no params\n // So we need to do a positive lookahead to check if the route ends with /index\n // Nested routes that are hoisted will have a name ending with /index\n // e.g name could be /user/[id]/index\n if (route.name.match(/.+\\/index$/)) return true;\n\n // The state will either have params (because there are multiple _layout) or it will be hoisted with a name\n // If we don't match the above cases, then it's not an index route\n\n return false;\n}\n\n// TODO: Split up getPathFromState to return all this info at once.\nexport function getNormalizedStatePath(\n {\n path: statePath,\n params,\n }: {\n path: string;\n params: any;\n },\n baseUrl?: string\n): Pick {\n const [pathname] = statePath.split('?');\n return {\n // Strip empty path at the start\n segments: stripBaseUrl(pathname!, baseUrl)\n .split('/')\n .filter((x) => !!x)\n .map(decodeURIComponent),\n // TODO: This is not efficient, we should generate based on the state instead\n // of converting to string then back to object\n params: decodeParams(params),\n };\n}\n\nfunction decodeParams(params: Record) {\n const parsed: Record = {};\n\n for (const [key, value] of Object.entries(params)) {\n try {\n if (key === 'params' && typeof value === 'object') {\n parsed[key] = decodeParams(value);\n } else if (Array.isArray(value)) {\n parsed[key] = value.map((v) => decodeURIComponent(v));\n } else {\n parsed[key] = decodeURIComponent(value);\n }\n } catch {\n parsed[key] = value;\n }\n }\n\n return parsed;\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/fork/createMemoryHistory.d.ts b/packages/expo-router/build/fork/createMemoryHistory.d.ts index 76d357aedb9605..a0c7fc6e059713 100644 --- a/packages/expo-router/build/fork/createMemoryHistory.d.ts +++ b/packages/expo-router/build/fork/createMemoryHistory.d.ts @@ -6,7 +6,7 @@ type HistoryRecord = { }; export declare function createMemoryHistory(): { readonly index: number; - get(index: number): HistoryRecord; + get(index: number): HistoryRecord | undefined; backIndex({ path }: { path: string; }): number; diff --git a/packages/expo-router/build/fork/createMemoryHistory.d.ts.map b/packages/expo-router/build/fork/createMemoryHistory.d.ts.map index 7e44ba268347aa..aae84e8451c62a 100644 --- a/packages/expo-router/build/fork/createMemoryHistory.d.ts.map +++ b/packages/expo-router/build/fork/createMemoryHistory.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"createMemoryHistory.d.ts","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,KAAK,aAAa,GAAG;IAEnB,EAAE,EAAE,MAAM,CAAC;IAEX,KAAK,EAAE,eAAe,CAAC;IAEvB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAgB,mBAAmB;oBAmBlB,MAAM;eAcR,MAAM;wBAIG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;0BAad;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,eAAe,CAAA;KAAE;6BAmBrC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,eAAe,CAAA;KAAE;UAoC3D,MAAM;qBA2FK,MAAM,IAAI;EAiB9B"} \ No newline at end of file +{"version":3,"file":"createMemoryHistory.d.ts","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,KAAK,aAAa,GAAG;IAEnB,EAAE,EAAE,MAAM,CAAC;IAEX,KAAK,EAAE,eAAe,CAAC;IAEvB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAgB,mBAAmB;oBAmBlB,MAAM;eAcR,MAAM;wBAIG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;0BAYd;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,eAAe,CAAA;KAAE;6BAmBrC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,eAAe,CAAA;KAAE;UAoC3D,MAAM;qBA2FK,MAAM,IAAI;EAiB9B"} \ No newline at end of file diff --git a/packages/expo-router/build/fork/createMemoryHistory.js.map b/packages/expo-router/build/fork/createMemoryHistory.js.map index 685ad2ff7903d2..83af4e9f8e281a 100644 --- a/packages/expo-router/build/fork/createMemoryHistory.js.map +++ b/packages/expo-router/build/fork/createMemoryHistory.js.map @@ -1 +1 @@ -{"version":3,"file":"createMemoryHistory.js","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":";;AAiBA,kDAqNC;AAtOD,+EAA+E;AAC/E,6GAA6G;AAC7G,oCAAoC;AACpC,iCAAiC;AACjC,kDAA2C;AAa3C,SAAgB,mBAAmB;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAoB,EAAE,CAAC;IAEhC,wCAAwC;IACxC,6FAA6F;IAC7F,MAAM,OAAO,GAA4D,EAAE,CAAC;IAE5E,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,gFAAgF;QAChF,uFAAuF;QACvF,oEAAoE;QACpE,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YACrB,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;YACjB,EAAE,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG;QACd,IAAI,KAAK;YACP,kDAAkD;YAClD,oEAAoE;YACpE,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;YAEpC,IAAI,EAAE,EAAE,CAAC;gBACP,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;gBAExD,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAChC,CAAC;Y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AAE;gBACtB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;oBACnB,wEAAwE;oBACxE,OAAO;gBACT,CAAC;gBAED,QAAQ,EAAE,CAAC;YACb,CAAC,CAAC;YAEF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YAEhD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAClE,CAAC;KACF,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["// Forked from React Navigation in order to use a custom `useLinking` function.\n// https://github.com/react-navigation/react-navigation/blob/main/packages/native/src/createMemoryHistory.tsx\n// Look for 'START OF FORK' comments\n// Currently no forked behaviour.\nimport { nanoid } from 'nanoid/non-secure';\n\nimport type { NavigationState } from '../react-navigation/core';\n\ntype HistoryRecord = {\n // Unique identifier for this record to match it with window.history.state\n id: string;\n // Navigation state object for the history entry\n state: NavigationState;\n // Path of the history entry\n path: string;\n};\n\nexport function createMemoryHistory() {\n let index = 0;\n let items: HistoryRecord[] = [];\n\n // Pending callbacks for `history.go(n)`\n // We might modify the callback stored if it was interrupted, so we have a ref to identify it\n const pending: { ref: unknown; cb: (interrupted?: boolean) => void }[] = [];\n\n const interrupt = () => {\n // If another history operation was performed we need to interrupt existing ones\n // This makes sure that calls such as `history.replace` after `history.go` don't happen\n // Since otherwise it won't be correct if something else has changed\n pending.forEach((it) => {\n const cb = it.cb;\n it.cb = () => cb(true);\n });\n };\n\n const history = {\n get index(): number {\n // We store an id in the state instead of an index\n // Index could get out of sync with in-memory values if page reloads\n const id = window.history.state?.id;\n\n if (id) {\n const index = items.findIndex((item) => item.id === id);\n\n return index > -1 ? index : 0;\n }\n\n return 0;\n },\n\n get(index: number) {\n return items[index];\n },\n\n backIndex({ path }: { path: string }) {\n // We need to find the index from the element before current to get closest path to go back to\n for (let i = index - 1; i >= 0; i--) {\n const item = items[i];\n\n if (item.path === path) {\n return i;\n }\n }\n\n return -1;\n },\n\n push({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = nanoid();\n\n // When a new entry is pushed, all the existing entries after index will be inaccessible\n // So we remove any existing entries after the current index to clean them up\n items = items.slice(0, index + 1);\n\n items.push({ path, state, id });\n index = items.length - 1;\n\n // We pass empty string for title because it's ignored in all browsers except safari\n // We don't store state object in history.state because:\n // - browsers have limits on how big it can be, and we don't control the size\n // - while not recommended, there could be non-serializable data in state\n window.history.pushState({ id }, '', path);\n },\n\n replace({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = window.history.state?.id ?? nanoid();\n\n // Need to keep the hash part of the path if there was no previous history entry\n // or the previous history entry had the same path\n let pathWithHash = path;\n const hash = pathWithHash.includes('#') ? '' : location.hash;\n\n if (!items.length || items.findIndex((item) => item.id === id) < 0) {\n // There are two scenarios for creating an array with only one history record:\n // - When loaded id not found in the items array, this function by default will replace\n // the first item. We need to keep only the new updated object, otherwise it will break\n // the page when navigating forward in history.\n // - This is the first time any state modifications are done\n // So we need to push the entry as there's nothing to replace\n\n pathWithHash = pathWithHash + hash;\n items = [{ path: pathWithHash, state, id }];\n index = 0;\n } else {\n if (items[index].path === path) {\n pathWithHash = pathWithHash + hash;\n }\n items[index] = { path, state, id };\n }\n\n window.history.replaceState({ id }, '', pathWithHash);\n },\n\n // `history.go(n)` is asynchronous, there are couple of things to keep in mind:\n // - it won't do anything if we can't go `n` steps, the `popstate` event won't fire.\n // - each `history.go(n)` call will trigger a separate `popstate` event with correct location.\n // - the `popstate` event fires before the next frame after calling `history.go(n)`.\n // This method differs from `history.go(n)` in the sense that it'll go back as many steps it can.\n go(n: number) {\n interrupt();\n\n // To guard against unexpected navigation out of the app we will assume that browser history is only as deep as the length of our memory\n // history. If we don't have an item to navigate to then update our index and navigate as far as we can without taking the user out of the app.\n const nextIndex = index + n;\n const lastItemIndex = items.length - 1;\n if (n < 0 && !items[nextIndex]) {\n // Attempted to navigate beyond the first index. Negating the current index will align the browser history with the first item.\n n = -index;\n index = 0;\n } else if (n > 0 && nextIndex > lastItemIndex) {\n // Attempted to navigate past the last index. Calculate how many indices away from the last index and go there.\n n = lastItemIndex - index;\n index = lastItemIndex;\n } else {\n index = nextIndex;\n }\n\n if (n === 0) {\n return;\n }\n\n // When we call `history.go`, `popstate` will fire when there's history to go back to\n // So we need to somehow handle following cases:\n // - There's history to go back, `history.go` is called, and `popstate` fires\n // - `history.go` is called multiple times, we need to resolve on respective `popstate`\n // - No history to go back, but `history.go` was called, browser has no API to detect it\n return new Promise((resolve, reject) => {\n const done = (interrupted?: boolean) => {\n clearTimeout(timer);\n\n if (interrupted) {\n reject(new Error('History was changed during navigation.'));\n return;\n }\n\n // There seems to be a bug in Chrome regarding updating the title\n // If we set a title just before calling `history.go`, the title gets lost\n // However the value of `document.title` is still what we set it to\n // It's just not displayed in the tab bar\n // To update the tab bar, we need to reset the title to something else first (e.g. '')\n // And set the title to what it was before so it gets applied\n // It won't work without setting it to empty string coz otherwise title isn't changing\n // Which means that the browser won't do anything after setting the title\n const { title } = window.document;\n\n window.document.title = '';\n window.document.title = title;\n\n resolve();\n };\n\n pending.push({ ref: done, cb: done });\n\n // If navigation didn't happen within 100ms, assume that it won't happen\n // This may not be accurate, but hopefully it won't take so much time\n // In Chrome, navigation seems to happen instantly in next microtask\n // But on Firefox, it seems to take much longer, around 50ms from our testing\n // We're using a hacky timeout since there doesn't seem to be way to know for sure\n const timer = setTimeout(() => {\n const index = pending.findIndex((it) => it.ref === done);\n\n if (index > -1) {\n pending[index].cb();\n pending.splice(index, 1);\n }\n }, 100);\n\n const onPopState = () => {\n const id = window.history.state?.id;\n const currentIndex = items.findIndex((item) => item.id === id);\n\n // Fix createMemoryHistory.index variable's value\n // as it may go out of sync when navigating in the browser.\n index = Math.max(currentIndex, 0);\n\n const last = pending.pop();\n\n window.removeEventListener('popstate', onPopState);\n last?.cb();\n };\n\n window.addEventListener('popstate', onPopState);\n window.history.go(n);\n });\n },\n\n // The `popstate` event is triggered when history changes, except `pushState` and `replaceState`\n // If we call `history.go(n)` ourselves, we don't want it to trigger the listener\n // Here we normalize it so that only external changes (e.g. user pressing back/forward) trigger the listener\n listen(listener: () => void) {\n const onPopState = () => {\n if (pending.length) {\n // This was triggered by `history.go(n)`, we shouldn't call the listener\n return;\n }\n\n listener();\n };\n\n window.addEventListener('popstate', onPopState);\n\n return () => window.removeEventListener('popstate', onPopState);\n },\n };\n\n return history;\n}\n"]} \ No newline at end of file +{"version":3,"file":"createMemoryHistory.js","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":";;AAiBA,kDAoNC;AArOD,+EAA+E;AAC/E,6GAA6G;AAC7G,oCAAoC;AACpC,iCAAiC;AACjC,kDAA2C;AAa3C,SAAgB,mBAAmB;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAoB,EAAE,CAAC;IAEhC,wCAAwC;IACxC,6FAA6F;IAC7F,MAAM,OAAO,GAA4D,EAAE,CAAC;IAE5E,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,gFAAgF;QAChF,uFAAuF;QACvF,oEAAoE;QACpE,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YACrB,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;YACjB,EAAE,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG;QACd,IAAI,KAAK;YACP,kDAAkD;YAClD,oEAAoE;YACpE,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;YAEpC,IAAI,EAAE,EAAE,CAAC;gBACP,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;gBAEx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ED,gGAAgG;QAChG,iFAAiF;QACjF,4GAA4G;QAC5G,MAAM,CAAC,QAAoB;YACzB,MAAM,UAAU,GAAG,GAAG,EAAE;gBACtB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;oBACnB,wEAAwE;oBACxE,OAAO;gBACT,CAAC;gBAED,QAAQ,EAAE,CAAC;YACb,CAAC,CAAC;YAEF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YAEhD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAClE,CAAC;KACF,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["// Forked from React Navigation in order to use a custom `useLinking` function.\n// https://github.com/react-navigation/react-navigation/blob/main/packages/native/src/createMemoryHistory.tsx\n// Look for 'START OF FORK' comments\n// Currently no forked behaviour.\nimport { nanoid } from 'nanoid/non-secure';\n\nimport type { NavigationState } from '../react-navigation/core';\n\ntype HistoryRecord = {\n // Unique identifier for this record to match it with window.history.state\n id: string;\n // Navigation state object for the history entry\n state: NavigationState;\n // Path of the history entry\n path: string;\n};\n\nexport function createMemoryHistory() {\n let index = 0;\n let items: HistoryRecord[] = [];\n\n // Pending callbacks for `history.go(n)`\n // We might modify the callback stored if it was interrupted, so we have a ref to identify it\n const pending: { ref: unknown; cb: (interrupted?: boolean) => void }[] = [];\n\n const interrupt = () => {\n // If another history operation was performed we need to interrupt existing ones\n // This makes sure that calls such as `history.replace` after `history.go` don't happen\n // Since otherwise it won't be correct if something else has changed\n pending.forEach((it) => {\n const cb = it.cb;\n it.cb = () => cb(true);\n });\n };\n\n const history = {\n get index(): number {\n // We store an id in the state instead of an index\n // Index could get out of sync with in-memory values if page reloads\n const id = window.history.state?.id;\n\n if (id) {\n const index = items.findIndex((item) => item.id === id);\n\n return index > -1 ? index : 0;\n }\n\n return 0;\n },\n\n get(index: number) {\n return items[index];\n },\n\n backIndex({ path }: { path: string }) {\n // We need to find the index from the element before current to get closest path to go back to\n for (let i = index - 1; i >= 0; i--) {\n const item = items[i]!;\n if (item.path === path) {\n return i;\n }\n }\n\n return -1;\n },\n\n push({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = nanoid();\n\n // When a new entry is pushed, all the existing entries after index will be inaccessible\n // So we remove any existing entries after the current index to clean them up\n items = items.slice(0, index + 1);\n\n items.push({ path, state, id });\n index = items.length - 1;\n\n // We pass empty string for title because it's ignored in all browsers except safari\n // We don't store state object in history.state because:\n // - browsers have limits on how big it can be, and we don't control the size\n // - while not recommended, there could be non-serializable data in state\n window.history.pushState({ id }, '', path);\n },\n\n replace({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = window.history.state?.id ?? nanoid();\n\n // Need to keep the hash part of the path if there was no previous history entry\n // or the previous history entry had the same path\n let pathWithHash = path;\n const hash = pathWithHash.includes('#') ? '' : location.hash;\n\n if (!items.length || items.findIndex((item) => item.id === id) < 0) {\n // There are two scenarios for creating an array with only one history record:\n // - When loaded id not found in the items array, this function by default will replace\n // the first item. We need to keep only the new updated object, otherwise it will break\n // the page when navigating forward in history.\n // - This is the first time any state modifications are done\n // So we need to push the entry as there's nothing to replace\n\n pathWithHash = pathWithHash + hash;\n items = [{ path: pathWithHash, state, id }];\n index = 0;\n } else {\n if (items[index]!.path === path) {\n pathWithHash = pathWithHash + hash;\n }\n items[index] = { path, state, id };\n }\n\n window.history.replaceState({ id }, '', pathWithHash);\n },\n\n // `history.go(n)` is asynchronous, there are couple of things to keep in mind:\n // - it won't do anything if we can't go `n` steps, the `popstate` event won't fire.\n // - each `history.go(n)` call will trigger a separate `popstate` event with correct location.\n // - the `popstate` event fires before the next frame after calling `history.go(n)`.\n // This method differs from `history.go(n)` in the sense that it'll go back as many steps it can.\n go(n: number) {\n interrupt();\n\n // To guard against unexpected navigation out of the app we will assume that browser history is only as deep as the length of our memory\n // history. If we don't have an item to navigate to then update our index and navigate as far as we can without taking the user out of the app.\n const nextIndex = index + n;\n const lastItemIndex = items.length - 1;\n if (n < 0 && !items[nextIndex]) {\n // Attempted to navigate beyond the first index. Negating the current index will align the browser history with the first item.\n n = -index;\n index = 0;\n } else if (n > 0 && nextIndex > lastItemIndex) {\n // Attempted to navigate past the last index. Calculate how many indices away from the last index and go there.\n n = lastItemIndex - index;\n index = lastItemIndex;\n } else {\n index = nextIndex;\n }\n\n if (n === 0) {\n return;\n }\n\n // When we call `history.go`, `popstate` will fire when there's history to go back to\n // So we need to somehow handle following cases:\n // - There's history to go back, `history.go` is called, and `popstate` fires\n // - `history.go` is called multiple times, we need to resolve on respective `popstate`\n // - No history to go back, but `history.go` was called, browser has no API to detect it\n return new Promise((resolve, reject) => {\n const done = (interrupted?: boolean) => {\n clearTimeout(timer);\n\n if (interrupted) {\n reject(new Error('History was changed during navigation.'));\n return;\n }\n\n // There seems to be a bug in Chrome regarding updating the title\n // If we set a title just before calling `history.go`, the title gets lost\n // However the value of `document.title` is still what we set it to\n // It's just not displayed in the tab bar\n // To update the tab bar, we need to reset the title to something else first (e.g. '')\n // And set the title to what it was before so it gets applied\n // It won't work without setting it to empty string coz otherwise title isn't changing\n // Which means that the browser won't do anything after setting the title\n const { title } = window.document;\n\n window.document.title = '';\n window.document.title = title;\n\n resolve();\n };\n\n pending.push({ ref: done, cb: done });\n\n // If navigation didn't happen within 100ms, assume that it won't happen\n // This may not be accurate, but hopefully it won't take so much time\n // In Chrome, navigation seems to happen instantly in next microtask\n // But on Firefox, it seems to take much longer, around 50ms from our testing\n // We're using a hacky timeout since there doesn't seem to be way to know for sure\n const timer = setTimeout(() => {\n const index = pending.findIndex((it) => it.ref === done);\n\n if (index > -1) {\n pending[index]!.cb();\n pending.splice(index, 1);\n }\n }, 100);\n\n const onPopState = () => {\n const id = window.history.state?.id;\n const currentIndex = items.findIndex((item) => item.id === id);\n\n // Fix createMemoryHistory.index variable's value\n // as it may go out of sync when navigating in the browser.\n index = Math.max(currentIndex, 0);\n\n const last = pending.pop();\n\n window.removeEventListener('popstate', onPopState);\n last?.cb();\n };\n\n window.addEventListener('popstate', onPopState);\n window.history.go(n);\n });\n },\n\n // The `popstate` event is triggered when history changes, except `pushState` and `replaceState`\n // If we call `history.go(n)` ourselves, we don't want it to trigger the listener\n // Here we normalize it so that only external changes (e.g. user pressing back/forward) trigger the listener\n listen(listener: () => void) {\n const onPopState = () => {\n if (pending.length) {\n // This was triggered by `history.go(n)`, we shouldn't call the listener\n return;\n }\n\n listener();\n };\n\n window.addEventListener('popstate', onPopState);\n\n return () => window.removeEventListener('popstate', onPopState);\n },\n };\n\n return history;\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/fork/findFocusedRoute.d.ts.map b/packages/expo-router/build/fork/findFocusedRoute.d.ts.map index 0501240afc16f8..97355354d8a1b3 100644 --- a/packages/expo-router/build/fork/findFocusedRoute.d.ts.map +++ b/packages/expo-router/build/fork/findFocusedRoute.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"findFocusedRoute.d.ts","sourceRoot":"","sources":["../../src/fork/findFocusedRoute.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY;;eAUnD"} \ No newline at end of file +{"version":3,"file":"findFocusedRoute.d.ts","sourceRoot":"","sources":["../../src/fork/findFocusedRoute.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY;;eASnD"} \ No newline at end of file diff --git a/packages/expo-router/build/fork/findFocusedRoute.js b/packages/expo-router/build/fork/findFocusedRoute.js index 311d1129ba61d0..48d3c42801df47 100644 --- a/packages/expo-router/build/fork/findFocusedRoute.js +++ b/packages/expo-router/build/fork/findFocusedRoute.js @@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.findFocusedRoute = findFocusedRoute; function findFocusedRoute(state) { let current = state; - while (current?.routes[current.index ?? 0].state != null) { + while (current?.routes[current.index ?? 0]?.state != null) { current = current.routes[current.index ?? 0].state; } const route = current?.routes[current?.index ?? 0]; diff --git a/packages/expo-router/build/fork/findFocusedRoute.js.map b/packages/expo-router/build/fork/findFocusedRoute.js.map index 8f268039b01d4e..dce33db86c008a 100644 --- a/packages/expo-router/build/fork/findFocusedRoute.js.map +++ b/packages/expo-router/build/fork/findFocusedRoute.js.map @@ -1 +1 @@ -{"version":3,"file":"findFocusedRoute.js","sourceRoot":"","sources":["../../src/fork/findFocusedRoute.tsx"],"names":[],"mappings":";AAAA,2FAA2F;;AAI3F,4CAUC;AAVD,SAAgB,gBAAgB,CAAC,KAAmB;IAClD,IAAI,OAAO,GAA6B,KAAK,CAAC;IAE9C,OAAO,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;QACzD,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACrD,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;IAEnD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Forked so we can access without importing any React Native code in Node.js environments.\n\nimport type { InitialState } from '../react-navigation/routers';\n\nexport function findFocusedRoute(state: InitialState) {\n let current: InitialState | undefined = state;\n\n while (current?.routes[current.index ?? 0].state != null) {\n current = current.routes[current.index ?? 0].state;\n }\n\n const route = current?.routes[current?.index ?? 0];\n\n return route;\n}\n"]} \ No newline at end of file +{"version":3,"file":"findFocusedRoute.js","sourceRoot":"","sources":["../../src/fork/findFocusedRoute.tsx"],"names":[],"mappings":";AAAA,2FAA2F;;AAI3F,4CASC;AATD,SAAgB,gBAAgB,CAAC,KAAmB;IAClD,IAAI,OAAO,GAA6B,KAAK,CAAC;IAE9C,OAAO,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC;QAC1D,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAE,CAAC,KAAK,CAAC;IACtD,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;IACnD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Forked so we can access without importing any React Native code in Node.js environments.\n\nimport type { InitialState } from '../react-navigation/routers';\n\nexport function findFocusedRoute(state: InitialState) {\n let current: InitialState | undefined = state;\n\n while (current?.routes[current.index ?? 0]?.state != null) {\n current = current.routes[current.index ?? 0]!.state;\n }\n\n const route = current?.routes[current?.index ?? 0];\n return route;\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/fork/getPathFromState.d.ts.map b/packages/expo-router/build/fork/getPathFromState.d.ts.map index 12653c04a50311..ad2b69717aa924 100644 --- a/packages/expo-router/build/fork/getPathFromState.d.ts.map +++ b/packages/expo-router/build/fork/getPathFromState.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"getPathFromState.d.ts","sourceRoot":"","sources":["../../src/fork/getPathFromState.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAS,MAAM,6BAA6B,CAAC;AAGxF,MAAM,MAAM,OAAO,CAAC,SAAS,SAAS,MAAM,IAAI,WAAW,GAAG;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,aAAa,C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F,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,CAAC,CAAC;AA0BrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,SAAS,MAAM,EACvD,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAC3B,MAAM,CAER;AAED,wBAAgB,oBAAoB,CAAC,SAAS,SAAS,MAAM,EAC3D,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC;;;EA0P7B;AAsDD,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAM,GAAG,SAAqC,UAQxD"} \ No newline at end of file diff --git a/packages/expo-router/build/fork/getPathFromState.js b/packages/expo-router/build/fork/getPathFromState.js index 2adcbf6d7a65e5..0503037e1ef7f2 100644 --- a/packages/expo-router/build/fork/getPathFromState.js +++ b/packages/expo-router/build/fork/getPathFromState.js @@ -41,9 +41,7 @@ const expo = __importStar(require("./getPathFromState-forks")); const navigationParams_1 = require("../navigationParams"); // END FORK const getActiveRoute = (state) => { - const route = typeof state.index === 'number' - ? state.routes[state.index] - : state.routes[state.routes.length - 1]; + const route = state.index != null ? state.routes[state.index] : state.routes[state.routes.length - 1]; if (route.state) { return getActiveRoute(route.state); } @@ -197,8 +195,7 @@ function getPathDataFromState(state, options) { // END FORK } else { - index = - typeof route.state.index === 'number' ? route.state.index : route.state.routes.length - 1; + index = route.state.index != null ? route.state.index : route.state.routes.length - 1; const nextRoute = route.state.routes[index]; const nestedConfig = currentOptions[route.name].screens; // if there is config for next route name, we go deeper diff --git a/packages/expo-router/build/fork/getPathFromState.js.map b/packages/expo-router/build/fork/getPathFromState.js.map index b5bfe4f7631084..1d5f2f4a9d83e4 100644 --- a/packages/expo-router/build/fork/getPathFromState.js.map +++ b/packages/expo-router/build/fork/getPathFromState.js.map @@ -1 +1 @@ -{"version":3,"file":"getPathFromState.js","sourceRoot":"","sources":["../../src/fork/getPathFromState.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,4CAKC;AAED,oDA6PC;AAsDD,sCAUC;AA/YD,0DAA4C;AAE5C,+DAAiD;AAEjD,0DAAqE;AAsBrE,WAAW;AAEX,MAAM,cAAc,GAAG,CAAC,KAAY,EAAqC,EAAE;IACzE,MAAM,KAAK,GACT,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;QAC7B,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;QAC3B,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE5C,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,IAAI,uBAAuB,GAAoE;IAC7F,SAAS;IACT,EAAE;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,SAAgB,gBAAgB,CAC9B,KAAY,EACZ,OAA4B;IAE5B,OAAO,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC;AAED,SAAgB,oBAAoB,CAClC,KAAY,EACZ,OAA4B;IAE5B,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,MAAM,KAAK,CAAC,+EAA+E,CAAC,CAAC;IAC/F,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACZ,aAAa;QACb,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QACjC,+BAA+B;QAC/B,WAAW;IACb,CAAC;IAED,iEAAiE;IACjE,IAAI,uBAAuB,CAAC,CAAC,C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AAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IAEhG,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAuB,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE9F,OAAO;QACL,oFAAoF;QACpF,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QACtD,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,OAAO;KACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAC9B,OAA8B,EAC9B,OAAgB,EACY,EAAE,CAC9B,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE;IACxC,MAAM,MAAM,GAAG,gBAAgB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAE5C,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACxB,CAAC,CAAC,CACH,CAAC;AAEJ,SAAgB,aAAa,CAC3B,IAAY,EACZ,UAA8B,OAAO,CAAC,GAAG,CAAC,aAAa;IAEvD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;QAC3C,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC;QACrE,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import * as queryString from 'query-string';\n\nimport * as expo from './getPathFromState-forks';\nimport type { ExpoConfigItem, ExpoOptions } from './getPathFromState-forks';\nimport { removeInternalExpoRouterParams } from '../navigationParams';\nimport type { PathConfig, PathConfigMap } from '../react-navigation/native';\nimport type { NavigationState, PartialState, Route } from '../react-navigation/routers';\n\n// START FORK\nexport type Options = ExpoOptions & {\n path?: string;\n initialRouteName?: string;\n screens: PathConfigMap;\n};\n// END FORK\n\nexport type State = NavigationState | Omit, 'stale'>;\n\nexport type StringifyConfig = Record string>;\n\n// START FORK\ntype ConfigItem = ExpoConfigItem & {\n pattern?: string;\n stringify?: StringifyConfig;\n screens?: Record;\n};\n// END FORK\n\nconst getActiveRoute = (state: State): { name: string; params?: object } => {\n const route =\n typeof state.index === 'number'\n ? state.routes[state.index]\n : state.routes[state.routes.length - 1];\n\n if (route.state) {\n return getActiveRoute(route.state);\n }\n\n return route;\n};\n\nlet cachedNormalizedConfigs: [PathConfigMap | undefined, Record] = [\n undefined,\n {},\n];\n\n/**\n * Utility to serialize a navigation state object to a path string.\n *\n * @example\n * ```js\n * getPathFromState(\n * {\n * routes: [\n * {\n * name: 'Chat',\n * params: { author: 'Jane', id: 42 },\n * },\n * ],\n * },\n * {\n * screens: {\n * Chat: {\n * path: 'chat/:author/:id',\n * stringify: { author: author => author.toLowerCase() }\n * }\n * }\n * }\n * )\n * ```\n *\n * @param state Navigation state to serialize.\n * @param options Extra options to fine-tune how to serialize the path.\n * @returns Path representing the state, e.g. /foo/bar?count=42.\n */\nexport function getPathFromState(\n state: State,\n options?: Options\n): string {\n return getPathDataFromState(state, options).path;\n}\n\nexport function getPathDataFromState(\n state: State,\n options?: Options\n) {\n if (state == null) {\n throw Error(\"Got 'undefined' for the navigation state. You must pass a valid state object.\");\n }\n\n if (options) {\n // START FORK\n expo.validatePathConfig(options);\n // validatePathConfig(options);\n // END FORK\n }\n\n // Create a normalized configs object which will be easier to use\n if (cachedNormalizedConfigs[0] !== options?.screens) {\n cachedNormalizedConfigs = [\n options?.screens,\n options?.screens ? createNormalizedConfigs(options.screens) : {},\n ];\n }\n const configs: Record = cachedNormalizedConfigs[1];\n\n let path = '/';\n let current: State | undefined = state;\n\n const allParams: Record = {};\n\n while (current) {\n let index = typeof current.index === 'number' ? current.index : 0;\n let route = current.routes[index] as Route & {\n state?: State;\n };\n\n let pattern: string | undefined;\n\n let focusedParams: Record | undefined;\n const focusedRoute = getActiveRoute(state);\n let currentOptions = configs;\n\n // Keep all the route names that appeared during going deeper in config in case the pattern is resolved to undefined\n const nestedRouteNames: string[] = [];\n\n let hasNext = true;\n\n while (route.name in currentOptions && hasNext) {\n pattern = currentOptions[route.name].pattern;\n\n nestedRouteNames.push(route.name);\n\n if (route.params) {\n const stringify = currentOptions[route.name]?.stringify;\n\n // START FORK\n // This mutates allParams\n const currentParams = expo.fixCurrentParams(allParams, route, stringify);\n\n // const currentParams = Object.fromEntries(\n // Object.entries(route.params).map(([key, value]) => [\n // key,\n // stringify?.[key] ? stringify[key](value) : String(value),\n // ])\n // );\n\n // if (pattern) {\n // Object.assign(allParams, currentParams);\n // }\n // END FORK\n\n if (focusedRoute === route) {\n // If this is the focused route, keep the params for later use\n // We save it here since it's been stringified already\n focusedParams = { ...currentParams };\n\n pattern\n ?.split('/')\n .filter((p) => expo.isDynamicPart(p))\n // eslint-disable-next-line no-loop-func\n .forEach((p) => {\n const name = expo.getParamName(p);\n\n // Remove the params present in the pattern since we'll only use the rest for query string\n if (focusedParams) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete focusedParams[name];\n }\n });\n }\n }\n\n // If there is no `screens` property or no nested state, we return pattern\n if (!currentOptions[route.name].screens || route.state === undefined) {\n // START FORK\n // Expo Router allows you to navigate to a (group) and not specify a target screen\n // This is different from React Navigation, which requires a target screen\n // We need to handle this case here, by selecting either the index screen or the first screen of the group\n\n // IMPORTANT: This does not affect groups that use _layout files with initialRouteNames\n // Layout files create a new route config. This only affects groups without layouts that have their screens\n // hoisted.\n\n // Example:\n // - /home/_layout\n // - /home/(a|b|c)/index --> Hoisted to /home/_layout navigator\n // - /home/(a|b|c)/other --> Hoisted to /home/_layout navigator\n // - /home/(profile)/me --> Hoisted to /home/_layout navigator\n //\n // route.push('/home/(a)') --> This should navigate to /home/(a)/index\n // route.push('/home/(profile)') --> This should navigate to /home/(profile)/me\n const screens = currentOptions[route.name].screens;\n\n // Determine what screen the user wants to navigate to. If no screen is specified, assume there is an index screen\n // In the examples above, this ensures that /home/(a) navigates to /home/(a)/index\n const targetScreen =\n // This is typed as unknown, so we need to add these extra assertions\n route.params && 'screen' in route.params && typeof route.params.screen === 'string'\n ? route.params.screen\n : 'index';\n\n // If the target screen is not in the screens object, default to the first screen\n // In the examples above, this ensures that /home/(profile) navigates to /home/(profile)/me\n // As there is no index screen in the group\n const screen = screens\n ? screens[targetScreen]\n ? targetScreen\n : Object.keys(screens)[0]\n : undefined;\n\n if (screen && screens && currentOptions[route.name].screens?.[screen]) {\n const nestedParams = (route.params as { params?: object } | undefined)?.params;\n route = { ...screens[screen], name: screen, key: screen, params: nestedParams };\n currentOptions = screens;\n } else {\n hasNext = false;\n }\n // hasNext = false;\n // END FORK\n } else {\n index =\n typeof route.state.index === 'number' ? route.state.index : route.state.routes.length - 1;\n\n const nextRoute = route.state.routes[index];\n const nestedConfig = currentOptions[route.name].screens;\n\n // if there is config for next route name, we go deeper\n if (nestedConfig && nextRoute.name in nestedConfig) {\n route = nextRoute as Route & { state?: State };\n currentOptions = nestedConfig;\n } else {\n // If not, there is no sense in going deeper in config\n hasNext = false;\n }\n }\n }\n\n if (pattern === undefined) {\n pattern = nestedRouteNames.join('/');\n }\n\n if (currentOptions[route.name] !== undefined) {\n // START FORK\n path += expo.getPathWithConventionsCollapsed({\n ...options,\n pattern,\n route,\n params: allParams,\n initialRouteName: configs[route.name]?.initialRouteName,\n });\n // path += pattern\n // .split('/')\n // .map((p) => {\n // const name = getParamName(p);\n\n // // We don't know what to show for wildcard patterns\n // // Showing the route name seems ok, though whatever we show here will be incorrect\n // // Since the page doesn't actually exist\n // if (p === '*') {\n // return route.name;\n // }\n\n // // If the path has a pattern for a param, put the param in the path\n // if (p.startsWith(':')) {\n // const value = allParams[name];\n\n // if (value === undefined && p.endsWith('?')) {\n // // Optional params without value assigned in route.params should be ignored\n // return '';\n // }\n\n // // Valid characters according to\n // // https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 (see pchar definition)\n // return String(value).replace(/[^A-Za-z0-9\\-._~!$&'()*+,;=:@]/g, (char) =>\n // encodeURIComponent(char)\n // );\n // }\n\n // return encodeURIComponent(p);\n // })\n // .join('/');\n // } else {\n } else if (!route.name.startsWith('+')) {\n path += encodeURIComponent(route.name);\n }\n // END FORK\n\n if (!focusedParams) {\n focusedParams = focusedRoute.params ? { ...focusedRoute.params } : undefined;\n }\n\n if (route.state) {\n path += '/';\n } else if (focusedParams) {\n for (const param in focusedParams) {\n if (focusedParams[param] === 'undefined') {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete focusedParams[param];\n }\n }\n\n // START FORK\n delete focusedParams['#'];\n focusedParams = removeInternalExpoRouterParams(focusedParams);\n // END FORK\n\n const query = queryString.stringify(focusedParams, { sort: false });\n if (query) {\n path += `?${query}`;\n }\n }\n\n current = route.state;\n }\n\n // Remove multiple as well as trailing slashes\n path = path.replace(/\\/+/g, '/');\n path = path.length > 1 ? path.replace(/\\/$/, '') : path;\n\n // Include the root path if specified\n if (options?.path) {\n path = joinPaths(options.path, path);\n }\n\n // START FORK\n path = expo.appendBaseUrl(path);\n if (allParams['#']) {\n path += `#${allParams['#']}`;\n }\n // END FORK\n\n // START FORK\n return { path, params: allParams };\n // END FORK\n}\n\n// const getParamName = (pattern: string) => pattern.replace(/^:/, '').replace(/\\?$/, '');\n\nconst joinPaths = (...paths: string[]): string =>\n ([] as string[])\n .concat(...paths.map((p) => p.split('/')))\n .filter(Boolean)\n .join('/');\n\nconst createConfigItem = (\n config: PathConfig | string,\n parentPattern?: string\n): ConfigItem => {\n if (typeof config === 'string') {\n // If a string is specified as the value of the key(e.g. Foo: '/path'), use it as the pattern\n const pattern = parentPattern ? joinPaths(parentPattern, config) : config;\n\n return { pattern };\n }\n\n if (config.exact && config.path === undefined) {\n throw new Error(\n \"A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.\"\n );\n }\n\n // If an object is specified as the value (e.g. Foo: { ... }),\n // It can have `path` property and `screens` prop which has nested configs\n const pattern =\n config.exact !== true ? joinPaths(parentPattern || '', config.path || '') : config.path || '';\n\n const screens = config.screens ? createNormalizedConfigs(config.screens, pattern) : undefined;\n\n return {\n // Normalize pattern to remove any leading, trailing slashes, duplicate slashes etc.\n pattern: pattern?.split('/').filter(Boolean).join('/'),\n stringify: config.stringify,\n screens,\n };\n};\n\nconst createNormalizedConfigs = (\n options: PathConfigMap,\n pattern?: string\n): Record =>\n Object.fromEntries(\n Object.entries(options).map(([name, c]) => {\n const result = createConfigItem(c, pattern);\n\n return [name, result];\n })\n );\n\nexport function appendBaseUrl(\n path: string,\n baseUrl: string | undefined = process.env.EXPO_BASE_URL\n) {\n if (process.env.NODE_ENV !== 'development') {\n if (baseUrl) {\n return `/${baseUrl.replace(/^\\/+/, '').replace(/\\/$/, '')}${path}`;\n }\n }\n return path;\n}\n"]} \ No newline at end of file +{"version":3,"file":"getPathFromState.js","sourceRoot":"","sources":["../../src/fork/getPathFromState.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,4CAKC;AAED,oDA4PC;AAsDD,sCAUC;AA5YD,0DAA4C;AAE5C,+DAAiD;AAEjD,0DAAqE;AAsBrE,WAAW;AAEX,MAAM,cAAc,GAAG,CAAC,KAAY,EAAqC,EAAE;IACzE,MAAM,KAAK,GACT,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC;IAE5F,IAAI,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AAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE;IACxC,MAAM,MAAM,GAAG,gBAAgB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAE5C,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACxB,CAAC,CAAC,CACH,CAAC;AAEJ,SAAgB,aAAa,CAC3B,IAAY,EACZ,UAA8B,OAAO,CAAC,GAAG,CAAC,aAAa;IAEvD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;QAC3C,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC;QACrE,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import * as queryString from 'query-string';\n\nimport * as expo from './getPathFromState-forks';\nimport type { ExpoConfigItem, ExpoOptions } from './getPathFromState-forks';\nimport { removeInternalExpoRouterParams } from '../navigationParams';\nimport type { PathConfig, PathConfigMap } from '../react-navigation/native';\nimport type { NavigationState, PartialState, Route } from '../react-navigation/routers';\n\n// START FORK\nexport type Options = ExpoOptions & {\n path?: string;\n initialRouteName?: string;\n screens: PathConfigMap;\n};\n// END FORK\n\nexport type State = NavigationState | Omit, 'stale'>;\n\nexport type StringifyConfig = Record string>;\n\n// START FORK\ntype ConfigItem = ExpoConfigItem & {\n pattern?: string;\n stringify?: StringifyConfig;\n screens?: Record;\n};\n// END FORK\n\nconst getActiveRoute = (state: State): { name: string; params?: object } => {\n const route =\n state.index != null ? state.routes[state.index]! : state.routes[state.routes.length - 1]!;\n\n if (route.state) {\n return getActiveRoute(route.state);\n }\n\n return route;\n};\n\nlet cachedNormalizedConfigs: [PathConfigMap | undefined, Record] = [\n undefined,\n {},\n];\n\n/**\n * Utility to serialize a navigation state object to a path string.\n *\n * @example\n * ```js\n * getPathFromState(\n * {\n * routes: [\n * {\n * name: 'Chat',\n * params: { author: 'Jane', id: 42 },\n * },\n * ],\n * },\n * {\n * screens: {\n * Chat: {\n * path: 'chat/:author/:id',\n * stringify: { author: author => author.toLowerCase() }\n * }\n * }\n * }\n * )\n * ```\n *\n * @param state Navigation state to serialize.\n * @param options Extra options to fine-tune how to serialize the path.\n * @returns Path representing the state, e.g. /foo/bar?count=42.\n */\nexport function getPathFromState(\n state: State,\n options?: Options\n): string {\n return getPathDataFromState(state, options).path;\n}\n\nexport function getPathDataFromState(\n state: State,\n options?: Options\n) {\n if (state == null) {\n throw Error(\"Got 'undefined' for the navigation state. You must pass a valid state object.\");\n }\n\n if (options) {\n // START FORK\n expo.validatePathConfig(options);\n // validatePathConfig(options);\n // END FORK\n }\n\n // Create a normalized configs object which will be easier to use\n if (cachedNormalizedConfigs[0] !== options?.screens) {\n cachedNormalizedConfigs = [\n options?.screens,\n options?.screens ? createNormalizedConfigs(options.screens) : {},\n ];\n }\n const configs: Record = cachedNormalizedConfigs[1];\n\n let path = '/';\n let current: State | undefined = state;\n\n const allParams: Record = {};\n\n while (current) {\n let index = typeof current.index === 'number' ? current.index : 0;\n let route = current.routes[index] as Route & {\n state?: State;\n };\n\n let pattern: string | undefined;\n\n let focusedParams: Record | undefined;\n const focusedRoute = getActiveRoute(state);\n let currentOptions = configs;\n\n // Keep all the route names that appeared during going deeper in config in case the pattern is resolved to undefined\n const nestedRouteNames: string[] = [];\n\n let hasNext = true;\n\n while (route.name in currentOptions && hasNext) {\n pattern = currentOptions[route.name]!.pattern;\n\n nestedRouteNames.push(route.name);\n\n if (route.params) {\n const stringify = currentOptions[route.name]?.stringify;\n\n // START FORK\n // This mutates allParams\n const currentParams = expo.fixCurrentParams(allParams, route, stringify);\n\n // const currentParams = Object.fromEntries(\n // Object.entries(route.params).map(([key, value]) => [\n // key,\n // stringify?.[key] ? stringify[key](value) : String(value),\n // ])\n // );\n\n // if (pattern) {\n // Object.assign(allParams, currentParams);\n // }\n // END FORK\n\n if (focusedRoute === route) {\n // If this is the focused route, keep the params for later use\n // We save it here since it's been stringified already\n focusedParams = { ...currentParams };\n\n pattern\n ?.split('/')\n .filter((p) => expo.isDynamicPart(p))\n // eslint-disable-next-line no-loop-func\n .forEach((p) => {\n const name = expo.getParamName(p);\n\n // Remove the params present in the pattern since we'll only use the rest for query string\n if (focusedParams) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete focusedParams[name];\n }\n });\n }\n }\n\n // If there is no `screens` property or no nested state, we return pattern\n if (!currentOptions[route.name]!.screens || route.state === undefined) {\n // START FORK\n // Expo Router allows you to navigate to a (group) and not specify a target screen\n // This is different from React Navigation, which requires a target screen\n // We need to handle this case here, by selecting either the index screen or the first screen of the group\n\n // IMPORTANT: This does not affect groups that use _layout files with initialRouteNames\n // Layout files create a new route config. This only affects groups without layouts that have their screens\n // hoisted.\n\n // Example:\n // - /home/_layout\n // - /home/(a|b|c)/index --> Hoisted to /home/_layout navigator\n // - /home/(a|b|c)/other --> Hoisted to /home/_layout navigator\n // - /home/(profile)/me --> Hoisted to /home/_layout navigator\n //\n // route.push('/home/(a)') --> This should navigate to /home/(a)/index\n // route.push('/home/(profile)') --> This should navigate to /home/(profile)/me\n const screens = currentOptions[route.name]!.screens;\n\n // Determine what screen the user wants to navigate to. If no screen is specified, assume there is an index screen\n // In the examples above, this ensures that /home/(a) navigates to /home/(a)/index\n const targetScreen =\n // This is typed as unknown, so we need to add these extra assertions\n route.params && 'screen' in route.params && typeof route.params.screen === 'string'\n ? route.params.screen\n : 'index';\n\n // If the target screen is not in the screens object, default to the first screen\n // In the examples above, this ensures that /home/(profile) navigates to /home/(profile)/me\n // As there is no index screen in the group\n const screen = screens\n ? screens[targetScreen]\n ? targetScreen\n : Object.keys(screens)[0]\n : undefined;\n\n if (screen && screens && currentOptions[route.name]!.screens?.[screen]) {\n const nestedParams = (route.params as { params?: object } | undefined)?.params;\n route = { ...screens[screen], name: screen, key: screen, params: nestedParams };\n currentOptions = screens;\n } else {\n hasNext = false;\n }\n // hasNext = false;\n // END FORK\n } else {\n index = route.state.index != null ? route.state.index : route.state.routes.length - 1;\n\n const nextRoute = route.state.routes[index]!;\n const nestedConfig = currentOptions[route.name]!.screens;\n\n // if there is config for next route name, we go deeper\n if (nestedConfig && nextRoute!.name in nestedConfig) {\n route = nextRoute as Route & { state?: State };\n currentOptions = nestedConfig;\n } else {\n // If not, there is no sense in going deeper in config\n hasNext = false;\n }\n }\n }\n\n if (pattern === undefined) {\n pattern = nestedRouteNames.join('/');\n }\n\n if (currentOptions[route.name] !== undefined) {\n // START FORK\n path += expo.getPathWithConventionsCollapsed({\n ...options,\n pattern,\n route,\n params: allParams,\n initialRouteName: configs[route.name]?.initialRouteName,\n });\n // path += pattern\n // .split('/')\n // .map((p) => {\n // const name = getParamName(p);\n\n // // We don't know what to show for wildcard patterns\n // // Showing the route name seems ok, though whatever we show here will be incorrect\n // // Since the page doesn't actually exist\n // if (p === '*') {\n // return route.name;\n // }\n\n // // If the path has a pattern for a param, put the param in the path\n // if (p.startsWith(':')) {\n // const value = allParams[name];\n\n // if (value === undefined && p.endsWith('?')) {\n // // Optional params without value assigned in route.params should be ignored\n // return '';\n // }\n\n // // Valid characters according to\n // // https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 (see pchar definition)\n // return String(value).replace(/[^A-Za-z0-9\\-._~!$&'()*+,;=:@]/g, (char) =>\n // encodeURIComponent(char)\n // );\n // }\n\n // return encodeURIComponent(p);\n // })\n // .join('/');\n // } else {\n } else if (!route.name.startsWith('+')) {\n path += encodeURIComponent(route.name);\n }\n // END FORK\n\n if (!focusedParams) {\n focusedParams = focusedRoute.params ? { ...focusedRoute.params } : undefined;\n }\n\n if (route.state) {\n path += '/';\n } else if (focusedParams) {\n for (const param in focusedParams) {\n if (focusedParams[param] === 'undefined') {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete focusedParams[param];\n }\n }\n\n // START FORK\n delete focusedParams['#'];\n focusedParams = removeInternalExpoRouterParams(focusedParams);\n // END FORK\n\n const query = queryString.stringify(focusedParams, { sort: false });\n if (query) {\n path += `?${query}`;\n }\n }\n\n current = route.state;\n }\n\n // Remove multiple as well as trailing slashes\n path = path.replace(/\\/+/g, '/');\n path = path.length > 1 ? path.replace(/\\/$/, '') : path;\n\n // Include the root path if specified\n if (options?.path) {\n path = joinPaths(options.path, path);\n }\n\n // START FORK\n path = expo.appendBaseUrl(path);\n if (allParams['#']) {\n path += `#${allParams['#']}`;\n }\n // END FORK\n\n // START FORK\n return { path, params: allParams };\n // END FORK\n}\n\n// const getParamName = (pattern: string) => pattern.replace(/^:/, '').replace(/\\?$/, '');\n\nconst joinPaths = (...paths: string[]): string =>\n ([] as string[])\n .concat(...paths.map((p) => p.split('/')))\n .filter(Boolean)\n .join('/');\n\nconst createConfigItem = (\n config: PathConfig | string,\n parentPattern?: string\n): ConfigItem => {\n if (typeof config === 'string') {\n // If a string is specified as the value of the key(e.g. Foo: '/path'), use it as the pattern\n const pattern = parentPattern ? joinPaths(parentPattern, config) : config;\n\n return { pattern };\n }\n\n if (config.exact && config.path === undefined) {\n throw new Error(\n \"A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.\"\n );\n }\n\n // If an object is specified as the value (e.g. Foo: { ... }),\n // It can have `path` property and `screens` prop which has nested configs\n const pattern =\n config.exact !== true ? joinPaths(parentPattern || '', config.path || '') : config.path || '';\n\n const screens = config.screens ? createNormalizedConfigs(config.screens, pattern) : undefined;\n\n return {\n // Normalize pattern to remove any leading, trailing slashes, duplicate slashes etc.\n pattern: pattern?.split('/').filter(Boolean).join('/'),\n stringify: config.stringify,\n screens,\n };\n};\n\nconst createNormalizedConfigs = (\n options: PathConfigMap,\n pattern?: string\n): Record =>\n Object.fromEntries(\n Object.entries(options).map(([name, c]) => {\n const result = createConfigItem(c, pattern);\n\n return [name, result];\n })\n );\n\nexport function appendBaseUrl(\n path: string,\n baseUrl: string | undefined = process.env.EXPO_BASE_URL\n) {\n if (process.env.NODE_ENV !== 'development') {\n if (baseUrl) {\n return `/${baseUrl.replace(/^\\/+/, '').replace(/\\/$/, '')}${path}`;\n }\n }\n return path;\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/fork/getStateFromPath-forks.d.ts.map b/packages/expo-router/build/fork/getStateFromPath-forks.d.ts.map index 7034bdf26bcfa7..86c0a5fe8259bf 100644 --- a/packages/expo-router/build/fork/getStateFromPath-forks.d.ts.map +++ b/packages/expo-router/build/fork/getStateFromPath-forks.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"getStateFromPath-forks.d.ts","sourceRoot":"","sources":["../../src/fork/getStateFromPath-forks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,WAAW,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEhG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG/D,MAAM,MAAM,WAAW,GAAG;IACxB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IACtC,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EA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AAW,EAAE;;UApNhD,QAAQ,GAAG,SAAS,GAAG,QAAQ;sBACnB,MAAM;aACf,OAAO;gBACJ,OAAO;iBACN,OAAO;wBACA,MAAM,EAAE;WACrB,MAAM,EAAE;qBACE,MAAM;;;;;;;;cA6OxB;AAED,wBAAgB,eAAe,CAAC,aAAa,EAAE,kBAAkB,EAAE,IAKhD,QAAQ,WAAW,iBAMrC;AAQD,wBAAgB,oBAAoB,CAAC,gBAAgB,GAAE,MAAM,EAAO,IACtC,GAAG,WAAW,EAAE,GAAG,WAAW,YA2J3D;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,EAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,GAAG,CAAC,EACpD,IAAI,CAAC,EAAE,MAAM,iDA4Bd;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,UAUrC;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,UAelD"} \ No newline at end of file +{"version":3,"file":"getStateFromPath-forks.d.ts","sourceRoot":"","sources":["../../src/fork/getStateFromPath-forks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,WAAW,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEhG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG/D,MAAM,MAAM,WAAW,GAAG;IACxB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IACtC,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,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WAAW,QAsBnF;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAM5F;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAM,GAAG,SAAqC,UAQxD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE;;UArNhD,QAAQ,GAAG,SAAS,GAAG,QAAQ;sBACnB,MAAM;aACf,OAAO;gBACJ,OAAO;iBACN,OAAO;wBACA,MAAM,EAAE;WACrB,MAAM,EAAE;qBACE,MAAM;;;;;;;;cA8OxB;AAED,wBAAgB,eAAe,CAAC,aAAa,EAAE,kBAAkB,EAAE,IAKhD,QAAQ,WAAW,iBAMrC;AAQD,wBAAgB,oBAAoB,CAAC,gBAAgB,GAAE,MAAM,EAAO,IACtC,GAAG,WAAW,EAAE,GAAG,WAAW,YA6J3D;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,EAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,GAAG,CAAC,EACpD,IAAI,CAAC,EAAE,MAAM,iDA4Bd;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,UAUrC;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,UAelD"} \ No newline at end of file diff --git a/packages/expo-router/build/fork/getStateFromPath-forks.js b/packages/expo-router/build/fork/getStateFromPath-forks.js index 767b81da4a968d..63374a73c02494 100644 --- a/packages/expo-router/build/fork/getStateFromPath-forks.js +++ b/packages/expo-router/build/fork/getStateFromPath-forks.js @@ -169,6 +169,7 @@ function handleUrlParams(route, params) { } function spreadParamsAcrossAllStates(state, params) { while (state) { + // TODO(@kitten): Investigate why this is read-only or whether this function cal is used / is this dead code? const route = state.routes[0]; route.params = Object.assign({}, route.params, params); } @@ -281,6 +282,8 @@ function getRouteConfigSorter(previousSegments = []) { * If there is not difference in similarity, then each non-group segment is compared against each other */ for (let i = 0; i < Math.max(a.parts.length, b.parts.length); i++) { + const aParts = a.parts[i]; + const bParts = b.parts[i]; // if b is longer, b get higher priority if (a.parts[i] == null) { return 1; @@ -289,12 +292,12 @@ function getRouteConfigSorter(previousSegments = []) { if (b.parts[i] == null) { return -1; } - const aWildCard = a.parts[i].startsWith('*'); - const bWildCard = b.parts[i].startsWith('*'); + const aWildCard = aParts.startsWith('*'); + const bWildCard = bParts.startsWith('*'); // if both are wildcard we compare next component if (aWildCard && bWildCard) { - const aNotFound = a.parts[i].match(/^[*]not-found$/); - const bNotFound = b.parts[i].match(/^[*]not-found$/); + const aNotFound = aParts.match(/^[*]not-found$/); + const bNotFound = bParts.match(/^[*]not-found$/); if (aNotFound && bNotFound) { continue; } @@ -314,12 +317,12 @@ function getRouteConfigSorter(previousSegments = []) { if (bWildCard) { return -1; } - const aSlug = a.parts[i].startsWith(':'); - const bSlug = b.parts[i].startsWith(':'); + const aSlug = aParts.startsWith(':'); + const bSlug = bParts.startsWith(':'); // if both are wildcard we compare next component if (aSlug && bSlug) { - const aNotFound = a.parts[i].match(/^[*]not-found$/); - const bNotFound = b.parts[i].match(/^[*]not-found$/); + const aNotFound = aParts.match(/^[*]not-found$/); + const bNotFound = bParts.match(/^[*]not-found$/); if (aNotFound && bNotFound) { continue; } diff --git a/packages/expo-router/build/fork/getStateFromPath-forks.js.map b/packages/expo-router/build/fork/getStateFromPath-forks.js.map index bee9a55aa12bff..fc9f11f451c35a 100644 --- a/packages/expo-router/build/fork/getStateFromPath-forks.js.map +++ b/packages/expo-router/build/fork/getStateFromPath-forks.js.map @@ -1 +1 @@ -{"version":3,"file":"getStateFromPath-forks.js","sourceRoot":"","sources":["../../src/fork/getStateFromPath-forks.ts"],"names":[],"mappings":";;;;;AA4BA,wCAQC;AAED,4DAMC;AASD,oFAyBC;AAED,oCAiDC;AAED,sCA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AG,CAAC;QAClB,CAAC;aAAM,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,OAAO,cAAc,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;QACtD,CAAC;QAED,OAAO,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,8BAAM,EAAC,EAAE,CAAC,KAAK,CAAC;IAChD,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,CAAC,GAAG,CACf,CAAC;AACJ,CAAC","sourcesContent":["import escape from 'escape-string-regexp';\nimport type * as queryString from 'query-string';\n\nimport type { InitialRouteConfig, Options, ParsedRoute, RouteConfig } from './getStateFromPath';\nimport { matchGroupName, stripGroupSegmentsFromPath } from '../matchers';\nimport type { InitialState } from '../react-navigation/native';\nimport { parseUrlUsingCustomBase } from '../utils/url';\n\nexport type ExpoOptions = {\n previousSegments?: string[];\n};\n\nexport type ExpoRouteConfig = {\n type: 'static' | 'dynamic' | 'layout';\n userReadableName: string;\n isIndex: boolean;\n isInitial?: boolean;\n hasChildren: boolean;\n expandedRouteNames: string[];\n parts: string[];\n staticPartCount: number;\n};\n\n/**\n * In Expo Router, the params are available at all levels of the routing config\n * @param routes\n * @returns\n */\nexport function populateParams(routes?: ParsedRoute[], params?: Record) {\n if (!routes || !params || Object.keys(params).length === 0) return;\n\n for (const route of routes) {\n Object.assign(route, { params });\n }\n\n return routes;\n}\n\nexport function safelyDecodeURIComponent(str: string) {\n try {\n return decodeURIComponent(str);\n } catch {\n return str;\n }\n}\n\ninterface UrlWithReactNavigationConcessions {\n path: string;\n nonstandardPathname: string;\n hash: string;\n pathWithoutGroups: string;\n}\n\nexport function getUrlWithReactNavigationConcessions(\n path: string,\n baseUrl: string | undefined = process.env.EXPO_BASE_URL\n): UrlWithReactNavigationConcessions {\n const pathWithoutGroups = stripGroupSegmentsFromPath(stripBaseUrl(path, baseUrl));\n\n let pathname = '';\n let hash = '';\n try {\n const parsed = parseUrlUsingCustomBase(path);\n pathname = parsed.pathname;\n hash = parsed.hash;\n } catch {\n // Do nothing with invalid URLs.\n }\n\n const withoutBaseUrl = stripBaseUrl(pathname, baseUrl);\n return {\n path,\n // Make sure there is a trailing slash\n // The slashes are at the end, not the beginning\n nonstandardPathname: withoutBaseUrl.replace(/^\\/+/g, '').replace(/\\/+$/g, '') + '/',\n hash,\n pathWithoutGroups,\n };\n}\n\nexport function createConfig(\n screen: string,\n pattern: string,\n routeNames: string[],\n config: Record = {}\n): Omit {\n const parts: string[] = [];\n let isDynamic = false;\n const isIndex = screen === 'index' || screen.endsWith('/index');\n let staticPartCount = 0;\n\n for (const part of pattern.split('/')) {\n if (part) {\n // If any part is dynamic, then the route is dynamic\n const isDynamicPart =\n part.startsWith(':') || part.startsWith('*') || part.includes('*not-found');\n\n isDynamic ||= isDynamicPart;\n\n if (!matchGroupName(part)) {\n parts.push(part);\n\n if (!isDynamicPart) {\n staticPartCount++;\n }\n }\n }\n }\n\n const hasChildren = config.screens ? !!Object.keys(config.screens)?.length : false;\n const type = hasChildren ? 'layout' : isDynamic ? 'dynamic' : 'static';\n\n if (isIndex) {\n parts.push('index');\n staticPartCount++;\n }\n\n return {\n type,\n isIndex,\n hasChildren,\n parts,\n staticPartCount,\n userReadableName: [...routeNames.slice(0, -1), config.path || screen].join('/'),\n // Don't include the __root route name\n expandedRouteNames: routeNames.slice(1).flatMap((name) => {\n return name.split('/');\n }),\n };\n}\n\nexport function assertScreens(options?: Options): asserts options is Options {\n if (!options?.screens) {\n throw Error(\"You must pass a 'screens' object to 'getStateFromPath' to generate a path.\");\n }\n}\n\nexport function configRegExp(config: RouteConfig) {\n return config.pattern\n ? new RegExp(`^(${config.pattern.split('/').map(formatRegexPattern).join('')})$`)\n : undefined;\n}\n\nexport function isDynamicPart(p: string) {\n return p.length > 1 && (p.startsWith(':') || p.startsWith('*'));\n}\n\nexport function replacePart(p: string) {\n return p.replace(/^[:*]/, '').replace(/\\?$/, '');\n}\n\nexport function getParamValue(p: string, value: string) {\n if (p.startsWith('*')) {\n const values = value.split('/').filter((v) => v !== '');\n return values.length === 0 && p.endsWith('?') ? undefined : values;\n } else {\n return value;\n }\n}\n\nfunction formatRegexPattern(it: string): string {\n // Allow spaces in file path names.\n it = it.replace(/ /g, '%20');\n\n if (it.startsWith(':')) {\n // TODO: Remove unused match group\n return `(([^/]+\\\\/)${it.endsWith('?') ? '?' : ''})`;\n } else if (it.startsWith('*')) {\n return `((.*\\\\/)${it.endsWith('?') ? '?' : ''})`;\n }\n\n // Strip groups from the matcher\n if (matchGroupName(it) != null) {\n // Groups are optional segments\n // this enables us to match `/bar` and `/(foo)/bar` for the same route\n // NOTE(EvanBacon): Ignore this match in the regex to avoid capturing the group\n return `(?:${escape(it)}\\\\/)?`;\n }\n\n return escape(it) + `\\\\/`;\n}\n\nexport function handleUrlParams(route: ParsedRoute, params?: queryString.ParsedQuery) {\n if (params) {\n route.params = Object.assign(Object.create(null), route.params) as Record;\n for (const [name, value] of Object.entries(params)) {\n if (route.params?.[name]) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Route '/${route.name}' with param '${name}' was specified both in the path and as a param, removing from path`\n );\n }\n }\n\n if (!route.params?.[name]) {\n route.params[name] = value;\n continue;\n }\n }\n\n if (Object.keys(route.params).length === 0) {\n delete route.params;\n }\n }\n}\n\nexport function spreadParamsAcrossAllStates(state: InitialState, params?: Record) {\n while (state) {\n const route = state.routes[0];\n (route as any).params = Object.assign({}, route.params, params);\n }\n}\n\nexport function stripBaseUrl(\n path: string,\n baseUrl: string | undefined = process.env.EXPO_BASE_URL\n) {\n if (process.env.NODE_ENV !== 'development') {\n if (baseUrl) {\n return path.replace(/^\\/+/g, '/').replace(new RegExp(`^\\\\/?${escape(baseUrl)}`, 'g'), '');\n }\n }\n return path;\n}\n\nexport function matchForEmptyPath(configs: RouteConfig[]) {\n // We need to add special handling of empty path so navigation to empty path also works\n // When handling empty path, we should only look at the root level config\n\n // NOTE(EvanBacon): We only care about matching leaf nodes.\n const leafNodes = configs\n .filter((config) => !config.hasChildren)\n .map((value) => {\n return {\n ...value,\n // Collapse all levels of group segments before testing.\n // This enables `app/(one)/(two)/index.js` to be matched.\n path: stripGroupSegmentsFromPath(value.path),\n };\n });\n\n const match =\n leafNodes.find(\n (config) =>\n // NOTE(EvanBacon): Test leaf node index routes that either don't have a regex or match an empty string.\n config.path === '' && (!config.regex || config.regex.test(''))\n ) ??\n leafNodes.find(\n (config) =>\n // NOTE(EvanBacon): Test leaf node dynamic routes that match an empty string.\n config.path.startsWith(':') && config.regex!.test('')\n ) ??\n // NOTE(EvanBacon): Test leaf node deep dynamic routes that match a slash.\n // This should be done last to enable dynamic routes having a higher priority.\n leafNodes.find((config) => config.path.startsWith('*') && config.regex!.test('/'));\n\n return match;\n}\n\nexport function appendIsInitial(initialRoutes: InitialRouteConfig[]) {\n const resolvedInitialPatterns = initialRoutes.map((route) =>\n joinPaths(...route.parentScreens, route.initialRouteName)\n );\n\n return function (config: RouteConfig) {\n // TODO(EvanBacon): Probably a safer way to do this\n // Mark initial routes to give them potential priority over other routes that match.\n config.isInitial = resolvedInitialPatterns.includes(config.routeNames.join('/'));\n return config;\n };\n}\n\nconst joinPaths = (...paths: string[]): string =>\n ([] as string[])\n .concat(...paths.map((p) => p.split('/')))\n .filter(Boolean)\n .join('/');\n\nexport function getRouteConfigSorter(previousSegments: string[] = []) {\n return function sortConfigs(a: RouteConfig, b: RouteConfig) {\n // Sort config so that:\n // - the most exhaustive ones are always at the beginning\n // - patterns with wildcard are always at the end\n\n // If 2 patterns are same, move the one with less route names up\n // This is an error state, so it's only useful for consistent error messages\n if (a.pattern === b.pattern) {\n return b.routeNames.join('>').localeCompare(a.routeNames.join('>'));\n }\n\n /*\n * If one of the patterns starts with the other, it is earlier in the config sorting.\n * However, configs are a mix of route configs and layout configs\n * e.g There will be a config for `/(group)`, but maybe there isn't a `/(group)/index.tsx`\n *\n * This is because you can navigate to a directory and its navigator will determine the route\n * These routes should be later in the config sorting, as their patterns are very open\n * and will prevent routes from being matched\n *\n * Therefore before we compare segment parts, we force these layout configs later in the sorting\n *\n * NOTE(marklawlor): Is this a feature we want? I'm unsure if this is a gimmick or a feature.\n */\n if (a.pattern.startsWith(b.pattern) && !b.isIndex) {\n return -1;\n }\n\n if (b.pattern.startsWith(a.pattern) && !a.isIndex) {\n return 1;\n }\n\n /*\n * Static routes should always be higher than dynamic and layout routes.\n */\n if (a.type === 'static' && b.type !== 'static') {\n return -1;\n } else if (a.type !== 'static' && b.type === 'static') {\n return 1;\n }\n\n /*\n * If the routes have any static segments, the one the most static segments should be higher\n */\n if (a.staticPartCount !== b.staticPartCount) {\n return b.staticPartCount - a.staticPartCount;\n }\n\n /*\n * If both are static/dynamic or a layout file, then we check group similarity\n */\n const similarToPreviousA = previousSegments.filter((value, index) => {\n return value === a.expandedRouteNames[index] && value.startsWith('(') && value.endsWith(')');\n });\n\n const similarToPreviousB = previousSegments.filter((value, index) => {\n return value === b.expandedRouteNames[index] && value.startsWith('(') && value.endsWith(')');\n });\n\n if (\n (similarToPreviousA.length > 0 || similarToPreviousB.length > 0) &&\n similarToPreviousA.length !== similarToPreviousB.length\n ) {\n // One matches more than the other, so pick the one that matches more\n return similarToPreviousB.length - similarToPreviousA.length;\n }\n\n /*\n * If there is not difference in similarity, then each non-group segment is compared against each other\n */\n for (let i = 0; i < Math.max(a.parts.length, b.parts.length); i++) {\n // if b is longer, b get higher priority\n if (a.parts[i] == null) {\n return 1;\n }\n // if a is longer, a get higher priority\n if (b.parts[i] == null) {\n return -1;\n }\n\n const aWildCard = a.parts[i].startsWith('*');\n const bWildCard = b.parts[i].startsWith('*');\n // if both are wildcard we compare next component\n if (aWildCard && bWildCard) {\n const aNotFound = a.parts[i].match(/^[*]not-found$/);\n const bNotFound = b.parts[i].match(/^[*]not-found$/);\n\n if (aNotFound && bNotFound) {\n continue;\n } else if (aNotFound) {\n return 1;\n } else if (bNotFound) {\n return -1;\n }\n continue;\n }\n // if only a is wild card, b get higher priority\n if (aWildCard) {\n return 1;\n }\n // if only b is wild card, a get higher priority\n if (bWildCard) {\n return -1;\n }\n\n const aSlug = a.parts[i].startsWith(':');\n const bSlug = b.parts[i].startsWith(':');\n // if both are wildcard we compare next component\n if (aSlug && bSlug) {\n const aNotFound = a.parts[i].match(/^[*]not-found$/);\n const bNotFound = b.parts[i].match(/^[*]not-found$/);\n\n if (aNotFound && bNotFound) {\n continue;\n } else if (aNotFound) {\n return 1;\n } else if (bNotFound) {\n return -1;\n }\n\n continue;\n }\n // if only a is wild card, b get higher priority\n if (aSlug) {\n return 1;\n }\n // if only b is wild card, a get higher priority\n if (bSlug) {\n return -1;\n }\n }\n\n /*\n * Both configs are identical in specificity and segments count/type\n * Try and sort by initial instead.\n *\n * TODO: We don't differentiate between the default initialRoute and group specific default routes\n *\n * const unstable_settings = {\n * \"group\": {\n * initialRouteName: \"article\"\n * }\n * }\n *\n * \"article\" will be ranked higher because its an initialRoute for a group - even if not your not currently in\n * that group. The current work around is to ways provide initialRouteName for all groups\n */\n if (a.isInitial && !b.isInitial) {\n return -1;\n } else if (!a.isInitial && b.isInitial) {\n return 1;\n }\n\n return b.parts.length - a.parts.length;\n };\n}\n\nexport function parseQueryParams(\n path: string,\n route: ParsedRoute,\n parseConfig?: Record any>,\n hash?: string\n) {\n const searchParams = parseUrlUsingCustomBase(path).searchParams;\n const params: Record = Object.create(null);\n\n if (hash) {\n params['#'] = hash.slice(1);\n }\n\n for (const name of searchParams.keys()) {\n if (route.params?.[name]) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Route '/${route.name}' with param '${name}' was specified both in the path and as a param, removing from path`\n );\n }\n } else {\n const values = parseConfig?.hasOwnProperty(name)\n ? searchParams.getAll(name).map((value) => parseConfig[name](value))\n : searchParams.getAll(name);\n\n // searchParams.getAll returns an array.\n // if we only have a single value, and its not an array param, we need to extract the value\n params[name] = values.length === 1 ? values[0] : values;\n }\n }\n\n return Object.keys(params).length ? params : undefined;\n}\n\nexport function cleanPath(path: string) {\n path = path\n // let remaining = path\n // END FORK\n .replace(/\\/+/g, '/') // Replace multiple slash (//) with single ones\n .replace(/^\\//, '') // Remove extra leading slash\n .replace(/\\?.*$/, ''); // Remove query params which we will handle later\n\n // Make sure there is a trailing slash\n return path.endsWith('/') ? path : `${path}/`;\n}\n\nexport function routePatternToRegex(pattern: string) {\n return new RegExp(\n `^(${pattern\n .split('/')\n .map((it) => {\n if (it.startsWith('(') && it.endsWith(')')) {\n return `${it}?`;\n } else if (it.startsWith(':')) {\n return `(([^/]+\\\\/)${it.endsWith('?') ? '?' : ''})`;\n }\n\n return `${it === '*' ? '.*' : escape(it)}\\\\/`;\n })\n .join('')})`\n );\n}\n"]} \ No newline at end of file +{"version":3,"file":"getStateFromPath-forks.js","sourceRoot":"","sources":["../../src/fork/getStateFromPath-forks.ts"],"names":[],"mappings":";;;;;AA4BA,wCAQC;AAED,4DAMC;AASD,oFAyBC;AAED,oCAiDC;AAED,sCAIC;AAED,oCAIC;AAED,sCAEC;AAED,kCAEC;AAED,sCAOC;AAwBD,0CAsBC;AAED,kEAMC;AAED,oCAUC;AAED,8CAgCC;AAED,0CAWC;AAQD,oDA8JC;AAED,4CAgCC;AAED,8BAUC;AAED,kDAeC;AApfD,gFAA0C;AAI1C,0CAAyE;AAEzE,sCAAuD;AAiBvD;;;;GAIG;AACH,SAAgB,cAAc,CAAC,MAAsB,EAAE,MAA4B;IACjF,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAEnE,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,MAAM,CAA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V,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,+CAA+C;SACpE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,6BAA6B;SAChD,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,iDAAiD;IAE1E,sCAAsC;IACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC;AAChD,CAAC;AAED,SAAgB,mBAAmB,CAAC,OAAe;IACjD,OAAO,IAAI,MAAM,CACf,KAAK,OAAO;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;QACV,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3C,OAAO,GAAG,EAAE,GAAG,CAAC;QAClB,CAAC;aAAM,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,OAAO,cAAc,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;QACtD,CAAC;QAED,OAAO,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,8BAAM,EAAC,EAAE,CAAC,KAAK,CAAC;IAChD,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,CAAC,GAAG,CACf,CAAC;AACJ,CAAC","sourcesContent":["import escape from 'escape-string-regexp';\nimport type * as queryString from 'query-string';\n\nimport type { InitialRouteConfig, Options, ParsedRoute, RouteConfig } from './getStateFromPath';\nimport { matchGroupName, stripGroupSegmentsFromPath } from '../matchers';\nimport type { InitialState } from '../react-navigation/native';\nimport { parseUrlUsingCustomBase } from '../utils/url';\n\nexport type ExpoOptions = {\n previousSegments?: string[];\n};\n\nexport type ExpoRouteConfig = {\n type: 'static' | 'dynamic' | 'layout';\n userReadableName: string;\n isIndex: boolean;\n isInitial?: boolean;\n hasChildren: boolean;\n expandedRouteNames: string[];\n parts: string[];\n staticPartCount: number;\n};\n\n/**\n * In Expo Router, the params are available at all levels of the routing config\n * @param routes\n * @returns\n */\nexport function populateParams(routes?: ParsedRoute[], params?: Record) {\n if (!routes || !params || Object.keys(params).length === 0) return;\n\n for (const route of routes) {\n Object.assign(route, { params });\n }\n\n return routes;\n}\n\nexport function safelyDecodeURIComponent(str: string) {\n try {\n return decodeURIComponent(str);\n } catch {\n return str;\n }\n}\n\ninterface UrlWithReactNavigationConcessions {\n path: string;\n nonstandardPathname: string;\n hash: string;\n pathWithoutGroups: string;\n}\n\nexport function getUrlWithReactNavigationConcessions(\n path: string,\n baseUrl: string | undefined = process.env.EXPO_BASE_URL\n): UrlWithReactNavigationConcessions {\n const pathWithoutGroups = stripGroupSegmentsFromPath(stripBaseUrl(path, baseUrl));\n\n let pathname = '';\n let hash = '';\n try {\n const parsed = parseUrlUsingCustomBase(path);\n pathname = parsed.pathname;\n hash = parsed.hash;\n } catch {\n // Do nothing with invalid URLs.\n }\n\n const withoutBaseUrl = stripBaseUrl(pathname, baseUrl);\n return {\n path,\n // Make sure there is a trailing slash\n // The slashes are at the end, not the beginning\n nonstandardPathname: withoutBaseUrl.replace(/^\\/+/g, '').replace(/\\/+$/g, '') + '/',\n hash,\n pathWithoutGroups,\n };\n}\n\nexport function createConfig(\n screen: string,\n pattern: string,\n routeNames: string[],\n config: Record = {}\n): Omit {\n const parts: string[] = [];\n let isDynamic = false;\n const isIndex = screen === 'index' || screen.endsWith('/index');\n let staticPartCount = 0;\n\n for (const part of pattern.split('/')) {\n if (part) {\n // If any part is dynamic, then the route is dynamic\n const isDynamicPart =\n part.startsWith(':') || part.startsWith('*') || part.includes('*not-found');\n\n isDynamic ||= isDynamicPart;\n\n if (!matchGroupName(part)) {\n parts.push(part);\n\n if (!isDynamicPart) {\n staticPartCount++;\n }\n }\n }\n }\n\n const hasChildren = config.screens ? !!Object.keys(config.screens)?.length : false;\n const type = hasChildren ? 'layout' : isDynamic ? 'dynamic' : 'static';\n\n if (isIndex) {\n parts.push('index');\n staticPartCount++;\n }\n\n return {\n type,\n isIndex,\n hasChildren,\n parts,\n staticPartCount,\n userReadableName: [...routeNames.slice(0, -1), config.path || screen].join('/'),\n // Don't include the __root route name\n expandedRouteNames: routeNames.slice(1).flatMap((name) => {\n return name.split('/');\n }),\n };\n}\n\nexport function assertScreens(options?: Options): asserts options is Options {\n if (!options?.screens) {\n throw Error(\"You must pass a 'screens' object to 'getStateFromPath' to generate a path.\");\n }\n}\n\nexport function configRegExp(config: RouteConfig) {\n return config.pattern\n ? new RegExp(`^(${config.pattern.split('/').map(formatRegexPattern).join('')})$`)\n : undefined;\n}\n\nexport function isDynamicPart(p: string) {\n return p.length > 1 && (p.startsWith(':') || p.startsWith('*'));\n}\n\nexport function replacePart(p: string) {\n return p.replace(/^[:*]/, '').replace(/\\?$/, '');\n}\n\nexport function getParamValue(p: string, value: string) {\n if (p.startsWith('*')) {\n const values = value.split('/').filter((v) => v !== '');\n return values.length === 0 && p.endsWith('?') ? undefined : values;\n } else {\n return value;\n }\n}\n\nfunction formatRegexPattern(it: string): string {\n // Allow spaces in file path names.\n it = it.replace(/ /g, '%20');\n\n if (it.startsWith(':')) {\n // TODO: Remove unused match group\n return `(([^/]+\\\\/)${it.endsWith('?') ? '?' : ''})`;\n } else if (it.startsWith('*')) {\n return `((.*\\\\/)${it.endsWith('?') ? '?' : ''})`;\n }\n\n // Strip groups from the matcher\n if (matchGroupName(it) != null) {\n // Groups are optional segments\n // this enables us to match `/bar` and `/(foo)/bar` for the same route\n // NOTE(EvanBacon): Ignore this match in the regex to avoid capturing the group\n return `(?:${escape(it)}\\\\/)?`;\n }\n\n return escape(it) + `\\\\/`;\n}\n\nexport function handleUrlParams(route: ParsedRoute, params?: queryString.ParsedQuery) {\n if (params) {\n route.params = Object.assign(Object.create(null), route.params) as Record;\n for (const [name, value] of Object.entries(params)) {\n if (route.params?.[name]) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Route '/${route.name}' with param '${name}' was specified both in the path and as a param, removing from path`\n );\n }\n }\n\n if (!route.params?.[name]) {\n route.params[name] = value;\n continue;\n }\n }\n\n if (Object.keys(route.params).length === 0) {\n delete route.params;\n }\n }\n}\n\nexport function spreadParamsAcrossAllStates(state: InitialState, params?: Record) {\n while (state) {\n // TODO(@kitten): Investigate why this is read-only or whether this function cal is used / is this dead code?\n const route: any = state.routes[0]!;\n route.params = Object.assign({}, route.params, params);\n }\n}\n\nexport function stripBaseUrl(\n path: string,\n baseUrl: string | undefined = process.env.EXPO_BASE_URL\n) {\n if (process.env.NODE_ENV !== 'development') {\n if (baseUrl) {\n return path.replace(/^\\/+/g, '/').replace(new RegExp(`^\\\\/?${escape(baseUrl)}`, 'g'), '');\n }\n }\n return path;\n}\n\nexport function matchForEmptyPath(configs: RouteConfig[]) {\n // We need to add special handling of empty path so navigation to empty path also works\n // When handling empty path, we should only look at the root level config\n\n // NOTE(EvanBacon): We only care about matching leaf nodes.\n const leafNodes = configs\n .filter((config) => !config.hasChildren)\n .map((value) => {\n return {\n ...value,\n // Collapse all levels of group segments before testing.\n // This enables `app/(one)/(two)/index.js` to be matched.\n path: stripGroupSegmentsFromPath(value.path),\n };\n });\n\n const match =\n leafNodes.find(\n (config) =>\n // NOTE(EvanBacon): Test leaf node index routes that either don't have a regex or match an empty string.\n config.path === '' && (!config.regex || config.regex.test(''))\n ) ??\n leafNodes.find(\n (config) =>\n // NOTE(EvanBacon): Test leaf node dynamic routes that match an empty string.\n config.path.startsWith(':') && config.regex!.test('')\n ) ??\n // NOTE(EvanBacon): Test leaf node deep dynamic routes that match a slash.\n // This should be done last to enable dynamic routes having a higher priority.\n leafNodes.find((config) => config.path.startsWith('*') && config.regex!.test('/'));\n\n return match;\n}\n\nexport function appendIsInitial(initialRoutes: InitialRouteConfig[]) {\n const resolvedInitialPatterns = initialRoutes.map((route) =>\n joinPaths(...route.parentScreens, route.initialRouteName)\n );\n\n return function (config: RouteConfig) {\n // TODO(EvanBacon): Probably a safer way to do this\n // Mark initial routes to give them potential priority over other routes that match.\n config.isInitial = resolvedInitialPatterns.includes(config.routeNames.join('/'));\n return config;\n };\n}\n\nconst joinPaths = (...paths: string[]): string =>\n ([] as string[])\n .concat(...paths.map((p) => p.split('/')))\n .filter(Boolean)\n .join('/');\n\nexport function getRouteConfigSorter(previousSegments: string[] = []) {\n return function sortConfigs(a: RouteConfig, b: RouteConfig) {\n // Sort config so that:\n // - the most exhaustive ones are always at the beginning\n // - patterns with wildcard are always at the end\n\n // If 2 patterns are same, move the one with less route names up\n // This is an error state, so it's only useful for consistent error messages\n if (a.pattern === b.pattern) {\n return b.routeNames.join('>').localeCompare(a.routeNames.join('>'));\n }\n\n /*\n * If one of the patterns starts with the other, it is earlier in the config sorting.\n * However, configs are a mix of route configs and layout configs\n * e.g There will be a config for `/(group)`, but maybe there isn't a `/(group)/index.tsx`\n *\n * This is because you can navigate to a directory and its navigator will determine the route\n * These routes should be later in the config sorting, as their patterns are very open\n * and will prevent routes from being matched\n *\n * Therefore before we compare segment parts, we force these layout configs later in the sorting\n *\n * NOTE(marklawlor): Is this a feature we want? I'm unsure if this is a gimmick or a feature.\n */\n if (a.pattern.startsWith(b.pattern) && !b.isIndex) {\n return -1;\n }\n\n if (b.pattern.startsWith(a.pattern) && !a.isIndex) {\n return 1;\n }\n\n /*\n * Static routes should always be higher than dynamic and layout routes.\n */\n if (a.type === 'static' && b.type !== 'static') {\n return -1;\n } else if (a.type !== 'static' && b.type === 'static') {\n return 1;\n }\n\n /*\n * If the routes have any static segments, the one the most static segments should be higher\n */\n if (a.staticPartCount !== b.staticPartCount) {\n return b.staticPartCount - a.staticPartCount;\n }\n\n /*\n * If both are static/dynamic or a layout file, then we check group similarity\n */\n const similarToPreviousA = previousSegments.filter((value, index) => {\n return value === a.expandedRouteNames[index] && value.startsWith('(') && value.endsWith(')');\n });\n\n const similarToPreviousB = previousSegments.filter((value, index) => {\n return value === b.expandedRouteNames[index] && value.startsWith('(') && value.endsWith(')');\n });\n\n if (\n (similarToPreviousA.length > 0 || similarToPreviousB.length > 0) &&\n similarToPreviousA.length !== similarToPreviousB.length\n ) {\n // One matches more than the other, so pick the one that matches more\n return similarToPreviousB.length - similarToPreviousA.length;\n }\n\n /*\n * If there is not difference in similarity, then each non-group segment is compared against each other\n */\n for (let i = 0; i < Math.max(a.parts.length, b.parts.length); i++) {\n const aParts = a.parts[i]!;\n const bParts = b.parts[i]!;\n // if b is longer, b get higher priority\n if (a.parts[i] == null) {\n return 1;\n }\n // if a is longer, a get higher priority\n if (b.parts[i] == null) {\n return -1;\n }\n\n const aWildCard = aParts.startsWith('*');\n const bWildCard = bParts.startsWith('*');\n // if both are wildcard we compare next component\n if (aWildCard && bWildCard) {\n const aNotFound = aParts.match(/^[*]not-found$/);\n const bNotFound = bParts.match(/^[*]not-found$/);\n\n if (aNotFound && bNotFound) {\n continue;\n } else if (aNotFound) {\n return 1;\n } else if (bNotFound) {\n return -1;\n }\n continue;\n }\n // if only a is wild card, b get higher priority\n if (aWildCard) {\n return 1;\n }\n // if only b is wild card, a get higher priority\n if (bWildCard) {\n return -1;\n }\n\n const aSlug = aParts.startsWith(':');\n const bSlug = bParts.startsWith(':');\n // if both are wildcard we compare next component\n if (aSlug && bSlug) {\n const aNotFound = aParts.match(/^[*]not-found$/);\n const bNotFound = bParts.match(/^[*]not-found$/);\n\n if (aNotFound && bNotFound) {\n continue;\n } else if (aNotFound) {\n return 1;\n } else if (bNotFound) {\n return -1;\n }\n\n continue;\n }\n // if only a is wild card, b get higher priority\n if (aSlug) {\n return 1;\n }\n // if only b is wild card, a get higher priority\n if (bSlug) {\n return -1;\n }\n }\n\n /*\n * Both configs are identical in specificity and segments count/type\n * Try and sort by initial instead.\n *\n * TODO: We don't differentiate between the default initialRoute and group specific default routes\n *\n * const unstable_settings = {\n * \"group\": {\n * initialRouteName: \"article\"\n * }\n * }\n *\n * \"article\" will be ranked higher because its an initialRoute for a group - even if not your not currently in\n * that group. The current work around is to ways provide initialRouteName for all groups\n */\n if (a.isInitial && !b.isInitial) {\n return -1;\n } else if (!a.isInitial && b.isInitial) {\n return 1;\n }\n\n return b.parts.length - a.parts.length;\n };\n}\n\nexport function parseQueryParams(\n path: string,\n route: ParsedRoute,\n parseConfig?: Record any>,\n hash?: string\n) {\n const searchParams = parseUrlUsingCustomBase(path).searchParams;\n const params: Record = Object.create(null);\n\n if (hash) {\n params['#'] = hash.slice(1);\n }\n\n for (const name of searchParams.keys()) {\n if (route.params?.[name]) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Route '/${route.name}' with param '${name}' was specified both in the path and as a param, removing from path`\n );\n }\n } else {\n const values = parseConfig?.hasOwnProperty(name)\n ? searchParams.getAll(name).map((value) => parseConfig[name]!(value))\n : searchParams.getAll(name);\n\n // searchParams.getAll returns an array.\n // if we only have a single value, and its not an array param, we need to extract the value\n params[name] = values.length === 1 ? values[0] : values;\n }\n }\n\n return Object.keys(params).length ? params : undefined;\n}\n\nexport function cleanPath(path: string) {\n path = path\n // let remaining = path\n // END FORK\n .replace(/\\/+/g, '/') // Replace multiple slash (//) with single ones\n .replace(/^\\//, '') // Remove extra leading slash\n .replace(/\\?.*$/, ''); // Remove query params which we will handle later\n\n // Make sure there is a trailing slash\n return path.endsWith('/') ? path : `${path}/`;\n}\n\nexport function routePatternToRegex(pattern: string) {\n return new RegExp(\n `^(${pattern\n .split('/')\n .map((it) => {\n if (it.startsWith('(') && it.endsWith(')')) {\n return `${it}?`;\n } else if (it.startsWith(':')) {\n return `(([^/]+\\\\/)${it.endsWith('?') ? '?' : ''})`;\n }\n\n return `${it === '*' ? '.*' : escape(it)}\\\\/`;\n })\n .join('')})`\n );\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/fork/getStateFromPath.js b/packages/expo-router/build/fork/getStateFromPath.js index d9798c3fb80243..97ef77ac0434d4 100644 --- a/packages/expo-router/build/fork/getStateFromPath.js +++ b/packages/expo-router/build/fork/getStateFromPath.js @@ -300,8 +300,7 @@ const matchAgainstConfigs = (remaining, configs) => { const decodedParamSegment = expo.safelyDecodeURIComponent( // const decodedParamSegment = decodeURIComponent( // The param segments appear every second item starting from 2 in the regex match result - match[(acc.pos + 1) * 2] - // Remove trailing slash + match[(acc.pos + 1) * 2] // Remove trailing slash .replace(/\/$/, '')); // END FORK Object.assign(acc.matchedParams, { @@ -335,6 +334,7 @@ const matchAgainstConfigs = (remaining, configs) => { const offset = numInitialSegments ? numInitialSegments - 1 : 0; // START FORK // const value = matchedParams[p]?.[index + offset]; + // TODO(@kitten): Assess which is intended, non-optional or getParamValue accepting undefined const value = expo.getParamValue(p, matchedParams[p]?.[index + offset]); // END FORK if (value) { diff --git a/packages/expo-router/build/fork/getStateFromPath.js.map b/packages/expo-router/build/fork/getStateFromPath.js.map index a35d8021197bcc..b867ffc3c6481c 100644 --- a/packages/expo-router/build/fork/getStateFromPath.js.map +++ b/packages/expo-router/build/fork/getStateFromPath.js.map @@ -1 +1 @@ -{"version":3,"file":"getStateFromPath.js","sourceRoot":"","sources":["../../src/fork/getStateFromPath.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,4CA8GC;AAnLD,gFAA0C;AAE1C,yDAAsD;AAEtD,+DAAiD;AACjD,4CAAkD;AAElD,uDAAgE;AAyChE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,gBAAgB,CAC9B,IAAY,EACZ,OAA4B;AAC5B,aAAa;AACb,WAAqB,EAAE;AACvB,WAAW;;IAEX,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,iBAAiB,EAAE,GAAG,kBAAkB,CACtE,OAAO;IACP,aAAa;IACb,QAAQ;IACR,WAAW;KACZ,CAAC;IAEF,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,CAA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AAM,GAAG,IAAI,CAAC,gBAAgB,CAClC,IAAI,EACJ,KAAK,EACL,UAAU,CAAC,CAAC,CAAC,uBAAuB,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,EACxE,IAAI,CACL,CAAC;IACF,WAAW;IAEX,aAAa;IACb,6CAA6C;IAC7C,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,CAAC,MAAM,GAAG,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAChD,CAAC;IACD,WAAW;IAEX,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,aAAa;AACb,qGAAqG;AACrG,sCAAsC;AACtC,6CAA6C;AAE7C,uBAAuB;AACvB,8CAA8C;AAC9C,iGAAiG;AACjG,oEAAoE;AACpE,UAAU;AACV,UAAU;AACV,MAAM;AAEN,4DAA4D;AAC5D,KAAK;AACL,WAAW","sourcesContent":["import escape from 'escape-string-regexp';\n\nimport { findFocusedRoute } from './findFocusedRoute';\nimport type { ExpoOptions, ExpoRouteConfig } from './getStateFromPath-forks';\nimport * as expo from './getStateFromPath-forks';\nimport { INTERNAL_SLOT_NAME } from '../constants';\nimport type { PathConfigMap } from '../react-navigation/native';\nimport { validatePathConfig } from '../react-navigation/native';\nimport type { InitialState, NavigationState, PartialState } from '../react-navigation/routers';\n\nexport type Options = ExpoOptions & {\n path?: string;\n initialRouteName?: string;\n screens: PathConfigMap;\n};\n\ntype ParseConfig = Record any>;\n\nexport type RouteConfig = ExpoRouteConfig & {\n screen: string;\n regex?: RegExp;\n path: string;\n pattern: string;\n routeNames: string[];\n parse?: ParseConfig;\n};\n\nexport type InitialRouteConfig = {\n initialRouteName: string;\n parentScreens: string[];\n};\n\nexport type ResultState = PartialState & {\n state?: ResultState;\n};\n\nexport type ParsedRoute = {\n name: string;\n path?: string;\n params?: Record | undefined;\n};\n\ntype ConfigResources = {\n initialRoutes: InitialRouteConfig[];\n configs: RouteConfig[];\n configWithRegexes: RouteConfig[];\n};\n\n/**\n * Utility to parse a path string to initial state object accepted by the container.\n * This is useful for deep linking when we need to handle the incoming URL.\n *\n * @example\n * ```js\n * getStateFromPath(\n * '/chat/jane/42',\n * {\n * screens: {\n * Chat: {\n * path: 'chat/:author/:id',\n * parse: { id: Number }\n * }\n * }\n * }\n * )\n * ```\n * @param path Path string to parse and convert, e.g. /foo/bar?count=42.\n * @param options Extra options to fine-tune how to parse the path.\n */\nexport function getStateFromPath(\n path: string,\n options?: Options,\n // START FORK\n segments: string[] = []\n // END FORK\n): ResultState | undefined {\n const { initialRoutes, configs, configWithRegexes } = getConfigResources(\n options,\n // START FORK\n segments\n // END FORK\n );\n\n const screens = options?.screens;\n\n // START FORK\n const expoPath = expo.getUrlWithReactNavigationConcessions(path);\n // END FORK\n\n // START FORK\n let remaining = expo.cleanPath(expoPath.nonstandardPathname);\n // let remaining = path\n // .replace(/\\/+/g, '/') // Replace multiple slash (//) with single ones\n // .replace(/^\\//, '') // Remove extra leading slash\n // .replace(/\\?.*$/, ''); // Remove query params which we will handle later\n\n // // Make sure there is a trailing slash\n // remaining = remaining.endsWith('/') ? remaining : `${remaining}/`;\n // END FORK\n\n const prefix = options?.path?.replace(/^\\//, ''); // Remove extra leading slash\n\n if (prefix) {\n // Make sure there is a trailing slash\n const normalizedPrefix = prefix.endsWith('/') ? prefix : `${prefix}/`;\n\n // If the path doesn't start with the prefix, it's not a match\n if (!remaining.startsWith(normalizedPrefix)) {\n return undefined;\n }\n\n // Remove the prefix from the path\n remaining = remaining.replace(normalizedPrefix, '');\n }\n\n if (screens === undefined) {\n // When no config is specified, use the path segments as route names\n const routes = remaining\n .split('/')\n .filter(Boolean)\n .map((segment) => {\n const name = decodeURIComponent(segment);\n return { name };\n });\n\n if (routes.length) {\n return createNestedStateObject(expoPath, routes, initialRoutes, [], expoPath.hash);\n }\n\n return undefined;\n }\n\n if (remaining === '/') {\n // We need to add special handling of empty path so navigation to empty path also works\n // When handling empty path, we should only look at the root level config\n // START FORK\n const match = expo.matchForEmptyPath(configWithRegexes);\n // const match = configs.find(\n // (config) =>\n // config.path === '' &&\n // config.routeNames.every(\n // // Make sure that none of the parent configs have a non-empty path defined\n // (name) => !configs.find((c) => c.screen === name)?.path\n // )\n // );\n // END FORK\n\n if (match) {\n return createNestedStateObject(\n expoPath,\n match.routeNames.map((name) => ({ name })),\n initialRoutes,\n configs,\n expoPath.hash\n );\n }\n\n return undefined;\n }\n\n let result: PartialState | undefined;\n let current: PartialState | undefined;\n\n // We match the whole path against the regex instead of segments\n // This makes sure matches such as wildcard will catch any unmatched routes, even if nested\n const { routes, remainingPath } = matchAgainstConfigs(remaining, configWithRegexes);\n\n if (routes !== undefined) {\n // This will always be empty if full path matched\n current = createNestedStateObject(expoPath, routes, initialRoutes, configs, expoPath.hash);\n remaining = remainingPath;\n result = current;\n }\n\n if (current == null || result == null) {\n return undefined;\n }\n\n return result;\n}\n\n/**\n * Reference to the last used config resources. This is used to avoid recomputing the config resources when the options are the same.\n */\nlet cachedConfigResources: [Options | undefined, ConfigResources] = [\n undefined,\n prepareConfigResources(),\n];\n\nfunction getConfigResources(\n options: Options | undefined,\n // START FORK\n previousSegments?: string[]\n // END FORK\n) {\n // START FORK - We need to disable this caching as our configs can change based upon the current state\n // if (cachedConfigResources[0] !== options) {\n cachedConfigResources = [options, prepareConfigResources(options, previousSegments)];\n // }\n // END FORK FORK\n\n return cachedConfigResources[1];\n}\n\nfunction prepareConfigResources(options?: Options, previousSegments?: string[]) {\n if (options) {\n validatePathConfig(options);\n }\n\n const initialRoutes = getInitialRoutes(options);\n\n const configs = getNormalizedConfigs(initialRoutes, options?.screens, previousSegments);\n\n checkForDuplicatedConfigs(configs);\n\n const configWithRegexes = getConfigsWithRegexes(configs);\n\n return {\n initialRoutes,\n configs,\n configWithRegexes,\n };\n}\n\nfunction getInitialRoutes(options?: Options) {\n const initialRoutes: InitialRouteConfig[] = [];\n\n if (options?.initialRouteName) {\n initialRoutes.push({\n initialRouteName: options.initialRouteName,\n parentScreens: [],\n });\n }\n\n return initialRoutes;\n}\n\nfunction getNormalizedConfigs(\n initialRoutes: InitialRouteConfig[],\n screens: PathConfigMap = {},\n // START FORK\n previousSegments?: string[]\n // END FORK\n) {\n // Create a normalized configs array which will be easier to use\n return ([] as RouteConfig[])\n .concat(\n ...Object.keys(screens).map((key) =>\n createNormalizedConfigs(key, screens as PathConfigMap, [], initialRoutes, [])\n )\n )\n .map(expo.appendIsInitial(initialRoutes))\n .sort(expo.getRouteConfigSorter(previousSegments));\n // .sort((a, b) => {\n // // Sort config so that:\n // // - the most exhaustive ones are always at the beginning\n // // - patterns with wildcard are always at the end\n\n // // If 2 patterns are same, move the one with less route names up\n // // This is an error state, so it's only useful for consistent error messages\n // if (a.pattern === b.pattern) {\n // return b.routeNames.join('>').localeCompare(a.routeNames.join('>'));\n // }\n\n // // If one of the patterns starts with the other, it's more exhaustive\n // // So move it up\n // if (a.pattern.startsWith(b.pattern)) {\n // return -1;\n // }\n\n // if (b.pattern.startsWith(a.pattern)) {\n // return 1;\n // }\n\n // const aParts = a.pattern.split('/');\n // const bParts = b.pattern.split('/');\n\n // for (let i = 0; i < Math.max(aParts.length, bParts.length); i++) {\n // // if b is longer, b get higher priority\n // if (aParts[i] == null) {\n // return 1;\n // }\n // // if a is longer, a get higher priority\n // if (bParts[i] == null) {\n // return -1;\n // }\n // const aWildCard = aParts[i] === '*' || aParts[i].startsWith(':');\n // const bWildCard = bParts[i] === '*' || bParts[i].startsWith(':');\n // // if both are wildcard we compare next component\n // if (aWildCard && bWildCard) {\n // continue;\n // }\n // // if only a is wild card, b get higher priority\n // if (aWildCard) {\n // return 1;\n // }\n // // if only b is wild card, a get higher priority\n // if (bWildCard) {\n // return -1;\n // }\n // }\n // return bParts.length - aParts.length;\n // });\n}\n\nfunction checkForDuplicatedConfigs(configs: RouteConfig[]) {\n // Check for duplicate patterns in the config\n configs.reduce>((acc, config) => {\n if (acc[config.pattern]) {\n const a = acc[config.pattern].routeNames;\n const b = config.routeNames;\n\n // It's not a problem if the path string omitted from a inner most screen\n // For example, it's ok if a path resolves to `A > B > C` or `A > B`\n const intersects =\n a.length > b.length ? b.every((it, i) => a[i] === it) : a.every((it, i) => b[i] === it);\n\n if (!intersects) {\n throw new Error(\n `Found conflicting screens with the same pattern. The pattern '${\n config.pattern\n }' resolves to both '${a.join(' > ')}' and '${b.join(\n ' > '\n )}'. Patterns must be unique and cannot resolve to more than one screen.`\n );\n }\n }\n\n return Object.assign(acc, {\n [config.pattern]: config,\n });\n }, {});\n}\n\nfunction getConfigsWithRegexes(configs: RouteConfig[]) {\n return configs.map((c) => ({\n ...c,\n // Add `$` to the regex to make sure it matches till end of the path and not just beginning\n // START FORK\n // regex: c.regex ? new RegExp(c.regex.source + '$') : undefined,\n regex: expo.configRegExp(c),\n // END FORK\n }));\n}\n\nconst joinPaths = (...paths: string[]): string =>\n ([] as string[])\n .concat(...paths.map((p) => p.split('/')))\n .filter(Boolean)\n .join('/');\n\nconst matchAgainstConfigs = (remaining: string, configs: RouteConfig[]) => {\n let routes: ParsedRoute[] | undefined;\n let remainingPath = remaining;\n\n // START FORK\n const allParams = Object.create(null);\n // END FORK\n\n // Go through all configs, and see if the next path segment matches our regex\n for (const config of configs) {\n if (!config.regex) {\n continue;\n }\n\n const match = remainingPath.match(config.regex);\n\n // If our regex matches, we need to extract params from the path\n if (match) {\n const matchResult = config.pattern?.split('/').reduce<{\n pos: number; // Position of the current path param segment in the path (e.g in pattern `a/:b/:c`, `:a` is 0 and `:b` is 1)\n matchedParams: Record>; // The extracted params\n }>(\n (acc, p, index) => {\n if (!expo.isDynamicPart(p)) {\n return acc;\n }\n\n acc.pos += 1;\n\n // START FORK\n const decodedParamSegment = expo.safelyDecodeURIComponent(\n // const decodedParamSegment = decodeURIComponent(\n // The param segments appear every second item starting from 2 in the regex match result\n match![(acc.pos + 1) * 2]\n // Remove trailing slash\n .replace(/\\/$/, '')\n );\n // END FORK\n\n Object.assign(acc.matchedParams, {\n [p]: Object.assign(acc.matchedParams[p] || {}, {\n [index]: decodedParamSegment,\n }),\n });\n\n return acc;\n },\n { pos: -1, matchedParams: {} }\n );\n\n const matchedParams = matchResult.matchedParams || {};\n\n routes = config.routeNames.map((name) => {\n const routeConfig = configs.find((c) => {\n // Check matching name AND pattern in case same screen is used at different levels in config\n return c.screen === name && config.pattern.startsWith(c.pattern);\n });\n\n // Normalize pattern to remove any leading, trailing slashes, duplicate slashes etc.\n const normalizedPath = routeConfig?.path.split('/').filter(Boolean).join('/');\n\n // Get the number of segments in the initial pattern\n const numInitialSegments = routeConfig?.pattern\n // Extract the prefix from the pattern by removing the ending path pattern (e.g pattern=`a/b/c/d` and normalizedPath=`c/d` becomes `a/b`)\n .replace(new RegExp(`${escape(normalizedPath!)}$`), '')\n ?.split('/').length;\n\n const params = normalizedPath\n ?.split('/')\n .reduce>((acc, p, index) => {\n if (!expo.isDynamicPart(p)) {\n return acc;\n }\n\n // Get the real index of the path parameter in the matched path\n // by offsetting by the number of segments in the initial pattern\n const offset = numInitialSegments ? numInitialSegments - 1 : 0;\n // START FORK\n // const value = matchedParams[p]?.[index + offset];\n const value = expo.getParamValue(p, matchedParams[p]?.[index + offset]);\n // END FORK\n\n if (value) {\n // START FORK\n // const key = p.replace(/^:/, '').replace(/\\?$/, '');\n const key = expo.replacePart(p);\n // END FORK\n acc[key] = routeConfig?.parse?.[key] ? routeConfig.parse[key](value as any) : value;\n }\n\n return acc;\n }, {});\n\n if (params && Object.keys(params).length) {\n Object.assign(allParams, params);\n return { name, params };\n }\n\n return { name };\n });\n\n remainingPath = remainingPath.replace(match[1], '');\n\n break;\n }\n }\n\n // START FORK\n expo.populateParams(routes, allParams);\n // END FORK\n\n return { routes, remainingPath };\n};\n\nconst createNormalizedConfigs = (\n screen: string,\n routeConfig: PathConfigMap,\n routeNames: string[] = [],\n initials: InitialRouteConfig[],\n parentScreens: string[],\n parentPattern?: string\n): RouteConfig[] => {\n const configs: RouteConfig[] = [];\n\n routeNames.push(screen);\n\n parentScreens.push(screen);\n\n // @ts-expect-error: TODO(@kitten): This is entirely untyped. The index access just flags this, but we're not typing the config properly here\n const config = routeConfig[screen];\n\n if (typeof config === 'string') {\n // If a string is specified as the value of the key(e.g. Foo: '/path'), use it as the pattern\n const pattern = parentPattern ? joinPaths(parentPattern, config) : config;\n\n configs.push(createConfigItem(screen, routeNames, pattern, config));\n } else if (typeof config === 'object') {\n let pattern: string | undefined;\n\n // if an object is specified as the value (e.g. Foo: { ... }),\n // it can have `path` property and\n // it could have `screens` prop which has nested configs\n if (typeof config.path === 'string') {\n if (config.exact && config.path === undefined) {\n throw new Error(\n \"A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.\"\n );\n }\n\n pattern =\n config.exact !== true\n ? joinPaths(parentPattern || '', config.path || '')\n : config.path || '';\n\n if (screen !== INTERNAL_SLOT_NAME) {\n configs.push(\n createConfigItem(screen, routeNames, pattern!, config.path, config.parse, config)\n );\n }\n }\n\n if (config.screens) {\n // property `initialRouteName` without `screens` has no purpose\n if (config.initialRouteName) {\n initials.push({\n initialRouteName: config.initialRouteName,\n parentScreens,\n });\n }\n\n Object.keys(config.screens).forEach((nestedConfig) => {\n const result = createNormalizedConfigs(\n nestedConfig,\n config.screens as PathConfigMap,\n routeNames,\n initials,\n [...parentScreens],\n pattern ?? parentPattern\n );\n\n configs.push(...result);\n });\n }\n }\n\n routeNames.pop();\n\n return configs;\n};\n\nconst createConfigItem = (\n screen: string,\n routeNames: string[],\n pattern: string,\n path: string,\n parse: ParseConfig | undefined = undefined,\n config: Record = {}\n): RouteConfig => {\n // Normalize pattern to remove any leading, trailing slashes, duplicate slashes etc.\n pattern = pattern.split('/').filter(Boolean).join('/');\n\n // START FORK\n const regex = pattern ? expo.routePatternToRegex(pattern) : undefined;\n // const regex = pattern\n // ? new RegExp(\n // `^(${pattern\n // .split('/')\n // .map((it) => {\n // if (it.startsWith(':')) {\n // return `(([^/]+\\\\/)${it.endsWith('?') ? '?' : ''})`;\n // }\n\n // return `${it === '*' ? '.*' : escape(it)}\\\\/`;\n // })\n // .join('')})`\n // )\n // : undefined;\n // END FORK\n\n return {\n screen,\n regex,\n pattern,\n path,\n // The routeNames array is mutated, so copy it to keep the current state\n routeNames: [...routeNames],\n parse,\n // START FORK\n ...expo.createConfig(screen, pattern, routeNames, config),\n // END FORK\n };\n};\n\nconst findParseConfigForRoute = (\n routeName: string,\n flatConfig: RouteConfig[]\n): ParseConfig | undefined => {\n for (const config of flatConfig) {\n if (routeName === config.routeNames[config.routeNames.length - 1]) {\n return config.parse;\n }\n }\n\n return undefined;\n};\n\n// Try to find an initial route connected with the one passed\nconst findInitialRoute = (\n routeName: string,\n parentScreens: string[],\n initialRoutes: InitialRouteConfig[]\n): string | undefined => {\n for (const config of initialRoutes) {\n if (parentScreens.length === config.parentScreens.length) {\n let sameParents = true;\n for (let i = 0; i < parentScreens.length; i++) {\n if (parentScreens[i].localeCompare(config.parentScreens[i]) !== 0) {\n sameParents = false;\n break;\n }\n }\n if (sameParents) {\n return routeName !== config.initialRouteName ? config.initialRouteName : undefined;\n }\n }\n }\n return undefined;\n};\n\n// returns state object with values depending on whether\n// it is the end of state and if there is initialRoute for this level\nconst createStateObject = (\n initialRoute: string | undefined,\n route: ParsedRoute,\n isEmpty: boolean\n): InitialState => {\n if (isEmpty) {\n if (initialRoute) {\n return {\n index: 1,\n routes: [{ name: initialRoute, params: route.params }, route],\n };\n } else {\n return {\n routes: [route],\n };\n }\n } else {\n if (initialRoute) {\n return {\n index: 1,\n routes: [\n { name: initialRoute, params: route.params },\n { ...route, state: { routes: [] } },\n ],\n };\n } else {\n return {\n routes: [{ ...route, state: { routes: [] } }],\n };\n }\n }\n};\n\nconst createNestedStateObject = (\n { path, ...expoURL }: ReturnType,\n routes: ParsedRoute[],\n initialRoutes: InitialRouteConfig[],\n flatConfig?: RouteConfig[],\n hash?: string\n) => {\n let route = routes.shift() as ParsedRoute;\n const parentScreens: string[] = [];\n\n let initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);\n\n parentScreens.push(route.name);\n\n const state: InitialState = createStateObject(initialRoute, route, routes.length === 0);\n\n if (routes.length > 0) {\n let nestedState = state;\n\n while ((route = routes.shift() as ParsedRoute)) {\n initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);\n\n const nestedStateIndex = nestedState.index || nestedState.routes.length - 1;\n\n nestedState.routes[nestedStateIndex].state = createStateObject(\n initialRoute,\n route,\n routes.length === 0\n );\n\n if (routes.length > 0) {\n nestedState = nestedState.routes[nestedStateIndex].state as InitialState;\n }\n\n parentScreens.push(route.name);\n }\n }\n\n route = findFocusedRoute(state) as ParsedRoute;\n // START FORK\n route.path = expoURL.pathWithoutGroups;\n // route.path = path;\n // END FORK\n\n // START FORK\n // const params = parseQueryParams(\n const params = expo.parseQueryParams(\n path,\n route,\n flatConfig ? findParseConfigForRoute(route.name, flatConfig) : undefined,\n hash\n );\n // END FORK\n\n // START FORK\n // expo.handleUrlParams(route, params, hash);\n if (params) {\n route.params = { ...route.params, ...params };\n }\n // END FORK\n\n return state;\n};\n\n// START FORK\n// const parseQueryParams = (path: string, parseConfig?: Record any>) => {\n// const query = path.split('?')[1];\n// const params = queryString.parse(query);\n\n// if (parseConfig) {\n// Object.keys(params).forEach((name) => {\n// if (Object.hasOwnProperty.call(parseConfig, name) && typeof params[name] === 'string') {\n// params[name] = parseConfig[name](params[name] as string);\n// }\n// });\n// }\n\n// return Object.keys(params).length ? params : undefined;\n// };\n// END FORK\n"]} \ No newline at end of file +{"version":3,"file":"getStateFromPath.js","sourceRoot":"","sources":["../../src/fork/getStateFromPath.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,4CA8GC;AAnLD,gFAA0C;AAE1C,yDAAsD;AAEtD,+DAAiD;AACjD,4CAAkD;AAElD,uDAAgE;AAyChE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,S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AAC;YAED,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAED,KAAK,GAAG,IAAA,mCAAgB,EAAC,KAAK,CAAgB,CAAC;IAC/C,aAAa;IACb,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,iBAAiB,CAAC;IACvC,qBAAqB;IACrB,WAAW;IAEX,aAAa;IACb,mCAAmC;IACnC,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAClC,IAAI,EACJ,KAAK,EACL,UAAU,CAAC,CAAC,CAAC,uBAAuB,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,EACxE,IAAI,CACL,CAAC;IACF,WAAW;IAEX,aAAa;IACb,6CAA6C;IAC7C,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,CAAC,MAAM,GAAG,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAChD,CAAC;IACD,WAAW;IAEX,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,aAAa;AACb,qGAAqG;AACrG,sCAAsC;AACtC,6CAA6C;AAE7C,uBAAuB;AACvB,8CAA8C;AAC9C,iGAAiG;AACjG,oEAAoE;AACpE,UAAU;AACV,UAAU;AACV,MAAM;AAEN,4DAA4D;AAC5D,KAAK;AACL,WAAW","sourcesContent":["import escape from 'escape-string-regexp';\n\nimport { findFocusedRoute } from './findFocusedRoute';\nimport type { ExpoOptions, ExpoRouteConfig } from './getStateFromPath-forks';\nimport * as expo from './getStateFromPath-forks';\nimport { INTERNAL_SLOT_NAME } from '../constants';\nimport type { PathConfigMap } from '../react-navigation/native';\nimport { validatePathConfig } from '../react-navigation/native';\nimport type { InitialState, NavigationState, PartialState } from '../react-navigation/routers';\n\nexport type Options = ExpoOptions & {\n path?: string;\n initialRouteName?: string;\n screens: PathConfigMap;\n};\n\ntype ParseConfig = Record any>;\n\nexport type RouteConfig = ExpoRouteConfig & {\n screen: string;\n regex?: RegExp;\n path: string;\n pattern: string;\n routeNames: string[];\n parse?: ParseConfig;\n};\n\nexport type InitialRouteConfig = {\n initialRouteName: string;\n parentScreens: string[];\n};\n\nexport type ResultState = PartialState & {\n state?: ResultState;\n};\n\nexport type ParsedRoute = {\n name: string;\n path?: string;\n params?: Record | undefined;\n};\n\ntype ConfigResources = {\n initialRoutes: InitialRouteConfig[];\n configs: RouteConfig[];\n configWithRegexes: RouteConfig[];\n};\n\n/**\n * Utility to parse a path string to initial state object accepted by the container.\n * This is useful for deep linking when we need to handle the incoming URL.\n *\n * @example\n * ```js\n * getStateFromPath(\n * '/chat/jane/42',\n * {\n * screens: {\n * Chat: {\n * path: 'chat/:author/:id',\n * parse: { id: Number }\n * }\n * }\n * }\n * )\n * ```\n * @param path Path string to parse and convert, e.g. /foo/bar?count=42.\n * @param options Extra options to fine-tune how to parse the path.\n */\nexport function getStateFromPath(\n path: string,\n options?: Options,\n // START FORK\n segments: string[] = []\n // END FORK\n): ResultState | undefined {\n const { initialRoutes, configs, configWithRegexes } = getConfigResources(\n options,\n // START FORK\n segments\n // END FORK\n );\n\n const screens = options?.screens;\n\n // START FORK\n const expoPath = expo.getUrlWithReactNavigationConcessions(path);\n // END FORK\n\n // START FORK\n let remaining = expo.cleanPath(expoPath.nonstandardPathname);\n // let remaining = path\n // .replace(/\\/+/g, '/') // Replace multiple slash (//) with single ones\n // .replace(/^\\//, '') // Remove extra leading slash\n // .replace(/\\?.*$/, ''); // Remove query params which we will handle later\n\n // // Make sure there is a trailing slash\n // remaining = remaining.endsWith('/') ? remaining : `${remaining}/`;\n // END FORK\n\n const prefix = options?.path?.replace(/^\\//, ''); // Remove extra leading slash\n\n if (prefix) {\n // Make sure there is a trailing slash\n const normalizedPrefix = prefix.endsWith('/') ? prefix : `${prefix}/`;\n\n // If the path doesn't start with the prefix, it's not a match\n if (!remaining.startsWith(normalizedPrefix)) {\n return undefined;\n }\n\n // Remove the prefix from the path\n remaining = remaining.replace(normalizedPrefix, '');\n }\n\n if (screens === undefined) {\n // When no config is specified, use the path segments as route names\n const routes = remaining\n .split('/')\n .filter(Boolean)\n .map((segment) => {\n const name = decodeURIComponent(segment);\n return { name };\n });\n\n if (routes.length) {\n return createNestedStateObject(expoPath, routes, initialRoutes, [], expoPath.hash);\n }\n\n return undefined;\n }\n\n if (remaining === '/') {\n // We need to add special handling of empty path so navigation to empty path also works\n // When handling empty path, we should only look at the root level config\n // START FORK\n const match = expo.matchForEmptyPath(configWithRegexes);\n // const match = configs.find(\n // (config) =>\n // config.path === '' &&\n // config.routeNames.every(\n // // Make sure that none of the parent configs have a non-empty path defined\n // (name) => !configs.find((c) => c.screen === name)?.path\n // )\n // );\n // END FORK\n\n if (match) {\n return createNestedStateObject(\n expoPath,\n match.routeNames.map((name) => ({ name })),\n initialRoutes,\n configs,\n expoPath.hash\n );\n }\n\n return undefined;\n }\n\n let result: PartialState | undefined;\n let current: PartialState | undefined;\n\n // We match the whole path against the regex instead of segments\n // This makes sure matches such as wildcard will catch any unmatched routes, even if nested\n const { routes, remainingPath } = matchAgainstConfigs(remaining, configWithRegexes);\n\n if (routes !== undefined) {\n // This will always be empty if full path matched\n current = createNestedStateObject(expoPath, routes, initialRoutes, configs, expoPath.hash);\n remaining = remainingPath;\n result = current;\n }\n\n if (current == null || result == null) {\n return undefined;\n }\n\n return result;\n}\n\n/**\n * Reference to the last used config resources. This is used to avoid recomputing the config resources when the options are the same.\n */\nlet cachedConfigResources: [Options | undefined, ConfigResources] = [\n undefined,\n prepareConfigResources(),\n];\n\nfunction getConfigResources(\n options: Options | undefined,\n // START FORK\n previousSegments?: string[]\n // END FORK\n) {\n // START FORK - We need to disable this caching as our configs can change based upon the current state\n // if (cachedConfigResources[0] !== options) {\n cachedConfigResources = [options, prepareConfigResources(options, previousSegments)];\n // }\n // END FORK FORK\n\n return cachedConfigResources[1];\n}\n\nfunction prepareConfigResources(options?: Options, previousSegments?: string[]) {\n if (options) {\n validatePathConfig(options);\n }\n\n const initialRoutes = getInitialRoutes(options);\n\n const configs = getNormalizedConfigs(initialRoutes, options?.screens, previousSegments);\n\n checkForDuplicatedConfigs(configs);\n\n const configWithRegexes = getConfigsWithRegexes(configs);\n\n return {\n initialRoutes,\n configs,\n configWithRegexes,\n };\n}\n\nfunction getInitialRoutes(options?: Options) {\n const initialRoutes: InitialRouteConfig[] = [];\n\n if (options?.initialRouteName) {\n initialRoutes.push({\n initialRouteName: options.initialRouteName,\n parentScreens: [],\n });\n }\n\n return initialRoutes;\n}\n\nfunction getNormalizedConfigs(\n initialRoutes: InitialRouteConfig[],\n screens: PathConfigMap = {},\n // START FORK\n previousSegments?: string[]\n // END FORK\n) {\n // Create a normalized configs array which will be easier to use\n return ([] as RouteConfig[])\n .concat(\n ...Object.keys(screens).map((key) =>\n createNormalizedConfigs(key, screens as PathConfigMap, [], initialRoutes, [])\n )\n )\n .map(expo.appendIsInitial(initialRoutes))\n .sort(expo.getRouteConfigSorter(previousSegments));\n // .sort((a, b) => {\n // // Sort config so that:\n // // - the most exhaustive ones are always at the beginning\n // // - patterns with wildcard are always at the end\n\n // // If 2 patterns are same, move the one with less route names up\n // // This is an error state, so it's only useful for consistent error messages\n // if (a.pattern === b.pattern) {\n // return b.routeNames.join('>').localeCompare(a.routeNames.join('>'));\n // }\n\n // // If one of the patterns starts with the other, it's more exhaustive\n // // So move it up\n // if (a.pattern.startsWith(b.pattern)) {\n // return -1;\n // }\n\n // if (b.pattern.startsWith(a.pattern)) {\n // return 1;\n // }\n\n // const aParts = a.pattern.split('/');\n // const bParts = b.pattern.split('/');\n\n // for (let i = 0; i < Math.max(aParts.length, bParts.length); i++) {\n // // if b is longer, b get higher priority\n // if (aParts[i] == null) {\n // return 1;\n // }\n // // if a is longer, a get higher priority\n // if (bParts[i] == null) {\n // return -1;\n // }\n // const aWildCard = aParts[i] === '*' || aParts[i].startsWith(':');\n // const bWildCard = bParts[i] === '*' || bParts[i].startsWith(':');\n // // if both are wildcard we compare next component\n // if (aWildCard && bWildCard) {\n // continue;\n // }\n // // if only a is wild card, b get higher priority\n // if (aWildCard) {\n // return 1;\n // }\n // // if only b is wild card, a get higher priority\n // if (bWildCard) {\n // return -1;\n // }\n // }\n // return bParts.length - aParts.length;\n // });\n}\n\nfunction checkForDuplicatedConfigs(configs: RouteConfig[]) {\n // Check for duplicate patterns in the config\n configs.reduce>((acc, config) => {\n if (acc[config.pattern]) {\n const a = acc[config.pattern]!.routeNames;\n const b = config.routeNames;\n\n // It's not a problem if the path string omitted from a inner most screen\n // For example, it's ok if a path resolves to `A > B > C` or `A > B`\n const intersects =\n a.length > b.length ? b.every((it, i) => a[i] === it) : a.every((it, i) => b[i] === it);\n\n if (!intersects) {\n throw new Error(\n `Found conflicting screens with the same pattern. The pattern '${\n config.pattern\n }' resolves to both '${a.join(' > ')}' and '${b.join(\n ' > '\n )}'. Patterns must be unique and cannot resolve to more than one screen.`\n );\n }\n }\n\n return Object.assign(acc, {\n [config.pattern]: config,\n });\n }, {});\n}\n\nfunction getConfigsWithRegexes(configs: RouteConfig[]) {\n return configs.map((c) => ({\n ...c,\n // Add `$` to the regex to make sure it matches till end of the path and not just beginning\n // START FORK\n // regex: c.regex ? new RegExp(c.regex.source + '$') : undefined,\n regex: expo.configRegExp(c),\n // END FORK\n }));\n}\n\nconst joinPaths = (...paths: string[]): string =>\n ([] as string[])\n .concat(...paths.map((p) => p.split('/')))\n .filter(Boolean)\n .join('/');\n\nconst matchAgainstConfigs = (remaining: string, configs: RouteConfig[]) => {\n let routes: ParsedRoute[] | undefined;\n let remainingPath = remaining;\n\n // START FORK\n const allParams = Object.create(null);\n // END FORK\n\n // Go through all configs, and see if the next path segment matches our regex\n for (const config of configs) {\n if (!config.regex) {\n continue;\n }\n\n const match = remainingPath.match(config.regex);\n\n // If our regex matches, we need to extract params from the path\n if (match) {\n const matchResult = config.pattern?.split('/').reduce<{\n pos: number; // Position of the current path param segment in the path (e.g in pattern `a/:b/:c`, `:a` is 0 and `:b` is 1)\n matchedParams: Record>; // The extracted params\n }>(\n (acc, p, index) => {\n if (!expo.isDynamicPart(p)) {\n return acc;\n }\n\n acc.pos += 1;\n\n // START FORK\n const decodedParamSegment = expo.safelyDecodeURIComponent(\n // const decodedParamSegment = decodeURIComponent(\n // The param segments appear every second item starting from 2 in the regex match result\n match[(acc.pos + 1) * 2]! // Remove trailing slash\n .replace(/\\/$/, '')\n );\n // END FORK\n\n Object.assign(acc.matchedParams, {\n [p]: Object.assign(acc.matchedParams[p] || {}, {\n [index]: decodedParamSegment,\n }),\n });\n\n return acc;\n },\n { pos: -1, matchedParams: {} }\n );\n\n const matchedParams = matchResult.matchedParams || {};\n\n routes = config.routeNames.map((name) => {\n const routeConfig = configs.find((c) => {\n // Check matching name AND pattern in case same screen is used at different levels in config\n return c.screen === name && config.pattern.startsWith(c.pattern);\n });\n\n // Normalize pattern to remove any leading, trailing slashes, duplicate slashes etc.\n const normalizedPath = routeConfig?.path.split('/').filter(Boolean).join('/');\n\n // Get the number of segments in the initial pattern\n const numInitialSegments = routeConfig?.pattern\n // Extract the prefix from the pattern by removing the ending path pattern (e.g pattern=`a/b/c/d` and normalizedPath=`c/d` becomes `a/b`)\n .replace(new RegExp(`${escape(normalizedPath!)}$`), '')\n ?.split('/').length;\n\n const params = normalizedPath\n ?.split('/')\n .reduce>((acc, p, index) => {\n if (!expo.isDynamicPart(p)) {\n return acc;\n }\n\n // Get the real index of the path parameter in the matched path\n // by offsetting by the number of segments in the initial pattern\n const offset = numInitialSegments ? numInitialSegments - 1 : 0;\n // START FORK\n // const value = matchedParams[p]?.[index + offset];\n // TODO(@kitten): Assess which is intended, non-optional or getParamValue accepting undefined\n const value = expo.getParamValue(p, matchedParams[p]?.[index + offset]!);\n // END FORK\n\n if (value) {\n // START FORK\n // const key = p.replace(/^:/, '').replace(/\\?$/, '');\n const key = expo.replacePart(p);\n // END FORK\n acc[key] = routeConfig?.parse?.[key] ? routeConfig.parse[key](value as any) : value;\n }\n\n return acc;\n }, {});\n\n if (params && Object.keys(params).length) {\n Object.assign(allParams, params);\n return { name, params };\n }\n\n return { name };\n });\n\n remainingPath = remainingPath.replace(match[1]!, '');\n\n break;\n }\n }\n\n // START FORK\n expo.populateParams(routes, allParams);\n // END FORK\n\n return { routes, remainingPath };\n};\n\nconst createNormalizedConfigs = (\n screen: string,\n routeConfig: PathConfigMap,\n routeNames: string[] = [],\n initials: InitialRouteConfig[],\n parentScreens: string[],\n parentPattern?: string\n): RouteConfig[] => {\n const configs: RouteConfig[] = [];\n\n routeNames.push(screen);\n\n parentScreens.push(screen);\n\n // @ts-expect-error: TODO(@kitten): This is entirely untyped. The index access just flags this, but we're not typing the config properly here\n const config = routeConfig[screen];\n\n if (typeof config === 'string') {\n // If a string is specified as the value of the key(e.g. Foo: '/path'), use it as the pattern\n const pattern = parentPattern ? joinPaths(parentPattern, config) : config;\n\n configs.push(createConfigItem(screen, routeNames, pattern, config));\n } else if (typeof config === 'object') {\n let pattern: string | undefined;\n\n // if an object is specified as the value (e.g. Foo: { ... }),\n // it can have `path` property and\n // it could have `screens` prop which has nested configs\n if (typeof config.path === 'string') {\n if (config.exact && config.path === undefined) {\n throw new Error(\n \"A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.\"\n );\n }\n\n pattern =\n config.exact !== true\n ? joinPaths(parentPattern || '', config.path || '')\n : config.path || '';\n\n if (screen !== INTERNAL_SLOT_NAME) {\n configs.push(\n createConfigItem(screen, routeNames, pattern!, config.path, config.parse, config)\n );\n }\n }\n\n if (config.screens) {\n // property `initialRouteName` without `screens` has no purpose\n if (config.initialRouteName) {\n initials.push({\n initialRouteName: config.initialRouteName,\n parentScreens,\n });\n }\n\n Object.keys(config.screens).forEach((nestedConfig) => {\n const result = createNormalizedConfigs(\n nestedConfig,\n config.screens as PathConfigMap,\n routeNames,\n initials,\n [...parentScreens],\n pattern ?? parentPattern\n );\n\n configs.push(...result);\n });\n }\n }\n\n routeNames.pop();\n\n return configs;\n};\n\nconst createConfigItem = (\n screen: string,\n routeNames: string[],\n pattern: string,\n path: string,\n parse: ParseConfig | undefined = undefined,\n config: Record = {}\n): RouteConfig => {\n // Normalize pattern to remove any leading, trailing slashes, duplicate slashes etc.\n pattern = pattern.split('/').filter(Boolean).join('/');\n\n // START FORK\n const regex = pattern ? expo.routePatternToRegex(pattern) : undefined;\n // const regex = pattern\n // ? new RegExp(\n // `^(${pattern\n // .split('/')\n // .map((it) => {\n // if (it.startsWith(':')) {\n // return `(([^/]+\\\\/)${it.endsWith('?') ? '?' : ''})`;\n // }\n\n // return `${it === '*' ? '.*' : escape(it)}\\\\/`;\n // })\n // .join('')})`\n // )\n // : undefined;\n // END FORK\n\n return {\n screen,\n regex,\n pattern,\n path,\n // The routeNames array is mutated, so copy it to keep the current state\n routeNames: [...routeNames],\n parse,\n // START FORK\n ...expo.createConfig(screen, pattern, routeNames, config),\n // END FORK\n };\n};\n\nconst findParseConfigForRoute = (\n routeName: string,\n flatConfig: RouteConfig[]\n): ParseConfig | undefined => {\n for (const config of flatConfig) {\n if (routeName === config.routeNames[config.routeNames.length - 1]) {\n return config.parse;\n }\n }\n\n return undefined;\n};\n\n// Try to find an initial route connected with the one passed\nconst findInitialRoute = (\n routeName: string,\n parentScreens: string[],\n initialRoutes: InitialRouteConfig[]\n): string | undefined => {\n for (const config of initialRoutes) {\n if (parentScreens.length === config.parentScreens.length) {\n let sameParents = true;\n for (let i = 0; i < parentScreens.length; i++) {\n if (parentScreens[i]!.localeCompare(config.parentScreens[i]!) !== 0) {\n sameParents = false;\n break;\n }\n }\n if (sameParents) {\n return routeName !== config.initialRouteName ? config.initialRouteName : undefined;\n }\n }\n }\n return undefined;\n};\n\n// returns state object with values depending on whether\n// it is the end of state and if there is initialRoute for this level\nconst createStateObject = (\n initialRoute: string | undefined,\n route: ParsedRoute,\n isEmpty: boolean\n): InitialState => {\n if (isEmpty) {\n if (initialRoute) {\n return {\n index: 1,\n routes: [{ name: initialRoute, params: route.params }, route],\n };\n } else {\n return {\n routes: [route],\n };\n }\n } else {\n if (initialRoute) {\n return {\n index: 1,\n routes: [\n { name: initialRoute, params: route.params },\n { ...route, state: { routes: [] } },\n ],\n };\n } else {\n return {\n routes: [{ ...route, state: { routes: [] } }],\n };\n }\n }\n};\n\nconst createNestedStateObject = (\n { path, ...expoURL }: ReturnType,\n routes: ParsedRoute[],\n initialRoutes: InitialRouteConfig[],\n flatConfig?: RouteConfig[],\n hash?: string\n) => {\n let route = routes.shift() as ParsedRoute;\n const parentScreens: string[] = [];\n\n let initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);\n\n parentScreens.push(route.name);\n\n const state: InitialState = createStateObject(initialRoute, route, routes.length === 0);\n\n if (routes.length > 0) {\n let nestedState = state;\n\n while ((route = routes.shift() as ParsedRoute)) {\n initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);\n\n const nestedStateIndex = nestedState.index || nestedState.routes.length - 1;\n\n nestedState.routes[nestedStateIndex]!.state = createStateObject(\n initialRoute,\n route,\n routes.length === 0\n );\n\n if (routes.length > 0) {\n nestedState = nestedState.routes[nestedStateIndex]!.state as InitialState;\n }\n\n parentScreens.push(route.name);\n }\n }\n\n route = findFocusedRoute(state) as ParsedRoute;\n // START FORK\n route.path = expoURL.pathWithoutGroups;\n // route.path = path;\n // END FORK\n\n // START FORK\n // const params = parseQueryParams(\n const params = expo.parseQueryParams(\n path,\n route,\n flatConfig ? findParseConfigForRoute(route.name, flatConfig) : undefined,\n hash\n );\n // END FORK\n\n // START FORK\n // expo.handleUrlParams(route, params, hash);\n if (params) {\n route.params = { ...route.params, ...params };\n }\n // END FORK\n\n return state;\n};\n\n// START FORK\n// const parseQueryParams = (path: string, parseConfig?: Record any>) => {\n// const query = path.split('?')[1];\n// const params = queryString.parse(query);\n\n// if (parseConfig) {\n// Object.keys(params).forEach((name) => {\n// if (Object.hasOwnProperty.call(parseConfig, name) && typeof params[name] === 'string') {\n// params[name] = parseConfig[name](params[name] as string);\n// }\n// });\n// }\n\n// return Object.keys(params).length ? params : undefined;\n// };\n// END FORK\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/fork/native-stack/composition-options/CompositionOptionsContext.js b/packages/expo-router/build/fork/native-stack/composition-options/CompositionOptionsContext.js index 7861d83038f67d..f8ed354626f094 100644 --- a/packages/expo-router/build/fork/native-stack/composition-options/CompositionOptionsContext.js +++ b/packages/expo-router/build/fork/native-stack/composition-options/CompositionOptionsContext.js @@ -26,7 +26,7 @@ function registryReducer(state, action) { if (!existing || filtered?.length === existing.length) { return state; } - if (filtered.length === 0) { + if (!filtered?.length) { const { [routeKey]: _, ...newState } = state; return newState; } diff --git a/packages/expo-router/build/fork/native-stack/composition-options/CompositionOptionsContext.js.map b/packages/expo-router/build/fork/native-stack/composition-options/CompositionOptionsContext.js.map index e28df514b9ce69..6d9d8e97c8fc8d 100644 --- a/packages/expo-router/build/fork/native-stack/composition-options/CompositionOptionsContext.js.map +++ b/packages/expo-router/build/fork/native-stack/composition-options/CompositionOptionsContext.js.map @@ -1 +1 @@ -{"version":3,"file":"CompositionOptionsContext.js","sourceRoot":"","sources":["../../../../src/fork/native-stack/composition-options/CompositionOptionsContext.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAqBb,0CA0BC;AASD,wDAgBC;AAQD,oDAiBC;AA/FD,iCAA6E;AAG7E,6DAA4D;AAE5D,4EAAyE;AAEzE,gBAAgB;AACH,QAAA,kBAAkB,GAAG,IAAA,qBAAa,EAAiC,IAAI,CAAC,CAAC;AAUtF,gBAAgB;AAChB,SAAgB,eAAe,CAC7B,KAA0B,EAC1B,MAAsB;IAEtB,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QAC1B,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QACrC,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACvC,OAAO,KAAK,C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CAAC,CAAC;IAEP,MAAM,KAAK,GAAG,IAAA,mBAAW,EAAC,CAAC,QAAgB,EAAE,OAA8C,EAAE,EAAE;QAC7F,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IACjD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,YAAY,GAAG,IAAA,eAAO,EAC1B,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAmC,EACxD,CAAC,GAAG,EAAE,KAAK,CAAC,CACb,CAAC;IACF,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,oBAAoB,CAAC,OAA8C;IACjF,MAAM,OAAO,GAAG,IAAA,WAAG,EAAC,0BAAkB,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,mHAAmH,CACpH,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,IAAA,iBAAQ,GAAE,CAAC;IACzB,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAE/B,IAAA,yCAAmB,EAAC,GAAG,EAAE;QACvB,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACxB,OAAO,GAAG,EAAE;YACV,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AACvC,CAAC","sourcesContent":["'use client';\n\nimport { createContext, use, useCallback, useMemo, useReducer } from 'react';\n\nimport type { CompositionContextValue, CompositionRegistry } from './types';\nimport { useRoute } from '../../../react-navigation/native';\nimport type { NativeStackNavigationOptions } from '../../../react-navigation/native-stack';\nimport { useSafeLayoutEffect } from '../../../views/useSafeLayoutEffect';\n\n/** @internal */\nexport const CompositionContext = createContext(null);\n\ntype RegistryAction =\n | {\n type: 'set';\n routeKey: string;\n options: Partial;\n }\n | { type: 'unset'; routeKey: string; options: Partial };\n\n/** @internal */\nexport function registryReducer(\n state: CompositionRegistry,\n action: RegistryAction\n): CompositionRegistry {\n if (action.type === 'set') {\n const { routeKey, options } = action;\n if (state[routeKey]?.includes(options)) {\n return state;\n }\n return { ...state, [routeKey]: [...(state[routeKey] ?? []), options] };\n }\n\n if (action.type === 'unset') {\n const { routeKey, options } = action;\n const existing = state[routeKey];\n const filtered = existing?.filter((o) => o !== options);\n if (!existing || filtered?.length === existing.length) {\n return state;\n }\n if (filtered.length === 0) {\n const { [routeKey]: _, ...newState } = state;\n return newState;\n }\n return { ...state, [routeKey]: filtered };\n }\n return state;\n}\n\n/**\n * Provides the composition registry to descendant composition components.\n *\n * Uses useReducer with immutable object updates for React Compiler compatibility.\n * Each set/unset call produces a new object reference, which the compiler can\n * track as a reactive dependency.\n */\nexport function useCompositionRegistry() {\n const [registry, dispatch] = useReducer(registryReducer, {} as CompositionRegistry);\n\n const set = useCallback((routeKey: string, options: Partial) => {\n dispatch({ type: 'set', routeKey, options });\n }, []);\n\n const unset = useCallback((routeKey: string, options: Partial) => {\n dispatch({ type: 'unset', routeKey, options });\n }, []);\n\n const contextValue = useMemo(\n () => ({ set, unset }) satisfies CompositionContextValue,\n [set, unset]\n );\n return { registry, contextValue };\n}\n\n/**\n * Hook used by composition components to register their options in the composition registry.\n *\n * Registers options on mount/update via useSafeLayoutEffect, and unregisters on unmount.\n * Callers should memoize the options object to avoid unnecessary re-registrations.\n */\nexport function useCompositionOption(options: Partial) {\n const context = use(CompositionContext);\n if (!context) {\n throw new Error(\n 'useCompositionOption must be used within a RouterCompositionOptionsProvider. This is likely a bug in Expo Router.'\n );\n }\n\n const route = useRoute();\n const { set, unset } = context;\n\n useSafeLayoutEffect(() => {\n set(route.key, options);\n return () => {\n unset(route.key, options);\n };\n }, [route.key, set, unset, options]);\n}\n"]} \ No newline at end of file +{"version":3,"file":"CompositionOptionsContext.js","sourceRoot":"","sources":["../../../../src/fork/native-stack/composition-options/CompositionOptionsContext.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAqBb,0CA0BC;AASD,wDAgBC;AAQD,oDAiBC;AA/FD,iCAA6E;AAG7E,6DAA4D;AAE5D,4EAAyE;AAEzE,gBAAgB;AACH,QAAA,kBAAkB,GAAG,IAAA,qBAAa,EAAiC,IAAI,CAAC,CAAC;AAUtF,gBAAgB;AAChB,SAAgB,eAAe,CAC7B,KAA0B,EAC1B,MAAsB;IAEtB,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QAC1B,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QACrC,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACvC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC;IACzE,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC5B,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QACrC,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;QACjC,MAAM,QAAQ,GAAG,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,QAAQ,IAAI,QAAQ,EAAE,MAAM,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;YACtD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,QAAQ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ACpH,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,IAAA,iBAAQ,GAAE,CAAC;IACzB,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAE/B,IAAA,yCAAmB,EAAC,GAAG,EAAE;QACvB,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACxB,OAAO,GAAG,EAAE;YACV,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AACvC,CAAC","sourcesContent":["'use client';\n\nimport { createContext, use, useCallback, useMemo, useReducer } from 'react';\n\nimport type { CompositionContextValue, CompositionRegistry } from './types';\nimport { useRoute } from '../../../react-navigation/native';\nimport type { NativeStackNavigationOptions } from '../../../react-navigation/native-stack';\nimport { useSafeLayoutEffect } from '../../../views/useSafeLayoutEffect';\n\n/** @internal */\nexport const CompositionContext = createContext(null);\n\ntype RegistryAction =\n | {\n type: 'set';\n routeKey: string;\n options: Partial;\n }\n | { type: 'unset'; routeKey: string; options: Partial };\n\n/** @internal */\nexport function registryReducer(\n state: CompositionRegistry,\n action: RegistryAction\n): CompositionRegistry {\n if (action.type === 'set') {\n const { routeKey, options } = action;\n if (state[routeKey]?.includes(options)) {\n return state;\n }\n return { ...state, [routeKey]: [...(state[routeKey] ?? []), options] };\n }\n\n if (action.type === 'unset') {\n const { routeKey, options } = action;\n const existing = state[routeKey];\n const filtered = existing?.filter((o) => o !== options);\n if (!existing || filtered?.length === existing.length) {\n return state;\n }\n if (!filtered?.length) {\n const { [routeKey]: _, ...newState } = state;\n return newState;\n }\n return { ...state, [routeKey]: filtered };\n }\n return state;\n}\n\n/**\n * Provides the composition registry to descendant composition components.\n *\n * Uses useReducer with immutable object updates for React Compiler compatibility.\n * Each set/unset call produces a new object reference, which the compiler can\n * track as a reactive dependency.\n */\nexport function useCompositionRegistry() {\n const [registry, dispatch] = useReducer(registryReducer, {} as CompositionRegistry);\n\n const set = useCallback((routeKey: string, options: Partial) => {\n dispatch({ type: 'set', routeKey, options });\n }, []);\n\n const unset = useCallback((routeKey: string, options: Partial) => {\n dispatch({ type: 'unset', routeKey, options });\n }, []);\n\n const contextValue = useMemo(\n () => ({ set, unset }) satisfies CompositionContextValue,\n [set, unset]\n );\n return { registry, contextValue };\n}\n\n/**\n * Hook used by composition components to register their options in the composition registry.\n *\n * Registers options on mount/update via useSafeLayoutEffect, and unregisters on unmount.\n * Callers should memoize the options object to avoid unnecessary re-registrations.\n */\nexport function useCompositionOption(options: Partial) {\n const context = use(CompositionContext);\n if (!context) {\n throw new Error(\n 'useCompositionOption must be used within a RouterCompositionOptionsProvider. This is likely a bug in Expo Router.'\n );\n }\n\n const route = useRoute();\n const { set, unset } = context;\n\n useSafeLayoutEffect(() => {\n set(route.key, options);\n return () => {\n unset(route.key, options);\n };\n }, [route.key, set, unset, options]);\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/fork/native-stack/composition-options/mergeOptions.js.map b/packages/expo-router/build/fork/native-stack/composition-options/mergeOptions.js.map index 5e5858fd8ebbec..c1c21737d17e6b 100644 --- a/packages/expo-router/build/fork/native-stack/composition-options/mergeOptions.js.map +++ b/packages/expo-router/build/fork/native-stack/composition-options/mergeOptions.js.map @@ -1 +1 @@ -{"version":3,"file":"mergeOptions.js","sourceRoot":"","sources":["../../../../src/fork/native-stack/composition-options/mergeOptions.ts"],"names":[],"mappings":";;AAYA,oCAqCC;AA7CD;;;;;;;GAOG;AACH,SAAgB,YAAY,CAC1B,WAAqC,EACrC,QAA6B,EAC7B,KAA0C;IAE1C,MAAM,MAAM,GAA6B,EAAE,CAAC;IAC5C,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC;IAElD,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QAC9B,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAEnC,uDAAuD;QACvD,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/C,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;YACzB,SAAS;QACX,CAAC;QAED,iEAAiE;QACjE,MAAM,WAAW,GAAG,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,KAAK,CAAC;QAC/E,IAAI,WAAW,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;YACtC,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;YACzB,SAAS;QACX,CAAC;QAED,kEAAkE;QAClE,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,CAAC;QAE7E,MAAM,MAAM,GAAG;YACb,GAAG,UAAU;YACb,OAAO,EAAE,aAAa;SACvB,CAAC;QAEF,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { ParamListBase, StackNavigationState } from '../../../react-navigation/native';\nimport type { NativeStackDescriptorMap } from '../descriptors-context';\nimport type { CompositionRegistry } from './types';\n\n/**\n * Merges composition component options into navigation descriptors.\n *\n * For each descriptor:\n * 1. If no composition options registered → pass through unchanged\n * 2. If route is preloaded AND not focused → skip composition (pass through)\n * 3. Otherwise → merge descriptor.options with composition options (composition wins)\n */\nexport function mergeOptions(\n descriptors: NativeStackDescriptorMap,\n registry: CompositionRegistry,\n state: StackNavigationState\n): NativeStackDescriptorMap {\n const result: NativeStackDescriptorMap = {};\n const focusedKey = state.routes[state.index]?.key;\n\n for (const key in descriptors) {\n const descriptor = descriptors[key];\n const routeOptions = registry[key];\n\n // No composition options or empty array → pass through\n if (!routeOptions || routeOptions.length === 0) {\n result[key] = descriptor;\n continue;\n }\n\n // Check if route is preloaded and not focused → skip composition\n const isPreloaded = state.preloadedRoutes?.some((r) => r.key === key) ?? false;\n if (isPreloaded && key !== focusedKey) {\n result[key] = descriptor;\n continue;\n }\n\n // Merge: descriptor options as base, composition options override\n const mergedOptions = Object.assign({}, descriptor.options, ...routeOptions);\n\n const merged = {\n ...descriptor,\n options: mergedOptions,\n };\n\n result[key] = merged;\n }\n\n return result;\n}\n"]} \ No newline at end of file +{"version":3,"file":"mergeOptions.js","sourceRoot":"","sources":["../../../../src/fork/native-stack/composition-options/mergeOptions.ts"],"names":[],"mappings":";;AAYA,oCAqCC;AA7CD;;;;;;;GAOG;AACH,SAAgB,YAAY,CAC1B,WAAqC,EACrC,QAA6B,EAC7B,KAA0C;IAE1C,MAAM,MAAM,GAA6B,EAAE,CAAC;IAC5C,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC;IAElD,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QAC9B,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAE,CAAC;QACrC,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAEnC,uDAAuD;QACvD,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/C,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;YACzB,SAAS;QACX,CAAC;QAED,iEAAiE;QACjE,MAAM,WAAW,GAAG,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,KAAK,CAAC;QAC/E,IAAI,WAAW,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;YACtC,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;YACzB,SAAS;QACX,CAAC;QAED,kEAAkE;QAClE,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,CAAC;QAE7E,MAAM,MAAM,GAAG;YACb,GAAG,UAAU;YACb,OAAO,EAAE,aAAa;SACvB,CAAC;QAEF,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { ParamListBase, StackNavigationState } from '../../../react-navigation/native';\nimport type { NativeStackDescriptorMap } from '../descriptors-context';\nimport type { CompositionRegistry } from './types';\n\n/**\n * Merges composition component options into navigation descriptors.\n *\n * For each descriptor:\n * 1. If no composition options registered → pass through unchanged\n * 2. If route is preloaded AND not focused → skip composition (pass through)\n * 3. Otherwise → merge descriptor.options with composition options (composition wins)\n */\nexport function mergeOptions(\n descriptors: NativeStackDescriptorMap,\n registry: CompositionRegistry,\n state: StackNavigationState\n): NativeStackDescriptorMap {\n const result: NativeStackDescriptorMap = {};\n const focusedKey = state.routes[state.index]?.key;\n\n for (const key in descriptors) {\n const descriptor = descriptors[key]!;\n const routeOptions = registry[key];\n\n // No composition options or empty array → pass through\n if (!routeOptions || routeOptions.length === 0) {\n result[key] = descriptor;\n continue;\n }\n\n // Check if route is preloaded and not focused → skip composition\n const isPreloaded = state.preloadedRoutes?.some((r) => r.key === key) ?? false;\n if (isPreloaded && key !== focusedKey) {\n result[key] = descriptor;\n continue;\n }\n\n // Merge: descriptor options as base, composition options override\n const mergedOptions = Object.assign({}, descriptor.options, ...routeOptions);\n\n const merged = {\n ...descriptor,\n options: mergedOptions,\n };\n\n result[key] = merged;\n }\n\n return result;\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/fork/native-stack/createNativeStackNavigator.js.map b/packages/expo-router/build/fork/native-stack/createNativeStackNavigator.js.map index ba20ddec7a13fc..3791efbf34f5fd 100644 --- a/packages/expo-router/build/fork/native-stack/createNativeStackNavigator.js.map +++ b/packages/expo-router/build/fork/native-stack/createNativeStackNavigator.js.map @@ -1 +1 @@ -{"version":3,"file":"createNativeStackNavigator.js","sourceRoot":"","sources":["../../../src/fork/native-stack/createNativeStackNavigator.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyKA,gEAiBC;;AA1LD,yDAA2D;AAC3D,6CAA+B;AAE/B,+DAAiG;AACjG,+DAA2D;AAC3D,iEAA8D;AAC9D,6DAGgC;AAChC,0DAauC;AACvC,sEAM6C;AAE7C,MAAM,KAAK,GAAG,IAAA,0CAAsB,GAAE,CAAC;AAKvC,SAAS,oBAAoB,CAAC,EAC5B,EAAE,EACF,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,GAAG,IAAI,EACmB;IAC1B,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,IAAA,6BAAoB,EAM1F,oBAAW,EAAE;QACb,EAAE;QACF,gBAAgB;QAChB,QAAQ;QACR,MAAM;QACN,eAAe;QACf,aAAa;QACb,YAAY;QACZ,eAAe;KAChB,CAAC,CAAC;IAEH,KAAK,CAAC,SAAS,CACb,GAAG,EAAE;IACH,+DAA+D;IAC/D,UAAU,EAAE,WAAW,EAAE,CAAC,UAAU,EAAE,CAAC,CAAM,EAAE,EAAE;QAC/C,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;QAEzC,gFAAgF;QAChF,gEAAgE;QAChE,qBAAqB,CAAC,GAAG,EAAE;YACzB,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC,IAAI,SAAS,IAAI,CAAE,CAAgC,CAAC,gBAAgB,EAAE,CAA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B,WAAW,EAAE,iBAAiB;oBAC9B,gBAAgB;oBAChB,0BAA0B;oBAC1B,4BAA4B;oBAC5B,WAAW;oBACX,QAAQ,EAAE,QAAQ,GAClB,GACiB,GACH,GAED;IACrB,WAAW;KACZ,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B,CAexC,MAAe;IACf,OAAO,IAAA,+BAAsB,EAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["import { isLiquidGlassAvailable } from 'expo-glass-effect';\nimport * as React from 'react';\n\nimport { CompositionContext, mergeOptions, useCompositionRegistry } from './composition-options';\nimport { DescriptorsContext } from './descriptors-context';\nimport { usePreviewTransition } from './usePreviewTransition';\nimport {\n INTERNAL_EXPO_ROUTER_GESTURE_ENABLED_OPTION_NAME,\n type InternalNavigationOptions,\n} from '../../navigationParams';\nimport {\n createNavigatorFactory,\n type EventArg,\n type NavigatorTypeBagBase,\n type ParamListBase,\n type StackActionHelpers,\n StackActions,\n type StackNavigationState,\n StackRouter,\n type StackRouterOptions,\n type StaticConfig,\n type TypedNavigator,\n useNavigationBuilder,\n} from '../../react-navigation/native';\nimport {\n type NativeStackNavigationEventMap,\n type NativeStackNavigationOptions,\n type NativeStackNavigationProp,\n NativeStackView,\n type NativeStackNavigatorProps,\n} from '../../react-navigation/native-stack';\n\nconst GLASS = isLiquidGlassAvailable();\n\ntype NativeStackNavigationOptionsWithInternal = NativeStackNavigationOptions &\n InternalNavigationOptions;\n\nfunction NativeStackNavigator({\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n UNSTABLE_router,\n ...rest\n}: NativeStackNavigatorProps) {\n const { state, describe, descriptors, navigation, NavigationContent } = useNavigationBuilder<\n StackNavigationState,\n StackRouterOptions,\n StackActionHelpers,\n NativeStackNavigationOptionsWithInternal,\n NativeStackNavigationEventMap\n >(StackRouter, {\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n UNSTABLE_router,\n });\n\n React.useEffect(\n () =>\n // @ts-expect-error: there may not be a tab navigator in parent\n navigation?.addListener?.('tabPress', (e: any) => {\n const isFocused = navigation.isFocused();\n\n // Run the operation in the next frame so we're sure all listeners have been run\n // This is necessary to know if preventDefault() has been called\n requestAnimationFrame(() => {\n if (state.index > 0 && isFocused && !(e as EventArg<'tabPress', true>).defaultPrevented) {\n // When user taps on already focused tab and we're inside the tab,\n // reset the stack to replicate native behaviour\n // START FORK\n // navigation.dispatch({\n // ...StackActions.popToTop(),\n // target: state.key,\n // });\n // The popToTop will be automatically triggered on native side for native tabs\n if (e.data?.__internalTabsType !== 'native') {\n navigation.dispatch({\n ...StackActions.popToTop(),\n target: state.key,\n });\n }\n // END FORK\n }\n });\n }),\n [navigation, state.index, state.key]\n );\n\n // START FORK\n const { computedState, computedDescriptors, navigationWrapper } = usePreviewTransition(\n state,\n navigation,\n descriptors,\n describe\n );\n\n // Map internal gesture option to React Navigation's gestureEnabled option\n // This allows Expo Router to override gesture behavior without affecting user settings\n const finalDescriptors = React.useMemo(() => {\n let needsNewMap = false;\n const result: typeof computedDescriptors = {};\n for (const key of Object.keys(computedDescriptors)) {\n const descriptor = computedDescriptors[key];\n const options = descriptor.options as NativeStackNavigationOptionsWithInternal;\n const internalGestureEnabled = options?.[INTERNAL_EXPO_ROUTER_GESTURE_ENABLED_OPTION_NAME];\n const needsGestureFix = internalGestureEnabled !== undefined;\n const needsGlassFix = GLASS && options?.presentation === 'formSheet';\n\n if (needsGestureFix || needsGlassFix) {\n needsNewMap = true;\n const newOptions = { ...options };\n if (needsGestureFix) {\n newOptions.gestureEnabled = internalGestureEnabled;\n }\n if (needsGlassFix) {\n newOptions.headerTransparent ??= true;\n newOptions.contentStyle ??= { backgroundColor: 'transparent' };\n newOptions.headerShadowVisible ??= false;\n newOptions.headerLargeTitleShadowVisible ??= false;\n }\n result[key] = { ...descriptor, options: newOptions };\n } else {\n result[key] = descriptor;\n }\n }\n return needsNewMap ? result : computedDescriptors;\n }, [computedDescriptors]);\n const { registry, contextValue } = useCompositionRegistry();\n\n const mergedDescriptors = React.useMemo(\n () => mergeOptions(finalDescriptors, registry, computedState),\n [finalDescriptors, computedState, registry]\n );\n // END FORK\n\n return (\n // START FORK\n \n {/* END FORK */}\n \n \n \n \n \n {/* START FORK */}\n \n // END FORK\n );\n}\n\nexport function createNativeStackNavigator<\n const ParamList extends ParamListBase,\n const NavigatorID extends string | undefined = undefined,\n const TypeBag extends NavigatorTypeBagBase = {\n ParamList: ParamList;\n NavigatorID: NavigatorID;\n State: StackNavigationState;\n ScreenOptions: NativeStackNavigationOptions;\n EventMap: NativeStackNavigationEventMap;\n NavigationList: {\n [RouteName in keyof ParamList]: NativeStackNavigationProp;\n };\n Navigator: typeof NativeStackNavigator;\n },\n const Config extends StaticConfig = StaticConfig,\n>(config?: Config): TypedNavigator {\n return createNavigatorFactory(NativeStackNavigator)(config);\n}\n"]} \ No newline at end of file +{"version":3,"file":"createNativeStackNavigator.js","sourceRoot":"","sources":["../../../src/fork/native-stack/createNativeStackNavigator.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyKA,gEAiBC;;AA1LD,yDAA2D;AAC3D,6CAA+B;AAE/B,+DAAiG;AACjG,+DAA2D;AAC3D,iEAA8D;AAC9D,6DAGgC;AAChC,0DAauC;AACvC,sEAM6C;AAE7C,MAAM,KAAK,GAAG,IAAA,0CAAsB,GAAE,CAAC;AAKvC,SAAS,oBAAoB,CAAC,EAC5B,EAAE,EACF,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,GAAG,IAAI,EACmB;IAC1B,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,IAAA,6BAAoB,EAM1F,oBAAW,EAAE;QACb,EAAE;QACF,gBAAgB;QAChB,QAAQ;QACR,MAAM;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G,KAAK,CAAC,OAAO,CACrC,GAAG,EAAE,CAAC,IAAA,kCAAY,EAAC,gBAAgB,EAAE,QAAQ,EAAE,aAAa,CAAC,EAC7D,CAAC,gBAAgB,EAAE,aAAa,EAAE,QAAQ,CAAC,CAC5C,CAAC;IACF,WAAW;IAEX,OAAO,CAEL,uBAAC,wCAAkB,IAAC,KAAK,EAAE,WAAW,YAEpC,uBAAC,iBAAiB,cAChB,uBAAC,wCAAkB,IAAC,KAAK,EAAE,YAAY,YACrC,uBAAC,8BAAe,OACV,IAAI;oBACR,aAAa;oBACb,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,iBAAiB,EAC7B,WAAW,EAAE,iBAAiB;oBAC9B,gBAAgB;oBAChB,0BAA0B;oBAC1B,4BAA4B;oBAC5B,WAAW;oBACX,QAAQ,EAAE,QAAQ,GAClB,GACiB,GACH,GAED;IACrB,WAAW;KACZ,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B,CAexC,MAAe;IACf,OAAO,IAAA,+BAAsB,EAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["import { isLiquidGlassAvailable } from 'expo-glass-effect';\nimport * as React from 'react';\n\nimport { CompositionContext, mergeOptions, useCompositionRegistry } from './composition-options';\nimport { DescriptorsContext } from './descriptors-context';\nimport { usePreviewTransition } from './usePreviewTransition';\nimport {\n INTERNAL_EXPO_ROUTER_GESTURE_ENABLED_OPTION_NAME,\n type InternalNavigationOptions,\n} from '../../navigationParams';\nimport {\n createNavigatorFactory,\n type EventArg,\n type NavigatorTypeBagBase,\n type ParamListBase,\n type StackActionHelpers,\n StackActions,\n type StackNavigationState,\n StackRouter,\n type StackRouterOptions,\n type StaticConfig,\n type TypedNavigator,\n useNavigationBuilder,\n} from '../../react-navigation/native';\nimport {\n type NativeStackNavigationEventMap,\n type NativeStackNavigationOptions,\n type NativeStackNavigationProp,\n NativeStackView,\n type NativeStackNavigatorProps,\n} from '../../react-navigation/native-stack';\n\nconst GLASS = isLiquidGlassAvailable();\n\ntype NativeStackNavigationOptionsWithInternal = NativeStackNavigationOptions &\n InternalNavigationOptions;\n\nfunction NativeStackNavigator({\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n UNSTABLE_router,\n ...rest\n}: NativeStackNavigatorProps) {\n const { state, describe, descriptors, navigation, NavigationContent } = useNavigationBuilder<\n StackNavigationState,\n StackRouterOptions,\n StackActionHelpers,\n NativeStackNavigationOptionsWithInternal,\n NativeStackNavigationEventMap\n >(StackRouter, {\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n UNSTABLE_router,\n });\n\n React.useEffect(\n () =>\n // @ts-expect-error: there may not be a tab navigator in parent\n navigation?.addListener?.('tabPress', (e: any) => {\n const isFocused = navigation.isFocused();\n\n // Run the operation in the next frame so we're sure all listeners have been run\n // This is necessary to know if preventDefault() has been called\n requestAnimationFrame(() => {\n if (state.index > 0 && isFocused && !(e as EventArg<'tabPress', true>).defaultPrevented) {\n // When user taps on already focused tab and we're inside the tab,\n // reset the stack to replicate native behaviour\n // START FORK\n // navigation.dispatch({\n // ...StackActions.popToTop(),\n // target: state.key,\n // });\n // The popToTop will be automatically triggered on native side for native tabs\n if (e.data?.__internalTabsType !== 'native') {\n navigation.dispatch({\n ...StackActions.popToTop(),\n target: state.key,\n });\n }\n // END FORK\n }\n });\n }),\n [navigation, state.index, state.key]\n );\n\n // START FORK\n const { computedState, computedDescriptors, navigationWrapper } = usePreviewTransition(\n state,\n navigation,\n descriptors,\n describe\n );\n\n // Map internal gesture option to React Navigation's gestureEnabled option\n // This allows Expo Router to override gesture behavior without affecting user settings\n const finalDescriptors = React.useMemo(() => {\n let needsNewMap = false;\n const result: typeof computedDescriptors = {};\n for (const key of Object.keys(computedDescriptors)) {\n const descriptor = computedDescriptors[key]!;\n const options = descriptor.options as NativeStackNavigationOptionsWithInternal;\n const internalGestureEnabled = options?.[INTERNAL_EXPO_ROUTER_GESTURE_ENABLED_OPTION_NAME];\n const needsGestureFix = internalGestureEnabled !== undefined;\n const needsGlassFix = GLASS && options?.presentation === 'formSheet';\n\n if (needsGestureFix || needsGlassFix) {\n needsNewMap = true;\n const newOptions = { ...options };\n if (needsGestureFix) {\n newOptions.gestureEnabled = internalGestureEnabled;\n }\n if (needsGlassFix) {\n newOptions.headerTransparent ??= true;\n newOptions.contentStyle ??= { backgroundColor: 'transparent' };\n newOptions.headerShadowVisible ??= false;\n newOptions.headerLargeTitleShadowVisible ??= false;\n }\n result[key] = { ...descriptor, options: newOptions };\n } else {\n result[key] = descriptor;\n }\n }\n return needsNewMap ? result : computedDescriptors;\n }, [computedDescriptors]);\n const { registry, contextValue } = useCompositionRegistry();\n\n const mergedDescriptors = React.useMemo(\n () => mergeOptions(finalDescriptors, registry, computedState),\n [finalDescriptors, computedState, registry]\n );\n // END FORK\n\n return (\n // START FORK\n \n {/* END FORK */}\n \n \n \n \n \n {/* START FORK */}\n \n // END FORK\n );\n}\n\nexport function createNativeStackNavigator<\n const ParamList extends ParamListBase,\n const NavigatorID extends string | undefined = undefined,\n const TypeBag extends NavigatorTypeBagBase = {\n ParamList: ParamList;\n NavigatorID: NavigatorID;\n State: StackNavigationState;\n ScreenOptions: NativeStackNavigationOptions;\n EventMap: NativeStackNavigationEventMap;\n NavigationList: {\n [RouteName in keyof ParamList]: NativeStackNavigationProp;\n };\n Navigator: typeof NativeStackNavigator;\n },\n const Config extends StaticConfig = StaticConfig,\n>(config?: Config): TypedNavigator {\n return createNavigatorFactory(NativeStackNavigator)(config);\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/fork/useLinking.js.map b/packages/expo-router/build/fork/useLinking.js.map index 6e38703e50c581..501c13de21059c 100644 --- a/packages/expo-router/build/fork/useLinking.js.map +++ b/packages/expo-router/build/fork/useLinking.js.map @@ -1 +1 @@ -{"version":3,"file":"useLinking.js","sourceRoot":"","sources":["../../src/fork/useLinking.ts"],"names":[],"mappings":";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AC","sourcesContent":["import isEqual from 'fast-deep-equal';\nimport { type RefObject, useEffect, useState, useCallback, useRef, use } from 'react';\n\nimport { createMemoryHistory } from './createMemoryHistory';\nimport { appendBaseUrl } from './getPathFromState';\nimport { ServerContext } from '../global-state/serverLocationContext';\nimport { useExpoRouterStore } from '../global-state/storeContext';\nimport { getRootStackRouteNames } from '../global-state/utils';\nimport {\n type LinkingOptions,\n findFocusedRoute,\n getActionFromState as getActionFromStateDefault,\n getPathFromState as getPathFromStateDefault,\n getStateFromPath as getStateFromPathDefault,\n type NavigationContainerRef,\n type NavigationState,\n type ParamListBase,\n useNavigationIndependentTree,\n} from '../react-navigation/native';\n\ntype ResultState = ReturnType;\n\n/**\n * Find the matching navigation state that changed between 2 navigation states\n * e.g.: a -> b -> c -> d and a -> b -> c -> e -> f, if history in b changed, b is the matching state\n */\nconst findMatchingState = (\n a: T | undefined,\n b: T | undefined\n): [T | undefined, T | undefined] => {\n if (a === undefined || b === undefined || a.key !== b.key) {\n return [undefined, undefined];\n }\n\n // Tab and drawer will have `history` property, but stack will have history in `routes`\n const aHistoryLength = a.history ? a.history.length : a.routes.length;\n const bHistoryLength = b.history ? b.history.length : b.routes.length;\n\n const aRoute = a.routes[a.index];\n const bRoute = b.routes[b.index];\n\n const aChildState = aRoute.state as T | undefined;\n const bChildState = bRoute.state as T | undefined;\n\n // Stop here if this is the state object that changed:\n // - history length is different\n // - focused routes are different\n // - one of them doesn't have child state\n // - child state keys are different\n if (\n aHistoryLength !== bHistoryLength ||\n aRoute.key !== bRoute.key ||\n aChildState === undefined ||\n bChildState === undefined ||\n aChildState.key !== bChildState.key\n ) {\n return [a, b];\n }\n\n return findMatchingState(aChildState, bChildState);\n};\n\n/**\n * Run async function in series as it's called.\n */\nexport const series = (cb: () => Promise) => {\n let queue = Promise.resolve();\n const callback = () => {\n queue = queue.then(cb);\n };\n return callback;\n};\n\nconst linkingHandlers: symbol[] = [];\n\ntype Options = LinkingOptions;\n\nexport function useLinking(\n ref: RefObject | null>,\n {\n enabled = true,\n config,\n getStateFromPath = getStateFromPathDefault,\n getPathFromState = getPathFromStateDefault,\n getActionFromState = getActionFromStateDefault,\n }: Options,\n onUnhandledLinking: (lastUnhandledLining: string | undefined) => void\n) {\n const independent = useNavigationIndependentTree();\n\n const store = useExpoRouterStore();\n\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return undefined;\n }\n\n if (independent) {\n return undefined;\n }\n\n if (enabled !== false && linkingHandlers.length) {\n console.error(\n [\n 'Looks like you have configured linking in multiple places. This is likely an error since deep links should only be handled in one place to avoid conflicts. Make sure that:',\n \"- You don't have multiple NavigationContainers in the app each with 'linking' enabled\",\n '- Only a single instance of the root component is rendered',\n ]\n .join('\\n')\n .trim()\n );\n }\n\n const handler = Symbol();\n\n if (enabled !== false) {\n linkingHandlers.push(handler);\n }\n\n return () => {\n const index = linkingHandlers.indexOf(handler);\n\n if (index > -1) {\n linkingHandlers.splice(index, 1);\n }\n };\n }, [enabled, independent]);\n\n const [history] = useState(createMemoryHistory);\n\n // We store these options in ref to avoid re-creating getInitialState and re-subscribing listeners\n // This lets user avoid wrapping the items in `React.useCallback` or `React.useMemo`\n // Not re-creating `getInitialState` is important coz it makes it easier for the user to use in an effect\n const enabledRef = useRef(enabled);\n const configRef = useRef(config);\n const getStateFromPathRef = useRef(getStateFromPath);\n const getPathFromStateRef = useRef(getPathFromState);\n const getActionFromStateRef = useRef(getActionFromState);\n\n useEffect(() => {\n enabledRef.current = enabled;\n configRef.current = config;\n getStateFromPathRef.current = getStateFromPath;\n getPathFromStateRef.current = getPathFromState;\n getActionFromStateRef.current = getActionFromState;\n });\n\n const validateRoutesNotExistInRootState = useCallback(\n (state: ResultState) => {\n // START FORK\n // Instead of using the rootState, we use INTERNAL_SLOT_NAME, which is the only route in the root navigator in Expo Router\n // const navigation = ref.current;\n // const rootState = navigation?.getRootState();\n const routeNames = getRootStackRouteNames();\n // END FORK\n\n // Make sure that the routes in the state exist in the root navigator\n // Otherwise there's an error in the linking configuration\n // START FORK\n // return state?.routes.some((r) => !rootState?.routeNames?.includes(r.name));\n return state?.routes.some((r) => !routeNames.includes(r.name));\n // END FORK\n },\n [ref]\n );\n\n const server = use(ServerContext);\n\n const getInitialState = useCallback(() => {\n let value: ResultState | undefined;\n\n if (enabledRef.current) {\n const location =\n server?.location ?? (typeof window !== 'undefined' ? window.location : undefined);\n\n const path = location\n ? location.pathname + location.search + (location.hash ?? '')\n : undefined;\n\n if (path) {\n value = getStateFromPathRef.current(path, configRef.current);\n }\n\n // If the link were handled, it gets cleared in NavigationContainer\n onUnhandledLinking(path);\n }\n\n const thenable = {\n then(onfulfilled?: (state: ResultState | undefined) => void) {\n return Promise.resolve(onfulfilled ? onfulfilled(value) : value);\n },\n catch() {\n return thenable;\n },\n };\n\n return thenable as PromiseLike;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const previousIndexRef = useRef(undefined);\n const previousStateRef = useRef(undefined);\n const pendingPopStatePathRef = useRef(undefined);\n\n useEffect(() => {\n previousIndexRef.current = history.index;\n\n return history.listen(() => {\n const navigation = ref.current;\n\n if (!navigation || !enabled) {\n return;\n }\n\n const { location } = window;\n\n const path = location.pathname + location.search + location.hash;\n const index = history.index;\n\n const previousIndex = previousIndexRef.current ?? 0;\n\n previousIndexRef.current = index;\n pendingPopStatePathRef.current = path;\n\n // When browser back/forward is clicked, we first need to check if state object for this index exists\n // If it does we'll reset to that state object\n // Otherwise, we'll handle it like a regular deep link\n const record = history.get(index);\n\n if (record?.path === path && record?.state) {\n navigation.resetRoot(record.state);\n return;\n }\n\n const state = getStateFromPathRef.current(path, configRef.current);\n\n // We should only dispatch an action when going forward\n // Otherwise the action will likely add items to history, which would mess things up\n if (state) {\n // If the link were handled, it gets cleared in NavigationContainer\n onUnhandledLinking(path);\n // Make sure that the routes in the state exist in the root navigator\n // Otherwise there's an error in the linking configuration\n if (validateRoutesNotExistInRootState(state)) {\n return;\n }\n\n if (\n index > previousIndex ||\n /* START FORK\n *\n * This is a workaround for React Navigation's handling of hashes (it doesn't handle them)\n * When you click on , the browser will first fire a popstate event\n * and this callback will be called.\n *\n * From React Navigation's perspective, it's treating the new hash change like a back/forward\n * button press, so it thinks it should reset the state. When we should\n * be to be pushing the new state\n *\n * Our fix is to check if the index is the same as the previous index\n * and if the incoming path is the same as the old path but with the hash added,\n * then treat it as a push instead of a reset\n *\n * This also works for subsequent hash changes, as internally RN\n * doesn't store the hash in the history state.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event#when_popstate_is_sent\n */\n (index === previousIndex && (!record || `${record?.path}${location.hash}` === path))\n // END FORK\n ) {\n const action = getActionFromStateRef.current(state, configRef.current);\n\n if (action !== undefined) {\n try {\n navigation.dispatch(action);\n } catch (e) {\n // Ignore any errors from deep linking.\n // This could happen in case of malformed links, navigation object not being initialized etc.\n console.warn(\n `An error occurred when trying to handle the link '${path}': ${\n typeof e === 'object' && e != null && 'message' in e ? e.message : e\n }`\n );\n }\n } else {\n navigation.resetRoot(state);\n }\n } else {\n navigation.resetRoot(state);\n }\n } else {\n // if current path didn't return any state, we should revert to initial state\n navigation.resetRoot(state);\n }\n });\n }, [enabled, history, onUnhandledLinking, ref, validateRoutesNotExistInRootState]);\n\n useEffect(() => {\n if (!enabled) {\n return;\n }\n\n const getPathForRoute = (\n route: ReturnType,\n state: NavigationState\n ): string => {\n let path;\n\n // If the `route` object contains a `path`, use that path as long as `route.name` and `params` still match\n // This makes sure that we preserve the original URL for wildcard routes\n if (route?.path) {\n const stateForPath = getStateFromPathRef.current(route.path, configRef.current);\n\n if (stateForPath) {\n const focusedRoute = findFocusedRoute(stateForPath);\n\n if (\n focusedRoute &&\n focusedRoute.name === route.name &&\n isEqual({ ...focusedRoute.params }, { ...route.params })\n ) {\n // START FORK - Ensure paths coming from events (e.g refresh) have the base URL\n // path = route.path;\n path = appendBaseUrl(route.path);\n // END FORK\n }\n }\n }\n\n if (path == null) {\n path = getPathFromStateRef.current(state, configRef.current);\n }\n\n // START FORK - ExpoRouter manually handles hashes. This code is intentionally removed\n // const previousRoute = previousStateRef.current\n // ? findFocusedRoute(previousStateRef.current)\n // : undefined;\n\n // Preserve the hash if the route didn't change\n // if (\n // previousRoute &&\n // route &&\n // 'key' in previousRoute &&\n // 'key' in route &&\n // previousRoute.key === route.key\n // ) {\n // path = path + location.hash;\n // }\n // END FORK\n\n return path;\n };\n\n if (ref.current) {\n // We need to record the current metadata on the first render if they aren't set\n // This will allow the initial state to be in the history entry\n\n // START FORK\n // Instead of using the rootState (which might be stale) we should use the focused state\n // const state = ref.current.getRootState();\n const rootState = ref.current.getRootState();\n const state = store.state as NavigationState;\n\n // END FORK\n\n if (state) {\n const route = findFocusedRoute(state);\n const path = getPathForRoute(route, state);\n\n if (previousStateRef.current === undefined) {\n // START FORK\n // previousStateRef.current = state;\n previousStateRef.current = rootState;\n // END FORK\n }\n\n history.replace({ path, state });\n }\n }\n\n const onStateChange = async () => {\n const navigation = ref.current;\n\n if (!navigation || !enabled) {\n return;\n }\n\n const previousState = previousStateRef.current;\n // START FORK\n // Instead of using the rootState (which might be stale) we should use the focused state\n // const state = navigation.getRootState();\n const rootState = navigation.getRootState();\n const state = store.state as NavigationState;\n\n // END FORK\n\n // root state may not available, for example when root navigators switch inside the container\n if (!state) {\n return;\n }\n\n const pendingPath = pendingPopStatePathRef.current;\n const route = findFocusedRoute(state);\n const path = getPathForRoute(route, state);\n\n // START FORK\n // previousStateRef.current = state;\n previousStateRef.current = rootState;\n // END FORK\n pendingPopStatePathRef.current = undefined;\n\n // To detect the kind of state change, we need to:\n // - Find the common focused navigation state in previous and current state\n // - If only the route keys changed, compare history/routes.length to check if we go back/forward/replace\n // - If no common focused navigation state found, it's a replace\n const [previousFocusedState, focusedState] = findMatchingState(previousState, state);\n\n if (\n previousFocusedState &&\n focusedState &&\n // We should only handle push/pop if path changed from what was in last `popstate`\n // Otherwise it's likely a change triggered by `popstate`\n path !== pendingPath\n ) {\n const historyDelta =\n (focusedState.history ? focusedState.history.length : focusedState.routes.length) -\n (previousFocusedState.history\n ? previousFocusedState.history.length\n : previousFocusedState.routes.length);\n\n if (historyDelta > 0) {\n // If history length is increased, we should pushState\n // Note that path might not actually change here, for example, drawer open should pushState\n history.push({ path, state });\n } else if (historyDelta < 0) {\n // If history length is decreased, i.e. entries were removed, we want to go back\n\n const nextIndex = history.backIndex({ path });\n const currentIndex = history.index;\n\n try {\n if (\n nextIndex !== -1 &&\n nextIndex < currentIndex &&\n // We should only go back if the entry exists and it's less than current index\n history.get(nextIndex - currentIndex)\n ) {\n // An existing entry for this path exists and it's less than current index, go back to that\n await history.go(nextIndex - currentIndex);\n } else {\n // We couldn't find an existing entry to go back to, so we'll go back by the delta\n // This won't be correct if multiple routes were pushed in one go before\n // Usually this shouldn't happen and this is a fallback for that\n await history.go(historyDelta);\n }\n\n // Store the updated state as well as fix the path if incorrect\n history.replace({ path, state });\n } catch {\n // The navigation was interrupted\n }\n } else {\n // If history length is unchanged, we want to replaceState\n history.replace({ path, state });\n }\n } else {\n // If no common navigation state was found, assume it's a replace\n // This would happen if the user did a reset/conditionally changed navigators\n history.replace({ path, state });\n }\n };\n\n // We debounce onStateChange coz we don't want multiple state changes to be handled at one time\n // This could happen since `history.go(n)` is asynchronous\n // If `pushState` or `replaceState` were called before `history.go(n)` completes, it'll mess stuff up\n return ref.current?.addListener('state', series(onStateChange));\n }, [enabled, history, ref]);\n\n return {\n getInitialState,\n };\n}\n\nexport function getInitialURLWithTimeout(): string | null | Promise {\n return typeof window === 'undefined' ? '' : window.location.href;\n}\n"]} \ No newline at end of file +{"version":3,"file":"useLinking.js","sourceRoot":"","sources":["../../src/fork/useLinking.ts"],"names":[],"mappings":";;;;;;AA6EA,gCAqZC;AAED,4DAEC;AAteD,sEAAsC;AACtC,iCAAsF;AAEtF,+DAA4D;AAC5D,yDAAmD;AACnD,iFAAsE;AACtE,+DAAkE;AAClE,iDAA+D;AAC/D,uDAUoC;AAIpC;;;GAGG;AACH,MA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AC3F,MAAM,OAAO,CAAC,EAAE,CAAC,SAAS,GAAG,YAAY,CAAC,CAAC;wBAC7C,CAAC;6BAAM,CAAC;4BACN,kFAAkF;4BAClF,wEAAwE;4BACxE,gEAAgE;4BAChE,MAAM,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;wBACjC,CAAC;wBAED,+DAA+D;wBAC/D,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;oBACnC,CAAC;oBAAC,MAAM,CAAC;wBACP,iCAAiC;oBACnC,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,0DAA0D;oBAC1D,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;gBACnC,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,iEAAiE;gBACjE,6EAA6E;gBAC7E,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YACnC,CAAC;QACH,CAAC,CAAC;QAEF,+FAA+F;QAC/F,0DAA0D;QAC1D,qGAAqG;QACrG,OAAO,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,IAAA,cAAM,EAAC,aAAa,CAAC,CAAC,CAAC;IAClE,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;IAE5B,OAAO;QACL,eAAe;KAChB,CAAC;AACJ,CAAC;AAED,SAAgB,wBAAwB;IACtC,OAAO,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;AACnE,CAAC","sourcesContent":["import isEqual from 'fast-deep-equal';\nimport { type RefObject, useEffect, useState, useCallback, useRef, use } from 'react';\n\nimport { createMemoryHistory } from './createMemoryHistory';\nimport { appendBaseUrl } from './getPathFromState';\nimport { ServerContext } from '../global-state/serverLocationContext';\nimport { useExpoRouterStore } from '../global-state/storeContext';\nimport { getRootStackRouteNames } from '../global-state/utils';\nimport {\n type LinkingOptions,\n findFocusedRoute,\n getActionFromState as getActionFromStateDefault,\n getPathFromState as getPathFromStateDefault,\n getStateFromPath as getStateFromPathDefault,\n type NavigationContainerRef,\n type NavigationState,\n type ParamListBase,\n useNavigationIndependentTree,\n} from '../react-navigation/native';\n\ntype ResultState = ReturnType;\n\n/**\n * Find the matching navigation state that changed between 2 navigation states\n * e.g.: a -> b -> c -> d and a -> b -> c -> e -> f, if history in b changed, b is the matching state\n */\nconst findMatchingState = (\n a: T | undefined,\n b: T | undefined\n): [T | undefined, T | undefined] => {\n if (a === undefined || b === undefined || a.key !== b.key) {\n return [undefined, undefined];\n }\n\n // Tab and drawer will have `history` property, but stack will have history in `routes`\n const aHistoryLength = a.history ? a.history.length : a.routes.length;\n const bHistoryLength = b.history ? b.history.length : b.routes.length;\n\n const aRoute = a.routes[a.index]!;\n const bRoute = b.routes[b.index]!;\n\n const aChildState = aRoute.state as T | undefined;\n const bChildState = bRoute.state as T | undefined;\n\n // Stop here if this is the state object that changed:\n // - history length is different\n // - focused routes are different\n // - one of them doesn't have child state\n // - child state keys are different\n if (\n aHistoryLength !== bHistoryLength ||\n aRoute.key !== bRoute.key ||\n aChildState === undefined ||\n bChildState === undefined ||\n aChildState.key !== bChildState.key\n ) {\n return [a, b];\n }\n\n return findMatchingState(aChildState, bChildState);\n};\n\n/**\n * Run async function in series as it's called.\n */\nexport const series = (cb: () => Promise) => {\n let queue = Promise.resolve();\n const callback = () => {\n queue = queue.then(cb);\n };\n return callback;\n};\n\nconst linkingHandlers: symbol[] = [];\n\ntype Options = LinkingOptions;\n\nexport function useLinking(\n ref: RefObject | null>,\n {\n enabled = true,\n config,\n getStateFromPath = getStateFromPathDefault,\n getPathFromState = getPathFromStateDefault,\n getActionFromState = getActionFromStateDefault,\n }: Options,\n onUnhandledLinking: (lastUnhandledLining: string | undefined) => void\n) {\n const independent = useNavigationIndependentTree();\n\n const store = useExpoRouterStore();\n\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return undefined;\n }\n\n if (independent) {\n return undefined;\n }\n\n if (enabled !== false && linkingHandlers.length) {\n console.error(\n [\n 'Looks like you have configured linking in multiple places. This is likely an error since deep links should only be handled in one place to avoid conflicts. Make sure that:',\n \"- You don't have multiple NavigationContainers in the app each with 'linking' enabled\",\n '- Only a single instance of the root component is rendered',\n ]\n .join('\\n')\n .trim()\n );\n }\n\n const handler = Symbol();\n\n if (enabled !== false) {\n linkingHandlers.push(handler);\n }\n\n return () => {\n const index = linkingHandlers.indexOf(handler);\n\n if (index > -1) {\n linkingHandlers.splice(index, 1);\n }\n };\n }, [enabled, independent]);\n\n const [history] = useState(createMemoryHistory);\n\n // We store these options in ref to avoid re-creating getInitialState and re-subscribing listeners\n // This lets user avoid wrapping the items in `React.useCallback` or `React.useMemo`\n // Not re-creating `getInitialState` is important coz it makes it easier for the user to use in an effect\n const enabledRef = useRef(enabled);\n const configRef = useRef(config);\n const getStateFromPathRef = useRef(getStateFromPath);\n const getPathFromStateRef = useRef(getPathFromState);\n const getActionFromStateRef = useRef(getActionFromState);\n\n useEffect(() => {\n enabledRef.current = enabled;\n configRef.current = config;\n getStateFromPathRef.current = getStateFromPath;\n getPathFromStateRef.current = getPathFromState;\n getActionFromStateRef.current = getActionFromState;\n });\n\n const validateRoutesNotExistInRootState = useCallback(\n (state: ResultState) => {\n // START FORK\n // Instead of using the rootState, we use INTERNAL_SLOT_NAME, which is the only route in the root navigator in Expo Router\n // const navigation = ref.current;\n // const rootState = navigation?.getRootState();\n const routeNames = getRootStackRouteNames();\n // END FORK\n\n // Make sure that the routes in the state exist in the root navigator\n // Otherwise there's an error in the linking configuration\n // START FORK\n // return state?.routes.some((r) => !rootState?.routeNames?.includes(r.name));\n return state?.routes.some((r) => !routeNames.includes(r.name));\n // END FORK\n },\n [ref]\n );\n\n const server = use(ServerContext);\n\n const getInitialState = useCallback(() => {\n let value: ResultState | undefined;\n\n if (enabledRef.current) {\n const location =\n server?.location ?? (typeof window !== 'undefined' ? window.location : undefined);\n\n const path = location\n ? location.pathname + location.search + (location.hash ?? '')\n : undefined;\n\n if (path) {\n value = getStateFromPathRef.current(path, configRef.current);\n }\n\n // If the link were handled, it gets cleared in NavigationContainer\n onUnhandledLinking(path);\n }\n\n const thenable = {\n then(onfulfilled?: (state: ResultState | undefined) => void) {\n return Promise.resolve(onfulfilled ? onfulfilled(value) : value);\n },\n catch() {\n return thenable;\n },\n };\n\n return thenable as PromiseLike;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const previousIndexRef = useRef(undefined);\n const previousStateRef = useRef(undefined);\n const pendingPopStatePathRef = useRef(undefined);\n\n useEffect(() => {\n previousIndexRef.current = history.index;\n\n return history.listen(() => {\n const navigation = ref.current;\n\n if (!navigation || !enabled) {\n return;\n }\n\n const { location } = window;\n\n const path = location.pathname + location.search + location.hash;\n const index = history.index;\n\n const previousIndex = previousIndexRef.current ?? 0;\n\n previousIndexRef.current = index;\n pendingPopStatePathRef.current = path;\n\n // When browser back/forward is clicked, we first need to check if state object for this index exists\n // If it does we'll reset to that state object\n // Otherwise, we'll handle it like a regular deep link\n const record = history.get(index);\n\n if (record?.path === path && record?.state) {\n navigation.resetRoot(record.state);\n return;\n }\n\n const state = getStateFromPathRef.current(path, configRef.current);\n\n // We should only dispatch an action when going forward\n // Otherwise the action will likely add items to history, which would mess things up\n if (state) {\n // If the link were handled, it gets cleared in NavigationContainer\n onUnhandledLinking(path);\n // Make sure that the routes in the state exist in the root navigator\n // Otherwise there's an error in the linking configuration\n if (validateRoutesNotExistInRootState(state)) {\n return;\n }\n\n if (\n index > previousIndex ||\n /* START FORK\n *\n * This is a workaround for React Navigation's handling of hashes (it doesn't handle them)\n * When you click on , the browser will first fire a popstate event\n * and this callback will be called.\n *\n * From React Navigation's perspective, it's treating the new hash change like a back/forward\n * button press, so it thinks it should reset the state. When we should\n * be to be pushing the new state\n *\n * Our fix is to check if the index is the same as the previous index\n * and if the incoming path is the same as the old path but with the hash added,\n * then treat it as a push instead of a reset\n *\n * This also works for subsequent hash changes, as internally RN\n * doesn't store the hash in the history state.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event#when_popstate_is_sent\n */\n (index === previousIndex && (!record || `${record?.path}${location.hash}` === path))\n // END FORK\n ) {\n const action = getActionFromStateRef.current(state, configRef.current);\n\n if (action !== undefined) {\n try {\n navigation.dispatch(action);\n } catch (e) {\n // Ignore any errors from deep linking.\n // This could happen in case of malformed links, navigation object not being initialized etc.\n console.warn(\n `An error occurred when trying to handle the link '${path}': ${\n typeof e === 'object' && e != null && 'message' in e ? e.message : e\n }`\n );\n }\n } else {\n navigation.resetRoot(state);\n }\n } else {\n navigation.resetRoot(state);\n }\n } else {\n // if current path didn't return any state, we should revert to initial state\n navigation.resetRoot(state);\n }\n });\n }, [enabled, history, onUnhandledLinking, ref, validateRoutesNotExistInRootState]);\n\n useEffect(() => {\n if (!enabled) {\n return;\n }\n\n const getPathForRoute = (\n route: ReturnType,\n state: NavigationState\n ): string => {\n let path;\n\n // If the `route` object contains a `path`, use that path as long as `route.name` and `params` still match\n // This makes sure that we preserve the original URL for wildcard routes\n if (route?.path) {\n const stateForPath = getStateFromPathRef.current(route.path, configRef.current);\n\n if (stateForPath) {\n const focusedRoute = findFocusedRoute(stateForPath);\n\n if (\n focusedRoute &&\n focusedRoute.name === route.name &&\n isEqual({ ...focusedRoute.params }, { ...route.params })\n ) {\n // START FORK - Ensure paths coming from events (e.g refresh) have the base URL\n // path = route.path;\n path = appendBaseUrl(route.path);\n // END FORK\n }\n }\n }\n\n if (path == null) {\n path = getPathFromStateRef.current(state, configRef.current);\n }\n\n // START FORK - ExpoRouter manually handles hashes. This code is intentionally removed\n // const previousRoute = previousStateRef.current\n // ? findFocusedRoute(previousStateRef.current)\n // : undefined;\n\n // Preserve the hash if the route didn't change\n // if (\n // previousRoute &&\n // route &&\n // 'key' in previousRoute &&\n // 'key' in route &&\n // previousRoute.key === route.key\n // ) {\n // path = path + location.hash;\n // }\n // END FORK\n\n return path;\n };\n\n if (ref.current) {\n // We need to record the current metadata on the first render if they aren't set\n // This will allow the initial state to be in the history entry\n\n // START FORK\n // Instead of using the rootState (which might be stale) we should use the focused state\n // const state = ref.current.getRootState();\n const rootState = ref.current.getRootState();\n const state = store.state as NavigationState;\n\n // END FORK\n\n if (state) {\n const route = findFocusedRoute(state);\n const path = getPathForRoute(route, state);\n\n if (previousStateRef.current === undefined) {\n // START FORK\n // previousStateRef.current = state;\n previousStateRef.current = rootState;\n // END FORK\n }\n\n history.replace({ path, state });\n }\n }\n\n const onStateChange = async () => {\n const navigation = ref.current;\n\n if (!navigation || !enabled) {\n return;\n }\n\n const previousState = previousStateRef.current;\n // START FORK\n // Instead of using the rootState (which might be stale) we should use the focused state\n // const state = navigation.getRootState();\n const rootState = navigation.getRootState();\n const state = store.state as NavigationState;\n\n // END FORK\n\n // root state may not available, for example when root navigators switch inside the container\n if (!state) {\n return;\n }\n\n const pendingPath = pendingPopStatePathRef.current;\n const route = findFocusedRoute(state);\n const path = getPathForRoute(route, state);\n\n // START FORK\n // previousStateRef.current = state;\n previousStateRef.current = rootState;\n // END FORK\n pendingPopStatePathRef.current = undefined;\n\n // To detect the kind of state change, we need to:\n // - Find the common focused navigation state in previous and current state\n // - If only the route keys changed, compare history/routes.length to check if we go back/forward/replace\n // - If no common focused navigation state found, it's a replace\n const [previousFocusedState, focusedState] = findMatchingState(previousState, state);\n\n if (\n previousFocusedState &&\n focusedState &&\n // We should only handle push/pop if path changed from what was in last `popstate`\n // Otherwise it's likely a change triggered by `popstate`\n path !== pendingPath\n ) {\n const historyDelta =\n (focusedState.history ? focusedState.history.length : focusedState.routes.length) -\n (previousFocusedState.history\n ? previousFocusedState.history.length\n : previousFocusedState.routes.length);\n\n if (historyDelta > 0) {\n // If history length is increased, we should pushState\n // Note that path might not actually change here, for example, drawer open should pushState\n history.push({ path, state });\n } else if (historyDelta < 0) {\n // If history length is decreased, i.e. entries were removed, we want to go back\n\n const nextIndex = history.backIndex({ path });\n const currentIndex = history.index;\n\n try {\n if (\n nextIndex !== -1 &&\n nextIndex < currentIndex &&\n // We should only go back if the entry exists and it's less than current index\n history.get(nextIndex - currentIndex)\n ) {\n // An existing entry for this path exists and it's less than current index, go back to that\n await history.go(nextIndex - currentIndex);\n } else {\n // We couldn't find an existing entry to go back to, so we'll go back by the delta\n // This won't be correct if multiple routes were pushed in one go before\n // Usually this shouldn't happen and this is a fallback for that\n await history.go(historyDelta);\n }\n\n // Store the updated state as well as fix the path if incorrect\n history.replace({ path, state });\n } catch {\n // The navigation was interrupted\n }\n } else {\n // If history length is unchanged, we want to replaceState\n history.replace({ path, state });\n }\n } else {\n // If no common navigation state was found, assume it's a replace\n // This would happen if the user did a reset/conditionally changed navigators\n history.replace({ path, state });\n }\n };\n\n // We debounce onStateChange coz we don't want multiple state changes to be handled at one time\n // This could happen since `history.go(n)` is asynchronous\n // If `pushState` or `replaceState` were called before `history.go(n)` completes, it'll mess stuff up\n return ref.current?.addListener('state', series(onStateChange));\n }, [enabled, history, ref]);\n\n return {\n getInitialState,\n };\n}\n\nexport function getInitialURLWithTimeout(): string | null | Promise {\n return typeof window === 'undefined' ? '' : window.location.href;\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/getRoutesCore.d.ts.map b/packages/expo-router/build/getRoutesCore.d.ts.map index e224551d8a6ca2..dbcfb60a94ea39 100644 --- a/packages/expo-router/build/getRoutesCore.d.ts.map +++ b/packages/expo-router/build/getRoutesCore.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"getRoutesCore.d.ts","sourceRoot":"","sources":["../src/getRoutesCore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAkB,SAAS,EAAE,MAAM,SAAS,CAAC;AAW5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C,MAAM,MAAM,OAAO,GAAG;IAC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IAAI,EAAE,MAAM,GAAG,iBAAiB,EAAE,GAAG,IAAI,CAgBxE"} \ No newline at end of file diff --git a/packages/expo-router/build/getRoutesCore.js b/packages/expo-router/build/getRoutesCore.js index 500bec9b2adec4..3f53885052280c 100644 --- a/packages/expo-router/build/getRoutesCore.js +++ b/packages/expo-router/build/getRoutesCore.js @@ -499,7 +499,9 @@ function getFileMeta(originalKey, options, redirects, rewrites) { let route = key; const parts = (0, matchers_1.removeFileSystemDots)(originalKey).split('/'); const filename = parts[parts.length - 1]; - const [filenameWithoutExtensions, platformExtension] = (0, matchers_1.removeSupportedExtensions)(filename).split('.'); + const filenameParts = (0, matchers_1.removeSupportedExtensions)(filename).split('.'); + const filenameWithoutExtensions = filenameParts[0]; + const platformExtension = filenameParts[1]; const isLayout = filenameWithoutExtensions === '_layout'; const isApi = originalKey.match(/\+api\.(\w+\.)?[jt]sx?$/); if (filenameWithoutExtensions.startsWith('(') && filenameWithoutExtensions.endsWith(')')) { @@ -728,6 +730,6 @@ function getMostSpecific(routes) { } // This works even tho routes is holey array (e.g it might have index 0 and 2 but not 1) // `.length` includes the holes in its count - return routes[routes.length - 1]; + return route; } //# sourceMappingURL=getRoutesCore.js.map \ No newline at end of file diff --git a/packages/expo-router/build/getRoutesCore.js.map b/packages/expo-router/build/getRoutesCore.js.map index cc58f9aaedc648..c7f774c1ba7a2c 100644 --- a/packages/expo-router/build/getRoutesCore.js.map +++ b/packages/expo-router/build/getRoutesCore.js.map @@ -1 +1 @@ -{"version":3,"file":"getRoutesCore.js","sourceRoot":"","sources":["../src/getRoutesCore.ts"],"names":[],"mappings":";;AAqFA,8BAoBC;AA4oBD,8CAwBC;AAED,0CAgBC;AA9xBD,yCASoB;AAEpB,qCAAmD;AA2DnD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS,CA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b,YAAY,KAAK,CAAC,UAAU,sEAAsE,CACnG,CAAC;IACJ,CAAC;IAED,wFAAwF;IACxF,4CAA4C;IAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import type { DynamicConvention, MiddlewareNode, RouteNode } from './Route';\nimport {\n matchArrayGroupName,\n matchDynamicName,\n matchGroupName,\n matchLastGroupName,\n removeFileSystemDots,\n removeFileSystemExtensions,\n removeSupportedExtensions,\n stripInvisibleSegmentsFromPath,\n} from './matchers';\nimport type { RequireContext } from './types';\nimport { shouldLinkExternally } from './utils/url';\n\nexport type Options = {\n ignore?: RegExp[];\n preserveApiRoutes?: boolean;\n ignoreRequireErrors?: boolean;\n ignoreEntryPoints?: boolean;\n /* Used to simplify testing for toEqual() comparison */\n internal_stripLoadRoute?: boolean;\n /* Used to simplify by skipping the generated routes */\n skipGenerated?: boolean;\n /** Skip routes created by `generateStaticParams()` */\n skipStaticParams?: boolean;\n /* Skip the generated not found route */\n notFound?: boolean;\n /* Enable experimental server middleware support */\n unstable_useServerMiddleware?: boolean;\n importMode?: string;\n platformRoutes?: boolean;\n sitemap?: boolean;\n platform?: string;\n redirects?: RedirectConfig[];\n rewrites?: RewriteConfig[];\n headers?: Record;\n /* Keep redirects as valid routes within the RouteConfig tree */\n preserveRedirectAndRewrites?: boolean;\n\n /** Get the system route for a location. Useful for shimming React Native imports in SSR environments. */\n getSystemRoute: (\n route: Pick & {\n defaults?: RouteNode;\n redirectConfig?: RedirectConfig;\n rewriteConfig?: RewriteConfig;\n }\n ) => RouteNode;\n};\n\ntype DirectoryNode = {\n layout?: RouteNode[];\n files: Map;\n subdirectories: Map;\n};\n\nexport type RedirectConfig = {\n source: string;\n destination: string;\n destinationContextKey: string;\n permanent?: boolean;\n methods?: string[];\n external?: boolean;\n};\n\nexport type RewriteConfig = {\n source: string;\n destination: string;\n destinationContextKey: string;\n methods?: string[];\n};\n\nconst validPlatforms = new Set(['android', 'ios', 'native', 'web']);\n\n/**\n * Given a Metro context module, return an array of nested routes.\n *\n * This is a two step process:\n * 1. Convert the RequireContext keys (file paths) into a directory tree.\n * - This should extrapolate array syntax into multiple routes\n * - Routes are given a specificity score\n * 2. Flatten the directory tree into routes\n * - Routes in directories without _layout files are hoisted to the nearest _layout\n * - The name of the route is relative to the nearest _layout\n * - If multiple routes have the same name, the most specific route is used\n */\nexport function getRoutes(contextModule: RequireContext, options: Options): RouteNode | null {\n const middleware = getMiddleware(contextModule, options);\n const directoryTree = getDirectoryTree(contextModule, options);\n\n // If there are no routes\n if (!directoryTree) {\n return null;\n }\n\n const rootNode = flattenDirectoryTreeToRoutes(directoryTree, options);\n\n if (middleware) {\n rootNode.middleware = middleware;\n }\n\n if (!options.ignoreEntryPoints) {\n crawlAndAppendInitialRoutesAndEntryFiles(rootNode, options);\n }\n\n return rootNode;\n}\n\n/**\n * Given a RequireContext, return the middleware node if one is found. If more than one middleware file is found, an error is thrown.\n */\nfunction getMiddleware(contextModule: RequireContext, options: Options): MiddlewareNode | null {\n const allMiddlewareFiles = contextModule.keys().filter((key) => key.includes('+middleware'));\n\n // Check if middleware is enabled via plugin config\n if (!options.unstable_useServerMiddleware) {\n if (allMiddlewareFiles.length > 0) {\n console.warn(\n 'Server middleware is not enabled. Add unstable_useServerMiddleware: true to your `expo-router` plugin config.\\n\\n' +\n JSON.stringify(\n {\n expo: {\n plugins: [['expo-router', { unstable_useServerMiddleware: true }]],\n },\n },\n null,\n 2\n )\n );\n }\n return null;\n }\n\n const isValidMiddleware = (key: string) => /^\\.\\/\\+middleware\\.[tj]sx?$/.test(key);\n\n const rootMiddlewareFiles = allMiddlewareFiles.filter(isValidMiddleware);\n\n const nonRootMiddleware = allMiddlewareFiles.filter(\n (file) => !rootMiddlewareFiles.includes(file)\n );\n if (nonRootMiddleware.length > 0) {\n throw new Error(\n `The middleware file can only be placed at the root level. Remove the following files: ${nonRootMiddleware.join(', ')}`\n );\n }\n\n if (rootMiddlewareFiles.length === 0) {\n return null;\n }\n\n // In development, throw an error if there are multiple root-level middleware files\n if (rootMiddlewareFiles.length > 1) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `Only one middleware file is allowed. Keep one of the conflicting files: ${rootMiddlewareFiles.map((p) => `\"${p}\"`).join(' or ')}`\n );\n }\n }\n\n const middlewareFilePath = rootMiddlewareFiles[0];\n\n const middleware: MiddlewareNode = {\n loadRoute() {\n if (options.ignoreRequireErrors) {\n try {\n return contextModule(middlewareFilePath);\n } catch {\n return {};\n }\n } else {\n return contextModule(middlewareFilePath);\n }\n },\n contextKey: middlewareFilePath,\n };\n\n if (options.internal_stripLoadRoute) {\n delete (middleware as any).loadRoute;\n }\n\n return middleware;\n}\n\n/**\n * Converts the RequireContext keys (file paths) into a directory tree.\n */\nfunction getDirectoryTree(contextModule: RequireContext, options: Options) {\n const importMode = options.importMode || process.env.EXPO_ROUTER_IMPORT_MODE;\n\n const ignoreList: RegExp[] = [/^\\.\\/\\+(html|native-intent)\\.[tj]sx?$/]; // Ignore the top level ./+html file\n\n if (options.ignore) {\n ignoreList.push(...options.ignore);\n }\n if (!options.preserveApiRoutes) {\n ignoreList.push(/\\+api$/, /\\+api\\.[tj]sx?$/);\n }\n\n // Always ignore middleware files in regular route processing\n ignoreList.push(/\\+middleware$/, /\\+middleware\\.[tj]sx?$/);\n\n const rootDirectory: DirectoryNode = {\n files: new Map(),\n subdirectories: new Map(),\n };\n\n let hasRoutes = false;\n let isValid = false;\n\n const contextKeys = contextModule.keys();\n const redirects: Record = {};\n const rewrites: Record = {};\n\n let validRedirectDestinations: { contextKey: string; nameWithoutInvisible: string }[] | undefined;\n\n const getValidDestinations = () => {\n // Loop over contexts once and cache the valid destinations\n validRedirectDestinations ??= contextKeys.map((key) => {\n return {\n contextKey: key,\n nameWithoutInvisible: getNameWithoutInvisibleSegmentsFromRedirectPath(\n removeSupportedExtensions(key)\n ),\n };\n });\n return validRedirectDestinations;\n };\n\n // If we are keeping redirects as valid routes, then we need to add them to the contextKeys\n // This is useful for generating a sitemap with redirects, or static site generation that includes redirects\n if (options.preserveRedirectAndRewrites) {\n if (options.redirects) {\n for (const redirect of options.redirects) {\n const sourceContextKey = getSourceContextKeyFromRedirectSource(redirect.source);\n const sourceName = getNameFromRedirectPath(redirect.source);\n\n const isExternalRedirect = shouldLinkExternally(redirect.destination);\n\n const targetDestinationName = isExternalRedirect\n ? redirect.destination\n : getNameWithoutInvisibleSegmentsFromRedirectPath(redirect.destination);\n\n if (ignoreList.some((regex) => regex.test(sourceContextKey))) {\n continue;\n }\n\n const validDestination = isExternalRedirect\n ? undefined\n : getValidDestinations().find(\n (key) => key.nameWithoutInvisible === targetDestinationName\n );\n const destination = isExternalRedirect\n ? targetDestinationName\n : validDestination?.nameWithoutInvisible;\n const destinationContextKey = isExternalRedirect\n ? targetDestinationName\n : validDestination?.contextKey;\n\n if (!destinationContextKey || destination === undefined) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Redirect destination \"${redirect.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n contextKeys.push(sourceContextKey);\n redirects[sourceName] = {\n source: sourceName,\n destination,\n destinationContextKey,\n permanent: Boolean(redirect.permanent),\n external: isExternalRedirect,\n methods: redirect.methods,\n };\n }\n }\n\n if (options.rewrites) {\n for (const rewrite of options.rewrites) {\n const sourceContextKey = getSourceContextKeyFromRedirectSource(rewrite.source);\n const sourceName = getNameFromRedirectPath(rewrite.source);\n\n // We check to see if the context key is already known so that we don't create a rewrite for\n // a route that already exists on disk\n const isSourceContextKeyAlreadyKnown = contextKeys.includes(sourceContextKey);\n const targetDestinationName = isSourceContextKeyAlreadyKnown\n ? getNameFromRedirectPath(rewrite.destination)\n : getNameWithoutInvisibleSegmentsFromRedirectPath(rewrite.destination);\n\n if (ignoreList.some((regex) => regex.test(sourceContextKey))) {\n continue;\n }\n\n const validDestination = getValidDestinations().find(\n (key) => key.nameWithoutInvisible === targetDestinationName\n );\n const destination = validDestination?.nameWithoutInvisible;\n const destinationContextKey = validDestination?.contextKey;\n\n if (!destinationContextKey || destination === undefined) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Rewrite destination \"${rewrite.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n contextKeys.push(sourceContextKey);\n rewrites[sourceName] = {\n source: sourceName,\n destination,\n destinationContextKey,\n methods: rewrite.methods,\n };\n }\n }\n }\n\n const processedRedirectsRewrites = new Set();\n\n for (const filePath of contextKeys) {\n if (ignoreList.some((regex) => regex.test(filePath))) {\n continue;\n }\n\n isValid = true;\n\n const meta = getFileMeta(filePath, options, redirects, rewrites);\n\n // This is a file that should be ignored. e.g maybe it has an invalid platform?\n if (meta.specificity < 0) {\n continue;\n }\n\n let node: RouteNode = {\n type: meta.isApi ? 'api' : meta.isLayout ? 'layout' : 'route',\n loadRoute() {\n let routeModule: any;\n\n if (options.ignoreRequireErrors) {\n try {\n routeModule = contextModule(filePath);\n } catch {\n routeModule = {};\n }\n } else {\n routeModule = contextModule(filePath);\n }\n\n if (process.env.NODE_ENV === 'development' && importMode === 'sync') {\n // In development mode, when async routes are disabled, add some extra error handling to improve the developer experience.\n // This can be useful when you accidentally use an async function in a route file for the default export.\n if (routeModule instanceof Promise) {\n throw new Error(\n `Route \"${filePath}\" cannot be a promise when async routes is disabled.`\n );\n }\n\n const defaultExport = routeModule?.default;\n if (defaultExport instanceof Promise) {\n throw new Error(\n `The default export from route \"${filePath}\" is a promise. Ensure the React Component does not use async or promises.`\n );\n }\n\n // check if default is an async function without invoking it\n if (\n defaultExport instanceof Function &&\n // This only works on web because Hermes support async functions so we have to transform them out.\n defaultExport.constructor.name === 'AsyncFunction'\n ) {\n throw new Error(\n `The default export from route \"${filePath}\" is an async function. Ensure the React Component does not use async or promises.`\n );\n }\n\n // Validate loader export in development\n const loaderExport = routeModule?.loader;\n if (loaderExport && typeof loaderExport !== 'function') {\n throw new Error(`Route \"${filePath}\" exports a loader that is not a function.`);\n }\n }\n\n return routeModule;\n },\n contextKey: filePath,\n route: '', // This is overwritten during hoisting based upon the _layout\n dynamic: null,\n children: [], // While we are building the directory tree, we don't know the node's children just yet. This is added during hoisting\n };\n\n if (meta.isRedirect) {\n if (processedRedirectsRewrites.has(meta.route)) {\n continue;\n }\n\n const redirect = redirects[meta.route];\n node.destinationContextKey = redirect.destinationContextKey;\n node.permanent = redirect.permanent;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute({\n type: 'redirect',\n route: redirect.destination,\n defaults: node,\n redirectConfig: redirect,\n });\n }\n if (redirect.methods) {\n node.methods = redirect.methods;\n }\n node.type = 'redirect';\n processedRedirectsRewrites.add(meta.route);\n }\n\n if (meta.isRewrite) {\n if (processedRedirectsRewrites.has(meta.route)) {\n continue;\n }\n\n const rewrite = rewrites[meta.route];\n node.destinationContextKey = rewrite.destinationContextKey;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute({\n type: 'rewrite',\n route: rewrite.destination,\n defaults: node,\n rewriteConfig: rewrite,\n });\n }\n if (rewrite.methods) {\n node.methods = rewrite.methods;\n }\n node.type = 'rewrite';\n processedRedirectsRewrites.add(meta.route);\n }\n\n if (process.env.NODE_ENV === 'development') {\n // If the user has set the `EXPO_ROUTER_IMPORT_MODE` to `sync` then we should\n // filter the missing routes.\n if (node.type !== 'api' && importMode === 'sync') {\n const routeItem = node.loadRoute();\n // Have a warning for nullish ex\n const route = routeItem?.default;\n if (route == null) {\n // Do not throw an error since a user may just be creating a new route.\n console.warn(\n `Route \"${filePath}\" is missing the required default export. Ensure a React component is exported as default.`\n );\n continue;\n }\n if (['boolean', 'number', 'string'].includes(typeof route)) {\n throw new Error(\n `The default export from route \"${filePath}\" is an unsupported type: \"${typeof route}\". Only React Components are supported as default exports from route files.`\n );\n }\n }\n }\n\n /**\n * A single filepath may be extrapolated into multiple routes if it contains array syntax.\n * Another way to thinking about is that a filepath node is present in multiple leaves of the directory tree.\n */\n for (const route of extrapolateGroups(meta.route)) {\n // Traverse the directory tree to its leaf node, creating any missing directories along the way\n const subdirectoryParts = route.split('/').slice(0, -1);\n\n // Start at the root directory and traverse the path to the leaf directory\n let directory = rootDirectory;\n\n for (const part of subdirectoryParts) {\n let subDirectory = directory.subdirectories.get(part);\n\n // Create any missing subdirectories\n if (!subDirectory) {\n subDirectory = {\n files: new Map(),\n subdirectories: new Map(),\n };\n directory.subdirectories.set(part, subDirectory);\n }\n\n directory = subDirectory;\n }\n\n // Clone the node for this route\n node = { ...node, route };\n\n if (meta.isLayout) {\n directory.layout ??= [];\n const existing = directory.layout[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The layouts \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n node = getLayoutNode(node, options);\n directory.layout[meta.specificity] = node;\n }\n } else if (meta.isApi) {\n const fileKey = `${route}+api`;\n let nodes = directory.files.get(fileKey);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(fileKey, nodes);\n }\n\n // API Routes have no specificity, they are always the first node\n const existing = nodes[0];\n\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The API route file \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n nodes[0] = node;\n }\n } else {\n let nodes = directory.files.get(route);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(route, nodes);\n }\n\n /**\n * If there is an existing node with the same specificity, then we have a conflict.\n * NOTE(Platform Routes):\n * We cannot check for specificity conflicts here, as we haven't processed all the context keys yet!\n * This will be checked during hoisting, as well as enforcing that all routes have a non-platform route.\n */\n const existing = nodes[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The route files \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n hasRoutes ||= true;\n nodes[meta.specificity] = node;\n }\n }\n }\n }\n\n // If there are no routes/layouts then we should display the tutorial.\n if (!isValid) {\n return null;\n }\n\n /**\n * If there are no top-level _layout, add a default _layout\n * While this is a generated route, it will still be generated even if skipGenerated is true.\n */\n if (!rootDirectory.layout) {\n rootDirectory.layout = [\n options.getSystemRoute({\n type: 'layout',\n route: '',\n }),\n ];\n }\n\n // Only include the sitemap if there are routes.\n if (!options.skipGenerated) {\n if (hasRoutes && options.sitemap !== false) {\n appendSitemapRoute(rootDirectory, options);\n }\n if (options.notFound !== false) {\n appendNotFoundRoute(rootDirectory, options);\n }\n }\n return rootDirectory;\n}\n\nfunction getNameFromRedirectPath(path: string): string {\n // Removing only the filesystem extensions, to be able to handle +api, +html\n return (\n removeFileSystemExtensions(removeFileSystemDots(path))\n // Remove the leading `/`\n .replace(/^\\//, '')\n );\n}\n\nfunction getNameWithoutInvisibleSegmentsFromRedirectPath(path: string): string {\n return stripInvisibleSegmentsFromPath(getNameFromRedirectPath(path));\n}\n\n// Creates fake context key for redirects and rewrites\nfunction getSourceContextKeyFromRedirectSource(source: string): string {\n const name = getNameFromRedirectPath(source);\n const prefix = './';\n const suffix = /\\.[tj]sx?$/.test(name) ? '' : '.js'; // Ensure it has a file extension\n return `${prefix}${name}${suffix}`;\n}\n\n/**\n * Flatten the directory tree into routes, hoisting routes to the nearest _layout.\n */\nfunction flattenDirectoryTreeToRoutes(\n directory: DirectoryNode,\n options: Options,\n /* The nearest _layout file in the directory tree */\n layout?: RouteNode,\n /* Route names are relative to their layout */\n pathToRemove = ''\n) {\n /**\n * This directory has a _layout file so it becomes the new target for hoisting routes.\n */\n if (directory.layout) {\n const previousLayout = layout;\n layout = getMostSpecific(directory.layout);\n\n // Add the new layout as a child of its parent\n if (previousLayout) {\n previousLayout.children.push(layout);\n }\n\n if (options.internal_stripLoadRoute) {\n delete (layout as any).loadRoute;\n }\n\n // `route` is the absolute pathname. We need to make this relative to the last _layout\n const newRoute = layout.route.replace(pathToRemove, '');\n pathToRemove = layout.route ? `${layout.route}/` : '';\n\n // Now update this layout with the new relative route and dynamic conventions\n layout.route = newRoute;\n layout.dynamic = generateDynamic(layout.contextKey.slice(0));\n }\n\n // This should never occur as there will always be a root layout, but it makes the type system happy\n if (!layout) throw new Error('Expo Router Internal Error: No nearest layout');\n\n for (const routes of directory.files.values()) {\n const routeNode = getMostSpecific(routes);\n\n // `route` is the absolute pathname. We need to make this relative to the nearest layout\n routeNode.route = routeNode.route.replace(pathToRemove, '');\n routeNode.dynamic = generateDynamic(routeNode.route);\n\n if (options.internal_stripLoadRoute) {\n delete (routeNode as any).loadRoute;\n }\n\n layout.children.push(routeNode);\n }\n\n // Recursively flatten the subdirectories\n for (const child of directory.subdirectories.values()) {\n flattenDirectoryTreeToRoutes(child, options, layout, pathToRemove);\n }\n\n return layout;\n}\n\nfunction getFileMeta(\n originalKey: string,\n options: Options,\n redirects: Record,\n rewrites: Record\n) {\n // Remove the leading `./`\n const key = removeSupportedExtensions(removeFileSystemDots(originalKey));\n let route = key;\n\n const parts = removeFileSystemDots(originalKey).split('/');\n const filename = parts[parts.length - 1];\n const [filenameWithoutExtensions, platformExtension] =\n removeSupportedExtensions(filename).split('.');\n\n const isLayout = filenameWithoutExtensions === '_layout';\n const isApi = originalKey.match(/\\+api\\.(\\w+\\.)?[jt]sx?$/);\n\n if (filenameWithoutExtensions.startsWith('(') && filenameWithoutExtensions.endsWith(')')) {\n throw new Error(`Invalid route ${originalKey}. Routes cannot end with '(group)' syntax`);\n }\n\n // Nested routes cannot start with the '+' character, except for the '+not-found' route\n if (!isApi && filename.startsWith('+') && filenameWithoutExtensions !== '+not-found') {\n const renamedRoute = [...parts.slice(0, -1), filename.slice(1)].join('/');\n throw new Error(\n `Invalid route ${originalKey}. Route nodes cannot start with the '+' character. \"Rename it to ${renamedRoute}\"`\n );\n }\n let specificity = 0;\n\n const hasPlatformExtension = validPlatforms.has(platformExtension);\n const usePlatformRoutes = options.platformRoutes ?? true;\n\n if (hasPlatformExtension) {\n if (!usePlatformRoutes) {\n // If the user has disabled platform routes, then we should ignore this file\n specificity = -1;\n } else if (!options.platform) {\n // If we don't have a platform, then we should ignore this file\n // This used by typed routes, sitemap, etc\n specificity = -1;\n } else if (platformExtension === options.platform) {\n // If the platform extension is the same as the options.platform, then it is the most specific\n specificity = 2;\n } else if (platformExtension === 'native' && options.platform !== 'web') {\n // `native` is allow but isn't as specific as the platform\n specificity = 1;\n } else if (platformExtension !== options.platform) {\n // Somehow we have a platform extension that doesn't match the options.platform and it isn't native\n // This is an invalid file and we will ignore it\n specificity = -1;\n }\n\n if (isApi && specificity !== 0) {\n throw new Error(\n `API routes cannot have platform extensions. Remove '.${platformExtension}' from '${originalKey}'`\n );\n }\n\n route = route.replace(new RegExp(`.${platformExtension}$`), '');\n }\n\n return {\n route,\n specificity,\n isLayout,\n isApi,\n isRedirect: key in redirects,\n isRewrite: key in rewrites,\n };\n}\n\n/**\n * Generates a set of strings which have the router array syntax extrapolated.\n *\n * /(a,b)/(c,d)/e.tsx => new Set(['a/c/e.tsx', 'a/d/e.tsx', 'b/c/e.tsx', 'b/d/e.tsx'])\n */\nexport function extrapolateGroups(key: string, keys: Set = new Set()): Set {\n const match = matchArrayGroupName(key);\n\n if (!match) {\n keys.add(key);\n return keys;\n }\n const groups = match.split(',');\n const groupsSet = new Set(groups);\n\n if (groupsSet.size !== groups.length) {\n throw new Error(`Array syntax cannot contain duplicate group name \"${groups}\" in \"${key}\".`);\n }\n\n if (groups.length === 1) {\n keys.add(key);\n return keys;\n }\n\n for (const group of groups) {\n extrapolateGroups(key.replace(match, group.trim()), keys);\n }\n\n return keys;\n}\n\nexport function generateDynamic(path: string): DynamicConvention[] | null {\n const dynamic = path\n .split('/')\n .map((part): DynamicConvention | null => {\n if (part === '+not-found') {\n return {\n name: '+not-found',\n deep: true,\n notFound: true,\n };\n }\n return matchDynamicName(part) ?? null;\n })\n .filter((part): part is DynamicConvention => !!part);\n\n return dynamic.length === 0 ? null : dynamic;\n}\n\nfunction appendSitemapRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('_sitemap') && options.getSystemRoute) {\n directory.files.set('_sitemap', [\n options.getSystemRoute({\n type: 'route',\n route: '_sitemap',\n }),\n ]);\n }\n}\n\nfunction appendNotFoundRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('+not-found') && options.getSystemRoute) {\n directory.files.set('+not-found', [\n options.getSystemRoute({\n type: 'route',\n route: '+not-found',\n }),\n ]);\n }\n}\n\nfunction getLayoutNode(node: RouteNode, options: Options) {\n /**\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group name.\n */\n // We may strip loadRoute during testing\n const groupName = matchLastGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n\n return {\n ...node,\n route: node.route.replace(/\\/?_layout$/, ''),\n children: [], // Each layout should have its own children\n initialRouteName: anchor,\n };\n}\n\nfunction crawlAndAppendInitialRoutesAndEntryFiles(\n node: RouteNode,\n options: Options,\n entryPoints: string[] = []\n) {\n if (node.type === 'route') {\n node.entryPoints = [...new Set([...entryPoints, node.contextKey])];\n } else if (node.type === 'redirect') {\n node.entryPoints = [...new Set([...entryPoints, node.destinationContextKey!])];\n } else if (node.type === 'layout') {\n if (!node.children) {\n throw new Error(`Layout \"${node.contextKey}\" does not contain any child routes`);\n }\n\n // Every node below this layout will have it as an entryPoint\n entryPoints = [...entryPoints, node.contextKey];\n\n /**\n * Calculate the initialRouteNode\n *\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group.\n */\n const groupName = matchGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n // We may strip loadRoute during testing\n if (!options.internal_stripLoadRoute) {\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n }\n\n if (anchor) {\n const anchorRoute = node.children.find((child) => child.route === anchor);\n if (!anchorRoute) {\n const validAnchorRoutes = node.children\n .filter((child) => !child.generated)\n .map((child) => `'${child.route}'`)\n .join(', ');\n\n if (groupName) {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}' for group '(${groupName})'. Valid options are: ${validAnchorRoutes}`\n );\n } else {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}'. Valid options are: ${validAnchorRoutes}`\n );\n }\n }\n\n // Navigators can add initialsRoutes into the history, so they need to be to be included in the entryPoints\n node.initialRouteName = anchor;\n entryPoints.push(anchorRoute.contextKey);\n }\n\n for (const child of node.children) {\n crawlAndAppendInitialRoutesAndEntryFiles(child, options, entryPoints);\n }\n }\n}\n\nfunction getMostSpecific(routes: RouteNode[]) {\n const route = routes[routes.length - 1];\n\n if (!routes[0]) {\n throw new Error(\n `The file ${route.contextKey} does not have a fallback sibling file without a platform extension.`\n );\n }\n\n // This works even tho routes is holey array (e.g it might have index 0 and 2 but not 1)\n // `.length` includes the holes in its count\n return routes[routes.length - 1];\n}\n"]} \ No newline at end of file +{"version":3,"file":"getRoutesCore.js","sourceRoot":"","sources":["../src/getRoutesCore.ts"],"names":[],"mappings":";;AAqFA,8BAoBC;AA6oBD,8CAwBC;AAED,0CAgBC;AA/xBD,yCASoB;AAEpB,qCAAmD;AA2DnD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS,CAAC,aAA6B,EAAE,OAAgB;IACvE,MAAM,UAAU,GAAG,aAAa,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACzD,MAAM,aAAa,GAAG,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAE/D,yBAAyB;IACzB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,4BAA4B,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAEtE,IAAI,UAAU,EAAE,CAAC;QACf,QAAQ,CAA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AAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC;qBACnC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC;qBAClC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAEd,IAAI,SAAS,EAAE,CAAC;oBACd,MAAM,IAAI,KAAK,CACb,UAAU,IAAI,CAAC,UAAU,wBAAwB,MAAM,iBAAiB,SAAS,0BAA0B,iBAAiB,EAAE,CAC/H,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,KAAK,CACb,UAAU,IAAI,CAAC,UAAU,wBAAwB,MAAM,yBAAyB,iBAAiB,EAAE,CACpG,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,2GAA2G;YAC3G,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC;YAC/B,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC3C,CAAC;QAED,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClC,wCAAwC,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,MAAmB;IAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC;IAEzC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,YAAY,KAAK,CAAC,UAAU,sEAAsE,CACnG,CAAC;IACJ,CAAC;IAED,wFAAwF;IACxF,4CAA4C;IAC5C,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import type { DynamicConvention, MiddlewareNode, RouteNode } from './Route';\nimport {\n matchArrayGroupName,\n matchDynamicName,\n matchGroupName,\n matchLastGroupName,\n removeFileSystemDots,\n removeFileSystemExtensions,\n removeSupportedExtensions,\n stripInvisibleSegmentsFromPath,\n} from './matchers';\nimport type { RequireContext } from './types';\nimport { shouldLinkExternally } from './utils/url';\n\nexport type Options = {\n ignore?: RegExp[];\n preserveApiRoutes?: boolean;\n ignoreRequireErrors?: boolean;\n ignoreEntryPoints?: boolean;\n /* Used to simplify testing for toEqual() comparison */\n internal_stripLoadRoute?: boolean;\n /* Used to simplify by skipping the generated routes */\n skipGenerated?: boolean;\n /** Skip routes created by `generateStaticParams()` */\n skipStaticParams?: boolean;\n /* Skip the generated not found route */\n notFound?: boolean;\n /* Enable experimental server middleware support */\n unstable_useServerMiddleware?: boolean;\n importMode?: string;\n platformRoutes?: boolean;\n sitemap?: boolean;\n platform?: string;\n redirects?: RedirectConfig[];\n rewrites?: RewriteConfig[];\n headers?: Record;\n /* Keep redirects as valid routes within the RouteConfig tree */\n preserveRedirectAndRewrites?: boolean;\n\n /** Get the system route for a location. Useful for shimming React Native imports in SSR environments. */\n getSystemRoute: (\n route: Pick & {\n defaults?: RouteNode;\n redirectConfig?: RedirectConfig;\n rewriteConfig?: RewriteConfig;\n }\n ) => RouteNode;\n};\n\ntype DirectoryNode = {\n layout?: RouteNode[];\n files: Map;\n subdirectories: Map;\n};\n\nexport type RedirectConfig = {\n source: string;\n destination: string;\n destinationContextKey: string;\n permanent?: boolean;\n methods?: string[];\n external?: boolean;\n};\n\nexport type RewriteConfig = {\n source: string;\n destination: string;\n destinationContextKey: string;\n methods?: string[];\n};\n\nconst validPlatforms = new Set(['android', 'ios', 'native', 'web']);\n\n/**\n * Given a Metro context module, return an array of nested routes.\n *\n * This is a two step process:\n * 1. Convert the RequireContext keys (file paths) into a directory tree.\n * - This should extrapolate array syntax into multiple routes\n * - Routes are given a specificity score\n * 2. Flatten the directory tree into routes\n * - Routes in directories without _layout files are hoisted to the nearest _layout\n * - The name of the route is relative to the nearest _layout\n * - If multiple routes have the same name, the most specific route is used\n */\nexport function getRoutes(contextModule: RequireContext, options: Options): RouteNode | null {\n const middleware = getMiddleware(contextModule, options);\n const directoryTree = getDirectoryTree(contextModule, options);\n\n // If there are no routes\n if (!directoryTree) {\n return null;\n }\n\n const rootNode = flattenDirectoryTreeToRoutes(directoryTree, options);\n\n if (middleware) {\n rootNode.middleware = middleware;\n }\n\n if (!options.ignoreEntryPoints) {\n crawlAndAppendInitialRoutesAndEntryFiles(rootNode, options);\n }\n\n return rootNode;\n}\n\n/**\n * Given a RequireContext, return the middleware node if one is found. If more than one middleware file is found, an error is thrown.\n */\nfunction getMiddleware(contextModule: RequireContext, options: Options): MiddlewareNode | null {\n const allMiddlewareFiles = contextModule.keys().filter((key) => key.includes('+middleware'));\n\n // Check if middleware is enabled via plugin config\n if (!options.unstable_useServerMiddleware) {\n if (allMiddlewareFiles.length > 0) {\n console.warn(\n 'Server middleware is not enabled. Add unstable_useServerMiddleware: true to your `expo-router` plugin config.\\n\\n' +\n JSON.stringify(\n {\n expo: {\n plugins: [['expo-router', { unstable_useServerMiddleware: true }]],\n },\n },\n null,\n 2\n )\n );\n }\n return null;\n }\n\n const isValidMiddleware = (key: string) => /^\\.\\/\\+middleware\\.[tj]sx?$/.test(key);\n\n const rootMiddlewareFiles = allMiddlewareFiles.filter(isValidMiddleware);\n\n const nonRootMiddleware = allMiddlewareFiles.filter(\n (file) => !rootMiddlewareFiles.includes(file)\n );\n if (nonRootMiddleware.length > 0) {\n throw new Error(\n `The middleware file can only be placed at the root level. Remove the following files: ${nonRootMiddleware.join(', ')}`\n );\n }\n\n if (rootMiddlewareFiles.length === 0) {\n return null;\n }\n\n // In development, throw an error if there are multiple root-level middleware files\n if (rootMiddlewareFiles.length > 1) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `Only one middleware file is allowed. Keep one of the conflicting files: ${rootMiddlewareFiles.map((p) => `\"${p}\"`).join(' or ')}`\n );\n }\n }\n\n const middlewareFilePath = rootMiddlewareFiles[0]!;\n\n const middleware: MiddlewareNode = {\n loadRoute() {\n if (options.ignoreRequireErrors) {\n try {\n return contextModule(middlewareFilePath);\n } catch {\n return {};\n }\n } else {\n return contextModule(middlewareFilePath);\n }\n },\n contextKey: middlewareFilePath,\n };\n\n if (options.internal_stripLoadRoute) {\n delete (middleware as any).loadRoute;\n }\n\n return middleware;\n}\n\n/**\n * Converts the RequireContext keys (file paths) into a directory tree.\n */\nfunction getDirectoryTree(contextModule: RequireContext, options: Options) {\n const importMode = options.importMode || process.env.EXPO_ROUTER_IMPORT_MODE;\n\n const ignoreList: RegExp[] = [/^\\.\\/\\+(html|native-intent)\\.[tj]sx?$/]; // Ignore the top level ./+html file\n\n if (options.ignore) {\n ignoreList.push(...options.ignore);\n }\n if (!options.preserveApiRoutes) {\n ignoreList.push(/\\+api$/, /\\+api\\.[tj]sx?$/);\n }\n\n // Always ignore middleware files in regular route processing\n ignoreList.push(/\\+middleware$/, /\\+middleware\\.[tj]sx?$/);\n\n const rootDirectory: DirectoryNode = {\n files: new Map(),\n subdirectories: new Map(),\n };\n\n let hasRoutes = false;\n let isValid = false;\n\n const contextKeys = contextModule.keys();\n const redirects: Record = {};\n const rewrites: Record = {};\n\n let validRedirectDestinations: { contextKey: string; nameWithoutInvisible: string }[] | undefined;\n\n const getValidDestinations = () => {\n // Loop over contexts once and cache the valid destinations\n validRedirectDestinations ??= contextKeys.map((key) => {\n return {\n contextKey: key,\n nameWithoutInvisible: getNameWithoutInvisibleSegmentsFromRedirectPath(\n removeSupportedExtensions(key)\n ),\n };\n });\n return validRedirectDestinations;\n };\n\n // If we are keeping redirects as valid routes, then we need to add them to the contextKeys\n // This is useful for generating a sitemap with redirects, or static site generation that includes redirects\n if (options.preserveRedirectAndRewrites) {\n if (options.redirects) {\n for (const redirect of options.redirects) {\n const sourceContextKey = getSourceContextKeyFromRedirectSource(redirect.source);\n const sourceName = getNameFromRedirectPath(redirect.source);\n\n const isExternalRedirect = shouldLinkExternally(redirect.destination);\n\n const targetDestinationName = isExternalRedirect\n ? redirect.destination\n : getNameWithoutInvisibleSegmentsFromRedirectPath(redirect.destination);\n\n if (ignoreList.some((regex) => regex.test(sourceContextKey))) {\n continue;\n }\n\n const validDestination = isExternalRedirect\n ? undefined\n : getValidDestinations().find(\n (key) => key.nameWithoutInvisible === targetDestinationName\n );\n const destination = isExternalRedirect\n ? targetDestinationName\n : validDestination?.nameWithoutInvisible;\n const destinationContextKey = isExternalRedirect\n ? targetDestinationName\n : validDestination?.contextKey;\n\n if (!destinationContextKey || destination === undefined) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Redirect destination \"${redirect.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n contextKeys.push(sourceContextKey);\n redirects[sourceName] = {\n source: sourceName,\n destination,\n destinationContextKey,\n permanent: Boolean(redirect.permanent),\n external: isExternalRedirect,\n methods: redirect.methods,\n };\n }\n }\n\n if (options.rewrites) {\n for (const rewrite of options.rewrites) {\n const sourceContextKey = getSourceContextKeyFromRedirectSource(rewrite.source);\n const sourceName = getNameFromRedirectPath(rewrite.source);\n\n // We check to see if the context key is already known so that we don't create a rewrite for\n // a route that already exists on disk\n const isSourceContextKeyAlreadyKnown = contextKeys.includes(sourceContextKey);\n const targetDestinationName = isSourceContextKeyAlreadyKnown\n ? getNameFromRedirectPath(rewrite.destination)\n : getNameWithoutInvisibleSegmentsFromRedirectPath(rewrite.destination);\n\n if (ignoreList.some((regex) => regex.test(sourceContextKey))) {\n continue;\n }\n\n const validDestination = getValidDestinations().find(\n (key) => key.nameWithoutInvisible === targetDestinationName\n );\n const destination = validDestination?.nameWithoutInvisible;\n const destinationContextKey = validDestination?.contextKey;\n\n if (!destinationContextKey || destination === undefined) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Rewrite destination \"${rewrite.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n contextKeys.push(sourceContextKey);\n rewrites[sourceName] = {\n source: sourceName,\n destination,\n destinationContextKey,\n methods: rewrite.methods,\n };\n }\n }\n }\n\n const processedRedirectsRewrites = new Set();\n\n for (const filePath of contextKeys) {\n if (ignoreList.some((regex) => regex.test(filePath))) {\n continue;\n }\n\n isValid = true;\n\n const meta = getFileMeta(filePath, options, redirects, rewrites);\n\n // This is a file that should be ignored. e.g maybe it has an invalid platform?\n if (meta.specificity < 0) {\n continue;\n }\n\n let node: RouteNode = {\n type: meta.isApi ? 'api' : meta.isLayout ? 'layout' : 'route',\n loadRoute() {\n let routeModule: any;\n\n if (options.ignoreRequireErrors) {\n try {\n routeModule = contextModule(filePath);\n } catch {\n routeModule = {};\n }\n } else {\n routeModule = contextModule(filePath);\n }\n\n if (process.env.NODE_ENV === 'development' && importMode === 'sync') {\n // In development mode, when async routes are disabled, add some extra error handling to improve the developer experience.\n // This can be useful when you accidentally use an async function in a route file for the default export.\n if (routeModule instanceof Promise) {\n throw new Error(\n `Route \"${filePath}\" cannot be a promise when async routes is disabled.`\n );\n }\n\n const defaultExport = routeModule?.default;\n if (defaultExport instanceof Promise) {\n throw new Error(\n `The default export from route \"${filePath}\" is a promise. Ensure the React Component does not use async or promises.`\n );\n }\n\n // check if default is an async function without invoking it\n if (\n defaultExport instanceof Function &&\n // This only works on web because Hermes support async functions so we have to transform them out.\n defaultExport.constructor.name === 'AsyncFunction'\n ) {\n throw new Error(\n `The default export from route \"${filePath}\" is an async function. Ensure the React Component does not use async or promises.`\n );\n }\n\n // Validate loader export in development\n const loaderExport = routeModule?.loader;\n if (loaderExport && typeof loaderExport !== 'function') {\n throw new Error(`Route \"${filePath}\" exports a loader that is not a function.`);\n }\n }\n\n return routeModule;\n },\n contextKey: filePath,\n route: '', // This is overwritten during hoisting based upon the _layout\n dynamic: null,\n children: [], // While we are building the directory tree, we don't know the node's children just yet. This is added during hoisting\n };\n\n if (meta.isRedirect) {\n if (processedRedirectsRewrites.has(meta.route)) {\n continue;\n }\n\n const redirect = redirects[meta.route]!;\n node.destinationContextKey = redirect.destinationContextKey;\n node.permanent = redirect.permanent;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute({\n type: 'redirect',\n route: redirect.destination,\n defaults: node,\n redirectConfig: redirect,\n });\n }\n if (redirect!.methods) {\n node.methods = redirect.methods;\n }\n node.type = 'redirect';\n processedRedirectsRewrites.add(meta.route);\n }\n\n if (meta.isRewrite) {\n if (processedRedirectsRewrites.has(meta.route)) {\n continue;\n }\n\n const rewrite = rewrites[meta.route]!;\n node.destinationContextKey = rewrite.destinationContextKey;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute({\n type: 'rewrite',\n route: rewrite.destination,\n defaults: node,\n rewriteConfig: rewrite,\n });\n }\n if (rewrite.methods) {\n node.methods = rewrite.methods;\n }\n node.type = 'rewrite';\n processedRedirectsRewrites.add(meta.route);\n }\n\n if (process.env.NODE_ENV === 'development') {\n // If the user has set the `EXPO_ROUTER_IMPORT_MODE` to `sync` then we should\n // filter the missing routes.\n if (node.type !== 'api' && importMode === 'sync') {\n const routeItem = node.loadRoute();\n // Have a warning for nullish ex\n const route = routeItem?.default;\n if (route == null) {\n // Do not throw an error since a user may just be creating a new route.\n console.warn(\n `Route \"${filePath}\" is missing the required default export. Ensure a React component is exported as default.`\n );\n continue;\n }\n if (['boolean', 'number', 'string'].includes(typeof route)) {\n throw new Error(\n `The default export from route \"${filePath}\" is an unsupported type: \"${typeof route}\". Only React Components are supported as default exports from route files.`\n );\n }\n }\n }\n\n /**\n * A single filepath may be extrapolated into multiple routes if it contains array syntax.\n * Another way to thinking about is that a filepath node is present in multiple leaves of the directory tree.\n */\n for (const route of extrapolateGroups(meta.route)) {\n // Traverse the directory tree to its leaf node, creating any missing directories along the way\n const subdirectoryParts = route.split('/').slice(0, -1);\n\n // Start at the root directory and traverse the path to the leaf directory\n let directory = rootDirectory;\n\n for (const part of subdirectoryParts) {\n let subDirectory = directory.subdirectories.get(part);\n\n // Create any missing subdirectories\n if (!subDirectory) {\n subDirectory = {\n files: new Map(),\n subdirectories: new Map(),\n };\n directory.subdirectories.set(part, subDirectory);\n }\n\n directory = subDirectory;\n }\n\n // Clone the node for this route\n node = { ...node, route };\n\n if (meta.isLayout) {\n directory.layout ??= [];\n const existing = directory.layout[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The layouts \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n node = getLayoutNode(node, options);\n directory.layout[meta.specificity] = node;\n }\n } else if (meta.isApi) {\n const fileKey = `${route}+api`;\n let nodes = directory.files.get(fileKey);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(fileKey, nodes);\n }\n\n // API Routes have no specificity, they are always the first node\n const existing = nodes[0];\n\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The API route file \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n nodes[0] = node;\n }\n } else {\n let nodes = directory.files.get(route);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(route, nodes);\n }\n\n /**\n * If there is an existing node with the same specificity, then we have a conflict.\n * NOTE(Platform Routes):\n * We cannot check for specificity conflicts here, as we haven't processed all the context keys yet!\n * This will be checked during hoisting, as well as enforcing that all routes have a non-platform route.\n */\n const existing = nodes[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The route files \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n hasRoutes ||= true;\n nodes[meta.specificity] = node;\n }\n }\n }\n }\n\n // If there are no routes/layouts then we should display the tutorial.\n if (!isValid) {\n return null;\n }\n\n /**\n * If there are no top-level _layout, add a default _layout\n * While this is a generated route, it will still be generated even if skipGenerated is true.\n */\n if (!rootDirectory.layout) {\n rootDirectory.layout = [\n options.getSystemRoute({\n type: 'layout',\n route: '',\n }),\n ];\n }\n\n // Only include the sitemap if there are routes.\n if (!options.skipGenerated) {\n if (hasRoutes && options.sitemap !== false) {\n appendSitemapRoute(rootDirectory, options);\n }\n if (options.notFound !== false) {\n appendNotFoundRoute(rootDirectory, options);\n }\n }\n return rootDirectory;\n}\n\nfunction getNameFromRedirectPath(path: string): string {\n // Removing only the filesystem extensions, to be able to handle +api, +html\n return (\n removeFileSystemExtensions(removeFileSystemDots(path))\n // Remove the leading `/`\n .replace(/^\\//, '')\n );\n}\n\nfunction getNameWithoutInvisibleSegmentsFromRedirectPath(path: string): string {\n return stripInvisibleSegmentsFromPath(getNameFromRedirectPath(path));\n}\n\n// Creates fake context key for redirects and rewrites\nfunction getSourceContextKeyFromRedirectSource(source: string): string {\n const name = getNameFromRedirectPath(source);\n const prefix = './';\n const suffix = /\\.[tj]sx?$/.test(name) ? '' : '.js'; // Ensure it has a file extension\n return `${prefix}${name}${suffix}`;\n}\n\n/**\n * Flatten the directory tree into routes, hoisting routes to the nearest _layout.\n */\nfunction flattenDirectoryTreeToRoutes(\n directory: DirectoryNode,\n options: Options,\n /* The nearest _layout file in the directory tree */\n layout?: RouteNode,\n /* Route names are relative to their layout */\n pathToRemove = ''\n) {\n /**\n * This directory has a _layout file so it becomes the new target for hoisting routes.\n */\n if (directory.layout) {\n const previousLayout = layout;\n layout = getMostSpecific(directory.layout);\n\n // Add the new layout as a child of its parent\n if (previousLayout) {\n previousLayout.children.push(layout);\n }\n\n if (options.internal_stripLoadRoute) {\n delete (layout as any).loadRoute;\n }\n\n // `route` is the absolute pathname. We need to make this relative to the last _layout\n const newRoute = layout.route.replace(pathToRemove, '');\n pathToRemove = layout.route ? `${layout.route}/` : '';\n\n // Now update this layout with the new relative route and dynamic conventions\n layout.route = newRoute;\n layout.dynamic = generateDynamic(layout.contextKey.slice(0));\n }\n\n // This should never occur as there will always be a root layout, but it makes the type system happy\n if (!layout) throw new Error('Expo Router Internal Error: No nearest layout');\n\n for (const routes of directory.files.values()) {\n const routeNode = getMostSpecific(routes);\n\n // `route` is the absolute pathname. We need to make this relative to the nearest layout\n routeNode.route = routeNode.route.replace(pathToRemove, '');\n routeNode.dynamic = generateDynamic(routeNode.route);\n\n if (options.internal_stripLoadRoute) {\n delete (routeNode as any).loadRoute;\n }\n\n layout.children.push(routeNode);\n }\n\n // Recursively flatten the subdirectories\n for (const child of directory.subdirectories.values()) {\n flattenDirectoryTreeToRoutes(child, options, layout, pathToRemove);\n }\n\n return layout;\n}\n\nfunction getFileMeta(\n originalKey: string,\n options: Options,\n redirects: Record,\n rewrites: Record\n) {\n // Remove the leading `./`\n const key = removeSupportedExtensions(removeFileSystemDots(originalKey));\n let route = key;\n\n const parts = removeFileSystemDots(originalKey).split('/');\n const filename = parts[parts.length - 1]!;\n const filenameParts = removeSupportedExtensions(filename).split('.');\n const filenameWithoutExtensions = filenameParts[0]!;\n const platformExtension = filenameParts[1];\n\n const isLayout = filenameWithoutExtensions === '_layout';\n const isApi = originalKey.match(/\\+api\\.(\\w+\\.)?[jt]sx?$/);\n\n if (filenameWithoutExtensions.startsWith('(') && filenameWithoutExtensions.endsWith(')')) {\n throw new Error(`Invalid route ${originalKey}. Routes cannot end with '(group)' syntax`);\n }\n\n // Nested routes cannot start with the '+' character, except for the '+not-found' route\n if (!isApi && filename.startsWith('+') && filenameWithoutExtensions !== '+not-found') {\n const renamedRoute = [...parts.slice(0, -1), filename.slice(1)].join('/');\n throw new Error(\n `Invalid route ${originalKey}. Route nodes cannot start with the '+' character. \"Rename it to ${renamedRoute}\"`\n );\n }\n let specificity = 0;\n\n const hasPlatformExtension = validPlatforms.has(platformExtension!);\n const usePlatformRoutes = options.platformRoutes ?? true;\n\n if (hasPlatformExtension) {\n if (!usePlatformRoutes) {\n // If the user has disabled platform routes, then we should ignore this file\n specificity = -1;\n } else if (!options.platform) {\n // If we don't have a platform, then we should ignore this file\n // This used by typed routes, sitemap, etc\n specificity = -1;\n } else if (platformExtension === options.platform) {\n // If the platform extension is the same as the options.platform, then it is the most specific\n specificity = 2;\n } else if (platformExtension === 'native' && options.platform !== 'web') {\n // `native` is allow but isn't as specific as the platform\n specificity = 1;\n } else if (platformExtension !== options.platform) {\n // Somehow we have a platform extension that doesn't match the options.platform and it isn't native\n // This is an invalid file and we will ignore it\n specificity = -1;\n }\n\n if (isApi && specificity !== 0) {\n throw new Error(\n `API routes cannot have platform extensions. Remove '.${platformExtension}' from '${originalKey}'`\n );\n }\n\n route = route.replace(new RegExp(`.${platformExtension}$`), '');\n }\n\n return {\n route,\n specificity,\n isLayout,\n isApi,\n isRedirect: key in redirects,\n isRewrite: key in rewrites,\n };\n}\n\n/**\n * Generates a set of strings which have the router array syntax extrapolated.\n *\n * /(a,b)/(c,d)/e.tsx => new Set(['a/c/e.tsx', 'a/d/e.tsx', 'b/c/e.tsx', 'b/d/e.tsx'])\n */\nexport function extrapolateGroups(key: string, keys: Set = new Set()): Set {\n const match = matchArrayGroupName(key);\n\n if (!match) {\n keys.add(key);\n return keys;\n }\n const groups = match.split(',');\n const groupsSet = new Set(groups);\n\n if (groupsSet.size !== groups.length) {\n throw new Error(`Array syntax cannot contain duplicate group name \"${groups}\" in \"${key}\".`);\n }\n\n if (groups.length === 1) {\n keys.add(key);\n return keys;\n }\n\n for (const group of groups) {\n extrapolateGroups(key.replace(match, group.trim()), keys);\n }\n\n return keys;\n}\n\nexport function generateDynamic(path: string): DynamicConvention[] | null {\n const dynamic = path\n .split('/')\n .map((part): DynamicConvention | null => {\n if (part === '+not-found') {\n return {\n name: '+not-found',\n deep: true,\n notFound: true,\n };\n }\n return matchDynamicName(part) ?? null;\n })\n .filter((part): part is DynamicConvention => !!part);\n\n return dynamic.length === 0 ? null : dynamic;\n}\n\nfunction appendSitemapRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('_sitemap') && options.getSystemRoute) {\n directory.files.set('_sitemap', [\n options.getSystemRoute({\n type: 'route',\n route: '_sitemap',\n }),\n ]);\n }\n}\n\nfunction appendNotFoundRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('+not-found') && options.getSystemRoute) {\n directory.files.set('+not-found', [\n options.getSystemRoute({\n type: 'route',\n route: '+not-found',\n }),\n ]);\n }\n}\n\nfunction getLayoutNode(node: RouteNode, options: Options) {\n /**\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group name.\n */\n // We may strip loadRoute during testing\n const groupName = matchLastGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n\n return {\n ...node,\n route: node.route.replace(/\\/?_layout$/, ''),\n children: [], // Each layout should have its own children\n initialRouteName: anchor,\n };\n}\n\nfunction crawlAndAppendInitialRoutesAndEntryFiles(\n node: RouteNode,\n options: Options,\n entryPoints: string[] = []\n) {\n if (node.type === 'route') {\n node.entryPoints = [...new Set([...entryPoints, node.contextKey])];\n } else if (node.type === 'redirect') {\n node.entryPoints = [...new Set([...entryPoints, node.destinationContextKey!])];\n } else if (node.type === 'layout') {\n if (!node.children) {\n throw new Error(`Layout \"${node.contextKey}\" does not contain any child routes`);\n }\n\n // Every node below this layout will have it as an entryPoint\n entryPoints = [...entryPoints, node.contextKey];\n\n /**\n * Calculate the initialRouteNode\n *\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group.\n */\n const groupName = matchGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n // We may strip loadRoute during testing\n if (!options.internal_stripLoadRoute) {\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n }\n\n if (anchor) {\n const anchorRoute = node.children.find((child) => child.route === anchor);\n if (!anchorRoute) {\n const validAnchorRoutes = node.children\n .filter((child) => !child.generated)\n .map((child) => `'${child.route}'`)\n .join(', ');\n\n if (groupName) {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}' for group '(${groupName})'. Valid options are: ${validAnchorRoutes}`\n );\n } else {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}'. Valid options are: ${validAnchorRoutes}`\n );\n }\n }\n\n // Navigators can add initialsRoutes into the history, so they need to be to be included in the entryPoints\n node.initialRouteName = anchor;\n entryPoints.push(anchorRoute.contextKey);\n }\n\n for (const child of node.children) {\n crawlAndAppendInitialRoutesAndEntryFiles(child, options, entryPoints);\n }\n }\n}\n\nfunction getMostSpecific(routes: RouteNode[]) {\n const route = routes[routes.length - 1]!;\n\n if (!routes[0]) {\n throw new Error(\n `The file ${route.contextKey} does not have a fallback sibling file without a platform extension.`\n );\n }\n\n // This works even tho routes is holey array (e.g it might have index 0 and 2 but not 1)\n // `.length` includes the holes in its count\n return route;\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/getRoutesRedirects.js.map b/packages/expo-router/build/getRoutesRedirects.js.map index c6c6e4ecd14d80..26b61df9038939 100644 --- a/packages/expo-router/build/getRoutesRedirects.js.map +++ b/packages/expo-router/build/getRoutesRedirects.js.map @@ -1 +1 @@ -{"version":3,"file":"getRoutesRedirects.js","sourceRoot":"","sources":["../src/getRoutesRedirects.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,wCA4BC;AAED,8CA6BC;AAED,0CAoBC;AAED,wDAeC;AA3GD,sDAAwC;AACxC,iCAAiD;AAEjD,0EAA0D;AAG1D,yCAA8C;AAC9C,qCAAmD;AAEnD,SAAgB,cAAc,CAC5B,GAA8B,EAC9B,SAAuC;IAEvC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,kCAAS,EAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAElE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,GAAG,CAAC;IACb,CAAC;IAED,4CAA4C;IAC5C,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAChB,IAAI,IAAI,GAAG,QAAQ,CAAC,C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AC,CAAC;YAChC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,CAAC;SACD,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC","sourcesContent":["import * as Linking from 'expo-linking';\nimport { createElement, useEffect } from 'react';\n\nimport { cleanPath } from './fork/getStateFromPath-forks';\nimport type { RedirectConfig } from './getRoutesCore';\nimport type { StoreRedirects } from './global-state/router-store';\nimport { matchDynamicName } from './matchers';\nimport { shouldLinkExternally } from './utils/url';\n\nexport function applyRedirects(\n url: string | null | undefined,\n redirects: StoreRedirects[] | undefined\n): string | undefined | null {\n if (typeof url !== 'string' || !redirects) {\n return url;\n }\n\n const nextUrl = cleanPath(url);\n const redirect = redirects.find(([regex]) => regex.test(nextUrl));\n\n if (!redirect) {\n return url;\n }\n\n // If the redirect is external, open the URL\n if (redirect[2]) {\n let href = redirect[1].destination;\n\n if (href.startsWith('//') && process.env.EXPO_OS !== 'web') {\n href = `https:${href}`;\n }\n\n Linking.openURL(href);\n return href;\n }\n\n return applyRedirects(convertRedirect(url, redirect[1]), redirects);\n}\n\nexport function getRedirectModule(redirectConfig: RedirectConfig) {\n return {\n default: function RedirectComponent() {\n const pathname = require('./hooks').usePathname();\n\n const isExternal = shouldLinkExternally(redirectConfig.destination);\n\n useEffect(() => {\n if (isExternal) {\n let href = redirectConfig.destination;\n if (href.startsWith('//') && process.env.EXPO_OS !== 'web') {\n href = `https:${href}`;\n }\n\n Linking.openURL(href);\n }\n }, []);\n\n if (isExternal) {\n return null;\n }\n\n const href = convertRedirect(pathname, redirectConfig);\n\n return createElement(require('./link/Link').Redirect, {\n href,\n });\n },\n };\n}\n\nexport function convertRedirect(path: string, config: RedirectConfig) {\n const params: Record = {};\n\n const parts = path.split('/');\n const sourceParts = config.source.split('/');\n\n for (const [index, sourcePart] of sourceParts.entries()) {\n const dynamicName = matchDynamicName(sourcePart);\n if (!dynamicName) {\n continue;\n } else if (!dynamicName.deep) {\n params[dynamicName.name] = parts[index];\n continue;\n } else {\n params[dynamicName.name] = parts.slice(index);\n break;\n }\n }\n\n return mergeVariablesWithPath(config.destination, params);\n}\n\nexport function mergeVariablesWithPath(path: string, params: Record) {\n return path\n .split('/')\n .map((part) => {\n const dynamicName = matchDynamicName(part);\n if (!dynamicName) {\n return part;\n } else {\n const param = params[dynamicName.name];\n delete params[dynamicName.name];\n return param;\n }\n })\n .filter(Boolean)\n .join('/');\n}\n"]} \ No newline at end of file +{"version":3,"file":"getRoutesRedirects.js","sourceRoot":"","sources":["../src/getRoutesRedirects.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,wCA4BC;AAED,8CA6BC;AAED,0CAoBC;AAED,wDAeC;AA3GD,sDAAwC;AACxC,iCAAiD;AAEjD,0EAA0D;AAG1D,yCAA8C;AAC9C,qCAAmD;AAEnD,SAAgB,cAAc,CAC5B,GAA8B,EAC9B,SAAuC;IAEvC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,kCAAS,EAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAElE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,GAAG,CAAC;IACb,CAAC;IAED,4CAA4C;IAC5C,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAChB,IAAI,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;QAEnC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;YAC3D,IAAI,GAAG,S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-linking';\nimport { createElement, useEffect } from 'react';\n\nimport { cleanPath } from './fork/getStateFromPath-forks';\nimport type { RedirectConfig } from './getRoutesCore';\nimport type { StoreRedirects } from './global-state/router-store';\nimport { matchDynamicName } from './matchers';\nimport { shouldLinkExternally } from './utils/url';\n\nexport function applyRedirects(\n url: string | null | undefined,\n redirects: StoreRedirects[] | undefined\n): string | undefined | null {\n if (typeof url !== 'string' || !redirects) {\n return url;\n }\n\n const nextUrl = cleanPath(url);\n const redirect = redirects.find(([regex]) => regex.test(nextUrl));\n\n if (!redirect) {\n return url;\n }\n\n // If the redirect is external, open the URL\n if (redirect[2]) {\n let href = redirect[1].destination;\n\n if (href.startsWith('//') && process.env.EXPO_OS !== 'web') {\n href = `https:${href}`;\n }\n\n Linking.openURL(href);\n return href;\n }\n\n return applyRedirects(convertRedirect(url, redirect[1]), redirects);\n}\n\nexport function getRedirectModule(redirectConfig: RedirectConfig) {\n return {\n default: function RedirectComponent() {\n const pathname = require('./hooks').usePathname();\n\n const isExternal = shouldLinkExternally(redirectConfig.destination);\n\n useEffect(() => {\n if (isExternal) {\n let href = redirectConfig.destination;\n if (href.startsWith('//') && process.env.EXPO_OS !== 'web') {\n href = `https:${href}`;\n }\n\n Linking.openURL(href);\n }\n }, []);\n\n if (isExternal) {\n return null;\n }\n\n const href = convertRedirect(pathname, redirectConfig);\n\n return createElement(require('./link/Link').Redirect, {\n href,\n });\n },\n };\n}\n\nexport function convertRedirect(path: string, config: RedirectConfig) {\n const params: Record = {};\n\n const parts = path.split('/');\n const sourceParts = config.source.split('/');\n\n for (const [index, sourcePart] of sourceParts.entries()) {\n const dynamicName = matchDynamicName(sourcePart);\n if (!dynamicName) {\n continue;\n } else if (!dynamicName.deep) {\n params[dynamicName.name] = parts[index]!;\n continue;\n } else {\n params[dynamicName.name] = parts.slice(index);\n break;\n }\n }\n\n return mergeVariablesWithPath(config.destination, params);\n}\n\nexport function mergeVariablesWithPath(path: string, params: Record) {\n return path\n .split('/')\n .map((part) => {\n const dynamicName = matchDynamicName(part);\n if (!dynamicName) {\n return part;\n } else {\n const param = params[dynamicName.name];\n delete params[dynamicName.name];\n return param;\n }\n })\n .filter(Boolean)\n .join('/');\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/global-state/getRouteInfoFromState.d.ts.map b/packages/expo-router/build/global-state/getRouteInfoFromState.d.ts.map index 25bda5a8f3e9ac..070ce5a847df15 100644 --- a/packages/expo-router/build/global-state/getRouteInfoFromState.d.ts.map +++ b/packages/expo-router/build/global-state/getRouteInfoFromState.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"getRouteInfoFromState.d.ts","sourceRoot":"","sources":["../../src/global-state/getRouteInfoFromState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGjD,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAEhF,MAAM,MAAM,SAAS,GAAG;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IACnD,YAAY,EAAE,eAAe,CAAC;IAC9B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,SAS9B,CAAC;AAEF;;GAEG;AACH,KAAK,WAAW,GAAG,CAAC,iBAAiB,GAAG,eAAe,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC,GAAG;IACzF,MAAM,EAAE;QACN,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,wBAAwB,CAAC;QAClC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,WAAW,CAAC;KACrB,EAAE,CAAC;CACL,CAAC;AAEF,KAAK,wBAAwB,GACzB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GACjC;IACE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,wBAAwB,CAAC;CACnC,CAAC;AAEN,wBAAgB,qBAAqB,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,CAuKpE"} \ No newline at end of file +{"version":3,"file":"getRouteInfoFromState.d.ts","sourceRoot":"","sources":["../../src/global-state/getRouteInfoFromState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGjD,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAEhF,MAAM,MAAM,SAAS,GAAG;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IACnD,YAAY,EAAE,eAAe,CAAC;IAC9B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,SAS9B,CAAC;AAEF;;GAEG;AACH,KAAK,WAAW,GAAG,CAAC,iBAAiB,GAAG,eAAe,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC,GAAG;IACzF,MAAM,EAAE;QACN,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,wBAAwB,CAAC;QAClC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,WAAW,CAAC;KACrB,EAAE,CAAC;CACL,CAAC;AAEF,KAAK,wBAAwB,GACzB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GACjC;IACE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,wBAAwB,CAAC;CACnC,CAAC;AAEN,wBAAgB,qBAAqB,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,CAwKpE"} \ No newline at end of file diff --git a/packages/expo-router/build/global-state/getRouteInfoFromState.js b/packages/expo-router/build/global-state/getRouteInfoFromState.js index ae823ea0cf7c10..2494a02b07860d 100644 --- a/packages/expo-router/build/global-state/getRouteInfoFromState.js +++ b/packages/expo-router/build/global-state/getRouteInfoFromState.js @@ -17,6 +17,7 @@ exports.defaultRouteInfo = { function getRouteInfoFromState(state) { if (!state) return exports.defaultRouteInfo; + // TODO(@kitten): Review edge-case type safety const index = 'index' in state ? (state.index ?? 0) : 0; let route = state.routes[index]; if (route.name === constants_1.NOT_FOUND_ROUTE_NAME || route.name === constants_1.SITEMAP_ROUTE_NAME) { diff --git a/packages/expo-router/build/global-state/getRouteInfoFromState.js.map b/packages/expo-router/build/global-state/getRouteInfoFromState.js.map index c14e579b186fba..f0674f932aa438 100644 --- a/packages/expo-router/build/global-state/getRouteInfoFromState.js.map +++ b/packages/expo-router/build/global-state/getRouteInfoFromState.js.map @@ -1 +1 @@ -{"version":3,"file":"getRouteInfoFromState.js","sourceRoot":"","sources":["../../src/global-state/getRouteInfoFromState.ts"],"names":[],"mappings":";;;AA8CA,sDAuKC;AApND,4CAA4F;AAC5F,2EAA+D;AAalD,QAAA,gBAAgB,GAAc;IACzC,mBAAmB,EAAE,EAAE;IACvB,YAAY,EAAE,IAAI,eAAe,EAAE;IACnC,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ,kBAAkB,EAAE,GAAG;IACvB,6CAA6C;IAC7C,OAAO,EAAE,KAAK;CACf,CAAC;AAsBF,SAAgB,qBAAqB,CAAC,KAAmB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Q,EAAE,CAAC;IAClD,IAAI,kBAAkB,GAAG,iBAAiB,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,GAAG,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC3F,kBAAkB,GAAG,IAAI,CAAC,CAAC,CAAC,kBAAkB,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC;IAEjF,OAAO;QACL,QAAQ;QACR,QAAQ;QACR,MAAM;QACN,mBAAmB,EAAE,IAAA,sCAAa,EAAC,kBAAkB,CAAC;QACtD,YAAY;QACZ,kBAAkB;QAClB,6CAA6C;QAC7C,OAAO,EAAE,KAAK;KACf,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAU;IACxC,IAAI,CAAC;QACH,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACvE,CAAC;IAAC,MAAM,CAAC;QACP,6DAA6D;QAC7D,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["import type { FocusedRouteState } from './types';\nimport { INTERNAL_SLOT_NAME, NOT_FOUND_ROUTE_NAME, SITEMAP_ROUTE_NAME } from '../constants';\nimport { appendBaseUrl } from '../fork/getPathFromState-forks';\nimport type { NavigationState, PartialState } from '../react-navigation/native';\n\nexport type UrlObject = {\n unstable_globalHref: string;\n pathname: string;\n readonly params: Record;\n searchParams: URLSearchParams;\n segments: string[];\n pathnameWithParams: string;\n isIndex: boolean;\n};\n\nexport const defaultRouteInfo: UrlObject = {\n unstable_globalHref: '',\n searchParams: new URLSearchParams(),\n pathname: '/',\n params: {},\n segments: [],\n pathnameWithParams: '/',\n // TODO: Remove this, it is not used anywhere\n isIndex: false,\n};\n\n/**\n * A better typed version of `FocusedRouteState` that is easier to parse\n */\ntype StrictState = (FocusedRouteState | NavigationState | PartialState) & {\n routes: {\n key?: string;\n name: string;\n params?: StrictFocusedRouteParams;\n path?: string;\n state?: StrictState;\n }[];\n};\n\ntype StrictFocusedRouteParams =\n | Record\n | {\n screen?: string;\n params?: StrictFocusedRouteParams;\n };\n\nexport function getRouteInfoFromState(state?: StrictState): UrlObject {\n if (!state) return defaultRouteInfo;\n\n const index = 'index' in state ? (state.index ?? 0) : 0;\n let route = state.routes[index];\n\n if (route.name === NOT_FOUND_ROUTE_NAME || route.name === SITEMAP_ROUTE_NAME) {\n const path = route.path || (route.name === NOT_FOUND_ROUTE_NAME ? '/' : `/${route.name}`);\n return {\n ...defaultRouteInfo,\n unstable_globalHref: appendBaseUrl(path),\n pathname: path,\n pathnameWithParams: path,\n segments: [route.name],\n };\n }\n\n if (route.name !== INTERNAL_SLOT_NAME) {\n throw new Error(`Expected the first route to be ${INTERNAL_SLOT_NAME}, but got ${route.name}`);\n }\n\n state = route.state;\n\n const segments: string[] = [];\n let params: UrlObject['params'] = Object.create(null);\n\n while (state) {\n route = state.routes['index' in state && state.index ? state.index : 0];\n\n Object.assign(params, route.params);\n\n let routeName = route.name;\n if (routeName.startsWith('/')) {\n routeName = routeName.slice(1);\n }\n\n segments.push(...routeName.split('/'));\n state = route.state;\n }\n\n params = Object.fromEntries(\n Object.entries(params).map(([key, value]) => {\n if (typeof value === 'string') {\n return [key, safeDecodeURIComponent(value)];\n } else if (Array.isArray(value)) {\n return [key, value.map((v) => safeDecodeURIComponent(v))];\n } else {\n return [key, value];\n }\n })\n );\n\n /**\n * If React Navigation didn't render the entire tree (e.g it was interrupted in a layout)\n * then the state maybe incomplete. The reset of the path is in the params, instead of being a route\n */\n let routeParams: StrictFocusedRouteParams | undefined = route.params;\n while (routeParams && 'screen' in routeParams) {\n if (typeof routeParams.screen === 'string') {\n const screen = routeParams.screen.startsWith('/')\n ? routeParams.screen.slice(1)\n : routeParams.screen;\n segments.push(...screen.split('/'));\n }\n\n if (typeof routeParams.params === 'object' && !Array.isArray(routeParams.params)) {\n routeParams = routeParams.params;\n } else {\n routeParams = undefined;\n }\n }\n\n if (route.params && 'screen' in route.params && route.params.screen === 'string') {\n const screen = route.params.screen.startsWith('/')\n ? route.params.screen.slice(1)\n : route.params.screen;\n segments.push(...screen.split('/'));\n }\n\n if (segments[segments.length - 1] === 'index') {\n segments.pop();\n }\n\n delete params['screen'];\n delete params['params'];\n\n const pathParams = new Set();\n\n const pathname =\n '/' +\n segments\n .filter((segment) => {\n return !(segment.startsWith('(') && segment.endsWith(')'));\n })\n .flatMap((segment) => {\n if (segment === '+not-found') {\n const notFoundPath = params['not-found'];\n\n pathParams.add('not-found');\n\n if (typeof notFoundPath === 'undefined') {\n // Not founds are optional, do nothing if its not present\n return [];\n } else if (Array.isArray(notFoundPath)) {\n return notFoundPath;\n } else {\n return [notFoundPath];\n }\n } else if (segment.startsWith('[...') && segment.endsWith(']')) {\n let paramName = segment.slice(4, -1);\n\n // Legacy for React Navigation optional params\n if (paramName.endsWith('?')) {\n paramName = paramName.slice(0, -1);\n }\n\n const values = params[paramName];\n pathParams.add(paramName);\n\n // Catchall params are optional\n return values || [];\n } else if (segment.startsWith('[') && segment.endsWith(']')) {\n const paramName = segment.slice(1, -1);\n const value = params[paramName];\n pathParams.add(paramName);\n\n // Optional params are optional\n return value ? [value] : [];\n } else {\n return [segment];\n }\n })\n .join('/');\n\n const searchParams = new URLSearchParams(\n Object.entries(params).flatMap(([key, value]) => {\n // Search params should not include path params\n if (pathParams.has(key)) {\n return [];\n } else if (Array.isArray(value)) {\n return value.map((v) => [key, v]);\n }\n return [[key, value]];\n })\n );\n\n let hash: string | undefined;\n if (searchParams.has('#')) {\n hash = searchParams.get('#') || undefined;\n searchParams.delete('#');\n }\n\n // We cannot use searchParams.size because it is not included in the React Native polyfill\n const searchParamString = searchParams.toString();\n let pathnameWithParams = searchParamString ? pathname + '?' + searchParamString : pathname;\n pathnameWithParams = hash ? pathnameWithParams + '#' + hash : pathnameWithParams;\n\n return {\n segments,\n pathname,\n params,\n unstable_globalHref: appendBaseUrl(pathnameWithParams),\n searchParams,\n pathnameWithParams,\n // TODO: Remove this, it is not used anywhere\n isIndex: false,\n };\n}\n\nfunction safeDecodeURIComponent(value: any) {\n try {\n return typeof value === 'string' ? decodeURIComponent(value) : value;\n } catch {\n // If the value is not a valid URI component, return it as is\n return value;\n }\n}\n"]} \ No newline at end of file +{"version":3,"file":"getRouteInfoFromState.js","sourceRoot":"","sources":["../../src/global-state/getRouteInfoFromState.ts"],"names":[],"mappings":";;;AA8CA,sDAwKC;AArND,4CAA4F;AAC5F,2EAA+D;AAalD,QAAA,gBAAgB,GAAc;IACzC,mBAAmB,EAAE,EAAE;IACvB,YAAY,EAAE,IAAI,eAAe,EAAE;IACnC,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ,kBAAkB,EAAE,GAAG;IACvB,6CAA6C;IAC7C,OAAO,EAAE,KAAK;CACf,CAAC;AAsBF,SAAgB,qBAAqB,CAAC,KAAmB;IACvD,IAAI,CAAC,KAAK;QAAE,OAAO,wBAAgB,CAAC;IAEpC,8CAA8C;IAC9C,MAAM,KAAK,GAAG,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAE,CAAC;IAEjC,IAAI,KAAK,CAAC,IAAI,KAAK,gCAAoB,IAAI,KAAK,CAAC,IAAI,KAAK,8BAAkB,EAAE,CAAC;QAC7E,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,gCAAoB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1F,OAAO;YACL,GAAG,wBAAgB;YACnB,mBAAmB,EAAE,IAAA,sCAAa,EAAC,IAAI,CAAC;YACxC,QAAQ,EA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CAAC;QACP,6DAA6D;QAC7D,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["import type { FocusedRouteState } from './types';\nimport { INTERNAL_SLOT_NAME, NOT_FOUND_ROUTE_NAME, SITEMAP_ROUTE_NAME } from '../constants';\nimport { appendBaseUrl } from '../fork/getPathFromState-forks';\nimport type { NavigationState, PartialState } from '../react-navigation/native';\n\nexport type UrlObject = {\n unstable_globalHref: string;\n pathname: string;\n readonly params: Record;\n searchParams: URLSearchParams;\n segments: string[];\n pathnameWithParams: string;\n isIndex: boolean;\n};\n\nexport const defaultRouteInfo: UrlObject = {\n unstable_globalHref: '',\n searchParams: new URLSearchParams(),\n pathname: '/',\n params: {},\n segments: [],\n pathnameWithParams: '/',\n // TODO: Remove this, it is not used anywhere\n isIndex: false,\n};\n\n/**\n * A better typed version of `FocusedRouteState` that is easier to parse\n */\ntype StrictState = (FocusedRouteState | NavigationState | PartialState) & {\n routes: {\n key?: string;\n name: string;\n params?: StrictFocusedRouteParams;\n path?: string;\n state?: StrictState;\n }[];\n};\n\ntype StrictFocusedRouteParams =\n | Record\n | {\n screen?: string;\n params?: StrictFocusedRouteParams;\n };\n\nexport function getRouteInfoFromState(state?: StrictState): UrlObject {\n if (!state) return defaultRouteInfo;\n\n // TODO(@kitten): Review edge-case type safety\n const index = 'index' in state ? (state.index ?? 0) : 0;\n let route = state.routes[index]!;\n\n if (route.name === NOT_FOUND_ROUTE_NAME || route.name === SITEMAP_ROUTE_NAME) {\n const path = route.path || (route.name === NOT_FOUND_ROUTE_NAME ? '/' : `/${route.name}`);\n return {\n ...defaultRouteInfo,\n unstable_globalHref: appendBaseUrl(path),\n pathname: path,\n pathnameWithParams: path,\n segments: [route.name],\n };\n }\n\n if (route.name !== INTERNAL_SLOT_NAME) {\n throw new Error(`Expected the first route to be ${INTERNAL_SLOT_NAME}, but got ${route.name}`);\n }\n\n state = route.state;\n\n const segments: string[] = [];\n let params: UrlObject['params'] = Object.create(null);\n\n while (state) {\n route = state.routes['index' in state && state.index ? state.index : 0]!;\n\n Object.assign(params, route.params);\n\n let routeName = route.name;\n if (routeName.startsWith('/')) {\n routeName = routeName.slice(1);\n }\n\n segments.push(...routeName.split('/'));\n state = route.state;\n }\n\n params = Object.fromEntries(\n Object.entries(params).map(([key, value]) => {\n if (typeof value === 'string') {\n return [key, safeDecodeURIComponent(value)];\n } else if (Array.isArray(value)) {\n return [key, value.map((v) => safeDecodeURIComponent(v))];\n } else {\n return [key, value];\n }\n })\n );\n\n /**\n * If React Navigation didn't render the entire tree (e.g it was interrupted in a layout)\n * then the state maybe incomplete. The reset of the path is in the params, instead of being a route\n */\n let routeParams: StrictFocusedRouteParams | undefined = route.params;\n while (routeParams && 'screen' in routeParams) {\n if (typeof routeParams.screen === 'string') {\n const screen = routeParams.screen.startsWith('/')\n ? routeParams.screen.slice(1)\n : routeParams.screen;\n segments.push(...screen.split('/'));\n }\n\n if (typeof routeParams.params === 'object' && !Array.isArray(routeParams.params)) {\n routeParams = routeParams.params;\n } else {\n routeParams = undefined;\n }\n }\n\n if (route.params && 'screen' in route.params && route.params.screen === 'string') {\n const screen = route.params.screen.startsWith('/')\n ? route.params.screen.slice(1)\n : route.params.screen;\n segments.push(...screen.split('/'));\n }\n\n if (segments[segments.length - 1] === 'index') {\n segments.pop();\n }\n\n delete params['screen'];\n delete params['params'];\n\n const pathParams = new Set();\n\n const pathname =\n '/' +\n segments\n .filter((segment) => {\n return !(segment.startsWith('(') && segment.endsWith(')'));\n })\n .flatMap((segment) => {\n if (segment === '+not-found') {\n const notFoundPath = params['not-found'];\n\n pathParams.add('not-found');\n\n if (typeof notFoundPath === 'undefined') {\n // Not founds are optional, do nothing if its not present\n return [];\n } else if (Array.isArray(notFoundPath)) {\n return notFoundPath;\n } else {\n return [notFoundPath];\n }\n } else if (segment.startsWith('[...') && segment.endsWith(']')) {\n let paramName = segment.slice(4, -1);\n\n // Legacy for React Navigation optional params\n if (paramName.endsWith('?')) {\n paramName = paramName.slice(0, -1);\n }\n\n const values = params[paramName];\n pathParams.add(paramName);\n\n // Catchall params are optional\n return values || [];\n } else if (segment.startsWith('[') && segment.endsWith(']')) {\n const paramName = segment.slice(1, -1);\n const value = params[paramName];\n pathParams.add(paramName);\n\n // Optional params are optional\n return value ? [value] : [];\n } else {\n return [segment];\n }\n })\n .join('/');\n\n const searchParams = new URLSearchParams(\n Object.entries(params).flatMap(([key, value]) => {\n // Search params should not include path params\n if (pathParams.has(key)) {\n return [];\n } else if (Array.isArray(value)) {\n return value.map((v) => [key, v]);\n }\n return [[key, value]];\n })\n );\n\n let hash: string | undefined;\n if (searchParams.has('#')) {\n hash = searchParams.get('#') || undefined;\n searchParams.delete('#');\n }\n\n // We cannot use searchParams.size because it is not included in the React Native polyfill\n const searchParamString = searchParams.toString();\n let pathnameWithParams = searchParamString ? pathname + '?' + searchParamString : pathname;\n pathnameWithParams = hash ? pathnameWithParams + '#' + hash : pathnameWithParams;\n\n return {\n segments,\n pathname,\n params,\n unstable_globalHref: appendBaseUrl(pathnameWithParams),\n searchParams,\n pathnameWithParams,\n // TODO: Remove this, it is not used anywhere\n isIndex: false,\n };\n}\n\nfunction safeDecodeURIComponent(value: any) {\n try {\n return typeof value === 'string' ? decodeURIComponent(value) : value;\n } catch {\n // If the value is not a valid URI component, return it as is\n return value;\n }\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/global-state/stateUtils.d.ts.map b/packages/expo-router/build/global-state/stateUtils.d.ts.map index 21327e47cf9ae2..6a7e5147645a35 100644 --- a/packages/expo-router/build/global-state/stateUtils.d.ts.map +++ b/packages/expo-router/build/global-state/stateUtils.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"stateUtils.d.ts","sourceRoot":"","sources":["../../src/global-state/stateUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE9F;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,iBAAiB,EAAE,YAAY,CAAC,GAAG,CAAC,uBAwB5E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,WAAW,EACzB,gBAAgB,EAAE,eAAe,EAEjC,kBAAkB,GAAE,OAAe;;;;;;;;;;;;;;;;;;;;;EAoDpC"} \ No newline at end of file +{"version":3,"file":"stateUtils.d.ts","sourceRoot":"","sources":["../../src/global-state/stateUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE9F;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,iBAAiB,EAAE,YAAY,CAAC,GAAG,CAAC,uBAwB5E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,WAAW,EACzB,gBAAgB,EAAE,eAAe,EAEjC,kBAAkB,GAAE,OAAe;;;;;;;;;;;;;;;;;;;;;EAqDpC"} \ No newline at end of file diff --git a/packages/expo-router/build/global-state/stateUtils.js b/packages/expo-router/build/global-state/stateUtils.js index d106c40e3f2be7..85a320c2ab0ec7 100644 --- a/packages/expo-router/build/global-state/stateUtils.js +++ b/packages/expo-router/build/global-state/stateUtils.js @@ -47,6 +47,7 @@ lookThroughAllTabs = false) { let actionStateRoute; const navigationRoutes = []; while (actionState && navigationState) { + // TODO(@kitten): Review invalid indexed access into undefined actionStateRoute = actionState.routes[actionState.routes.length - 1]; const stateRoute = (() => { if (navigationState.type === 'tab' && lookThroughAllTabs) { @@ -62,8 +63,8 @@ lookThroughAllTabs = false) { !childState || !nextNavigationState || (dynamicName && - // @ts-expect-error: TODO(@kitten): This isn't properly typed, so the index access fails - actionStateRoute.params?.[dynamicName.name] !== stateRoute.params?.[dynamicName.name]); + actionStateRoute.params?.[dynamicName.name] !== + stateRoute.params?.[dynamicName.name]); if (didActionAndCurrentStateDiverge) { // If we are looking through all tabs, we need to add new tab id if this is the last route // Otherwise we wouldn't be able to change the tab diff --git a/packages/expo-router/build/global-state/stateUtils.js.map b/packages/expo-router/build/global-state/stateUtils.js.map index b3004205c263a4..be196d8113550f 100644 --- a/packages/expo-router/build/global-state/stateUtils.js.map +++ b/packages/expo-router/build/global-state/stateUtils.js.map @@ -1 +1 @@ -{"version":3,"file":"stateUtils.js","sourceRoot":"","sources":["../../src/global-state/stateUtils.ts"],"names":[],"mappings":";;AAQA,4DAwBC;AAaD,gDAwDC;AApGD,0CAA+C;AAG/C;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,iBAAoC;IAC3E,MAAM,WAAW,GAAwB,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACxD,IAAI,OAAO,GAAG,WAAW,CAAC;IAC1B,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC5B,IAAI,gBAAgB,GAAkC,iBAAiB,CAAC;IAExE,OAAO,gBAAgB,EAAE,CAAC;QACxB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC;QACzE,wCAAwC;QACxC,OAAO,CAAC,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC;QACvC,yDAAyD;QACzD,OAAO,CAAC,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;QAE/B,8DAA8D;QAC9D,OAAO,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEhC,iCAAiC;QACjC,uFAAuF;QACvF,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;QACzB,MAAM,GAAG,OAAO,CAAC;QAEjB,gBAAgB,GAAG,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,M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AAwF;gBACxF,gBAAgB,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QAE3F,IAAI,+BAA+B,EAAE,CAAC;YACpC,0FAA0F;YAC1F,kDAAkD;YAClD,IAAI,eAAe,CAAC,IAAI,KAAK,KAAK,IAAI,kBAAkB,EAAE,CAAC;gBACzD,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACpC,CAAC;YACD,MAAM;QACR,CAAC;QAED,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAElC,WAAW,GAAG,UAAU,CAAC;QACzB,eAAe,GAAG,mBAAsC,CAAC;IAC3D,CAAC;IAED,OAAO;QACL,WAAW;QACX,eAAe;QACf,gBAAgB;QAChB,gBAAgB;KACjB,CAAC;AACJ,CAAC","sourcesContent":["import type { ResultState } from '../fork/getStateFromPath';\nimport { matchDynamicName } from '../matchers';\nimport type { PartialRoute, NavigationState, PartialState } from '../react-navigation/native';\n\n/**\n * React Navigation uses params to store information about the screens, rather then create new state for each level.\n * This function traverses the action state that will not be part of state and returns a payload that can be used in action.\n */\nexport function getPayloadFromStateRoute(_actionStateRoute: PartialRoute) {\n const rootPayload: Record = { params: {} };\n let payload = rootPayload;\n let params = payload.params;\n let actionStateRoute: PartialRoute | undefined = _actionStateRoute;\n\n while (actionStateRoute) {\n Object.assign(params, { ...payload.params, ...actionStateRoute.params });\n // Assign the screen name to the payload\n payload.screen = actionStateRoute.name;\n // Merge the params, ensuring that we create a new object\n payload.params = { ...params };\n\n // Params don't include the screen, thats a separate attribute\n delete payload.params['screen'];\n\n // Continue down the payload tree\n // Initially these values are separate, but React Nav merges them after the first layer\n payload = payload.params;\n params = payload;\n\n actionStateRoute = actionStateRoute.state?.routes[actionStateRoute.state?.routes.length - 1];\n }\n return rootPayload;\n}\n\n/**\n * Traverse the state tree comparing the current state and the action state until we find where they diverge.\n *\n * @returns An object with:\n * - `actionState` — the remaining action state at the point of divergence\n * - `navigationState` — the navigator that should be targeted for the dispatched action\n * - `actionStateRoute` — the specific route in the action state where divergence was detected\n * - `navigationRoutes` — navigation routes that matched before divergence (used for tab targeting)\n *\n * @private\n */\nexport function findDivergentState(\n _actionState: ResultState,\n _navigationState: NavigationState,\n // If true, look through all tabs to find the target state, rather then just the current tab\n lookThroughAllTabs: boolean = false\n) {\n let actionState: PartialState | undefined = _actionState;\n let navigationState: NavigationState | undefined = _navigationState;\n let actionStateRoute: PartialRoute | undefined;\n const navigationRoutes = [];\n while (actionState && navigationState) {\n actionStateRoute = actionState.routes[actionState.routes.length - 1];\n const stateRoute = (() => {\n if (navigationState.type === 'tab' && lookThroughAllTabs) {\n return (\n navigationState.routes.find((route) => route.name === actionStateRoute?.name) ||\n navigationState.routes[navigationState.index ?? 0]\n );\n }\n return navigationState.routes[navigationState.index ?? 0];\n })();\n\n const childState: PartialState | undefined = actionStateRoute.state;\n const nextNavigationState = stateRoute.state;\n\n const dynamicName = matchDynamicName(actionStateRoute.name);\n\n const didActionAndCurrentStateDiverge =\n actionStateRoute.name !== stateRoute.name ||\n !childState ||\n !nextNavigationState ||\n (dynamicName &&\n // @ts-expect-error: TODO(@kitten): This isn't properly typed, so the index access fails\n actionStateRoute.params?.[dynamicName.name] !== stateRoute.params?.[dynamicName.name]);\n\n if (didActionAndCurrentStateDiverge) {\n // If we are looking through all tabs, we need to add new tab id if this is the last route\n // Otherwise we wouldn't be able to change the tab\n if (navigationState.type === 'tab' && lookThroughAllTabs) {\n navigationRoutes.push(stateRoute);\n }\n break;\n }\n\n navigationRoutes.push(stateRoute);\n\n actionState = childState;\n navigationState = nextNavigationState as NavigationState;\n }\n\n return {\n actionState,\n navigationState,\n actionStateRoute,\n navigationRoutes,\n };\n}\n"]} \ No newline at end of file +{"version":3,"file":"stateUtils.js","sourceRoot":"","sources":["../../src/global-state/stateUtils.ts"],"names":[],"mappings":";;AAQA,4DA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AAI,CAAC,UAAU,CAAC,CAAC;QAElC,WAAW,GAAG,UAAU,CAAC;QACzB,eAAe,GAAG,mBAAsC,CAAC;IAC3D,CAAC;IAED,OAAO;QACL,WAAW;QACX,eAAe;QACf,gBAAgB;QAChB,gBAAgB;KACjB,CAAC;AACJ,CAAC","sourcesContent":["import type { ResultState } from '../fork/getStateFromPath';\nimport { matchDynamicName } from '../matchers';\nimport type { PartialRoute, NavigationState, PartialState } from '../react-navigation/native';\n\n/**\n * React Navigation uses params to store information about the screens, rather then create new state for each level.\n * This function traverses the action state that will not be part of state and returns a payload that can be used in action.\n */\nexport function getPayloadFromStateRoute(_actionStateRoute: PartialRoute) {\n const rootPayload: Record = { params: {} };\n let payload = rootPayload;\n let params = payload.params;\n let actionStateRoute: PartialRoute | undefined = _actionStateRoute;\n\n while (actionStateRoute) {\n Object.assign(params, { ...payload.params, ...actionStateRoute.params });\n // Assign the screen name to the payload\n payload.screen = actionStateRoute.name;\n // Merge the params, ensuring that we create a new object\n payload.params = { ...params };\n\n // Params don't include the screen, thats a separate attribute\n delete payload.params['screen'];\n\n // Continue down the payload tree\n // Initially these values are separate, but React Nav merges them after the first layer\n payload = payload.params;\n params = payload;\n\n actionStateRoute = actionStateRoute.state?.routes[actionStateRoute.state?.routes.length - 1];\n }\n return rootPayload;\n}\n\n/**\n * Traverse the state tree comparing the current state and the action state until we find where they diverge.\n *\n * @returns An object with:\n * - `actionState` — the remaining action state at the point of divergence\n * - `navigationState` — the navigator that should be targeted for the dispatched action\n * - `actionStateRoute` — the specific route in the action state where divergence was detected\n * - `navigationRoutes` — navigation routes that matched before divergence (used for tab targeting)\n *\n * @private\n */\nexport function findDivergentState(\n _actionState: ResultState,\n _navigationState: NavigationState,\n // If true, look through all tabs to find the target state, rather then just the current tab\n lookThroughAllTabs: boolean = false\n) {\n let actionState: PartialState | undefined = _actionState;\n let navigationState: NavigationState | undefined = _navigationState;\n let actionStateRoute: PartialRoute | undefined;\n const navigationRoutes = [];\n while (actionState && navigationState) {\n // TODO(@kitten): Review invalid indexed access into undefined\n actionStateRoute = actionState.routes[actionState.routes.length - 1]!;\n const stateRoute = (() => {\n if (navigationState.type === 'tab' && lookThroughAllTabs) {\n return (\n navigationState.routes.find((route) => route.name === actionStateRoute?.name) ||\n navigationState.routes[navigationState.index ?? 0]!\n );\n }\n return navigationState.routes[navigationState.index ?? 0]!;\n })();\n\n const childState: PartialState | undefined = actionStateRoute.state;\n const nextNavigationState = stateRoute.state;\n\n const dynamicName = matchDynamicName(actionStateRoute!.name);\n\n const didActionAndCurrentStateDiverge =\n actionStateRoute.name !== stateRoute.name ||\n !childState ||\n !nextNavigationState ||\n (dynamicName &&\n actionStateRoute.params?.[dynamicName.name] !==\n (stateRoute.params as Record | undefined)?.[dynamicName.name]);\n\n if (didActionAndCurrentStateDiverge) {\n // If we are looking through all tabs, we need to add new tab id if this is the last route\n // Otherwise we wouldn't be able to change the tab\n if (navigationState.type === 'tab' && lookThroughAllTabs) {\n navigationRoutes.push(stateRoute);\n }\n break;\n }\n\n navigationRoutes.push(stateRoute);\n\n actionState = childState;\n navigationState = nextNavigationState as NavigationState;\n }\n\n return {\n actionState,\n navigationState,\n actionStateRoute,\n navigationRoutes,\n };\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/head/ExpoHead.ios.js.map b/packages/expo-router/build/head/ExpoHead.ios.js.map index 5522627d2c75e8..fffc1788d1a61e 100644 --- a/packages/expo-router/build/head/ExpoHead.ios.js.map +++ b/packages/expo-router/build/head/ExpoHead.ios.js.map @@ -1 +1 @@ -{"version":3,"file":"ExpoHead.ios.js","sourceRoot":"","sources":["../../src/head/ExpoHead.ios.tsx"],"names":[],"mappings":";;;;;;;AACA,kDAA0B;AAE1B,kDAA+C;AAE/C,qDAA4C;AAC5C,+BAAmD;AACnD,oCAAiG;AAEjG,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;AAC3C,C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M,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;gBAC1B,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACrE,CAAC;QACD,cAAc;QACd,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YAC7B,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;YAClC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC;AAED,UAAU,CAAC,QAAQ,GAAG,eAAK,CAAC,QAAQ,CAAC;AAErC,SAAS,QAAQ,CAAC,KAA8B;IAC9C,OAAO,IAAI,CAAC;AACd,CAAC;AAED,QAAQ,CAAC,QAAQ,GAAG,eAAK,CAAC,QAAQ,CAAC;AAEnC,gDAAgD;AACnC,QAAA,IAAI,GAEb,yBAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC","sourcesContent":["import type { JSX } from 'react';\nimport React from 'react';\n\nimport { useIsFocused } from '../useIsFocused';\nimport type { UserActivity } from './ExpoHeadModule';\nimport { ExpoHead } from './ExpoHeadModule';\nimport { getStaticUrlFromExpoRouter } from './url';\nimport { useLocalSearchParams, useUnstableGlobalHref, usePathname, useSegments } from '../hooks';\n\nfunction urlToId(url: string) {\n return url.replace(/[^a-zA-Z0-9]/g, '-');\n}\n\nfunction getLastSegment(path: string) {\n // Remove the extension\n const lastSegment = path.split('/').pop() ?? '';\n return lastSegment.replace(/\\.[^/.]+$/, '').split('?')[0];\n}\n\n// TODO: Use Head Provider to collect all props so only one Head is rendered for a given route.\n\nfunction useAddressableLink() {\n const pathname = useUnstableGlobalHref();\n const params = useLocalSearchParams();\n const url = getStaticUrlFromExpoRouter(pathname);\n return { url, pathname, params };\n}\n\ntype MetaNode =\n | React.ReactPortal\n | React.ReactElement>;\n\nfunction useMetaChildren(children: React.ReactNode) {\n return React.useMemo(() => {\n const renderableChildren: React.ReactNode[] = [];\n const metaChildren: MetaNode[] = [];\n\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) {\n return;\n }\n if (typeof child.type === 'string') {\n metaChildren.push(child);\n } else {\n renderableChildren.push(child);\n }\n });\n\n return { children: renderableChildren, metaChildren };\n }, [children]);\n}\n\ntype SerializedMeta = {\n type: string;\n props: Record;\n};\n\nfunction serializedMetaChildren(meta: MetaNode[]): SerializedMeta[] {\n const validMeta = meta.filter((child) => child.type === 'meta' || child.type === 'title');\n\n return validMeta.map((child) => {\n if (child.type === 'title') {\n return {\n type: 'title',\n props: {\n children:\n child.props &&\n typeof child.props === 'object' &&\n 'children' in child.props &&\n typeof child.props.children === 'string'\n ? child.props.children\n : undefined,\n },\n };\n }\n return {\n type: 'meta',\n props: {\n property:\n child.props &&\n typeof child.props === 'object' &&\n 'property' in child.props &&\n typeof child.props.property === 'string'\n ? child.props.property\n : undefined,\n content:\n child.props &&\n typeof child.props === 'object' &&\n 'content' in child.props &&\n typeof child.props.content === 'string'\n ? child.props.content\n : undefined,\n },\n };\n });\n}\n\nfunction useActivityFromMetaChildren(meta: MetaNode[]) {\n const { url: href, pathname } = useAddressableLink();\n\n const previousMeta = React.useRef([]);\n const cachedActivity = React.useRef>({});\n\n const sortedMeta = React.useMemo(() => serializedMetaChildren(meta), [meta]);\n\n const url = React.useMemo(() => {\n const urlMeta = sortedMeta.find(\n (child) => child.type === 'meta' && child.props.property === 'og:url'\n );\n\n if (urlMeta) {\n // Support =`/foo/bar` -> `https://example.com/foo/bar`\n if (urlMeta.props.content?.startsWith('/')) {\n return getStaticUrlFromExpoRouter(urlMeta.props.content);\n }\n return urlMeta.props.content;\n }\n return href;\n }, [sortedMeta, href]);\n\n const title = React.useMemo(() => {\n const titleTag = sortedMeta.find((child) => child.type === 'title');\n if (titleTag) {\n return titleTag.props.children ?? '';\n }\n const titleMeta = sortedMeta.find(\n (child) => child.type === 'meta' && child.props.property === 'og:title'\n );\n if (titleMeta) {\n return titleMeta.props.content ?? '';\n }\n\n return getLastSegment(pathname);\n }, [sortedMeta, pathname]);\n\n const activity = React.useMemo(() => {\n if (\n !!previousMeta.current &&\n !!cachedActivity.current &&\n deepObjectCompare(previousMeta.current, sortedMeta)\n ) {\n return cachedActivity.current;\n }\n previousMeta.current = sortedMeta;\n\n const userActivity: Partial = {};\n\n sortedMeta.forEach((child) => {\n if (\n // \n child.type === 'meta'\n ) {\n const { property, content } = child.props;\n\n switch (property) {\n case 'og:description':\n userActivity.description = content;\n break;\n // Custom properties\n case 'expo:handoff':\n userActivity.isEligibleForHandoff = isTruthy(content);\n break;\n case 'expo:spotlight':\n userActivity.isEligibleForSearch = isTruthy(content);\n break;\n }\n\n // // \n // if ([\"keywords\"].includes(name)) {\n // userActivity.keywords = Array.isArray(content)\n // ? content\n // : content.split(\",\");\n // }\n }\n });\n\n cachedActivity.current = userActivity;\n return userActivity;\n }, [meta, pathname, href]);\n\n const parsedActivity: UserActivity = {\n keywords: [title],\n ...activity,\n title,\n webpageURL: url,\n activityType: ExpoHead!.activities.INDEXED_ROUTE,\n userInfo: {\n // TODO: This may need to be versioned in the future, e.g. `_v1` if we change the format.\n href,\n },\n };\n\n return parsedActivity;\n}\n\nfunction isTruthy(value: any): boolean {\n return [true, 'true'].includes(value);\n}\n\nfunction HeadNative(props: { children?: React.ReactNode }) {\n const isFocused = useIsFocused();\n if (!isFocused) {\n return ;\n }\n return ;\n}\n\nfunction UnfocusedHead(props: { children?: React.ReactNode }): JSX.Element {\n const { children } = useMetaChildren(props.children);\n return <>{children};\n}\n\nfunction FocusedHead(props: { children?: React.ReactNode }): JSX.Element {\n const { metaChildren, children } = useMetaChildren(props.children);\n const activity = useActivityFromMetaChildren(metaChildren);\n useRegisterCurrentActivity(activity);\n return <>{children};\n}\n\n// segments => activity\nconst activities: Map = new Map();\n\nfunction useRegisterCurrentActivity(activity: UserActivity) {\n // ID is tied to Expo Router and agnostic of URLs to ensure dynamic parameters are not considered.\n // Using all segments ensures that cascading routes are considered.\n const activityId = urlToId(usePathname() || '/');\n const cascadingId = urlToId(useSegments().join('-') || '-');\n const activityIds = Array.from(activities.keys());\n const cascadingActivity: UserActivity = React.useMemo(() => {\n // Get all nested activities together, then update the id to match the current pathname.\n // This enables cases like `/user/[name]/post/[id]` to match all nesting, while still having a URL-specific ID, i.e. `/user/evanbacon/post/123`\n const cascadingActivity = activities.has(cascadingId)\n ? {\n ...activities.get(cascadingId),\n ...activity,\n id: activityId,\n }\n : {\n ...activity,\n id: activityId,\n };\n activities.set(cascadingId, cascadingActivity);\n\n return cascadingActivity;\n }, [cascadingId, activityId, activity, activityIds]);\n\n const previousActivity = React.useRef(null);\n\n React.useEffect(() => {\n if (!cascadingActivity) {\n return () => {};\n }\n if (\n !!previousActivity.current &&\n deepObjectCompare(previousActivity.current, cascadingActivity)\n ) {\n return () => {};\n }\n\n previousActivity.current = cascadingActivity;\n if (!cascadingActivity.id) {\n throw new Error('Activity must have an ID');\n }\n\n // If no features are enabled, then skip registering the activity\n if (cascadingActivity.isEligibleForHandoff || cascadingActivity.isEligibleForSearch) {\n ExpoHead?.createActivity(cascadingActivity);\n }\n\n return () => {};\n }, [cascadingActivity]);\n\n React.useEffect(() => {\n return () => {\n if (activityId) {\n ExpoHead?.suspendActivity(activityId);\n }\n };\n }, [activityId]);\n}\n\nfunction deepObjectCompare(a: any, b: any): boolean {\n if (typeof a !== typeof b) {\n return false;\n }\n if (typeof a === 'object') {\n if (Array.isArray(a) !== Array.isArray(b)) {\n return false;\n }\n if (Array.isArray(a)) {\n if (a.length !== b.length) {\n return false;\n }\n return a.every((item, index) => deepObjectCompare(item, b[index]));\n }\n // handle null\n if (a === null || b === null) {\n return a === b;\n }\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n return aKeys.every((key) => deepObjectCompare(a[key], b[key]));\n }\n return a === b;\n}\n\nHeadNative.Provider = React.Fragment;\n\nfunction HeadShim(props: React.PropsWithChildren) {\n return null;\n}\n\nHeadShim.Provider = React.Fragment;\n\n// Native Head is only enabled in bare iOS apps.\nexport const Head: ((props: React.PropsWithChildren) => React.ReactNode) & {\n Provider: React.ComponentType;\n} = ExpoHead ? HeadNative : HeadShim;\n"]} \ No newline at end of file +{"version":3,"file":"ExpoHead.ios.js","sourceRoot":"","sources":["../../src/head/ExpoHead.ios.tsx"],"names":[],"mappings":";;;;;;;AACA,kDAA0B;AAE1B,kDAA+C;AAE/C,qDAA4C;AAC5C,+BAAmD;AACnD,oCAAiG;AAEjG,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,cAAc,CAAC,IAAY;IAClC,uBAAuB;IACvB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;IAChD,OAAO,WAAW,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC;AAC7D,CAAC;AAED,+FAA+F;AAE/F,SAAS,kBAAkB;IACzB,MAAM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AAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;YAClC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC;AAED,UAAU,CAAC,QAAQ,GAAG,eAAK,CAAC,QAAQ,CAAC;AAErC,SAAS,QAAQ,CAAC,KAA8B;IAC9C,OAAO,IAAI,CAAC;AACd,CAAC;AAED,QAAQ,CAAC,QAAQ,GAAG,eAAK,CAAC,QAAQ,CAAC;AAEnC,gDAAgD;AACnC,QAAA,IAAI,GAEb,yBAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC","sourcesContent":["import type { JSX } from 'react';\nimport React from 'react';\n\nimport { useIsFocused } from '../useIsFocused';\nimport type { UserActivity } from './ExpoHeadModule';\nimport { ExpoHead } from './ExpoHeadModule';\nimport { getStaticUrlFromExpoRouter } from './url';\nimport { useLocalSearchParams, useUnstableGlobalHref, usePathname, useSegments } from '../hooks';\n\nfunction urlToId(url: string) {\n return url.replace(/[^a-zA-Z0-9]/g, '-');\n}\n\nfunction getLastSegment(path: string) {\n // Remove the extension\n const lastSegment = path.split('/').pop() ?? '';\n return lastSegment.replace(/\\.[^/.]+$/, '').split('?')[0]!;\n}\n\n// TODO: Use Head Provider to collect all props so only one Head is rendered for a given route.\n\nfunction useAddressableLink() {\n const pathname = useUnstableGlobalHref();\n const params = useLocalSearchParams();\n const url = getStaticUrlFromExpoRouter(pathname);\n return { url, pathname, params };\n}\n\ntype MetaNode =\n | React.ReactPortal\n | React.ReactElement>;\n\nfunction useMetaChildren(children: React.ReactNode) {\n return React.useMemo(() => {\n const renderableChildren: React.ReactNode[] = [];\n const metaChildren: MetaNode[] = [];\n\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) {\n return;\n }\n if (typeof child.type === 'string') {\n metaChildren.push(child);\n } else {\n renderableChildren.push(child);\n }\n });\n\n return { children: renderableChildren, metaChildren };\n }, [children]);\n}\n\ntype SerializedMeta = {\n type: string;\n props: Record;\n};\n\nfunction serializedMetaChildren(meta: MetaNode[]): SerializedMeta[] {\n const validMeta = meta.filter((child) => child.type === 'meta' || child.type === 'title');\n\n return validMeta.map((child) => {\n if (child.type === 'title') {\n return {\n type: 'title',\n props: {\n children:\n child.props &&\n typeof child.props === 'object' &&\n 'children' in child.props &&\n typeof child.props.children === 'string'\n ? child.props.children\n : undefined,\n },\n };\n }\n return {\n type: 'meta',\n props: {\n property:\n child.props &&\n typeof child.props === 'object' &&\n 'property' in child.props &&\n typeof child.props.property === 'string'\n ? child.props.property\n : undefined,\n content:\n child.props &&\n typeof child.props === 'object' &&\n 'content' in child.props &&\n typeof child.props.content === 'string'\n ? child.props.content\n : undefined,\n },\n };\n });\n}\n\nfunction useActivityFromMetaChildren(meta: MetaNode[]) {\n const { url: href, pathname } = useAddressableLink();\n\n const previousMeta = React.useRef([]);\n const cachedActivity = React.useRef>({});\n\n const sortedMeta = React.useMemo(() => serializedMetaChildren(meta), [meta]);\n\n const url = React.useMemo(() => {\n const urlMeta = sortedMeta.find(\n (child) => child.type === 'meta' && child.props.property === 'og:url'\n );\n\n if (urlMeta) {\n // Support =`/foo/bar` -> `https://example.com/foo/bar`\n if (urlMeta.props.content?.startsWith('/')) {\n return getStaticUrlFromExpoRouter(urlMeta.props.content);\n }\n return urlMeta.props.content;\n }\n return href;\n }, [sortedMeta, href]);\n\n const title = React.useMemo(() => {\n const titleTag = sortedMeta.find((child) => child.type === 'title');\n if (titleTag) {\n return titleTag.props.children ?? '';\n }\n const titleMeta = sortedMeta.find(\n (child) => child.type === 'meta' && child.props.property === 'og:title'\n );\n if (titleMeta) {\n return titleMeta.props.content ?? '';\n }\n\n return getLastSegment(pathname);\n }, [sortedMeta, pathname]);\n\n const activity = React.useMemo(() => {\n if (\n !!previousMeta.current &&\n !!cachedActivity.current &&\n deepObjectCompare(previousMeta.current, sortedMeta)\n ) {\n return cachedActivity.current;\n }\n previousMeta.current = sortedMeta;\n\n const userActivity: Partial = {};\n\n sortedMeta.forEach((child) => {\n if (\n // \n child.type === 'meta'\n ) {\n const { property, content } = child.props;\n\n switch (property) {\n case 'og:description':\n userActivity.description = content;\n break;\n // Custom properties\n case 'expo:handoff':\n userActivity.isEligibleForHandoff = isTruthy(content);\n break;\n case 'expo:spotlight':\n userActivity.isEligibleForSearch = isTruthy(content);\n break;\n }\n\n // // \n // if ([\"keywords\"].includes(name)) {\n // userActivity.keywords = Array.isArray(content)\n // ? content\n // : content.split(\",\");\n // }\n }\n });\n\n cachedActivity.current = userActivity;\n return userActivity;\n }, [meta, pathname, href]);\n\n const parsedActivity: UserActivity = {\n keywords: [title],\n ...activity,\n title,\n webpageURL: url,\n activityType: ExpoHead!.activities.INDEXED_ROUTE,\n userInfo: {\n // TODO: This may need to be versioned in the future, e.g. `_v1` if we change the format.\n href,\n },\n };\n\n return parsedActivity;\n}\n\nfunction isTruthy(value: any): boolean {\n return [true, 'true'].includes(value);\n}\n\nfunction HeadNative(props: { children?: React.ReactNode }) {\n const isFocused = useIsFocused();\n if (!isFocused) {\n return ;\n }\n return ;\n}\n\nfunction UnfocusedHead(props: { children?: React.ReactNode }): JSX.Element {\n const { children } = useMetaChildren(props.children);\n return <>{children};\n}\n\nfunction FocusedHead(props: { children?: React.ReactNode }): JSX.Element {\n const { metaChildren, children } = useMetaChildren(props.children);\n const activity = useActivityFromMetaChildren(metaChildren);\n useRegisterCurrentActivity(activity);\n return <>{children};\n}\n\n// segments => activity\nconst activities: Map = new Map();\n\nfunction useRegisterCurrentActivity(activity: UserActivity) {\n // ID is tied to Expo Router and agnostic of URLs to ensure dynamic parameters are not considered.\n // Using all segments ensures that cascading routes are considered.\n const activityId = urlToId(usePathname() || '/');\n const cascadingId = urlToId(useSegments().join('-') || '-');\n const activityIds = Array.from(activities.keys());\n const cascadingActivity: UserActivity = React.useMemo(() => {\n // Get all nested activities together, then update the id to match the current pathname.\n // This enables cases like `/user/[name]/post/[id]` to match all nesting, while still having a URL-specific ID, i.e. `/user/evanbacon/post/123`\n const cascadingActivity = activities.has(cascadingId)\n ? {\n ...activities.get(cascadingId),\n ...activity,\n id: activityId,\n }\n : {\n ...activity,\n id: activityId,\n };\n activities.set(cascadingId, cascadingActivity);\n\n return cascadingActivity;\n }, [cascadingId, activityId, activity, activityIds]);\n\n const previousActivity = React.useRef(null);\n\n React.useEffect(() => {\n if (!cascadingActivity) {\n return () => {};\n }\n if (\n !!previousActivity.current &&\n deepObjectCompare(previousActivity.current, cascadingActivity)\n ) {\n return () => {};\n }\n\n previousActivity.current = cascadingActivity;\n if (!cascadingActivity.id) {\n throw new Error('Activity must have an ID');\n }\n\n // If no features are enabled, then skip registering the activity\n if (cascadingActivity.isEligibleForHandoff || cascadingActivity.isEligibleForSearch) {\n ExpoHead?.createActivity(cascadingActivity);\n }\n\n return () => {};\n }, [cascadingActivity]);\n\n React.useEffect(() => {\n return () => {\n if (activityId) {\n ExpoHead?.suspendActivity(activityId);\n }\n };\n }, [activityId]);\n}\n\nfunction deepObjectCompare(a: any, b: any): boolean {\n if (typeof a !== typeof b) {\n return false;\n }\n if (typeof a === 'object') {\n if (Array.isArray(a) !== Array.isArray(b)) {\n return false;\n }\n if (Array.isArray(a)) {\n if (a.length !== b.length) {\n return false;\n }\n return a.every((item, index) => deepObjectCompare(item, b[index]));\n }\n // handle null\n if (a === null || b === null) {\n return a === b;\n }\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n return aKeys.every((key) => deepObjectCompare(a[key], b[key]));\n }\n return a === b;\n}\n\nHeadNative.Provider = React.Fragment;\n\nfunction HeadShim(props: React.PropsWithChildren) {\n return null;\n}\n\nHeadShim.Provider = React.Fragment;\n\n// Native Head is only enabled in bare iOS apps.\nexport const Head: ((props: React.PropsWithChildren) => React.ReactNode) & {\n Provider: React.ComponentType;\n} = ExpoHead ? HeadNative : HeadShim;\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/layouts/StackClient.d.ts.map b/packages/expo-router/build/layouts/StackClient.d.ts.map index be54b0d8d44148..b19880e0207156 100644 --- a/packages/expo-router/build/layouts/StackClient.d.ts.map +++ b/packages/expo-router/build/layouts/StackClient.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"StackClient.d.ts","sourceRoot":"","sources":["../../src/layouts/StackClient.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAgB5C,OAAO,EACL,KAAK,gBAAgB,EAGrB,cAAc,EAKf,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,KAAK,aAAa,EAMlB,KAAK,oBAAoB,EACzB,WAAW,IAAI,aAAa,EAC5B,KAAK,SAAS,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,6BAA6B,EAC7B,4BAA4B,EAC7B,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAM/C;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,4BAA4B,GAAG;IAC1E,aAAa,CAAC,EAAE;QACd;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACzB;;;WAGG;QACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAC5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,CAAC,EAAE;QACd;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACzB;;;WAGG;QACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAC5B;;;WAGG;QACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAC3B;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;;WAGG;QACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKU,CAAC;AA4CxB;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC,iBAAiB,CAAC,CA2V9F,CAAC;AA+DF;;;;GAIG;AACH,QAAA,MAAM,KAAK,WACD,cAAc,CAAC,OAAO,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;CA0DvC,CAAC;AAoCF,eAAe,KAAK,CAAC;AAErB,eAAO,MAAM,WAAW,EAAE,OAAO,aAMhC,CAAC"} \ No newline at end of file diff --git a/packages/expo-router/build/layouts/StackClient.js b/packages/expo-router/build/layouts/StackClient.js index 04f2138db2aef2..f956166a0baf2d 100644 --- a/packages/expo-router/build/layouts/StackClient.js +++ b/packages/expo-router/build/layouts/StackClient.js @@ -367,6 +367,7 @@ function filterSingular(state, getId) { if (!state.routes) { return state; } + // TODO(@kitten): This looks wrong as it's defaulting `index === 0` const currentIndex = state.index || state.routes.length - 1; const current = state.routes[currentIndex]; const name = current.name; diff --git a/packages/expo-router/build/layouts/StackClient.js.map b/packages/expo-router/build/layouts/StackClient.js.map index aa67b3766a73b1..ca23851c321280 100644 --- a/packages/expo-router/build/layouts/StackClient.js.map +++ b/packages/expo-router/build/layouts/StackClient.js.map @@ -1 +1 @@ -{"version":3,"file":"StackClient.js","sourceRoot":"","sources":["../../src/layouts/StackClient.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AACb,kDAA2C;AAE3C,iCAA0C;AAE1C,2DAAwD;AACxD,gGAA6F;AAC7F,2EAA2E;AAC3E,0DAO6B;AAE7B,8CAA8C;AAC9C,+CASuB;AACvB,uDAYoC;AAKpC,gDAAkD;AAClD,kDAA+C;AAI/C,MAAM,oBAAoB,GAAG,IAAA,uDAA0B,GAAE,CAAC,SAAS,CAAC;AA8CpE,MAAM,OAAO,GAAG,IAAA,qCAAiB,EAK/B,oBAAoB,CAAC,CAAC;AAUxB,SAAS,aAAa,CACpB,MAAwB;IAExB,OAAO,CACL,MAAM,CAAC,IAAI,KAAK,MAAM;QACtB,MAAM,CAAC,IAAI,KAAK,UAAU;QAC1B,MAAM,CAAC,IAAI,KAAK,KAAK;QACrB,MAAM,CAAC,IAAI,KAAK,YAAY;QAC5B,MAAM,CAAC,IAAI,KAAK,SAAS;QACzB,MAAM,CAAC,IAAI,KAAK,SAAS,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,eAAe,GAAG,CAAC,MAAwB,EAAkC,EAAE,CACnF,CAAC,CAAC,MAAM,CAAC,OAAO;IAChB,QAAQ,IAAI,MAAM,CAAC,OAAO;IAC1B,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,QAAQ;IACzC,CAAC,CAAC,IAAA,8CAA2B,EAAC,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,SAAS,CAAC,CAChE,wEAAqD,CACtD,CAAC;AAEJ,MAAM,6BAA6B,GAAG,CAAC,MAAwB,EAAsB,EAAE;IACrF,MAAM,SAAS,GACb,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,QAAQ,IAAI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EAAC,OAAO,CAAC,CAAC;IACtC,OAAO;QACL,GAAG,MAAM;QACT,GAAG,IAAA,2BAAmB,EAAC,MAAM,CAAC;KAC/B,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB","sourcesContent":["'use client';\nimport { nanoid } from 'nanoid/non-secure';\nimport type { ComponentProps } from 'react';\nimport { Children, useMemo } from 'react';\n\nimport { withLayoutContext } from './withLayoutContext';\nimport { createNativeStackNavigator } from '../fork/native-stack/createNativeStackNavigator';\nimport { useLinkPreviewContext } from '../link/preview/LinkPreviewContext';\nimport {\n getInternalExpoRouterParams,\n INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME,\n INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME,\n INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME,\n INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME,\n type InternalExpoRouterParams,\n} from '../navigationParams';\nimport type { SingularOptions } from '../useScreens';\nimport { getSingularId } from '../useScreens';\nimport {\n type StackScreenProps,\n StackHeader,\n StackScreen,\n StackSearchBar,\n StackToolbar,\n appendScreenStackPropsToOptions,\n mapProtectedScreen,\n validateStackPresentation,\n} from './stack-utils';\nimport {\n type CommonNavigationAction,\n type NavigationAction,\n type ParamListBase,\n type PartialRoute,\n type PartialState,\n type Route,\n type RouterConfigOptions,\n type StackActionType,\n type StackNavigationState,\n StackRouter as RNStackRouter,\n type RouteProp,\n} from '../react-navigation/native';\nimport type {\n NativeStackNavigationEventMap,\n NativeStackNavigationOptions,\n} from '../react-navigation/native-stack';\nimport { isChildOfType } from '../utils/children';\nimport { Protected } from '../views/Protected';\n\ntype GetId = NonNullable;\n\nconst NativeStackNavigator = createNativeStackNavigator().Navigator;\n\n/**\n * We extend NativeStackNavigationOptions with our custom props\n * to allow for several extra props to be used on web, like modalWidth\n */\nexport type ExtendedStackNavigationOptions = NativeStackNavigationOptions & {\n webModalStyle?: {\n /**\n * Override the width of the modal (px or percentage). Only applies on web platform.\n * @platform web\n */\n width?: number | string;\n /**\n * Override the height of the modal (px or percentage). Applies on web desktop.\n * @platform web\n */\n height?: number | string;\n /**\n * Minimum height of the desktop modal (px or percentage). Overrides the default 640px clamp.\n * @platform web\n */\n minHeight?: number | string;\n /**\n * Minimum width of the desktop modal (px or percentage). Overrides the default 580px.\n * @platform web\n */\n minWidth?: number | string;\n /**\n * Override the border of the desktop modal (any valid CSS border value, e.g. '1px solid #ccc' or 'none').\n * @platform web\n */\n border?: string;\n /**\n * Override the overlay background color (any valid CSS color or rgba/hsla value).\n * @platform web\n */\n overlayBackground?: string;\n /**\n * Override the modal shadow filter (any valid CSS filter value, e.g. 'drop-shadow(0 4px 8px rgba(0,0,0,0.1))' or 'none').\n * @platform web\n */\n shadow?: string;\n };\n};\n\nconst RNStack = withLayoutContext<\n ExtendedStackNavigationOptions,\n typeof NativeStackNavigator,\n StackNavigationState,\n NativeStackNavigationEventMap\n>(NativeStackNavigator);\n\ntype RNNavigationAction = Extract;\ntype RNPreloadAction = Extract;\ntype ExpoNavigationAction = Omit & {\n payload: Omit & {\n params: RNNavigationAction['payload']['params'] & InternalExpoRouterParams;\n };\n};\n\nfunction isStackAction(\n action: NavigationAction\n): action is StackActionType | RNPreloadAction | ExpoNavigationAction {\n return (\n action.type === 'PUSH' ||\n action.type === 'NAVIGATE' ||\n action.type === 'POP' ||\n action.type === 'POP_TO_TOP' ||\n action.type === 'REPLACE' ||\n action.type === 'PRELOAD'\n );\n}\n\nconst isPreviewAction = (action: NavigationAction): action is ExpoNavigationAction =>\n !!action.payload &&\n 'params' in action.payload &&\n typeof action.payload.params === 'object' &&\n !!getInternalExpoRouterParams(action.payload?.params ?? undefined)[\n INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME\n ];\n\nconst getZoomTransitionIdFromAction = (action: NavigationAction): string | undefined => {\n const allParams =\n !!action.payload && 'params' in action.payload && typeof action.payload.params === 'object'\n ? action.payload.params\n : undefined;\n const internalParams = getInternalExpoRouterParams(allParams ?? undefined);\n const val = internalParams[INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME];\n if (val && typeof val === 'string') {\n return val;\n }\n return undefined;\n};\n\n/**\n * React Navigation matches a screen by its name or a 'getID' function that uniquely identifies a screen.\n * When a screen has been uniquely identified, the Stack can only have one instance of that screen.\n *\n * Expo Router allows for a screen to be matched by name and path params, a 'getID' function or a singular id.\n *\n * Instead of reimplementing the entire StackRouter, we can override the getStateForAction method to handle the singular screen logic.\n *\n */\nexport const stackRouterOverride: NonNullable['UNSTABLE_router']> = (\n original\n) => {\n return {\n getStateForAction: (state, action, options) => {\n if (action.target && action.target !== state.key) {\n return null;\n }\n\n if (!isStackAction(action)) {\n return original.getStateForAction(state, action, options);\n }\n\n // The dynamic getId added to an action, `router.push('screen', { singular: true })`\n const actionSingularOptions =\n action.payload && 'singular' in action.payload\n ? (action.payload.singular as SingularOptions)\n : undefined;\n\n // Handle if 'getID' or 'singular' is set.\n function getIdFunction(): GetId | undefined {\n // Actions can be fired by the user, so we do need to validate their structure.\n if (\n !('payload' in action) ||\n !action.payload ||\n !('name' in action.payload) ||\n typeof action.payload.name !== 'string'\n ) {\n return;\n }\n\n const actionName = action.payload.name;\n\n return (\n // The dynamic singular added to an action, `router.push('screen', { singular: () => 'id' })`\n getActionSingularIdFn(actionSingularOptions, actionName) ||\n // The static getId added as a prop to `` or ``\n options.routeGetIdList[actionName]\n );\n }\n\n const { routeParamList } = options;\n\n switch (action.type) {\n case 'PUSH':\n case 'NAVIGATE': {\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n\n // START FORK\n const getId = getIdFunction();\n // const getId = options.routeGetIdList[action.payload.name];\n // END FORK\n const id = getId?.({ params: action.payload.params });\n\n let route: Route | undefined;\n\n if (id !== undefined) {\n route = state.routes.findLast(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n } else if (action.type === 'NAVIGATE') {\n const currentRoute = state.routes[state.index];\n\n // If the route matches the current one, then navigate to it\n if (action.payload.name === currentRoute.name && !isPreviewAction(action)) {\n route = currentRoute;\n } else if (action.payload.pop) {\n route = state.routes.findLast((route) => route.name === action.payload.name);\n }\n }\n\n // START FORK\n let isPreloadedRoute = false;\n if (isPreviewAction(action) && !route) {\n route = state.preloadedRoutes.find(\n (route) => route.name === action.payload.name && id === route.key\n );\n isPreloadedRoute = !!route;\n }\n // END FORK\n\n if (!route) {\n route = state.preloadedRoutes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n // START FORK\n isPreloadedRoute = !!route;\n // END FORK\n }\n\n let params;\n\n if (action.type === 'NAVIGATE' && action.payload.merge && route) {\n params =\n action.payload.params !== undefined ||\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...route.params,\n ...action.payload.params,\n }\n : route.params;\n } else {\n params =\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...action.payload.params,\n }\n : action.payload.params;\n }\n\n let routes: Route[];\n\n if (route) {\n if (action.type === 'NAVIGATE' && action.payload.pop) {\n routes = [];\n\n // Get all routes until the matching one\n for (const r of state.routes) {\n if (r.key === route.key) {\n routes.push({\n ...route,\n path: action.payload.path !== undefined ? action.payload.path : route.path,\n params,\n });\n break;\n }\n\n routes.push(r);\n }\n } else {\n // START FORK\n // If there is an id, then filter out the existing route with the same id.\n // THIS ACTION IS DANGEROUS. This can cause React Native Screens to freeze\n if (id !== undefined) {\n routes = state.routes.filter((r) => r.key !== route.key);\n } else if (action.type === 'NAVIGATE' && state.routes.length > 0) {\n // The navigation action should only replace the last route if it has the same name and path params.\n const lastRoute = state.routes[state.routes.length - 1];\n if (\n getSingularId(lastRoute.name, { params: lastRoute.params }) ===\n getSingularId(route.name, { params })\n ) {\n routes = state.routes.slice(0, -1);\n } else {\n routes = [...state.routes];\n }\n } else {\n routes = [...state.routes];\n }\n\n // If the routes length is the same as the state routes length, then we are navigating to a new route.\n // Otherwise we are replacing an existing route.\n // For preloaded route, we want to use the same key, so that preloaded screen is used.\n const key =\n routes.length === state.routes.length && !isPreloadedRoute\n ? `${action.payload.name}-${nanoid()}`\n : route.key;\n\n routes.push({\n ...route,\n key,\n path:\n action.type === 'NAVIGATE' && action.payload.path !== undefined\n ? action.payload.path\n : route.path,\n params,\n });\n\n // routes = state.routes.filter((r) => r.key !== route.key);\n // routes.push({\n // ...route,\n // path:\n // action.type === 'NAVIGATE' && action.payload.path !== undefined\n // ? action.payload.path\n // : route.path,\n // params,\n // });\n // END FORK\n }\n } else {\n routes = [\n ...state.routes,\n {\n key: `${action.payload.name}-${nanoid()}`,\n name: action.payload.name,\n path: action.type === 'NAVIGATE' ? action.payload.path : undefined,\n params,\n },\n ];\n }\n\n // START FORK\n // return filterSingular(\n const result = {\n ...state,\n index: routes.length - 1,\n preloadedRoutes: state.preloadedRoutes.filter(\n (route) => routes[routes.length - 1].key !== route.key\n ),\n routes,\n };\n\n if (actionSingularOptions) {\n return filterSingular(result, getId);\n }\n\n const zoomTransitionId = getZoomTransitionIdFromAction(action);\n if (zoomTransitionId) {\n const lastRoute = result.routes[result.routes.length - 1];\n const key = lastRoute.key;\n const modifiedLastRoute: typeof lastRoute = {\n ...lastRoute,\n params: {\n ...lastRoute.params,\n [INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME]: key,\n },\n };\n return {\n ...result,\n routes: [...result.routes.slice(0, -1), modifiedLastRoute],\n };\n }\n\n return result;\n // return {\n // ...state,\n // index: routes.length - 1,\n // preloadedRoutes: state.preloadedRoutes.filter(\n // (route) => routes[routes.length - 1].key !== route.key\n // ),\n // routes,\n // };\n // END FORK\n }\n case 'PRELOAD': {\n // START FORK\n // This will be the case for example for protected route\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n // END FORK\n const getId = options.routeGetIdList[action.payload.name];\n const id = getId?.({ params: action.payload.params });\n\n let route: Route | undefined;\n\n if (id !== undefined) {\n route = state.routes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n }\n\n const preloadZoomTransitionId = getZoomTransitionIdFromAction(action);\n\n if (route) {\n return {\n ...state,\n routes: state.routes.map((r) => {\n if (r.key !== route?.key) {\n return r;\n }\n const mergedParams =\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...action.payload.params,\n }\n : action.payload.params;\n return {\n ...r,\n params: preloadZoomTransitionId\n ? {\n ...mergedParams,\n [INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME]: r.key,\n }\n : mergedParams,\n };\n }),\n };\n } else {\n // START FORK\n const preloadedRouteKey = `${action.payload.name}-${nanoid()}`;\n const preloadedRouteParams =\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...action.payload.params,\n }\n : action.payload.params;\n const currentPreloadedRoute: (typeof state)['preloadedRoutes'][number] = {\n key: preloadedRouteKey,\n name: action.payload.name,\n params: preloadZoomTransitionId\n ? {\n ...preloadedRouteParams,\n [INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME]: preloadedRouteKey,\n }\n : preloadedRouteParams,\n };\n // END FORK\n return {\n ...state,\n // START FORK\n // Adding the current preloaded route to the beginning of the preloadedRoutes array\n // This ensures that the preloaded route will be the next one after the visible route\n // and when navigation will happen, there will be no reshuffling\n // This is a workaround for the link preview navigation issue, when screen would freeze after navigation from native side\n // and reshuffling from react-navigation\n preloadedRoutes: [currentPreloadedRoute].concat(\n state.preloadedRoutes.filter(\n (r) => r.name !== action.payload.name || id !== getId?.({ params: r.params })\n )\n ),\n // preloadedRoutes: state.preloadedRoutes\n // .filter(\n // (r) =>\n // r.name !== action.payload.name ||\n // id !== getId?.({ params: r.params })\n // )\n // .concat({\n // key: `${action.payload.name}-${nanoid()}`,\n // name: action.payload.name,\n // params:\n // routeParamList[action.payload.name] !== undefined\n // ? {\n // ...routeParamList[action.payload.name],\n // ...action.payload.params,\n // }\n // : action.payload.params,\n // }),\n // END FORK\n };\n }\n }\n default: {\n return original.getStateForAction(state, action, options);\n }\n }\n },\n };\n};\n\nfunction getActionSingularIdFn(\n actionGetId: SingularOptions | undefined,\n name: string\n): GetId | undefined {\n if (typeof actionGetId === 'function') {\n return (options) => actionGetId(name, options.params ?? {});\n } else if (actionGetId === true) {\n return (options) => getSingularId(name, options);\n }\n\n return undefined;\n}\n\n/**\n * If there is a dynamic singular on an action, then we need to filter the state to only have singular screens.\n * As multiples may have been added before we did the singular navigation.\n */\nfunction filterSingular<\n T extends\n | StackNavigationState\n | PartialState>\n | null,\n>(state: T, getId?: GetId): T {\n if (!state) {\n return state;\n }\n\n if (!state.routes) {\n return state;\n }\n\n const currentIndex = state.index || state.routes.length - 1;\n const current = state.routes[currentIndex];\n const name = current.name;\n\n const id = getId?.({ params: current.params });\n\n if (!id) {\n return state;\n }\n\n // TypeScript needs a type assertion here for the filter to work.\n let routes = state.routes as PartialRoute>[];\n routes = routes.filter((route, index) => {\n // If the route is the current route, keep it.\n if (index === currentIndex) {\n return true;\n }\n\n // Remove all other routes with the same name and id.\n return name !== route.name || id !== getId?.({ params: route.params });\n });\n\n return {\n ...state,\n index: routes.length - 1,\n routes,\n };\n}\n\n/**\n * Renders a native stack navigator.\n *\n * @hideType\n */\nconst Stack = Object.assign(\n (props: ComponentProps) => {\n const { isStackAnimationDisabled } = useLinkPreviewContext();\n\n const screenOptionsWithCompositionAPIOptions = useMemo(() => {\n const stackHeader = Children.toArray(props.children).find((child) =>\n isChildOfType(child, StackHeader)\n );\n if (stackHeader) {\n const screenStackProps: StackScreenProps = { children: stackHeader };\n const currentOptions = props.screenOptions;\n if (currentOptions) {\n if (typeof currentOptions === 'function') {\n return (...args) => {\n const options = currentOptions(...args);\n return appendScreenStackPropsToOptions(options, screenStackProps);\n };\n }\n return appendScreenStackPropsToOptions(currentOptions, screenStackProps);\n } else {\n return appendScreenStackPropsToOptions({}, screenStackProps);\n }\n } else if (props.screenOptions) {\n const screenOptions = props.screenOptions;\n if (typeof screenOptions === 'function') {\n return validateStackPresentation(screenOptions);\n }\n return validateStackPresentation(screenOptions);\n }\n return props.screenOptions;\n }, [props.screenOptions, props.children]);\n\n const screenOptions = useMemo(() => {\n const condition = isStackAnimationDisabled ? () => true : shouldDisableAnimationBasedOnParams;\n\n return disableAnimationInScreenOptions(screenOptionsWithCompositionAPIOptions, condition);\n }, [screenOptionsWithCompositionAPIOptions, isStackAnimationDisabled]);\n\n const rnChildren = useMemo(\n () => mapProtectedScreen({ guard: true, children: props.children }).children,\n [props.children]\n );\n\n return (\n \n );\n },\n {\n Screen: StackScreen,\n Protected,\n Header: StackHeader,\n SearchBar: StackSearchBar,\n Toolbar: StackToolbar,\n }\n);\n\ntype NativeStackScreenOptions = ComponentProps['screenOptions'];\n\nfunction disableAnimationInScreenOptions(\n options: NativeStackScreenOptions | undefined,\n condition: (route: RouteProp) => boolean\n): NativeStackScreenOptions {\n if (options && typeof options === 'function') {\n return (props) => {\n const oldOptions = options(props);\n if (condition(props.route)) {\n return {\n ...oldOptions,\n animation: 'none',\n };\n }\n return oldOptions ?? {};\n };\n }\n return (props) => {\n if (condition(props.route)) {\n return {\n ...(options ?? {}),\n animation: 'none',\n };\n }\n return options ?? {};\n };\n}\n\nfunction shouldDisableAnimationBasedOnParams(route: RouteProp): boolean {\n const expoParams = getInternalExpoRouterParams(route.params);\n return !!expoParams[INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME];\n}\n\nexport default Stack;\n\nexport const StackRouter: typeof RNStackRouter = (options) => {\n const router = RNStackRouter(options);\n return {\n ...router,\n ...stackRouterOverride(router),\n };\n};\n"]} \ No newline at end of file +{"version":3,"file":"StackClient.js","sourceRoot":"","sources":["../../src/layouts/StackClient.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AACb,kDAA2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BAAc;IACzB,OAAO,EAAE,0BAAY;CACtB,CACF,CAAC;AAIF,SAAS,+BAA+B,CACtC,OAA6C,EAC7C,SAA+D;IAE/D,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;QAC7C,OAAO,CAAC,KAAK,EAAE,EAAE;YACf,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;YAClC,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3B,OAAO;oBACL,GAAG,UAAU;oBACb,SAAS,EAAE,MAAM;iBAClB,CAAC;YACJ,CAAC;YACD,OAAO,UAAU,IAAI,EAAE,CAAC;QAC1B,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO;gBACL,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;gBAClB,SAAS,EAAE,MAAM;aAClB,CAAC;QACJ,CAAC;QACD,OAAO,OAAO,IAAI,EAAE,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,mCAAmC,CAAC,KAAuC;IAClF,MAAM,UAAU,GAAG,IAAA,8CAA2B,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7D,OAAO,CAAC,CAAC,UAAU,CAAC,+DAA4C,CAAC,CAAC;AACpE,CAAC;AAED,kBAAe,KAAK,CAAC;AAEd,MAAM,WAAW,GAAyB,CAAC,OAAO,EAAE,EAAE;IAC3D,MAAM,MAAM,GAAG,IAAA,oBAAa,EAAC,OAAO,CAAC,CAAC;IACtC,OAAO;QACL,GAAG,MAAM;QACT,GAAG,IAAA,2BAAmB,EAAC,MAAM,CAAC;KAC/B,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB","sourcesContent":["'use client';\nimport { nanoid } from 'nanoid/non-secure';\nimport type { ComponentProps } from 'react';\nimport { Children, useMemo } from 'react';\n\nimport { withLayoutContext } from './withLayoutContext';\nimport { createNativeStackNavigator } from '../fork/native-stack/createNativeStackNavigator';\nimport { useLinkPreviewContext } from '../link/preview/LinkPreviewContext';\nimport {\n getInternalExpoRouterParams,\n INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME,\n INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME,\n INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME,\n INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME,\n type InternalExpoRouterParams,\n} from '../navigationParams';\nimport type { SingularOptions } from '../useScreens';\nimport { getSingularId } from '../useScreens';\nimport {\n type StackScreenProps,\n StackHeader,\n StackScreen,\n StackSearchBar,\n StackToolbar,\n appendScreenStackPropsToOptions,\n mapProtectedScreen,\n validateStackPresentation,\n} from './stack-utils';\nimport {\n type CommonNavigationAction,\n type NavigationAction,\n type ParamListBase,\n type PartialRoute,\n type PartialState,\n type Route,\n type RouterConfigOptions,\n type StackActionType,\n type StackNavigationState,\n StackRouter as RNStackRouter,\n type RouteProp,\n} from '../react-navigation/native';\nimport type {\n NativeStackNavigationEventMap,\n NativeStackNavigationOptions,\n} from '../react-navigation/native-stack';\nimport { isChildOfType } from '../utils/children';\nimport { Protected } from '../views/Protected';\n\ntype GetId = NonNullable;\n\nconst NativeStackNavigator = createNativeStackNavigator().Navigator;\n\n/**\n * We extend NativeStackNavigationOptions with our custom props\n * to allow for several extra props to be used on web, like modalWidth\n */\nexport type ExtendedStackNavigationOptions = NativeStackNavigationOptions & {\n webModalStyle?: {\n /**\n * Override the width of the modal (px or percentage). Only applies on web platform.\n * @platform web\n */\n width?: number | string;\n /**\n * Override the height of the modal (px or percentage). Applies on web desktop.\n * @platform web\n */\n height?: number | string;\n /**\n * Minimum height of the desktop modal (px or percentage). Overrides the default 640px clamp.\n * @platform web\n */\n minHeight?: number | string;\n /**\n * Minimum width of the desktop modal (px or percentage). Overrides the default 580px.\n * @platform web\n */\n minWidth?: number | string;\n /**\n * Override the border of the desktop modal (any valid CSS border value, e.g. '1px solid #ccc' or 'none').\n * @platform web\n */\n border?: string;\n /**\n * Override the overlay background color (any valid CSS color or rgba/hsla value).\n * @platform web\n */\n overlayBackground?: string;\n /**\n * Override the modal shadow filter (any valid CSS filter value, e.g. 'drop-shadow(0 4px 8px rgba(0,0,0,0.1))' or 'none').\n * @platform web\n */\n shadow?: string;\n };\n};\n\nconst RNStack = withLayoutContext<\n ExtendedStackNavigationOptions,\n typeof NativeStackNavigator,\n StackNavigationState,\n NativeStackNavigationEventMap\n>(NativeStackNavigator);\n\ntype RNNavigationAction = Extract;\ntype RNPreloadAction = Extract;\ntype ExpoNavigationAction = Omit & {\n payload: Omit & {\n params: RNNavigationAction['payload']['params'] & InternalExpoRouterParams;\n };\n};\n\nfunction isStackAction(\n action: NavigationAction\n): action is StackActionType | RNPreloadAction | ExpoNavigationAction {\n return (\n action.type === 'PUSH' ||\n action.type === 'NAVIGATE' ||\n action.type === 'POP' ||\n action.type === 'POP_TO_TOP' ||\n action.type === 'REPLACE' ||\n action.type === 'PRELOAD'\n );\n}\n\nconst isPreviewAction = (action: NavigationAction): action is ExpoNavigationAction =>\n !!action.payload &&\n 'params' in action.payload &&\n typeof action.payload.params === 'object' &&\n !!getInternalExpoRouterParams(action.payload?.params ?? undefined)[\n INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME\n ];\n\nconst getZoomTransitionIdFromAction = (action: NavigationAction): string | undefined => {\n const allParams =\n !!action.payload && 'params' in action.payload && typeof action.payload.params === 'object'\n ? action.payload.params\n : undefined;\n const internalParams = getInternalExpoRouterParams(allParams ?? undefined);\n const val = internalParams[INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME];\n if (val && typeof val === 'string') {\n return val;\n }\n return undefined;\n};\n\n/**\n * React Navigation matches a screen by its name or a 'getID' function that uniquely identifies a screen.\n * When a screen has been uniquely identified, the Stack can only have one instance of that screen.\n *\n * Expo Router allows for a screen to be matched by name and path params, a 'getID' function or a singular id.\n *\n * Instead of reimplementing the entire StackRouter, we can override the getStateForAction method to handle the singular screen logic.\n *\n */\nexport const stackRouterOverride: NonNullable['UNSTABLE_router']> = (\n original\n) => {\n return {\n getStateForAction: (state, action, options) => {\n if (action.target && action.target !== state.key) {\n return null;\n }\n\n if (!isStackAction(action)) {\n return original.getStateForAction(state, action, options);\n }\n\n // The dynamic getId added to an action, `router.push('screen', { singular: true })`\n const actionSingularOptions =\n action.payload && 'singular' in action.payload\n ? (action.payload.singular as SingularOptions)\n : undefined;\n\n // Handle if 'getID' or 'singular' is set.\n function getIdFunction(): GetId | undefined {\n // Actions can be fired by the user, so we do need to validate their structure.\n if (\n !('payload' in action) ||\n !action.payload ||\n !('name' in action.payload) ||\n typeof action.payload.name !== 'string'\n ) {\n return;\n }\n\n const actionName = action.payload.name;\n\n return (\n // The dynamic singular added to an action, `router.push('screen', { singular: () => 'id' })`\n getActionSingularIdFn(actionSingularOptions, actionName) ||\n // The static getId added as a prop to `` or ``\n options.routeGetIdList[actionName]\n );\n }\n\n const { routeParamList } = options;\n\n switch (action.type) {\n case 'PUSH':\n case 'NAVIGATE': {\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n\n // START FORK\n const getId = getIdFunction();\n // const getId = options.routeGetIdList[action.payload.name];\n // END FORK\n const id = getId?.({ params: action.payload.params });\n\n let route: Route | undefined;\n\n if (id !== undefined) {\n route = state.routes.findLast(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n } else if (action.type === 'NAVIGATE') {\n const currentRoute = state.routes[state.index]!;\n\n // If the route matches the current one, then navigate to it\n if (action.payload.name === currentRoute.name && !isPreviewAction(action)) {\n route = currentRoute;\n } else if (action.payload.pop) {\n route = state.routes.findLast((route) => route.name === action.payload.name);\n }\n }\n\n // START FORK\n let isPreloadedRoute = false;\n if (isPreviewAction(action) && !route) {\n route = state.preloadedRoutes.find(\n (route) => route.name === action.payload.name && id === route.key\n );\n isPreloadedRoute = !!route;\n }\n // END FORK\n\n if (!route) {\n route = state.preloadedRoutes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n // START FORK\n isPreloadedRoute = !!route;\n // END FORK\n }\n\n let params;\n\n if (action.type === 'NAVIGATE' && action.payload.merge && route) {\n params =\n action.payload.params !== undefined ||\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...route.params,\n ...action.payload.params,\n }\n : route.params;\n } else {\n params =\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...action.payload.params,\n }\n : action.payload.params;\n }\n\n let routes: Route[];\n\n if (route) {\n if (action.type === 'NAVIGATE' && action.payload.pop) {\n routes = [];\n\n // Get all routes until the matching one\n for (const r of state.routes) {\n if (r.key === route.key) {\n routes.push({\n ...route,\n path: action.payload.path !== undefined ? action.payload.path : route.path,\n params,\n });\n break;\n }\n\n routes.push(r);\n }\n } else {\n // START FORK\n // If there is an id, then filter out the existing route with the same id.\n // THIS ACTION IS DANGEROUS. This can cause React Native Screens to freeze\n if (id !== undefined) {\n routes = state.routes.filter((r) => r.key !== route.key);\n } else if (action.type === 'NAVIGATE' && state.routes.length > 0) {\n // The navigation action should only replace the last route if it has the same name and path params.\n const lastRoute = state.routes[state.routes.length - 1]!;\n if (\n getSingularId(lastRoute.name, { params: lastRoute.params }) ===\n getSingularId(route.name, { params })\n ) {\n routes = state.routes.slice(0, -1);\n } else {\n routes = [...state.routes];\n }\n } else {\n routes = [...state.routes];\n }\n\n // If the routes length is the same as the state routes length, then we are navigating to a new route.\n // Otherwise we are replacing an existing route.\n // For preloaded route, we want to use the same key, so that preloaded screen is used.\n const key =\n routes.length === state.routes.length && !isPreloadedRoute\n ? `${action.payload.name}-${nanoid()}`\n : route.key;\n\n routes.push({\n ...route,\n key,\n path:\n action.type === 'NAVIGATE' && action.payload.path !== undefined\n ? action.payload.path\n : route.path,\n params,\n });\n\n // routes = state.routes.filter((r) => r.key !== route.key);\n // routes.push({\n // ...route,\n // path:\n // action.type === 'NAVIGATE' && action.payload.path !== undefined\n // ? action.payload.path\n // : route.path,\n // params,\n // });\n // END FORK\n }\n } else {\n routes = [\n ...state.routes,\n {\n key: `${action.payload.name}-${nanoid()}`,\n name: action.payload.name,\n path: action.type === 'NAVIGATE' ? action.payload.path : undefined,\n params,\n },\n ];\n }\n\n // START FORK\n // return filterSingular(\n const result = {\n ...state,\n index: routes.length - 1,\n preloadedRoutes: state.preloadedRoutes.filter(\n (route) => routes[routes.length - 1]!.key !== route.key\n ),\n routes,\n };\n\n if (actionSingularOptions) {\n return filterSingular(result, getId);\n }\n\n const zoomTransitionId = getZoomTransitionIdFromAction(action);\n if (zoomTransitionId) {\n const lastRoute = result.routes[result.routes.length - 1]!;\n const key = lastRoute.key;\n const modifiedLastRoute: typeof lastRoute = {\n ...lastRoute,\n params: {\n ...lastRoute.params,\n [INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME]: key,\n },\n };\n return {\n ...result,\n routes: [...result.routes.slice(0, -1), modifiedLastRoute],\n };\n }\n\n return result;\n // return {\n // ...state,\n // index: routes.length - 1,\n // preloadedRoutes: state.preloadedRoutes.filter(\n // (route) => routes[routes.length - 1].key !== route.key\n // ),\n // routes,\n // };\n // END FORK\n }\n case 'PRELOAD': {\n // START FORK\n // This will be the case for example for protected route\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n // END FORK\n const getId = options.routeGetIdList[action.payload.name];\n const id = getId?.({ params: action.payload.params });\n\n let route: Route | undefined;\n\n if (id !== undefined) {\n route = state.routes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n }\n\n const preloadZoomTransitionId = getZoomTransitionIdFromAction(action);\n\n if (route) {\n return {\n ...state,\n routes: state.routes.map((r) => {\n if (r.key !== route?.key) {\n return r;\n }\n const mergedParams =\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...action.payload.params,\n }\n : action.payload.params;\n return {\n ...r,\n params: preloadZoomTransitionId\n ? {\n ...mergedParams,\n [INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME]: r.key,\n }\n : mergedParams,\n };\n }),\n };\n } else {\n // START FORK\n const preloadedRouteKey = `${action.payload.name}-${nanoid()}`;\n const preloadedRouteParams =\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...action.payload.params,\n }\n : action.payload.params;\n const currentPreloadedRoute: (typeof state)['preloadedRoutes'][number] = {\n key: preloadedRouteKey,\n name: action.payload.name,\n params: preloadZoomTransitionId\n ? {\n ...preloadedRouteParams,\n [INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME]: preloadedRouteKey,\n }\n : preloadedRouteParams,\n };\n // END FORK\n return {\n ...state,\n // START FORK\n // Adding the current preloaded route to the beginning of the preloadedRoutes array\n // This ensures that the preloaded route will be the next one after the visible route\n // and when navigation will happen, there will be no reshuffling\n // This is a workaround for the link preview navigation issue, when screen would freeze after navigation from native side\n // and reshuffling from react-navigation\n preloadedRoutes: [currentPreloadedRoute].concat(\n state.preloadedRoutes.filter(\n (r) => r.name !== action.payload.name || id !== getId?.({ params: r.params })\n )\n ),\n // preloadedRoutes: state.preloadedRoutes\n // .filter(\n // (r) =>\n // r.name !== action.payload.name ||\n // id !== getId?.({ params: r.params })\n // )\n // .concat({\n // key: `${action.payload.name}-${nanoid()}`,\n // name: action.payload.name,\n // params:\n // routeParamList[action.payload.name] !== undefined\n // ? {\n // ...routeParamList[action.payload.name],\n // ...action.payload.params,\n // }\n // : action.payload.params,\n // }),\n // END FORK\n };\n }\n }\n default: {\n return original.getStateForAction(state, action, options);\n }\n }\n },\n };\n};\n\nfunction getActionSingularIdFn(\n actionGetId: SingularOptions | undefined,\n name: string\n): GetId | undefined {\n if (typeof actionGetId === 'function') {\n return (options) => actionGetId(name, options.params ?? {});\n } else if (actionGetId === true) {\n return (options) => getSingularId(name, options);\n }\n\n return undefined;\n}\n\n/**\n * If there is a dynamic singular on an action, then we need to filter the state to only have singular screens.\n * As multiples may have been added before we did the singular navigation.\n */\nfunction filterSingular<\n T extends\n | StackNavigationState\n | PartialState>\n | null,\n>(state: T, getId?: GetId): T {\n if (!state) {\n return state;\n }\n\n if (!state.routes) {\n return state;\n }\n\n // TODO(@kitten): This looks wrong as it's defaulting `index === 0`\n const currentIndex = state.index || state.routes.length - 1;\n const current = state.routes[currentIndex]!;\n const name = current.name;\n\n const id = getId?.({ params: current.params });\n\n if (!id) {\n return state;\n }\n\n // TypeScript needs a type assertion here for the filter to work.\n let routes = state.routes as PartialRoute>[];\n routes = routes.filter((route, index) => {\n // If the route is the current route, keep it.\n if (index === currentIndex) {\n return true;\n }\n\n // Remove all other routes with the same name and id.\n return name !== route.name || id !== getId?.({ params: route.params });\n });\n\n return {\n ...state,\n index: routes.length - 1,\n routes,\n };\n}\n\n/**\n * Renders a native stack navigator.\n *\n * @hideType\n */\nconst Stack = Object.assign(\n (props: ComponentProps) => {\n const { isStackAnimationDisabled } = useLinkPreviewContext();\n\n const screenOptionsWithCompositionAPIOptions = useMemo(() => {\n const stackHeader = Children.toArray(props.children).find((child) =>\n isChildOfType(child, StackHeader)\n );\n if (stackHeader) {\n const screenStackProps: StackScreenProps = { children: stackHeader };\n const currentOptions = props.screenOptions;\n if (currentOptions) {\n if (typeof currentOptions === 'function') {\n return (...args) => {\n const options = currentOptions(...args);\n return appendScreenStackPropsToOptions(options, screenStackProps);\n };\n }\n return appendScreenStackPropsToOptions(currentOptions, screenStackProps);\n } else {\n return appendScreenStackPropsToOptions({}, screenStackProps);\n }\n } else if (props.screenOptions) {\n const screenOptions = props.screenOptions;\n if (typeof screenOptions === 'function') {\n return validateStackPresentation(screenOptions);\n }\n return validateStackPresentation(screenOptions);\n }\n return props.screenOptions;\n }, [props.screenOptions, props.children]);\n\n const screenOptions = useMemo(() => {\n const condition = isStackAnimationDisabled ? () => true : shouldDisableAnimationBasedOnParams;\n\n return disableAnimationInScreenOptions(screenOptionsWithCompositionAPIOptions, condition);\n }, [screenOptionsWithCompositionAPIOptions, isStackAnimationDisabled]);\n\n const rnChildren = useMemo(\n () => mapProtectedScreen({ guard: true, children: props.children }).children,\n [props.children]\n );\n\n return (\n \n );\n },\n {\n Screen: StackScreen,\n Protected,\n Header: StackHeader,\n SearchBar: StackSearchBar,\n Toolbar: StackToolbar,\n }\n);\n\ntype NativeStackScreenOptions = ComponentProps['screenOptions'];\n\nfunction disableAnimationInScreenOptions(\n options: NativeStackScreenOptions | undefined,\n condition: (route: RouteProp) => boolean\n): NativeStackScreenOptions {\n if (options && typeof options === 'function') {\n return (props) => {\n const oldOptions = options(props);\n if (condition(props.route)) {\n return {\n ...oldOptions,\n animation: 'none',\n };\n }\n return oldOptions ?? {};\n };\n }\n return (props) => {\n if (condition(props.route)) {\n return {\n ...(options ?? {}),\n animation: 'none',\n };\n }\n return options ?? {};\n };\n}\n\nfunction shouldDisableAnimationBasedOnParams(route: RouteProp): boolean {\n const expoParams = getInternalExpoRouterParams(route.params);\n return !!expoParams[INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME];\n}\n\nexport default Stack;\n\nexport const StackRouter: typeof RNStackRouter = (options) => {\n const router = RNStackRouter(options);\n return {\n ...router,\n ...stackRouterOverride(router),\n };\n};\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot/native.ios.js.map b/packages/expo-router/build/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot/native.ios.js.map index 85ae4be6f6f203..1d1d1b01412f35 100644 --- a/packages/expo-router/build/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot/native.ios.js.map +++ b/packages/expo-router/build/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot/native.ios.js.map @@ -1 +1 @@ -{"version":3,"file":"native.ios.js","sourceRoot":"","sources":["../../../../../src/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot/native.ios.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AACb,iCAA8B;AAC9B,+CAAwC;AAGxC,uDAA+D;AAE/D;;;GAGG;AACI,MAAM,0BAA0B,GAA8C,CAAC,EACpF,qBAAqB,EACrB,MAAM,EACN,kBAAkB,GACnB,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,IAAA,aAAK,GAAE,CAAC;IACnB,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,uBAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC;QAC/F,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,uBAAC,0BAAiB,IAChB,qBAAqB,EAAE,qBAAqB,EAC5C,UAAU,EAAE,EAAE,EACd,gBAAgB,EAAE,CAAC,kBAAkB,EACrC,IAAI,EAAC,WAAW,GAChB,CACH,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,0BAA0B,8BAoBrC","sourcesContent":["'use client';\nimport { useId } from 'react';\nimport { Platform } from 'react-native';\n\nimport type { NativeToolbarSearchBarSlotProps } from './types';\nimport { RouterToolbarItem } from '../../../../toolbar/native';\n\n/**\n * Native toolbar search bar slot for bottom toolbar (iOS 26+).\n * Renders as RouterToolbarItem with type 'searchBar'.\n */\nexport const NativeToolbarSearchBarSlot: React.FC = ({\n hidesSharedBackground,\n hidden,\n separateBackground,\n}) => {\n const id = useId();\n if (process.env.EXPO_OS !== 'ios' || parseInt(String(Platform.Version).split('.')[0], 10) < 26) {\n return null;\n }\n if (hidden) {\n return null;\n }\n return (\n \n );\n};\n"]} \ No newline at end of file +{"version":3,"file":"native.ios.js","sourceRoot":"","sources":["../../../../../src/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot/native.ios.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AACb,iCAA8B;AAC9B,+CAAwC;AAGxC,uDAA+D;AAE/D;;;GAGG;AACI,MAAM,0BAA0B,GAA8C,CAAC,EACpF,qBAAqB,EACrB,MAAM,EACN,kBAAkB,GACnB,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,IAAA,aAAK,GAAE,CAAC;IACnB,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,uBAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC;QAChG,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,uBAAC,0BAAiB,IAChB,qBAAqB,EAAE,qBAAqB,EAC5C,UAAU,EAAE,EAAE,EACd,gBAAgB,EAAE,CAAC,kBAAkB,EACrC,IAAI,EAAC,WAAW,GAChB,CACH,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,0BAA0B,8BAoBrC","sourcesContent":["'use client';\nimport { useId } from 'react';\nimport { Platform } from 'react-native';\n\nimport type { NativeToolbarSearchBarSlotProps } from './types';\nimport { RouterToolbarItem } from '../../../../toolbar/native';\n\n/**\n * Native toolbar search bar slot for bottom toolbar (iOS 26+).\n * Renders as RouterToolbarItem with type 'searchBar'.\n */\nexport const NativeToolbarSearchBarSlot: React.FC = ({\n hidesSharedBackground,\n hidden,\n separateBackground,\n}) => {\n const id = useId();\n if (process.env.EXPO_OS !== 'ios' || parseInt(String(Platform.Version).split('.')[0]!, 10) < 26) {\n return null;\n }\n if (hidden) {\n return null;\n }\n return (\n \n );\n};\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/link/Link.d.ts b/packages/expo-router/build/link/Link.d.ts index 29799e39e4f310..41bebed9551f5e 100644 --- a/packages/expo-router/build/link/Link.d.ts +++ b/packages/expo-router/build/link/Link.d.ts @@ -12,6 +12,6 @@ export declare const Link: ((props: LinkProps) => import("react/jsx-runtime").JS AppleZoomTarget: typeof LinkAppleZoomTarget; }; export type LinkComponent = typeof Link; -export { LinkProps, WebAnchorProps }; +export type { LinkProps, WebAnchorProps }; export { Redirect, type RedirectProps } from './Redirect'; //# sourceMappingURL=Link.d.ts.map \ No newline at end of file diff --git a/packages/expo-router/build/link/Link.d.ts.map b/packages/expo-router/build/link/Link.d.ts.map index 7d69c20bdf18f0..71aa6e4f10eb9b 100644 --- a/packages/expo-router/build/link/Link.d.ts.map +++ b/packages/expo-router/build/link/Link.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEhF,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,eAAO,MAAM,IAAI,WA2BM,SAAS;;;;;;;;CAa/B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,IAAI,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC"} \ No newline at end of file +{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEhF,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,eAAO,MAAM,IAAI,WA2BM,SAAS;;;;;;;;CAa/B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,IAAI,CAAC;AAExC,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC"} \ No newline at end of file diff --git a/packages/expo-router/build/link/Link.js.map b/packages/expo-router/build/link/Link.js.map index 73dce2f9836577..6716faf57eb571 100644 --- a/packages/expo-router/build/link/Link.js.map +++ b/packages/expo-router/build/link/Link.js.map @@ -1 +1 @@ -{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":";;;;AAAA,yCAAsC;AACtC,yCAAgF;AAChF,iCAAqC;AAErC,4DAAuD;AACvD,0EAAoE;AAEvD,QAAA,IAAI,GAAG,MAAM,CAAC,MAAM;AAC/B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAS,IAAI,CAAC,KAAgB;IAC5B,8EAA8E;IAC9E,OAAO,uBAAC,mBAAQ,OAAK,KAAK,GAAI,CAAC;AACjC,CAAC,EACD;IACE,WAAW,EAAX,kBAAW;IACX,IAAI,EAAE,mBAAQ;IACd,OAAO,EAAE,sBAAW;IACpB,OAAO,EAAE,sBAAW;IACpB,UAAU,EAAE,yBAAc;IAC1B,SAAS,EAAE,+BAAa;IACxB,eAAe,EAAE,4CAAmB;CACrC,CACF,CAAC;AAKF,uCAA0D;AAAjD,oGAAA,QAAQ,OAAA","sourcesContent":["import { ExpoLink } from './ExpoLink';\nimport { LinkMenu, LinkMenuAction, LinkPreview, LinkTrigger } from './elements';\nimport { resolveHref } from './href';\nimport type { LinkProps, WebAnchorProps } from './useLinkHooks';\nimport { LinkAppleZoom } from './zoom/link-apple-zoom';\nimport { LinkAppleZoomTarget } from './zoom/link-apple-zoom-target';\n\nexport const Link = Object.assign(\n /**\n * Component that renders a link using [`href`](#href) to another route.\n * By default, it accepts children and wraps them in a `` component.\n *\n * Uses an anchor tag (``) on web and performs a client-side navigation to preserve\n * the state of the website and navigate faster. The web-only attributes such as `target`,\n * `rel`, and `download` are supported and passed to the anchor tag on web. See\n * [`WebAnchorProps`](#webanchorprops) for more details.\n *\n * > **Note**: Client-side navigation works with both single-page apps,\n * and [static-rendering](/router/reference/static-rendering/).\n *\n * @example\n * ```tsx\n * import { Link } from 'expo-router';\n * import { View } from 'react-native';\n *\n * export default function Route() {\n * return (\n * \n * About\n * \n * );\n *}\n * ```\n */\n function Link(props: LinkProps) {\n // Re-exporting ExpoLink here so that Link.* can be used in server components.\n return ;\n },\n {\n resolveHref,\n Menu: LinkMenu,\n Trigger: LinkTrigger,\n Preview: LinkPreview,\n MenuAction: LinkMenuAction,\n AppleZoom: LinkAppleZoom,\n AppleZoomTarget: LinkAppleZoomTarget,\n }\n);\n\nexport type LinkComponent = typeof Link;\n\nexport { LinkProps, WebAnchorProps };\nexport { Redirect, type RedirectProps } from './Redirect';\n"]} \ No newline at end of file +{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":";;;;AAAA,yCAAsC;AACtC,yCAAgF;AAChF,iCAAqC;AAErC,4DAAuD;AACvD,0EAAoE;AAEvD,QAAA,IAAI,GAAG,MAAM,CAAC,MAAM;AAC/B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAS,IAAI,CAAC,KAAgB;IAC5B,8EAA8E;IAC9E,OAAO,uBAAC,mBAAQ,OAAK,KAAK,GAAI,CAAC;AACjC,CAAC,EACD;IACE,WAAW,EAAX,kBAAW;IACX,IAAI,EAAE,mBAAQ;IACd,OAAO,EAAE,sBAAW;IACpB,OAAO,EAAE,sBAAW;IACpB,UAAU,EAAE,yBAAc;IAC1B,SAAS,EAAE,+BAAa;IACxB,eAAe,EAAE,4CAAmB;CACrC,CACF,CAAC;AAKF,uCAA0D;AAAjD,oGAAA,QAAQ,OAAA","sourcesContent":["import { ExpoLink } from './ExpoLink';\nimport { LinkMenu, LinkMenuAction, LinkPreview, LinkTrigger } from './elements';\nimport { resolveHref } from './href';\nimport type { LinkProps, WebAnchorProps } from './useLinkHooks';\nimport { LinkAppleZoom } from './zoom/link-apple-zoom';\nimport { LinkAppleZoomTarget } from './zoom/link-apple-zoom-target';\n\nexport const Link = Object.assign(\n /**\n * Component that renders a link using [`href`](#href) to another route.\n * By default, it accepts children and wraps them in a `` component.\n *\n * Uses an anchor tag (``) on web and performs a client-side navigation to preserve\n * the state of the website and navigate faster. The web-only attributes such as `target`,\n * `rel`, and `download` are supported and passed to the anchor tag on web. See\n * [`WebAnchorProps`](#webanchorprops) for more details.\n *\n * > **Note**: Client-side navigation works with both single-page apps,\n * and [static-rendering](/router/reference/static-rendering/).\n *\n * @example\n * ```tsx\n * import { Link } from 'expo-router';\n * import { View } from 'react-native';\n *\n * export default function Route() {\n * return (\n * \n * About\n * \n * );\n *}\n * ```\n */\n function Link(props: LinkProps) {\n // Re-exporting ExpoLink here so that Link.* can be used in server components.\n return ;\n },\n {\n resolveHref,\n Menu: LinkMenu,\n Trigger: LinkTrigger,\n Preview: LinkPreview,\n MenuAction: LinkMenuAction,\n AppleZoom: LinkAppleZoom,\n AppleZoomTarget: LinkAppleZoomTarget,\n }\n);\n\nexport type LinkComponent = typeof Link;\n\nexport type { LinkProps, WebAnchorProps };\nexport { Redirect, type RedirectProps } from './Redirect';\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/link/preview/HrefPreview.js b/packages/expo-router/build/link/preview/HrefPreview.js index 0e53c3ba9b7ee5..841fc02f89c2f3 100644 --- a/packages/expo-router/build/link/preview/HrefPreview.js +++ b/packages/expo-router/build/link/preview/HrefPreview.js @@ -101,6 +101,7 @@ function getParamsAndNodeFromHref(hrefState) { let routeNode = router_store_1.store.routeNode; const params = {}; while (state && routeNode) { + // TODO(@kitten): This looks wrong as it's defaulting `index === 0` const route = state.routes[state.index || state.routes.length - 1]; Object.assign(params, route.params); state = route.state; diff --git a/packages/expo-router/build/link/preview/HrefPreview.js.map b/packages/expo-router/build/link/preview/HrefPreview.js.map index 33628003860014..45e9870b9ad546 100644 --- a/packages/expo-router/build/link/preview/HrefPreview.js.map +++ b/packages/expo-router/build/link/preview/HrefPreview.js.map @@ -1 +1 @@ -{"version":3,"file":"HrefPreview.js","sourceRoot":"","sources":["../../../src/link/preview/HrefPreview.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAuBb,kCAyCC;;AA9DD,iCAAgC;AAChC,+CAA0C;AAE1C,+DAA4D;AAE5D,+CAA+F;AAE/F,qFAAiF;AACjF,kEAAwD;AACxD,oDAAkE;AAClE,uCAA0C;AAC1C,0DAIuC;AAEvC,uDAAoD;AACpD,iDAA8D;AAC9D,wCAA8C;AAE9C,SAAgB,WAAW,CAAC,EAAE,IAAI,EAAkB;IAClD,MAAM,SAAS,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,SAAS,EAAE,KAAK,IAAI,CAAC,CAAC;IAEpC,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,IAAI,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,KAAK,8BAAkB,EAAE,CAAC;QAC1D,IAAI,WAAW,GAAiC,SAAS,CAAC;QAC1D,IAAI,OAAO,GAAG,oBAAK,CAAC,KAAK,CAAC;QAC1B,OAAO,WAAW,IAAI,OAAO,EAAE,CAAC;YAC9B,MAAM,WAAW,GAAkC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACz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;IAC3C,QAAQ,EAAE,qBAAqB,CAAC,UAAU,CAAC;IAC3C,MAAM,EAAE,qBAAqB,CAAC,QAAQ,CAAC;IACvC,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC;IACrC,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC;IACnC,GAAG,EAAE,qBAAqB,CAAC,KAAK,CAAC;IACjC,QAAQ,EAAE,qBAAqB,CAAC,UAAU,CAAC;IAC3C,kBAAkB,EAAE,qBAAqB,CAAC,oBAAoB,CAAC;IAC/D,OAAO,EAAE,qBAAqB,CAAC,SAAS,CAAC;IACzC,KAAK,EAAE,GAAG,EAAE;QACV,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,mBAAmB;IACnB,SAAS,EAAE,qBAAqB,CAAC,WAAW,CAAC;IAC7C,QAAQ,EAAE,GAAG,EAAE;QACb,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO;YACL,GAAG,EAAE,EAAE;YACP,KAAK,EAAE,CAAC;YACR,UAAU,EAAE,EAAE;YACd,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,KAAK;SACb,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\nimport { Text, View } from 'react-native';\n\nimport { PreviewRouteContext } from './PreviewRouteContext';\nimport type { RouteNode } from '../../Route';\nimport { INTERNAL_SLOT_NAME, NOT_FOUND_ROUTE_NAME, SITEMAP_ROUTE_NAME } from '../../constants';\nimport type { ResultState } from '../../exports';\nimport { CompositionContext } from '../../fork/native-stack/composition-options';\nimport { store } from '../../global-state/router-store';\nimport { getRootStackRouteNames } from '../../global-state/utils';\nimport { usePathname } from '../../hooks';\nimport {\n NavigationContext,\n type NavigationProp,\n type ParamListBase,\n} from '../../react-navigation/native';\nimport type { Href, UnknownOutputParams } from '../../types';\nimport { useNavigation } from '../../useNavigation';\nimport { getQualifiedRouteComponent } from '../../useScreens';\nimport { getPathFromState } from '../linking';\n\nexport function HrefPreview({ href }: { href: Href }) {\n const hrefState = useMemo(() => getHrefState(href), [href]);\n const index = hrefState?.index ?? 0;\n\n let isProtected = false;\n if (hrefState?.routes[index]?.name === INTERNAL_SLOT_NAME) {\n let routerState: typeof hrefState | undefined = hrefState;\n let rnState = store.state;\n while (routerState && rnState) {\n const routerRoute: ResultState['routes'][number] = routerState.routes[0];\n // When the route we want to show is not present in react-navigation state\n // Then most likely it is a protected route\n if (rnState.stale === false && !rnState.routeNames?.includes(routerRoute.name)) {\n isProtected = true;\n break;\n }\n const rnIndex = rnState.routes.findIndex((route) => route.name === routerRoute.name);\n if (rnIndex === -1) {\n break;\n }\n routerState = routerRoute.state;\n rnState = rnState.routes[rnIndex]?.state;\n }\n if (!isProtected) {\n return ;\n }\n }\n\n const pathname = href.toString();\n const segments = pathname.split('/').filter(Boolean);\n\n return (\n \n \n \n );\n}\n\nfunction PreviewForRootHrefState({ hrefState, href }: { hrefState: ResultState; href: Href }) {\n const navigation = useNavigation();\n const { routeNode, params, state } = getParamsAndNodeFromHref(hrefState);\n\n const path = state ? getPathFromState(state) : undefined;\n\n const value = useMemo(\n () => ({\n params,\n pathname: href.toString(),\n segments: path?.split('/').filter(Boolean) || [],\n }),\n [params, href]\n );\n\n // This can happen in a theoretical case where the state is not yet initialized or is incorrectly initialized.\n // This check ensures TypeScript type safety as well.\n if (!routeNode) {\n return null;\n }\n\n const Component = getQualifiedRouteComponent(routeNode);\n\n return (\n \n {}, unset: () => {} }}>\n {/* Using NavigationContext to override useNavigation */}\n \n \n \n \n \n );\n}\n\nfunction PreviewForInternalRoutes() {\n const pathname = usePathname();\n return (\n \n Invalid preview\n {pathname}\n \n );\n}\n\nfunction getHrefState(href: Href) {\n const hrefState = store.getStateForHref(href as any);\n return hrefState;\n}\n\nfunction getParamsAndNodeFromHref(hrefState: ResultState) {\n const index = hrefState?.index ?? 0;\n if (hrefState?.routes[index] && hrefState.routes[index].name !== INTERNAL_SLOT_NAME) {\n const name = hrefState.routes[index].name;\n if (name === SITEMAP_ROUTE_NAME || name === NOT_FOUND_ROUTE_NAME) {\n console.log(store.routeNode);\n console.log(hrefState);\n }\n const error = `Expo Router Error: Expected navigation state to begin with one of [${getRootStackRouteNames().join(', ')}] routes`;\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(error);\n } else {\n console.warn(error);\n }\n }\n const initialState = hrefState?.routes[index]?.state;\n let state = initialState;\n let routeNode: RouteNode | undefined | null = store.routeNode;\n\n const params: UnknownOutputParams = {};\n\n while (state && routeNode) {\n const route = state.routes[state.index || state.routes.length - 1];\n Object.assign(params, route.params);\n state = route.state;\n routeNode = routeNode.children.find((child) => child.route === route.name);\n }\n\n return { params, routeNode, state: initialState };\n}\n\nconst displayWarningForProp = (prop: string) => {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `navigation.${prop} should not be used in a previewed screen. To fix this issue, wrap navigation calls with 'if (!isPreview) { ... }'.`\n );\n }\n};\n\nconst createNOOPWithWarning = (prop: string) => () => displayWarningForProp(prop);\n\nconst navigationPropWithWarnings: NavigationProp = {\n setParams: createNOOPWithWarning('setParams'),\n setOptions: createNOOPWithWarning('setOptions'),\n addListener: (() => () => {}) as NavigationProp['addListener'],\n removeListener: () => {},\n isFocused: () => true,\n canGoBack: () => false,\n dispatch: createNOOPWithWarning('dispatch'),\n navigate: createNOOPWithWarning('navigate'),\n goBack: createNOOPWithWarning('goBack'),\n reset: createNOOPWithWarning('reset'),\n push: createNOOPWithWarning('push'),\n pop: createNOOPWithWarning('pop'),\n popToTop: createNOOPWithWarning('popToTop'),\n navigateDeprecated: createNOOPWithWarning('navigateDeprecated'),\n preload: createNOOPWithWarning('preload'),\n getId: () => {\n displayWarningForProp('getId');\n return '';\n },\n // @ts-expect-error\n getParent: createNOOPWithWarning('getParent'),\n getState: () => {\n displayWarningForProp('getState');\n return {\n key: '',\n index: 0,\n routeNames: [],\n routes: [],\n type: '',\n stale: false,\n };\n },\n};\n"]} \ No newline at end of file +{"version":3,"file":"HrefPreview.js","sourceRoot":"","sources":["../../../src/link/preview/HrefPreview.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAuBb,kCAyCC;;AA9DD,iCAAgC;AAChC,+CAA0C;AAE1C,+DAA4D;AAE5D,+CAA+F;AAE/F,qFAAiF;AACjF,kEAAwD;AACxD,oDAAkE;AAClE,uCAA0C;AAC1C,0DAIuC;AAEvC,uDAAoD;AACpD,iDAA8D;AAC9D,wCAA8C;AAE9C,SAAgB,WAAW,CAAC,EAAE,IAAI,EAAkB;IAClD,MAAM,SAAS,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,SAAS,EAAE,KAAK,IAAI,CAAC,CAAC;IAEpC,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,IAAI,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,KAAK,8BAAkB,EAAE,CAAC;QAC1D,IAAI,WAAW,GAAiC,SAAS,CAAC;QAC1D,IAAI,OAAO,GAAG,oBAAK,CAAC,KAAK,CAAC;QAC1B,OAAO,WAAW,IAAI,OAAO,EAAE,CAAC;YAC9B,MAAM,WAAW,GAAkC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC;YAC1E,0EAA0E;YAC1E,2CAA2C;YAC3C,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC/E,WAAW,GAAG,IAAI,CAAC;gBACnB,MAAM;YACR,CAAC;YACD,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI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C/D,OAAO,EAAE,qBAAqB,CAAC,SAAS,CAAC;IACzC,KAAK,EAAE,GAAG,EAAE;QACV,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,mBAAmB;IACnB,SAAS,EAAE,qBAAqB,CAAC,WAAW,CAAC;IAC7C,QAAQ,EAAE,GAAG,EAAE;QACb,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO;YACL,GAAG,EAAE,EAAE;YACP,KAAK,EAAE,CAAC;YACR,UAAU,EAAE,EAAE;YACd,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,KAAK;SACb,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\nimport { Text, View } from 'react-native';\n\nimport { PreviewRouteContext } from './PreviewRouteContext';\nimport type { RouteNode } from '../../Route';\nimport { INTERNAL_SLOT_NAME, NOT_FOUND_ROUTE_NAME, SITEMAP_ROUTE_NAME } from '../../constants';\nimport type { ResultState } from '../../exports';\nimport { CompositionContext } from '../../fork/native-stack/composition-options';\nimport { store } from '../../global-state/router-store';\nimport { getRootStackRouteNames } from '../../global-state/utils';\nimport { usePathname } from '../../hooks';\nimport {\n NavigationContext,\n type NavigationProp,\n type ParamListBase,\n} from '../../react-navigation/native';\nimport type { Href, UnknownOutputParams } from '../../types';\nimport { useNavigation } from '../../useNavigation';\nimport { getQualifiedRouteComponent } from '../../useScreens';\nimport { getPathFromState } from '../linking';\n\nexport function HrefPreview({ href }: { href: Href }) {\n const hrefState = useMemo(() => getHrefState(href), [href]);\n const index = hrefState?.index ?? 0;\n\n let isProtected = false;\n if (hrefState?.routes[index]?.name === INTERNAL_SLOT_NAME) {\n let routerState: typeof hrefState | undefined = hrefState;\n let rnState = store.state;\n while (routerState && rnState) {\n const routerRoute: ResultState['routes'][number] = routerState.routes[0]!;\n // When the route we want to show is not present in react-navigation state\n // Then most likely it is a protected route\n if (rnState.stale === false && !rnState.routeNames?.includes(routerRoute.name)) {\n isProtected = true;\n break;\n }\n const rnIndex = rnState.routes.findIndex((route) => route.name === routerRoute.name);\n if (rnIndex === -1) {\n break;\n }\n routerState = routerRoute.state;\n rnState = rnState.routes[rnIndex]?.state;\n }\n if (!isProtected) {\n return ;\n }\n }\n\n const pathname = href.toString();\n const segments = pathname.split('/').filter(Boolean);\n\n return (\n \n \n \n );\n}\n\nfunction PreviewForRootHrefState({ hrefState, href }: { hrefState: ResultState; href: Href }) {\n const navigation = useNavigation();\n const { routeNode, params, state } = getParamsAndNodeFromHref(hrefState);\n\n const path = state ? getPathFromState(state) : undefined;\n\n const value = useMemo(\n () => ({\n params,\n pathname: href.toString(),\n segments: path?.split('/').filter(Boolean) || [],\n }),\n [params, href]\n );\n\n // This can happen in a theoretical case where the state is not yet initialized or is incorrectly initialized.\n // This check ensures TypeScript type safety as well.\n if (!routeNode) {\n return null;\n }\n\n const Component = getQualifiedRouteComponent(routeNode);\n\n return (\n \n {}, unset: () => {} }}>\n {/* Using NavigationContext to override useNavigation */}\n \n \n \n \n \n );\n}\n\nfunction PreviewForInternalRoutes() {\n const pathname = usePathname();\n return (\n \n Invalid preview\n {pathname}\n \n );\n}\n\nfunction getHrefState(href: Href) {\n const hrefState = store.getStateForHref(href as any);\n return hrefState;\n}\n\nfunction getParamsAndNodeFromHref(hrefState: ResultState) {\n const index = hrefState?.index ?? 0;\n if (hrefState?.routes[index] && hrefState.routes[index].name !== INTERNAL_SLOT_NAME) {\n const name = hrefState.routes[index].name;\n if (name === SITEMAP_ROUTE_NAME || name === NOT_FOUND_ROUTE_NAME) {\n console.log(store.routeNode);\n console.log(hrefState);\n }\n const error = `Expo Router Error: Expected navigation state to begin with one of [${getRootStackRouteNames().join(', ')}] routes`;\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(error);\n } else {\n console.warn(error);\n }\n }\n const initialState = hrefState?.routes[index]?.state;\n let state = initialState;\n let routeNode: RouteNode | undefined | null = store.routeNode;\n\n const params: UnknownOutputParams = {};\n\n while (state && routeNode) {\n // TODO(@kitten): This looks wrong as it's defaulting `index === 0`\n const route = state.routes[state.index || state.routes.length - 1]!;\n Object.assign(params, route.params);\n state = route.state;\n routeNode = routeNode.children.find((child) => child.route === route.name);\n }\n\n return { params, routeNode, state: initialState };\n}\n\nconst displayWarningForProp = (prop: string) => {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `navigation.${prop} should not be used in a previewed screen. To fix this issue, wrap navigation calls with 'if (!isPreview) { ... }'.`\n );\n }\n};\n\nconst createNOOPWithWarning = (prop: string) => () => displayWarningForProp(prop);\n\nconst navigationPropWithWarnings: NavigationProp = {\n setParams: createNOOPWithWarning('setParams'),\n setOptions: createNOOPWithWarning('setOptions'),\n addListener: (() => () => {}) as NavigationProp['addListener'],\n removeListener: () => {},\n isFocused: () => true,\n canGoBack: () => false,\n dispatch: createNOOPWithWarning('dispatch'),\n navigate: createNOOPWithWarning('navigate'),\n goBack: createNOOPWithWarning('goBack'),\n reset: createNOOPWithWarning('reset'),\n push: createNOOPWithWarning('push'),\n pop: createNOOPWithWarning('pop'),\n popToTop: createNOOPWithWarning('popToTop'),\n navigateDeprecated: createNOOPWithWarning('navigateDeprecated'),\n preload: createNOOPWithWarning('preload'),\n getId: () => {\n displayWarningForProp('getId');\n return '';\n },\n // @ts-expect-error\n getParent: createNOOPWithWarning('getParent'),\n getState: () => {\n displayWarningForProp('getState');\n return {\n key: '',\n index: 0,\n routeNames: [],\n routes: [],\n type: '',\n stale: false,\n };\n },\n};\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/link/preview/utils.js.map b/packages/expo-router/build/link/preview/utils.js.map index 38dd2b1f9348a9..3d9624a719398b 100644 --- a/packages/expo-router/build/link/preview/utils.js.map +++ b/packages/expo-router/build/link/preview/utils.js.map @@ -1 +1 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/link/preview/utils.ts"],"names":[],"mappings":";;AAcA,sEAgC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C,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CACrD,EACD,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,SAAS,CACvB,CAAqC,EACrC,CAAqC;IAErC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QACnD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5B,OAAO,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjG,CAAC","sourcesContent":["import type { TabPath } from './native';\nimport { store, type ReactNavigationState } from '../../global-state/router-store';\nimport { findDivergentState, getPayloadFromStateRoute } from '../../global-state/routing';\nimport { removeInternalExpoRouterParams } from '../../navigationParams';\nimport type {\n ParamListBase,\n StackNavigationState,\n NavigationRoute,\n NavigationState,\n TabNavigationState,\n} from '../../react-navigation/native';\nimport type { Href } from '../../types';\nimport { resolveHref } from '../href';\n\nexport function getTabPathFromRootStateByHref(\n href: Href,\n rootState: ReactNavigationState\n): TabPath[] {\n const hrefState = store.getStateForHref(resolveHref(href));\n const state: ReactNavigationState | undefined = rootState;\n if (!hrefState || !state) {\n return [];\n }\n // Replicating the logic from `linkTo`\n const { navigationRoutes } = findDivergentState(hrefState, state as NavigationState, true);\n\n if (!navigationRoutes.length) {\n return [];\n }\n\n const tabPath: TabPath[] = [];\n navigationRoutes.forEach((route, i, arr) => {\n if (route.state?.type === 'tab') {\n const tabState = route.state as TabNavigationState;\n const oldTabKey = tabState.routes[tabState.index].key;\n // The next route will be either stack inside a tab or a new tab key\n if (!arr[i + 1]) {\n throw new Error(\n `New tab route is missing for ${route.key}. This is likely an internal Expo Router bug.`\n );\n }\n const newTabKey = arr[i + 1].key;\n tabPath.push({ oldTabKey, newTabKey });\n }\n });\n return tabPath;\n}\n\nexport function getPreloadedRouteFromRootStateByHref(\n href: Href,\n rootState: ReactNavigationState\n): NavigationRoute | undefined {\n const hrefState = store.getStateForHref(resolveHref(href));\n const state: ReactNavigationState | undefined = rootState;\n if (!hrefState || !state) {\n return undefined;\n }\n // Replicating the logic from `linkTo`\n const { navigationState, actionStateRoute } = findDivergentState(\n hrefState,\n state as NavigationState,\n true\n );\n\n if (!navigationState || !actionStateRoute) {\n return undefined;\n }\n\n if (navigationState.type === 'stack') {\n const stackState = navigationState as StackNavigationState;\n const payload = getPayloadFromStateRoute(actionStateRoute);\n\n const preloadedRoute = stackState.preloadedRoutes.find(\n (route) =>\n route.name === actionStateRoute.name &&\n deepEqual(\n removeInternalExpoRouterParams(route.params),\n removeInternalExpoRouterParams(payload.params)\n )\n );\n\n const activeRoute = stackState.routes[stackState.index];\n // When the active route is the same as the preloaded route,\n // then we should not navigate. It aligns with base link behavior.\n if (\n activeRoute.name === preloadedRoute?.name &&\n deepEqual(\n // using ?? {}, because from our perspective undefined === {}, as both mean no params\n removeInternalExpoRouterParams(activeRoute.params ?? {}),\n removeInternalExpoRouterParams(payload.params ?? {})\n )\n ) {\n return undefined;\n }\n\n return preloadedRoute;\n }\n\n return undefined;\n}\n\nexport function deepEqual(\n a: { [key: string]: any } | undefined,\n b: { [key: string]: any } | undefined\n): boolean {\n if (a === b) {\n return true;\n }\n if (a == null || b == null) {\n return false;\n }\n if (typeof a !== 'object' || typeof b !== 'object') {\n return false;\n }\n const keys = Object.keys(a);\n return keys.length === Object.keys(b).length && keys.every((key) => deepEqual(a[key], b[key]));\n}\n"]} \ No newline at end of file +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/link/preview/utils.ts"],"names":[],"mappings":";;AAcA,sEAgCC;AAED,oFAmDC;AAED,8BAeC;AAnHD,kEAAmF;AACnF,wDAA0F;AAC1F,6DAAwE;AASxE,kCAAsC;AAEtC,SAAgB,6BAA6B,CAC3C,IAAU,EACV,SAA+B;IAE/B,MAAM,SAAS,GAAG,oBAAK,CAAC,eAAe,CAAC,IAAA,kBAAW,EAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,MAAM,KAAK,GAAqC,SAAS,CAAC;IAC1D,IAAI,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,sCAAsC;IACtC,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAA,4BAAkB,EAAC,SAAS,EAAE,KAAwB,EAAE,IAAI,CAAC,CAAC;IAE3F,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;QAC7B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,OAAO,GAAc,EAAE,CAAC;IAC9B,gBAAgB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE;QACzC,IAAI,KAAK,CAAC,KAAK,EAAE,IAAI,KAAK,KAAK,EAAE,CAAC;YAChC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAA0C,CAAC;YAClE,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAE,CAAC,GAAG,CAAC;YACvD,oEAAoE;YACpE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBAChB,MAAM,IAAI,KAAK,CACb,gCAAgC,KAAK,CAA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KAAK,CAAE,CAAC;QACzD,4DAA4D;QAC5D,kEAAkE;QAClE,IACE,WAAW,CAAC,IAAI,KAAK,cAAc,EAAE,IAAI;YACzC,SAAS;YACP,qFAAqF;YACrF,IAAA,iDAA8B,EAAC,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC,EACxD,IAAA,iDAA8B,EAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CACrD,EACD,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,SAAS,CACvB,CAAqC,EACrC,CAAqC;IAErC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QACnD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5B,OAAO,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjG,CAAC","sourcesContent":["import type { TabPath } from './native';\nimport { store, type ReactNavigationState } from '../../global-state/router-store';\nimport { findDivergentState, getPayloadFromStateRoute } from '../../global-state/routing';\nimport { removeInternalExpoRouterParams } from '../../navigationParams';\nimport type {\n ParamListBase,\n StackNavigationState,\n NavigationRoute,\n NavigationState,\n TabNavigationState,\n} from '../../react-navigation/native';\nimport type { Href } from '../../types';\nimport { resolveHref } from '../href';\n\nexport function getTabPathFromRootStateByHref(\n href: Href,\n rootState: ReactNavigationState\n): TabPath[] {\n const hrefState = store.getStateForHref(resolveHref(href));\n const state: ReactNavigationState | undefined = rootState;\n if (!hrefState || !state) {\n return [];\n }\n // Replicating the logic from `linkTo`\n const { navigationRoutes } = findDivergentState(hrefState, state as NavigationState, true);\n\n if (!navigationRoutes.length) {\n return [];\n }\n\n const tabPath: TabPath[] = [];\n navigationRoutes.forEach((route, i, arr) => {\n if (route.state?.type === 'tab') {\n const tabState = route.state as TabNavigationState;\n const oldTabKey = tabState.routes[tabState.index]!.key;\n // The next route will be either stack inside a tab or a new tab key\n if (!arr[i + 1]) {\n throw new Error(\n `New tab route is missing for ${route.key}. This is likely an internal Expo Router bug.`\n );\n }\n const newTabKey = arr[i + 1]!.key;\n tabPath.push({ oldTabKey, newTabKey });\n }\n });\n return tabPath;\n}\n\nexport function getPreloadedRouteFromRootStateByHref(\n href: Href,\n rootState: ReactNavigationState\n): NavigationRoute | undefined {\n const hrefState = store.getStateForHref(resolveHref(href));\n const state: ReactNavigationState | undefined = rootState;\n if (!hrefState || !state) {\n return undefined;\n }\n // Replicating the logic from `linkTo`\n const { navigationState, actionStateRoute } = findDivergentState(\n hrefState,\n state as NavigationState,\n true\n );\n\n if (!navigationState || !actionStateRoute) {\n return undefined;\n }\n\n if (navigationState.type === 'stack') {\n const stackState = navigationState as StackNavigationState;\n const payload = getPayloadFromStateRoute(actionStateRoute);\n\n const preloadedRoute = stackState.preloadedRoutes.find(\n (route) =>\n route.name === actionStateRoute.name &&\n deepEqual(\n removeInternalExpoRouterParams(route.params),\n removeInternalExpoRouterParams(payload.params)\n )\n );\n\n const activeRoute = stackState.routes[stackState.index]!;\n // When the active route is the same as the preloaded route,\n // then we should not navigate. It aligns with base link behavior.\n if (\n activeRoute.name === preloadedRoute?.name &&\n deepEqual(\n // using ?? {}, because from our perspective undefined === {}, as both mean no params\n removeInternalExpoRouterParams(activeRoute.params ?? {}),\n removeInternalExpoRouterParams(payload.params ?? {})\n )\n ) {\n return undefined;\n }\n\n return preloadedRoute;\n }\n\n return undefined;\n}\n\nexport function deepEqual(\n a: { [key: string]: any } | undefined,\n b: { [key: string]: any } | undefined\n): boolean {\n if (a === b) {\n return true;\n }\n if (a == null || b == null) {\n return false;\n }\n if (typeof a !== 'object' || typeof b !== 'object') {\n return false;\n }\n const keys = Object.keys(a);\n return keys.length === Object.keys(b).length && keys.every((key) => deepEqual(a[key], b[key]));\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/modal/web/ModalStack.d.ts.map b/packages/expo-router/build/modal/web/ModalStack.d.ts.map index beede3845c34ae..de16a70791965d 100644 --- a/packages/expo-router/build/modal/web/ModalStack.d.ts.map +++ b/packages/expo-router/build/modal/web/ModalStack.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"ModalStack.d.ts","sourceRoot":"","sources":["../../../src/modal/web/ModalStack.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiC,MAAM,OAAO,CAAC;AAYtD,OAAO,KAAK,EAEV,aAAa,EAId,MAAM,+BAA+B,CAAC;AAgIvC,QAAA,MAAM,WAAW;;;;;;;;;;;CAAkD,CAAC;AACpE,QAAA,MAAM,iBAAiB;;;;;;;;0CAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"ModalStack.d.ts","sourceRoot":"","sources":["../../../src/modal/web/ModalStack.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiC,MAAM,OAAO,CAAC;AAYtD,OAAO,KAAK,EAEV,aAAa,EAId,MAAM,+BAA+B,CAAC;AAkIvC,QAAA,MAAM,WAAW;;;;;;;;;;;CAAkD,CAAC;AACpE,QAAA,MAAM,iBAAiB;;;;;;;;0CAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/expo-router/build/modal/web/ModalStack.js.map b/packages/expo-router/build/modal/web/ModalStack.js.map index f881a8e305bb64..5567e663c5f897 100644 --- a/packages/expo-router/build/modal/web/ModalStack.js.map +++ b/packages/expo-router/build/modal/web/ModalStack.js.map @@ -1 +1 @@ -{"version":3,"file":"ModalStack.js","sourceRoot":"","sources":["../../../src/modal/web/ModalStack.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,+CAAsD;AAEtD,mEAAgE;AAChE,yFAAsF;AAEtF,mCAIiB;AAEjB,uEAAoE;AAQpE,0DAOuC;AAKvC,sEAAsE;AAEtE,SAAS,mBAAmB,CAAC,EAC3B,gBAAgB,EAChB,QAAQ,EACR,aAAa,GACY;IACzB,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,QAAQ,EAAE,GAAG,IAAA,6BAAoB,EAM1F,oBAAW,EAAE;QACb,QAAQ;QACR,aAAa;QACb,gBAAgB;KACjB,CAAC,CAAC;IAEH,IAAA,iBAAS,EACP,GAAG,EAAE;IACH,+DAA+D;IAC/D,UAAU,EAAE,WAAW,EAAE,CAAC,UAAU,EAAE,CAAC,CAA6B,EAAE,EAAE;QACtE,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;QAEzC,gFAAgF;QAChF,gEAAgE;QAChE,qBAAqB,CAAC,GAAG,EAAE;YACzB,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC,IAAI,SAAS,IAAI,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;gBACxD,kEAAkE;gBAClE,gDAAgD;gBAChD,UAAU,CAAC,QAAQ,CAAC;oBAClB,GAAG,qBAAY,CAAC,QAAQ,EAAE;oBAC1B,MAAM,EAAE,KAAK,CAAC,GAAG;iBAClB,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,EACJ,CAAC,UAAU,EAAE,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B,8CAAiB","sourcesContent":["'use client';\nimport React, { useCallback, useEffect } from 'react';\n\nimport { ModalStackRouteDrawer } from './ModalStackRouteDrawer';\nimport { TransparentModalStackRouteDrawer } from './TransparentModalStackRouteDrawer';\nimport type { ModalStackNavigatorProps, ModalStackViewProps } from './types';\nimport {\n convertStackStateToNonModalState,\n findLastNonModalIndex,\n isTransparentModalPresentation,\n} from './utils';\nimport type { ExtendedStackNavigationOptions } from '../../layouts/StackClient';\nimport { withLayoutContext } from '../../layouts/withLayoutContext';\nimport type {\n EventArg,\n ParamListBase,\n StackActionHelpers,\n StackNavigationState,\n StackRouterOptions,\n} from '../../react-navigation/native';\nimport {\n createNavigatorFactory,\n StackActions,\n StackRouter,\n useNavigationBuilder,\n usePreventRemoveContext,\n useTheme,\n} from '../../react-navigation/native';\nimport type {\n NativeStackNavigationEventMap,\n NativeStackNavigationOptions,\n} from '../../react-navigation/native-stack';\nimport { NativeStackView } from '../../react-navigation/native-stack';\n\nfunction ModalStackNavigator({\n initialRouteName,\n children,\n screenOptions,\n}: ModalStackNavigatorProps) {\n const { state, navigation, descriptors, NavigationContent, describe } = useNavigationBuilder<\n StackNavigationState,\n StackRouterOptions,\n StackActionHelpers,\n NativeStackNavigationOptions,\n NativeStackNavigationEventMap\n >(StackRouter, {\n children,\n screenOptions,\n initialRouteName,\n });\n\n useEffect(\n () =>\n // @ts-expect-error: there may not be a tab navigator in parent\n navigation?.addListener?.('tabPress', (e: EventArg<'tabPress', true>) => {\n const isFocused = navigation.isFocused();\n\n // Run the operation in the next frame so we're sure all listeners have been run\n // This is necessary to know if preventDefault() has been called\n requestAnimationFrame(() => {\n if (state.index > 0 && isFocused && !e.defaultPrevented) {\n // When user taps on already focused tab and we're inside the tab,\n // reset the stack to replicate native behaviour\n navigation.dispatch({\n ...StackActions.popToTop(),\n target: state.key,\n });\n }\n });\n }),\n [navigation, state.index, state.key]\n );\n\n return (\n \n \n \n );\n}\n\nconst ModalStackView = ({ state, navigation, descriptors, describe }: ModalStackViewProps) => {\n const isWeb = process.env.EXPO_OS === 'web';\n const { colors } = useTheme();\n const { preventedRoutes } = usePreventRemoveContext();\n\n const { routes: filteredRoutes, index: nonModalIndex } = convertStackStateToNonModalState(\n state,\n descriptors,\n isWeb\n );\n\n const newStackState = {\n ...state,\n routes: filteredRoutes,\n index: nonModalIndex,\n };\n\n const dismiss = useCallback(() => {\n navigation.goBack();\n }, [navigation]);\n\n const overlayRoutes = React.useMemo(() => {\n if (!isWeb) return [];\n const idx = findLastNonModalIndex(state, descriptors);\n return state.routes.slice(idx + 1);\n }, [isWeb, state, descriptors]);\n\n return (\n
\n \n {isWeb &&\n overlayRoutes.map((route) => {\n const isTransparentModal = isTransparentModalPresentation(descriptors[route.key].options);\n\n const isRemovePrevented = preventedRoutes[route.key]?.preventRemove;\n\n const ModalComponent = isTransparentModal\n ? TransparentModalStackRouteDrawer\n : ModalStackRouteDrawer;\n\n return (\n \n );\n })}\n
\n );\n};\n\nconst createModalStack = createNavigatorFactory(ModalStackNavigator);\nconst RouterModal = withLayoutContext(createModalStack().Navigator);\nconst RouterModalScreen = RouterModal.Screen;\n\nexport { RouterModal, RouterModalScreen };\n"]} \ No newline at end of file +{"version":3,"file":"ModalStack.js","sourceRoot":"","sources":["../../../src/modal/web/ModalStack.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,+CAAsD;AAEtD,mEAAgE;AAChE,yFAAsF;AAEtF,mCAIiB;AAEjB,uEAAoE;AAQpE,0DAOuC;AAKvC,sEAAsE;AAEtE,SAAS,mBAAmB,CAAC,EAC3B,gBAAgB,EAChB,QAAQ,EACR,aAAa,GACY;IACzB,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,QAAQ,EAAE,GAAG,IAAA,6BAAoB,EAM1F,oBAAW,EAAE;QACb,QAAQ;QACR,aAAa;QACb,gBAAgB;KACjB,CAAC,CAAC;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G,EACnB,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,CAAE,CAAC,OAAyC,EAC1E,YAAY,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,CAAE,CAAC,MAAM,EAC5C,SAAS,EAAE,OAAO,EAClB,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EAClD,WAAW,EAAE,MAAM,IANd,KAAK,CAAC,GAAG,CAOd,CACH,CAAC;gBACJ,CAAC,CAAC,IACA,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,IAAA,+BAAsB,EAAC,mBAAmB,CAAC,CAAC;AACrE,MAAM,WAAW,GAAG,IAAA,qCAAiB,EAAC,gBAAgB,EAAE,CAAC,SAAS,CAAC,CAAC;AAG3D,kCAAW;AAFpB,MAAM,iBAAiB,GAAG,WAAW,CAAC,MAAM,CAAC;AAEvB,8CAAiB","sourcesContent":["'use client';\nimport React, { useCallback, useEffect } from 'react';\n\nimport { ModalStackRouteDrawer } from './ModalStackRouteDrawer';\nimport { TransparentModalStackRouteDrawer } from './TransparentModalStackRouteDrawer';\nimport type { ModalStackNavigatorProps, ModalStackViewProps } from './types';\nimport {\n convertStackStateToNonModalState,\n findLastNonModalIndex,\n isTransparentModalPresentation,\n} from './utils';\nimport type { ExtendedStackNavigationOptions } from '../../layouts/StackClient';\nimport { withLayoutContext } from '../../layouts/withLayoutContext';\nimport type {\n EventArg,\n ParamListBase,\n StackActionHelpers,\n StackNavigationState,\n StackRouterOptions,\n} from '../../react-navigation/native';\nimport {\n createNavigatorFactory,\n StackActions,\n StackRouter,\n useNavigationBuilder,\n usePreventRemoveContext,\n useTheme,\n} from '../../react-navigation/native';\nimport type {\n NativeStackNavigationEventMap,\n NativeStackNavigationOptions,\n} from '../../react-navigation/native-stack';\nimport { NativeStackView } from '../../react-navigation/native-stack';\n\nfunction ModalStackNavigator({\n initialRouteName,\n children,\n screenOptions,\n}: ModalStackNavigatorProps) {\n const { state, navigation, descriptors, NavigationContent, describe } = useNavigationBuilder<\n StackNavigationState,\n StackRouterOptions,\n StackActionHelpers,\n NativeStackNavigationOptions,\n NativeStackNavigationEventMap\n >(StackRouter, {\n children,\n screenOptions,\n initialRouteName,\n });\n\n useEffect(\n () =>\n // @ts-expect-error: there may not be a tab navigator in parent\n navigation?.addListener?.('tabPress', (e: EventArg<'tabPress', true>) => {\n const isFocused = navigation.isFocused();\n\n // Run the operation in the next frame so we're sure all listeners have been run\n // This is necessary to know if preventDefault() has been called\n requestAnimationFrame(() => {\n if (state.index > 0 && isFocused && !e.defaultPrevented) {\n // When user taps on already focused tab and we're inside the tab,\n // reset the stack to replicate native behaviour\n navigation.dispatch({\n ...StackActions.popToTop(),\n target: state.key,\n });\n }\n });\n }),\n [navigation, state.index, state.key]\n );\n\n return (\n \n \n \n );\n}\n\nconst ModalStackView = ({ state, navigation, descriptors, describe }: ModalStackViewProps) => {\n const isWeb = process.env.EXPO_OS === 'web';\n const { colors } = useTheme();\n const { preventedRoutes } = usePreventRemoveContext();\n\n const { routes: filteredRoutes, index: nonModalIndex } = convertStackStateToNonModalState(\n state,\n descriptors,\n isWeb\n );\n\n const newStackState = {\n ...state,\n routes: filteredRoutes,\n index: nonModalIndex,\n };\n\n const dismiss = useCallback(() => {\n navigation.goBack();\n }, [navigation]);\n\n const overlayRoutes = React.useMemo(() => {\n if (!isWeb) return [];\n const idx = findLastNonModalIndex(state, descriptors);\n return state.routes.slice(idx + 1);\n }, [isWeb, state, descriptors]);\n\n return (\n
\n \n {isWeb &&\n overlayRoutes.map((route) => {\n const isTransparentModal = isTransparentModalPresentation(\n descriptors[route.key]!.options\n );\n\n const isRemovePrevented = preventedRoutes[route.key]?.preventRemove;\n\n const ModalComponent = isTransparentModal\n ? TransparentModalStackRouteDrawer\n : ModalStackRouteDrawer;\n\n return (\n \n );\n })}\n
\n );\n};\n\nconst createModalStack = createNavigatorFactory(ModalStackNavigator);\nconst RouterModal = withLayoutContext(createModalStack().Navigator);\nconst RouterModalScreen = RouterModal.Screen;\n\nexport { RouterModal, RouterModalScreen };\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/modal/web/ModalStackRouteDrawer.js.map b/packages/expo-router/build/modal/web/ModalStackRouteDrawer.js.map index d5fc7fc7db9e28..e24f1e93d067b5 100644 --- a/packages/expo-router/build/modal/web/ModalStackRouteDrawer.js.map +++ b/packages/expo-router/build/modal/web/ModalStackRouteDrawer.js.map @@ -1 +1 @@ -{"version":3,"file":"ModalStackRouteDrawer.js","sourceRoot":"","sources":["../../../src/modal/web/ModalStackRouteDrawer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;AAgOJ,sDAAqB;;AA/N9B,kDAA0B;AAE1B,+BAA8B;AAE9B,gEAAwC;AAExC,mCAAuC;AAGvC,SAAS,qBAAqB,CAAC,EAC7B,QAAQ,EACR,OAAO,EACP,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,GAQZ;IACC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7C,4EAA4E;IAC5E,wEAAwE;IACxE,wEAAwE;IACxE,MAAM,SAAS,GAAG,IAAA,oBAAY,GAAE,CAAC;IACjC,MAAM,OAAO,GAAG,CAAC,SAAS,CAAC;IAE3B,6BAA6B;IAC7B,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAE5C,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,mBAAmB,GAAG,cAAc,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAE1F,IAAI,UAAU,GAAoC,mBAAmB;QACnE,CAAC,CAAE,OAA+B;QAClC,CAAC,CAAC,SAAS,CAAC;IAEd,IAAI,CAAC,OAAO,EAAE,CAAC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AE,MAAM;wBACrB,uGAAuG;wBACvG,GAAG,CAAC,OAAO,IAAI,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;qBAC1D,YACD,iCACE,SAAS,EAAE,qBAAW,CAAC,KAAK,uBACT,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,EAClD,KAAK,EAAE,cAAc,aAErB,uBAAC,aAAM,CAAC,KAAK,IAAC,KAAK,EAAC,EAAE,sBAAkB,EAAE,EAAC,SAAS,EAAE,qBAAW,CAAC,MAAM,GAAI,EAC5E,uBAAC,aAAM,CAAC,WAAW,IAAC,KAAK,EAAC,EAAE,EAAC,SAAS,EAAE,qBAAW,CAAC,MAAM,GAAI,EAE9D,gCAAK,SAAS,EAAE,qBAAW,CAAC,SAAS,YAAG,YAAY,EAAE,GAAO,IACzD,GACS,IACH,IAtCX,GAAG,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,CAuCrC,CACf,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport React from 'react';\nimport type { ColorValue } from 'react-native';\nimport { Drawer } from 'vaul';\n\nimport modalStyles from './modalStyles';\nimport type { CSSWithVars } from './types';\nimport { useIsDesktop } from './utils';\nimport type { ExtendedStackNavigationOptions } from '../../layouts/StackClient';\n\nfunction ModalStackRouteDrawer({\n routeKey,\n options,\n dismissible,\n renderScreen,\n onDismiss,\n themeColors,\n}: {\n routeKey: string;\n options: ExtendedStackNavigationOptions;\n renderScreen: () => React.ReactNode;\n onDismiss: () => void;\n themeColors: { card: ColorValue; background: ColorValue };\n dismissible?: boolean;\n}) {\n const [open, setOpen] = React.useState(true);\n // Determine sheet vs. modal with an SSR-safe hook. The first render (during\n // hydration) always assumes mobile/sheet to match the server markup; an\n // effect then updates the state after mount if the viewport is desktop.\n const isDesktop = useIsDesktop();\n const isSheet = !isDesktop;\n\n // Resolve snap points logic.\n const allowed = options.sheetAllowedDetents;\n\n const isArrayDetents = Array.isArray(allowed);\n const useCustomSnapPoints = isArrayDetents && !(allowed.length === 1 && allowed[0] === 1);\n\n let snapPoints: (number | string)[] | undefined = useCustomSnapPoints\n ? (allowed as (number | string)[])\n : undefined;\n\n if (!isSheet) {\n snapPoints = [1];\n }\n\n const [snap, setSnap] = React.useState(\n useCustomSnapPoints && isArrayDetents ? allowed[0] : 1\n );\n\n // Update the snap value when custom snap points change.\n React.useEffect(() => {\n if (isSheet) {\n const next = useCustomSnapPoints && isArrayDetents ? allowed[0] : 1;\n setSnap(next);\n } else {\n // Desktop modal always fixed snap at 1\n setSnap(1);\n }\n }, [isSheet, useCustomSnapPoints, isArrayDetents, allowed]);\n\n // Map react-native-screens ios sheet undimmed logic to Vaul's fadeFromIndex\n const fadeFromIndex = isSheet\n ? options.sheetLargestUndimmedDetentIndex === 'last'\n ? (snapPoints?.length ?? 0)\n : typeof options.sheetLargestUndimmedDetentIndex === 'number'\n ? options.sheetLargestUndimmedDetentIndex + 1\n : 0\n : 0;\n\n // --- Styling -----------------------------------------------------------\n\n // Using CSS variables so defaults live in CSS and can be overridden via props.\n const modalStyleVars: CSSWithVars = {\n backgroundColor: themeColors.background as string,\n };\n\n if (!isSheet) {\n if (options.webModalStyle?.width) {\n modalStyleVars['--expo-router-modal-width'] =\n typeof options.webModalStyle.width === 'number'\n ? `${options.webModalStyle.width}px`\n : options.webModalStyle.width;\n\n modalStyleVars['--expo-router-modal-max-width'] =\n typeof options.webModalStyle.width === 'number'\n ? `${options.webModalStyle.width}px`\n : options.webModalStyle.width;\n\n // Also set explicit width so browsers that ignore CSS vars in `width` prop still work.\n modalStyleVars.width =\n typeof options.webModalStyle.width === 'number'\n ? `${options.webModalStyle.width}px`\n : options.webModalStyle.width;\n }\n\n // Min width override\n if (options.webModalStyle?.minWidth) {\n const mw =\n typeof options.webModalStyle.minWidth === 'number'\n ? `${options.webModalStyle.minWidth}px`\n : options.webModalStyle.minWidth;\n modalStyleVars['--expo-router-modal-min-width'] = mw;\n modalStyleVars.minWidth = mw;\n }\n\n if (options.webModalStyle?.height) {\n const h =\n typeof options.webModalStyle.height === 'number'\n ? `${options.webModalStyle.height}px`\n : options.webModalStyle.height;\n modalStyleVars['--expo-router-modal-height'] = h;\n modalStyleVars.maxHeight = h;\n modalStyleVars.height = h;\n modalStyleVars.minHeight = h;\n }\n\n // Separate min-height override (takes precedence over modalHeight)\n if (options.webModalStyle?.minHeight) {\n const mh =\n typeof options.webModalStyle.minHeight === 'number'\n ? `${options.webModalStyle.minHeight}px`\n : options.webModalStyle.minHeight;\n modalStyleVars['--expo-router-modal-min-height'] = mh;\n modalStyleVars.minHeight = mh;\n }\n }\n\n const fitToContents = options.sheetAllowedDetents === 'fitToContents';\n\n if (fitToContents) {\n modalStyleVars.height = 'auto';\n modalStyleVars.minHeight = 'auto';\n\n // TODO:(@Hirbod) Clarify if we should limit maxHeight to sheets only\n // Allow sheet to grow with content but never exceed viewport height\n // dvh is important, otherwise it will scale over the visible viewport height\n modalStyleVars.maxHeight = '100dvh';\n }\n\n // Apply corner radius (default 24px for iOS 26)\n const radiusValue = options.sheetCornerRadius ?? 24;\n const radiusCss = typeof radiusValue === 'number' ? `${radiusValue}px` : radiusValue;\n\n if (options.webModalStyle?.border) {\n modalStyleVars['--expo-router-modal-border'] = options.webModalStyle.border;\n }\n\n if (options.webModalStyle?.shadow) {\n modalStyleVars['--expo-router-modal-shadow'] = options.webModalStyle.shadow;\n }\n\n if (isSheet) {\n // Only top corners for mobile sheet\n modalStyleVars.borderTopLeftRadius = radiusCss;\n modalStyleVars.borderTopRightRadius = radiusCss;\n\n // Always set CSS var to ensure consistency with default iOS 26 radius\n modalStyleVars['--expo-router-modal-border-radius'] = radiusCss;\n } else {\n // All corners for desktop modal - always set CSS var for iOS 26 default\n modalStyleVars['--expo-router-modal-border-radius'] = radiusCss;\n }\n // --- End Styling -----------------------------------------------------------\n\n const handleOpenChange = (open: boolean) => {\n if (!open) onDismiss();\n };\n\n // Props that only make sense for sheets\n const sheetProps = isSheet\n ? {\n snapPoints: snapPoints as (number | string)[],\n activeSnapPoint: snap,\n setActiveSnapPoint: setSnap,\n fadeFromIndex,\n }\n : {};\n\n return (\n \n \n \n \n \n {/* TODO:(@Hirbod) Figure out how to add title and description to the modal for screen readers in a meaningful way */}\n \n \n {/* Render the screen content */}\n
{renderScreen()}
\n \n \n
\n \n );\n}\n\nexport { ModalStackRouteDrawer };\n"]} \ No newline at end of file +{"version":3,"file":"ModalStackRouteDrawer.js","sourceRoot":"","sources":["../../../src/modal/web/ModalStackRouteDrawer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;AAgOJ,sDAAqB;;AA/N9B,kDAA0B;AAE1B,+BAA8B;AAE9B,gEAAwC;AAExC,mCAAuC;AAGvC,SAAS,qBAAqB,CAAC,EAC7B,QAAQ,EACR,OAAO,EACP,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,GAQZ;IACC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7C,4EAA4E;IAC5E,wEAAwE;IACxE,wEAAwE;IACxE,MAAM,SAAS,GAAG,IAAA,oBAAY,GAAE,CAAC;IACjC,MAAM,OAAO,GAAG,CAAC,SAAS,CAAC;IAE3B,6BAA6B;IAC7B,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAE5C,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,mBAAmB,GAAG,cAAc,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAE1F,IAAI,UAAU,GAAoC,mBAAmB;QACnE,CAAC,CAAE,OAA+B;QAClC,CAAC,CAAC,SAAS,CAAC;IAEd,IAAI,CAAC,OAAO,E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,aAAa,EAAE,MAAM;wBACrB,uGAAuG;wBACvG,GAAG,CAAC,OAAO,IAAI,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;qBAC1D,YACD,iCACE,SAAS,EAAE,qBAAW,CAAC,KAAK,uBACT,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,EAClD,KAAK,EAAE,cAAc,aAErB,uBAAC,aAAM,CAAC,KAAK,IAAC,KAAK,EAAC,EAAE,sBAAkB,EAAE,EAAC,SAAS,EAAE,qBAAW,CAAC,MAAM,GAAI,EAC5E,uBAAC,aAAM,CAAC,WAAW,IAAC,KAAK,EAAC,EAAE,EAAC,SAAS,EAAE,qBAAW,CAAC,MAAM,GAAI,EAE9D,gCAAK,SAAS,EAAE,qBAAW,CAAC,SAAS,YAAG,YAAY,EAAE,GAAO,IACzD,GACS,IACH,IAtCX,GAAG,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,CAuCrC,CACf,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport React from 'react';\nimport type { ColorValue } from 'react-native';\nimport { Drawer } from 'vaul';\n\nimport modalStyles from './modalStyles';\nimport type { CSSWithVars } from './types';\nimport { useIsDesktop } from './utils';\nimport type { ExtendedStackNavigationOptions } from '../../layouts/StackClient';\n\nfunction ModalStackRouteDrawer({\n routeKey,\n options,\n dismissible,\n renderScreen,\n onDismiss,\n themeColors,\n}: {\n routeKey: string;\n options: ExtendedStackNavigationOptions;\n renderScreen: () => React.ReactNode;\n onDismiss: () => void;\n themeColors: { card: ColorValue; background: ColorValue };\n dismissible?: boolean;\n}) {\n const [open, setOpen] = React.useState(true);\n // Determine sheet vs. modal with an SSR-safe hook. The first render (during\n // hydration) always assumes mobile/sheet to match the server markup; an\n // effect then updates the state after mount if the viewport is desktop.\n const isDesktop = useIsDesktop();\n const isSheet = !isDesktop;\n\n // Resolve snap points logic.\n const allowed = options.sheetAllowedDetents;\n\n const isArrayDetents = Array.isArray(allowed);\n const useCustomSnapPoints = isArrayDetents && !(allowed.length === 1 && allowed[0] === 1);\n\n let snapPoints: (number | string)[] | undefined = useCustomSnapPoints\n ? (allowed as (number | string)[])\n : undefined;\n\n if (!isSheet) {\n snapPoints = [1];\n }\n\n const [snap, setSnap] = React.useState(\n useCustomSnapPoints && isArrayDetents ? allowed[0]! : 1\n );\n\n // Update the snap value when custom snap points change.\n React.useEffect(() => {\n if (isSheet) {\n const next = useCustomSnapPoints && isArrayDetents ? allowed[0]! : 1;\n setSnap(next);\n } else {\n // Desktop modal always fixed snap at 1\n setSnap(1);\n }\n }, [isSheet, useCustomSnapPoints, isArrayDetents, allowed]);\n\n // Map react-native-screens ios sheet undimmed logic to Vaul's fadeFromIndex\n const fadeFromIndex = isSheet\n ? options.sheetLargestUndimmedDetentIndex === 'last'\n ? (snapPoints?.length ?? 0)\n : typeof options.sheetLargestUndimmedDetentIndex === 'number'\n ? options.sheetLargestUndimmedDetentIndex + 1\n : 0\n : 0;\n\n // --- Styling -----------------------------------------------------------\n\n // Using CSS variables so defaults live in CSS and can be overridden via props.\n const modalStyleVars: CSSWithVars = {\n backgroundColor: themeColors.background as string,\n };\n\n if (!isSheet) {\n if (options.webModalStyle?.width) {\n modalStyleVars['--expo-router-modal-width'] =\n typeof options.webModalStyle.width === 'number'\n ? `${options.webModalStyle.width}px`\n : options.webModalStyle.width;\n\n modalStyleVars['--expo-router-modal-max-width'] =\n typeof options.webModalStyle.width === 'number'\n ? `${options.webModalStyle.width}px`\n : options.webModalStyle.width;\n\n // Also set explicit width so browsers that ignore CSS vars in `width` prop still work.\n modalStyleVars.width =\n typeof options.webModalStyle.width === 'number'\n ? `${options.webModalStyle.width}px`\n : options.webModalStyle.width;\n }\n\n // Min width override\n if (options.webModalStyle?.minWidth) {\n const mw =\n typeof options.webModalStyle.minWidth === 'number'\n ? `${options.webModalStyle.minWidth}px`\n : options.webModalStyle.minWidth;\n modalStyleVars['--expo-router-modal-min-width'] = mw;\n modalStyleVars.minWidth = mw;\n }\n\n if (options.webModalStyle?.height) {\n const h =\n typeof options.webModalStyle.height === 'number'\n ? `${options.webModalStyle.height}px`\n : options.webModalStyle.height;\n modalStyleVars['--expo-router-modal-height'] = h;\n modalStyleVars.maxHeight = h;\n modalStyleVars.height = h;\n modalStyleVars.minHeight = h;\n }\n\n // Separate min-height override (takes precedence over modalHeight)\n if (options.webModalStyle?.minHeight) {\n const mh =\n typeof options.webModalStyle.minHeight === 'number'\n ? `${options.webModalStyle.minHeight}px`\n : options.webModalStyle.minHeight;\n modalStyleVars['--expo-router-modal-min-height'] = mh;\n modalStyleVars.minHeight = mh;\n }\n }\n\n const fitToContents = options.sheetAllowedDetents === 'fitToContents';\n\n if (fitToContents) {\n modalStyleVars.height = 'auto';\n modalStyleVars.minHeight = 'auto';\n\n // TODO:(@Hirbod) Clarify if we should limit maxHeight to sheets only\n // Allow sheet to grow with content but never exceed viewport height\n // dvh is important, otherwise it will scale over the visible viewport height\n modalStyleVars.maxHeight = '100dvh';\n }\n\n // Apply corner radius (default 24px for iOS 26)\n const radiusValue = options.sheetCornerRadius ?? 24;\n const radiusCss = typeof radiusValue === 'number' ? `${radiusValue}px` : radiusValue;\n\n if (options.webModalStyle?.border) {\n modalStyleVars['--expo-router-modal-border'] = options.webModalStyle.border;\n }\n\n if (options.webModalStyle?.shadow) {\n modalStyleVars['--expo-router-modal-shadow'] = options.webModalStyle.shadow;\n }\n\n if (isSheet) {\n // Only top corners for mobile sheet\n modalStyleVars.borderTopLeftRadius = radiusCss;\n modalStyleVars.borderTopRightRadius = radiusCss;\n\n // Always set CSS var to ensure consistency with default iOS 26 radius\n modalStyleVars['--expo-router-modal-border-radius'] = radiusCss;\n } else {\n // All corners for desktop modal - always set CSS var for iOS 26 default\n modalStyleVars['--expo-router-modal-border-radius'] = radiusCss;\n }\n // --- End Styling -----------------------------------------------------------\n\n const handleOpenChange = (open: boolean) => {\n if (!open) onDismiss();\n };\n\n // Props that only make sense for sheets\n const sheetProps = isSheet\n ? {\n snapPoints: snapPoints as (number | string)[],\n activeSnapPoint: snap,\n setActiveSnapPoint: setSnap,\n fadeFromIndex,\n }\n : {};\n\n return (\n \n \n \n \n \n {/* TODO:(@Hirbod) Figure out how to add title and description to the modal for screen readers in a meaningful way */}\n \n \n {/* Render the screen content */}\n
{renderScreen()}
\n \n \n
\n \n );\n}\n\nexport { ModalStackRouteDrawer };\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/modal/web/utils.js.map b/packages/expo-router/build/modal/web/utils.js.map index e77669d97af6d1..391452bba4e49a 100644 --- a/packages/expo-router/build/modal/web/utils.js.map +++ b/packages/expo-router/build/modal/web/utils.js.map @@ -1 +1 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/modal/web/utils.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;AAqBb,wEAGC;AASD,oCAoBC;AAoBD,4EAsBC;AAWD,sDAWC;AApHD,kDAA0B;AAI1B,qEAAoE;AAQpE;;;;;;;GAOG;AACH,SAAgB,8BAA8B,CAAC,OAAoC;IACjF,MAAM,YAAY,GAAG,OAAO,EAAE,YAAY,CAAC;IAC3C,OAAO,YAAY,KAAK,kBAAkB,IAAI,YAAY,KAAK,2BAA2B,CAAC;AAC7F,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,YAAY,CAAC,aAAqB,GAAG;IACnD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,CAAC;IAE5C,qEAAqE;IACrE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAU,KAAK,CAAC,CAAC;IAEjE,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,KAAK,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO;QAEpD,MAAM,GAAG,GAAG,MAAM,CAAC,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,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC3B,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CACnC,KAA0C,EAC1C,WAAwE;IAExE,wEAAwE;IACxE,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAClD,IAAI,CAAC,IAAA,uCAAmB,EAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;YACnE,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC","sourcesContent":["'use client';\nimport React from 'react';\n\nimport type { ExtendedStackNavigationOptions } from '../../layouts/StackClient';\nimport type { ParamListBase, StackNavigationState } from '../../react-navigation/native';\nimport { isModalPresentation } from '../../utils/stackPresentation';\n\n/**\n * A minimal subset of `ExtendedStackNavigationOptions` needed for the helper\n * @internal\n */\nexport type PresentationOptions = Partial>;\n\n/**\n * Helper to determine if a given screen should be treated as a transparent modal-type presentation\n *\n * @param options - The navigation options.\n * @returns Whether the screen should be treated as a transparent modal-type presentation.\n *\n * @internal\n */\nexport function isTransparentModalPresentation(options?: PresentationOptions | null) {\n const presentation = options?.presentation;\n return presentation === 'transparentModal' || presentation === 'containedTransparentModal';\n}\n\n/**\n * SSR-safe viewport detection: initial render always returns `false` so that\n * server and client markup match. The actual media query evaluation happens\n * after mount.\n *\n * @internal\n */\nexport function useIsDesktop(breakpoint: number = 768) {\n const isWeb = process.env.EXPO_OS === 'web';\n\n // Ensure server-side and initial client render agree (mobile first).\n const [isDesktop, setIsDesktop] = React.useState(false);\n\n React.useEffect(() => {\n if (!isWeb || typeof window === 'undefined') return;\n\n const mql = window.matchMedia(`(min-width: ${breakpoint}px)`);\n const listener = (e: MediaQueryListEvent) => setIsDesktop(e.matches);\n\n // Update immediately after mount\n setIsDesktop(mql.matches);\n\n mql.addEventListener('change', listener);\n return () => mql.removeEventListener('change', listener);\n }, [breakpoint, isWeb]);\n\n return isDesktop;\n}\n\n/**\n * Returns a copy of the given Stack navigation state with any modal-type routes removed\n * (only when running on the web) and a recalculated `index` that still points at the\n * currently active non-modal route. If the active route *is* a modal that gets\n * filtered out, we fall back to the last remaining route – this matches the logic\n * used inside `ModalStackView` so that the underlying `NativeStackView` never tries\n * to render a modal screen that is simultaneously being shown in the overlay.\n *\n * This helper is exported primarily for unit-testing; it should be considered\n * internal to `ModalStack.web` and not a public API.\n *\n * @param state - The navigation state.\n * @param descriptors - The navigation descriptors.\n * @param isWeb - Whether the current platform is web.\n * @returns The navigation state with any modal-type routes removed.\n *\n * @internal\n */\nexport function convertStackStateToNonModalState(\n state: StackNavigationState,\n descriptors: Record,\n isWeb: boolean\n) {\n if (!isWeb) {\n return { routes: state.routes, index: state.index };\n }\n\n // Remove every modal-type route from the stack on web.\n const routes = state.routes.filter((route) => {\n return !isModalPresentation(descriptors[route.key].options);\n });\n\n // Recalculate the active index so it still points at the same non-modal route, or –\n // if that route was filtered out – at the last remaining route.\n let index = routes.findIndex((r) => r.key === state.routes[state.index]?.key);\n if (index < 0) {\n index = routes.length > 0 ? routes.length - 1 : 0;\n }\n\n return { routes, index };\n}\n\n/**\n * Returns the index of the last route in the stack that is *not* a modal.\n *\n * @param state - The navigation state.\n * @param descriptors - The navigation descriptors.\n * @returns The index of the last non-modal route.\n *\n * @internal\n */\nexport function findLastNonModalIndex(\n state: StackNavigationState,\n descriptors: Record\n) {\n // Iterate backwards through the stack to find the last non-modal route.\n for (let i = state.routes.length - 1; i >= 0; i--) {\n if (!isModalPresentation(descriptors[state.routes[i].key].options)) {\n return i;\n }\n }\n return -1;\n}\n"]} \ No newline at end of file +{"version":3,"file":"utils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H,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC","sourcesContent":["'use client';\nimport React from 'react';\n\nimport type { ExtendedStackNavigationOptions } from '../../layouts/StackClient';\nimport type { ParamListBase, StackNavigationState } from '../../react-navigation/native';\nimport { isModalPresentation } from '../../utils/stackPresentation';\n\n/**\n * A minimal subset of `ExtendedStackNavigationOptions` needed for the helper\n * @internal\n */\nexport type PresentationOptions = Partial>;\n\n/**\n * Helper to determine if a given screen should be treated as a transparent modal-type presentation\n *\n * @param options - The navigation options.\n * @returns Whether the screen should be treated as a transparent modal-type presentation.\n *\n * @internal\n */\nexport function isTransparentModalPresentation(options?: PresentationOptions | null) {\n const presentation = options?.presentation;\n return presentation === 'transparentModal' || presentation === 'containedTransparentModal';\n}\n\n/**\n * SSR-safe viewport detection: initial render always returns `false` so that\n * server and client markup match. The actual media query evaluation happens\n * after mount.\n *\n * @internal\n */\nexport function useIsDesktop(breakpoint: number = 768) {\n const isWeb = process.env.EXPO_OS === 'web';\n\n // Ensure server-side and initial client render agree (mobile first).\n const [isDesktop, setIsDesktop] = React.useState(false);\n\n React.useEffect(() => {\n if (!isWeb || typeof window === 'undefined') return;\n\n const mql = window.matchMedia(`(min-width: ${breakpoint}px)`);\n const listener = (e: MediaQueryListEvent) => setIsDesktop(e.matches);\n\n // Update immediately after mount\n setIsDesktop(mql.matches);\n\n mql.addEventListener('change', listener);\n return () => mql.removeEventListener('change', listener);\n }, [breakpoint, isWeb]);\n\n return isDesktop;\n}\n\n/**\n * Returns a copy of the given Stack navigation state with any modal-type routes removed\n * (only when running on the web) and a recalculated `index` that still points at the\n * currently active non-modal route. If the active route *is* a modal that gets\n * filtered out, we fall back to the last remaining route – this matches the logic\n * used inside `ModalStackView` so that the underlying `NativeStackView` never tries\n * to render a modal screen that is simultaneously being shown in the overlay.\n *\n * This helper is exported primarily for unit-testing; it should be considered\n * internal to `ModalStack.web` and not a public API.\n *\n * @param state - The navigation state.\n * @param descriptors - The navigation descriptors.\n * @param isWeb - Whether the current platform is web.\n * @returns The navigation state with any modal-type routes removed.\n *\n * @internal\n */\nexport function convertStackStateToNonModalState(\n state: StackNavigationState,\n descriptors: Record,\n isWeb: boolean\n) {\n if (!isWeb) {\n return { routes: state.routes, index: state.index };\n }\n\n // Remove every modal-type route from the stack on web.\n const routes = state.routes.filter((route) => {\n return !isModalPresentation(descriptors[route.key]!.options);\n });\n\n // Recalculate the active index so it still points at the same non-modal route, or –\n // if that route was filtered out – at the last remaining route.\n let index = routes.findIndex((r) => r.key === state.routes[state.index]?.key);\n if (index < 0) {\n index = routes.length > 0 ? routes.length - 1 : 0;\n }\n\n return { routes, index };\n}\n\n/**\n * Returns the index of the last route in the stack that is *not* a modal.\n *\n * @param state - The navigation state.\n * @param descriptors - The navigation descriptors.\n * @returns The index of the last non-modal route.\n *\n * @internal\n */\nexport function findLastNonModalIndex(\n state: StackNavigationState,\n descriptors: Record\n) {\n // Iterate backwards through the stack to find the last non-modal route.\n for (let i = state.routes.length - 1; i >= 0; i--) {\n if (!isModalPresentation(descriptors[state.routes[i]!.key]!.options)) {\n return i;\n }\n }\n return -1;\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/native-tabs/NativeBottomTabsNavigator.d.ts.map b/packages/expo-router/build/native-tabs/NativeBottomTabsNavigator.d.ts.map index 54dcc759d48495..f897e8cf5c656f 100644 --- a/packages/expo-router/build/native-tabs/NativeBottomTabsNavigator.d.ts.map +++ b/packages/expo-router/build/native-tabs/NativeBottomTabsNavigator.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"NativeBottomTabsNavigator.d.ts","sourceRoot":"","sources":["../../src/native-tabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAKzD,OAAO,KAAK,EACV,uBAAuB,EAGvB,eAAe,EAEhB,MAAM,SAAS,CAAC;AAcjB,eAAO,MAAM,iBAAiB,wBAAsC,CAAC;AAErE,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAkC,EAClC,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,GAAG,IAAI,EACR,EAAE,uBAAuB,2CAmHzB;AAWD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,eAAe,2CAiBhE"} \ No newline at end of file +{"version":3,"file":"NativeBottomTabsNavigator.d.ts","sourceRoot":"","sources":["../../src/native-tabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAKzD,OAAO,KAAK,EACV,uBAAuB,EAGvB,eAAe,EAEhB,MAAM,SAAS,CAAC;AAcjB,eAAO,MAAM,iBAAiB,wBAAsC,CAAC;AAErE,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAkC,EAClC,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,GAAG,IAAI,EACR,EAAE,uBAAuB,2CAkHzB;AAWD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,eAAe,2CAiBhE"} \ No newline at end of file diff --git a/packages/expo-router/build/native-tabs/NativeBottomTabsNavigator.js b/packages/expo-router/build/native-tabs/NativeBottomTabsNavigator.js index 7f527ab11c56ac..34dcd71e9d101d 100644 --- a/packages/expo-router/build/native-tabs/NativeBottomTabsNavigator.js +++ b/packages/expo-router/build/native-tabs/NativeBottomTabsNavigator.js @@ -103,8 +103,7 @@ function NativeTabsNavigator({ children, backBehavior = defaultBackBehavior, lab } const focusedIndex = visibleFocusedTabIndex >= 0 ? visibleFocusedTabIndex : 0; const onTabChange = (0, react_2.useCallback)((tabKey) => { - const descriptor = descriptors[tabKey]; - const route = descriptor.route; + const { route } = descriptors[tabKey]; navigation.emit({ type: 'tabPress', target: tabKey, diff --git a/packages/expo-router/build/native-tabs/NativeBottomTabsNavigator.js.map b/packages/expo-router/build/native-tabs/NativeBottomTabsNavigator.js.map index 220a4fd3692d5d..c06c88269be43c 100644 --- a/packages/expo-router/build/native-tabs/NativeBottomTabsNavigator.js.map +++ b/packages/expo-router/build/native-tabs/NativeBottomTabsNavigator.js.map @@ -1 +1 @@ -{"version":3,"file":"NativeBottomTabsNavigator.js","sourceRoot":"","sources":["../../src/native-tabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6Bb,kDAgIC;AAWD,gEAiBC;;;AAvLD,+CAAyD;AAEzD,qEAAkE;AAClE,yDAAsD;AACtD,qDAAkD;AAQlD,mCAAsF;AACtF,oEAAiE;AACjE,6CAAmD;AAMnD,uDAA0F;AAC1F,gDAAkF;AAElF,oFAAoF;AACpF,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAC9B,QAAA,iBAAiB,GAAG,eAAK,CAAC,aAAa,CAAU,KAAK,CAAC,CAAC;AAErE,SAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,GAAG,mBAAmB,EAClC,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,GAAG,IAAI,EACiB;IACxB,IAAI,IAAA,WAAG,EAAC,yBAAiB,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CACb,mGAAmG,CACpG,CAAC;IACJ,CAAC;IAED,MAAM,mBAAmB,GAAG,IAAA,qCAA6B,EAAC,UAAU,CAAC,CAAC;IACtE,MAAM,kBAAkB,GAAG,IAAA,oCAA4B,EAAC,SAAS,CAAC,CAAC;IAEnE,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,QAAQ;QACrD,CAAC,CAAC;YACE,GAAG,mBAAmB,CAAC,QAAQ;YAC/B,KAAK,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAAK,IAAI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AAE,KAAK,CAAC,IAAI;aACjB;SACF,CAAC,CAAC;IACL,CAAC,EACD,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,CACrC,CAAC;IAEF,OAAO,CACL,uBAAC,iBAAiB,cAChB,uBAAC,yBAAiB,IAAC,KAAK,kBACtB,2BAAC,+BAAc,OACT,IAAI,EACR,GAAG,EAAE,eAAe,EACpB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,WAAW,EACjB,WAAW,EAAE,WAAW,GACxB,GACgB,GACF,CACrB,CAAC;AACJ,CAAC;AAED,MAAM,wBAAwB,GAAG,IAAA,+BAAsB,EAAC,mBAAmB,CAAC,CAAC;AAE7E,MAAM,8BAA8B,GAAG,IAAA,qCAAiB,EAKtD,wBAAwB,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAEzD,SAAgB,0BAA0B,CAAC,KAAsB;IAC/D,MAAM,eAAe,GAAG,IAAA,eAAO,EAC7B,GAAG,EAAE,CAAC,IAAA,+BAAoB,EAAC,KAAK,CAAC,QAAQ,EAAE,mCAAgB,CAAC,EAC5D,CAAC,KAAK,CAAC,QAAQ,CAAC,CACjB,CAAC;IACF,MAAM,kBAAkB,GAAG,IAAA,eAAO,EAChC,GAAG,EAAE,CAAC,IAAA,kCAAuB,EAAC,KAAK,CAAC,QAAQ,EAAE,mCAAgB,CAAC,EAC/D,CAAC,KAAK,CAAC,QAAQ,CAAC,CACjB,CAAC;IAEF,OAAO,CACL,uBAAC,8BAA8B,OACzB,KAAK,EACT,QAAQ,EAAE,eAAe,EACzB,kBAAkB,EAAE,kBAAkB,GACtC,CACH,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport React, { use, useCallback, useMemo } from 'react';\n\nimport { NativeBottomTabsRouter } from './NativeBottomTabsRouter';\nimport { NativeTabTrigger } from './NativeTabTrigger';\nimport { NativeTabsView } from './NativeTabsView';\nimport type {\n InternalNativeTabsProps,\n NativeTabNavigationEventMap,\n NativeTabOptions,\n NativeTabsProps,\n NativeTabsViewTabItem,\n} from './types';\nimport { convertIconColorPropToObject, convertLabelStylePropToObject } from './utils';\nimport { withLayoutContext } from '../layouts/withLayoutContext';\nimport { getPathFromState } from '../link/linking';\nimport type {\n ParamListBase,\n TabNavigationState,\n TabRouterOptions,\n} from '../react-navigation/native';\nimport { createNavigatorFactory, useNavigationBuilder } from '../react-navigation/native';\nimport { getAllChildrenNotOfType, getAllChildrenOfType } from '../utils/children';\n\n// In Jetpack Compose, the default back behavior is to go back to the initial route.\nconst defaultBackBehavior = 'initialRoute';\nexport const NativeTabsContext = React.createContext(false);\n\nexport function NativeTabsNavigator({\n children,\n backBehavior = defaultBackBehavior,\n labelStyle,\n iconColor,\n blurEffect,\n backgroundColor,\n badgeBackgroundColor,\n indicatorColor,\n badgeTextColor,\n shadowColor,\n screenListeners,\n ...rest\n}: InternalNativeTabsProps) {\n if (use(NativeTabsContext)) {\n throw new Error(\n 'Nesting Native Tabs inside each other is not supported natively. Use JS tabs for nesting instead.'\n );\n }\n\n const processedLabelStyle = convertLabelStylePropToObject(labelStyle);\n const processedIconColor = convertIconColorPropToObject(iconColor);\n\n const selectedLabelStyle = processedLabelStyle.selected\n ? {\n ...processedLabelStyle.selected,\n color: processedLabelStyle.selected.color ?? rest.tintColor,\n }\n : rest.tintColor\n ? { color: rest.tintColor }\n : undefined;\n\n const { state, descriptors, navigation, NavigationContent } = useNavigationBuilder<\n TabNavigationState,\n TabRouterOptions,\n Record void>,\n NativeTabOptions,\n NativeTabNavigationEventMap\n >(NativeBottomTabsRouter, {\n children,\n backBehavior,\n screenListeners,\n screenOptions: {\n disableTransparentOnScrollEdge: rest.disableTransparentOnScrollEdge,\n labelStyle: processedLabelStyle.default,\n selectedLabelStyle,\n iconColor: processedIconColor.default,\n selectedIconColor: processedIconColor.selected ?? rest.tintColor,\n blurEffect,\n backgroundColor,\n badgeBackgroundColor,\n indicatorColor,\n badgeTextColor,\n shadowColor,\n },\n });\n\n const { routes } = state;\n\n const visibleTabs = useMemo(\n () =>\n routes\n // The always sets `hidden` to defined boolean value.\n // If it is not defined, then it was not specified, and we should hide the tab.\n .filter((route) => descriptors[route.key].options?.hidden !== true)\n .map(\n (route): NativeTabsViewTabItem => ({\n options: descriptors[route.key].options,\n routeKey: route.key,\n name: route.name,\n contentRenderer: () => descriptors[route.key].render(),\n })\n ),\n [routes, descriptors]\n );\n const visibleFocusedTabIndex = useMemo(\n () => visibleTabs.findIndex((tab) => tab.routeKey === routes[state.index].key),\n [visibleTabs, routes, state.index]\n );\n const visibleTabsKeys = useMemo(\n () => visibleTabs.map((tab) => tab.routeKey).join(';'),\n [visibleTabs]\n );\n\n if (visibleFocusedTabIndex < 0) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The focused tab in NativeTabsView cannot be displayed. Make sure path is correct and the route is not hidden. Path: \"${getPathFromState(state)}\"`\n );\n }\n }\n const focusedIndex = visibleFocusedTabIndex >= 0 ? visibleFocusedTabIndex : 0;\n\n const onTabChange = useCallback(\n (tabKey: string) => {\n const descriptor = descriptors[tabKey];\n const route = descriptor.route;\n navigation.emit({\n type: 'tabPress',\n target: tabKey,\n data: {\n __internalTabsType: 'native',\n },\n });\n navigation.dispatch({\n type: 'JUMP_TO',\n target: state.key,\n payload: {\n name: route.name,\n },\n });\n },\n [descriptors, navigation, state.key]\n );\n\n return (\n \n \n \n \n \n );\n}\n\nconst createNativeTabNavigator = createNavigatorFactory(NativeTabsNavigator);\n\nconst NativeTabsNavigatorWithContext = withLayoutContext<\n NativeTabOptions,\n typeof NativeTabsNavigator,\n TabNavigationState,\n NativeTabNavigationEventMap\n>(createNativeTabNavigator().Navigator, undefined, true);\n\nexport function NativeTabsNavigatorWrapper(props: NativeTabsProps) {\n const triggerChildren = useMemo(\n () => getAllChildrenOfType(props.children, NativeTabTrigger),\n [props.children]\n );\n const nonTriggerChildren = useMemo(\n () => getAllChildrenNotOfType(props.children, NativeTabTrigger),\n [props.children]\n );\n\n return (\n \n );\n}\n"]} \ No newline at end of file +{"version":3,"file":"NativeBottomTabsNavigator.js","sourceRoot":"","sources":["../../src/native-tabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6Bb,kDA+HC;AAWD,gEAiBC;;;AAtLD,+CAAyD;AAEzD,qEAAkE;AAClE,yDAAsD;AACtD,qDAAkD;AAQlD,mCAAsF;AACtF,oEAAiE;AACjE,6CAAmD;AAMnD,uDAA0F;AAC1F,gDAAkF;AAElF,oFAAoF;AACpF,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAC9B,QAAA,iBAAiB,GAAG,eAAK,CAAC,aAAa,CAAU,KAAK,CAAC,CAAC;AAErE,SAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,GAAG,mBAAmB,EAClC,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,GAAG,IAAI,EACiB;IACxB,IAAI,IAAA,WAAG,EAAC,yBAAiB,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CACb,mGAAmG,CACpG,CAAC;IACJ,CAAC;IAED,MAAM,mBAAmB,GAAG,IAAA,qCAA6B,EAAC,UAAU,CAAC,CAAC;IACtE,MAAM,kBAAkB,GAAG,IAAA,oCAA4B,EAAC,SAAS,CAAC,CAAC;IAEnE,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,QAAQ;QACrD,CAAC,CAAC;YACE,GAAG,mBAAmB,CAAC,QAAQ;YAC/B,KAAK,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS;SAC5D;QACH,CAAC,CAAC,IAAI,CAAC,SAAS;YACd,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE;YAC3B,CAAC,CAAC,SAAS,CAA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,KAAK,kBACtB,2BAAC,+BAAc,OACT,IAAI,EACR,GAAG,EAAE,eAAe,EACpB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,WAAW,EACjB,WAAW,EAAE,WAAW,GACxB,GACgB,GACF,CACrB,CAAC;AACJ,CAAC;AAED,MAAM,wBAAwB,GAAG,IAAA,+BAAsB,EAAC,mBAAmB,CAAC,CAAC;AAE7E,MAAM,8BAA8B,GAAG,IAAA,qCAAiB,EAKtD,wBAAwB,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAEzD,SAAgB,0BAA0B,CAAC,KAAsB;IAC/D,MAAM,eAAe,GAAG,IAAA,eAAO,EAC7B,GAAG,EAAE,CAAC,IAAA,+BAAoB,EAAC,KAAK,CAAC,QAAQ,EAAE,mCAAgB,CAAC,EAC5D,CAAC,KAAK,CAAC,QAAQ,CAAC,CACjB,CAAC;IACF,MAAM,kBAAkB,GAAG,IAAA,eAAO,EAChC,GAAG,EAAE,CAAC,IAAA,kCAAuB,EAAC,KAAK,CAAC,QAAQ,EAAE,mCAAgB,CAAC,EAC/D,CAAC,KAAK,CAAC,QAAQ,CAAC,CACjB,CAAC;IAEF,OAAO,CACL,uBAAC,8BAA8B,OACzB,KAAK,EACT,QAAQ,EAAE,eAAe,EACzB,kBAAkB,EAAE,kBAAkB,GACtC,CACH,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport React, { use, useCallback, useMemo } from 'react';\n\nimport { NativeBottomTabsRouter } from './NativeBottomTabsRouter';\nimport { NativeTabTrigger } from './NativeTabTrigger';\nimport { NativeTabsView } from './NativeTabsView';\nimport type {\n InternalNativeTabsProps,\n NativeTabNavigationEventMap,\n NativeTabOptions,\n NativeTabsProps,\n NativeTabsViewTabItem,\n} from './types';\nimport { convertIconColorPropToObject, convertLabelStylePropToObject } from './utils';\nimport { withLayoutContext } from '../layouts/withLayoutContext';\nimport { getPathFromState } from '../link/linking';\nimport type {\n ParamListBase,\n TabNavigationState,\n TabRouterOptions,\n} from '../react-navigation/native';\nimport { createNavigatorFactory, useNavigationBuilder } from '../react-navigation/native';\nimport { getAllChildrenNotOfType, getAllChildrenOfType } from '../utils/children';\n\n// In Jetpack Compose, the default back behavior is to go back to the initial route.\nconst defaultBackBehavior = 'initialRoute';\nexport const NativeTabsContext = React.createContext(false);\n\nexport function NativeTabsNavigator({\n children,\n backBehavior = defaultBackBehavior,\n labelStyle,\n iconColor,\n blurEffect,\n backgroundColor,\n badgeBackgroundColor,\n indicatorColor,\n badgeTextColor,\n shadowColor,\n screenListeners,\n ...rest\n}: InternalNativeTabsProps) {\n if (use(NativeTabsContext)) {\n throw new Error(\n 'Nesting Native Tabs inside each other is not supported natively. Use JS tabs for nesting instead.'\n );\n }\n\n const processedLabelStyle = convertLabelStylePropToObject(labelStyle);\n const processedIconColor = convertIconColorPropToObject(iconColor);\n\n const selectedLabelStyle = processedLabelStyle.selected\n ? {\n ...processedLabelStyle.selected,\n color: processedLabelStyle.selected.color ?? rest.tintColor,\n }\n : rest.tintColor\n ? { color: rest.tintColor }\n : undefined;\n\n const { state, descriptors, navigation, NavigationContent } = useNavigationBuilder<\n TabNavigationState,\n TabRouterOptions,\n Record void>,\n NativeTabOptions,\n NativeTabNavigationEventMap\n >(NativeBottomTabsRouter, {\n children,\n backBehavior,\n screenListeners,\n screenOptions: {\n disableTransparentOnScrollEdge: rest.disableTransparentOnScrollEdge,\n labelStyle: processedLabelStyle.default,\n selectedLabelStyle,\n iconColor: processedIconColor.default,\n selectedIconColor: processedIconColor.selected ?? rest.tintColor,\n blurEffect,\n backgroundColor,\n badgeBackgroundColor,\n indicatorColor,\n badgeTextColor,\n shadowColor,\n },\n });\n\n const { routes } = state;\n\n const visibleTabs = useMemo(\n () =>\n routes\n // The always sets `hidden` to defined boolean value.\n // If it is not defined, then it was not specified, and we should hide the tab.\n .filter((route) => descriptors[route.key]!.options?.hidden !== true)\n .map(\n (route): NativeTabsViewTabItem => ({\n options: descriptors[route.key]!.options,\n routeKey: route.key,\n name: route.name,\n contentRenderer: () => descriptors[route.key]!.render(),\n })\n ),\n [routes, descriptors]\n );\n const visibleFocusedTabIndex = useMemo(\n () => visibleTabs.findIndex((tab) => tab.routeKey === routes[state.index]!.key),\n [visibleTabs, routes, state.index]\n );\n const visibleTabsKeys = useMemo(\n () => visibleTabs.map((tab) => tab.routeKey).join(';'),\n [visibleTabs]\n );\n\n if (visibleFocusedTabIndex < 0) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The focused tab in NativeTabsView cannot be displayed. Make sure path is correct and the route is not hidden. Path: \"${getPathFromState(state)}\"`\n );\n }\n }\n const focusedIndex = visibleFocusedTabIndex >= 0 ? visibleFocusedTabIndex : 0;\n\n const onTabChange = useCallback(\n (tabKey: string) => {\n const { route } = descriptors[tabKey]!;\n navigation.emit({\n type: 'tabPress',\n target: tabKey,\n data: {\n __internalTabsType: 'native',\n },\n });\n navigation.dispatch({\n type: 'JUMP_TO',\n target: state.key,\n payload: {\n name: route.name,\n },\n });\n },\n [descriptors, navigation, state.key]\n );\n\n return (\n \n \n \n \n \n );\n}\n\nconst createNativeTabNavigator = createNavigatorFactory(NativeTabsNavigator);\n\nconst NativeTabsNavigatorWithContext = withLayoutContext<\n NativeTabOptions,\n typeof NativeTabsNavigator,\n TabNavigationState,\n NativeTabNavigationEventMap\n>(createNativeTabNavigator().Navigator, undefined, true);\n\nexport function NativeTabsNavigatorWrapper(props: NativeTabsProps) {\n const triggerChildren = useMemo(\n () => getAllChildrenOfType(props.children, NativeTabTrigger),\n [props.children]\n );\n const nonTriggerChildren = useMemo(\n () => getAllChildrenNotOfType(props.children, NativeTabTrigger),\n [props.children]\n );\n\n return (\n \n );\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/native-tabs/NativeTabsView.js.map b/packages/expo-router/build/native-tabs/NativeTabsView.js.map index 786daa7bb89f09..99b332c2355fef 100644 --- a/packages/expo-router/build/native-tabs/NativeTabsView.js.map +++ b/packages/expo-router/build/native-tabs/NativeTabsView.js.map @@ -1 +1 @@ -{"version":3,"file":"NativeTabsView.js","sourceRoot":"","sources":["../../src/native-tabs/NativeTabsView.tsx"],"names":[],"mappings":";;AA2BA,wCAyHC;;AApJD,iCAAyD;AACzD,+CAAqD;AACrD,mFAAkE;AAClE,+DAA2F;AAC3F,oEAAiE;AAEjE,6CAGsB;AACtB,oCAAiC;AACjC,gDAA8D;AAC9D,mCAKiB;AACjB,uDAAsD;AACtD,6DAA0F;AAC1F,uCAIsB;AACtB,gDAAwD;AAExD,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,EACJ,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,IAAI,EACJ,gBAAgB,EAChB,kBAAkB,GACnB,GAAG,KAAK,CAAC;IAEV,MAAM,oBAAoB,GAAG,IAAA,wBAAgB,EAAC,YAAY,CAAC,CAAC;IAC5D,8DAA8D;IAC9D,oFAAoF;IACpF,wFAAwF;IACxF,2BAA2B;IAC3B,MAAM,4BAA4B,GAChC,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,YAAY,CAAC;IAE3E,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACrC,kBAAkB,EAAE,IAAA,gDAAmC,EAAC,GAAG,CAAC,OAAO,CAAC;QACpE,oBAAoB,EAAE,IAAA,kDAAqC,EAAC,GAAG,CAAC,OAAO,CAAC;KACzE,CAAC,CAAC,CAAC;IAEJ,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAE/C,MAAM,eAAe,GAAG,IAAA,eAAO,EAC7B,GAAG,EAAE,CAAC,IAAA,8BAAmB,EAAC,kBAAkB,EAAE,oCAAyB,CAAC,EACxE,CAAC,kBAAkB,CAAC,CACrB,CAAC;IAEF,M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O,CAAC,IAAI,KACpB,OAAO,CAAC,WAAW,EACvB,MAAM,EAAE,QAAQ,EAChB,SAAS,EAAE,SAAS,YACnB,cAAc,GACH,CACf,CAAC;AACJ,CAAC;AAED,MAAM,mCAAmC,GAAG,IAAI,GAAG,CAAS,4CAAoC,CAAC,CAAC;AAClG,MAAM,0CAA0C,GAAG,IAAI,GAAG,CACxD,qDAA6C,CAC9C,CAAC;AAEF,SAAS,eAAe,CAAC,KAAoB;IAC3C,IAAI,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC/E,IAAI,sBAAsB,IAAI,CAAC,mCAAmC,CAAC,GAAG,CAAC,sBAAsB,CAAC,EAAE,CAAC;QAC/F,OAAO,CAAC,IAAI,CACV,iCAAiC,sBAAsB,2BAA2B,4CAAoC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACvK,CAAC;QACF,sBAAsB,GAAG,SAAS,CAAC;IACrC,CAAC;IACD,IACE,6BAA6B;QAC7B,CAAC,0CAA0C,CAAC,GAAG,CAAC,6BAA6B,CAAC,EAC9E,CAAC;QACD,OAAO,CAAC,IAAI,CACV,oCAAoC,6BAA6B,2BAA2B,qDAA6C,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAClL,CAAC;QACF,6BAA6B,GAAG,SAAS,CAAC;IAC5C,CAAC;IAED,OAAO,CACL,uBAAC,2BAAI,CAAC,IAAI,IACR,6BAA6B,EAAE,6BAA6B,EAC5D,sBAAsB,EAAE,sBAAsB,KAC1C,IAAI,GACR,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React, { useDeferredValue, useMemo } from 'react';\nimport { View, type ColorValue } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\nimport { Tabs, type TabsHostProps, type TabsScreenAppearance } from 'react-native-screens';\nimport { SafeAreaView } from 'react-native-screens/experimental';\n\nimport {\n createScrollEdgeAppearanceFromOptions,\n createStandardAppearanceFromOptions,\n} from './appearance';\nimport { Color } from '../color';\nimport { NativeTabsBottomAccessory } from './common/elements';\nimport {\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES,\n SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS,\n type NativeTabOptions,\n type NativeTabsViewProps,\n} from './types';\nimport { useTheme } from '../react-navigation/native';\nimport { useBottomAccessoryFunctionFromBottomAccessories } from './utils/bottomAccessory';\nimport {\n convertOptionsIconToRNScreensPropsIcon,\n convertOptionsIconToIOSPropsIcon,\n useAwaitedScreensIcon,\n} from './utils/icon';\nimport { getFirstChildOfType } from '../utils/children';\n\nexport function NativeTabsView(props: NativeTabsViewProps) {\n const {\n minimizeBehavior,\n disableIndicator,\n focusedIndex,\n tabs,\n sidebarAdaptable,\n nonTriggerChildren,\n } = props;\n\n const deferredFocusedIndex = useDeferredValue(focusedIndex);\n // We need to check if the deferred index is not out of bounds\n // This can happen when the focused index is the last tab, and user removes that tab\n // In that case the deferred index will still point to the last tab, but after re-render\n // it will be out of bounds\n const inBoundsDeferredFocusedIndex =\n deferredFocusedIndex < tabs.length ? deferredFocusedIndex : focusedIndex;\n\n const appearances = tabs.map((tab) => ({\n standardAppearance: createStandardAppearanceFromOptions(tab.options),\n scrollEdgeAppearance: createScrollEdgeAppearanceFromOptions(tab.options),\n }));\n\n const options = tabs.map((tab) => tab.options);\n\n const bottomAccessory = useMemo(\n () => getFirstChildOfType(nonTriggerChildren, NativeTabsBottomAccessory),\n [nonTriggerChildren]\n );\n\n const bottomAccessoryFn = useBottomAccessoryFunctionFromBottomAccessories(bottomAccessory);\n\n const children = tabs.map((tab, index) => {\n const isFocused = index === inBoundsDeferredFocusedIndex;\n\n return (\n \n );\n });\n\n const currentTabAppearance = appearances[inBoundsDeferredFocusedIndex]?.standardAppearance;\n const tabBarControllerMode: TabsHostProps['tabBarControllerMode'] = sidebarAdaptable\n ? 'tabSidebar'\n : sidebarAdaptable === false\n ? 'tabBar'\n : 'automatic';\n\n // Material Design 3 dynamic color defaults for Android\n const androidMaterialDefaults =\n process.env.EXPO_OS === 'android'\n ? {\n inactiveColor: Color.android.dynamic.onSurfaceVariant,\n activeIconColor: Color.android.dynamic.onSecondaryContainer,\n activeLabelColor: Color.android.dynamic.onSurface,\n backgroundColor: Color.android.dynamic.surfaceContainer,\n rippleColor: Color.android.dynamic.primary,\n indicatorColor: Color.android.dynamic.secondaryContainer,\n }\n : undefined;\n\n return (\n {\n props.onTabChange(tabKey);\n }}>\n {children}\n \n );\n}\n\nfunction Screen(props: {\n routeKey: string;\n name: string;\n isFocused: boolean;\n options: NativeTabOptions;\n standardAppearance: TabsScreenAppearance;\n scrollEdgeAppearance: TabsScreenAppearance;\n badgeTextColor: ColorValue | undefined;\n contentRenderer: () => React.ReactNode;\n}) {\n const {\n routeKey,\n name,\n options,\n isFocused,\n standardAppearance,\n scrollEdgeAppearance,\n badgeTextColor,\n contentRenderer,\n } = props;\n const title = options.title ?? name;\n\n // We need to await the icon, as VectorIcon will load asynchronously\n const icon = useAwaitedScreensIcon(options.icon);\n const selectedIcon = useAwaitedScreensIcon(options.selectedIcon);\n const { colors } = useTheme();\n\n const content = (\n \n {contentRenderer()}\n \n );\n const wrappedContent = useMemo(() => {\n if (process.env.EXPO_OS === 'android' && !options.disableAutomaticContentInsets) {\n return (\n \n {content}\n \n );\n } else if (process.env.EXPO_OS === 'ios') {\n return {content};\n } else {\n return content;\n }\n }, [content, options.disableAutomaticContentInsets]);\n\n return (\n \n {wrappedContent}\n \n );\n}\n\nconst supportedTabBarMinimizeBehaviorsSet = new Set(SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS);\nconst supportedTabBarItemLabelVisibilityModesSet = new Set(\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES\n);\n\nfunction TabsHostWrapper(props: TabsHostProps) {\n let { tabBarMinimizeBehavior, tabBarItemLabelVisibilityMode, ...rest } = props;\n if (tabBarMinimizeBehavior && !supportedTabBarMinimizeBehaviorsSet.has(tabBarMinimizeBehavior)) {\n console.warn(\n `Unsupported minimizeBehavior: ${tabBarMinimizeBehavior}. Supported values are: ${SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS.map((behavior) => `\"${behavior}\"`).join(', ')}`\n );\n tabBarMinimizeBehavior = undefined;\n }\n if (\n tabBarItemLabelVisibilityMode &&\n !supportedTabBarItemLabelVisibilityModesSet.has(tabBarItemLabelVisibilityMode)\n ) {\n console.warn(\n `Unsupported labelVisibilityMode: ${tabBarItemLabelVisibilityMode}. Supported values are: ${SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES.map((mode) => `\"${mode}\"`).join(', ')}`\n );\n tabBarItemLabelVisibilityMode = undefined;\n }\n\n return (\n \n );\n}\n"]} \ No newline at end of file +{"version":3,"file":"NativeTabsView.js","sourceRoot":"","sources":["../../src/native-tabs/NativeTabsView.tsx"],"names":[],"mappings":";;AA2BA,wCAyHC;;AApJD,iCAAyD;AACzD,+CAAqD;AACrD,mFAAkE;AAClE,+DAA2F;AAC3F,oEAAiE;AAEjE,6CAGsB;AACtB,oCAAiC;AACjC,gDAA8D;AAC9D,mCAKiB;AACjB,uDAAsD;AACtD,6DAA0F;AAC1F,uCAIsB;AACtB,gDAAwD;AAExD,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,EACJ,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,IAAI,EACJ,gBAAgB,EAChB,kBAAkB,GACnB,GAAG,KAAK,CAAC;IAEV,MAAM,oBAAoB,GAAG,IAAA,wBAAgB,EAAC,YAAY,CAAC,CAAC;IAC5D,8DAA8D;IAC9D,oFAAoF;IACpF,wFAAwF;IACxF,2BAA2B;IAC3B,MAAM,4BAA4B,GAChC,oBAAoB,GAAG,IA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BAAsB,GAAG,SAAS,CAAC;IACrC,CAAC;IACD,IACE,6BAA6B;QAC7B,CAAC,0CAA0C,CAAC,GAAG,CAAC,6BAA6B,CAAC,EAC9E,CAAC;QACD,OAAO,CAAC,IAAI,CACV,oCAAoC,6BAA6B,2BAA2B,qDAA6C,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAClL,CAAC;QACF,6BAA6B,GAAG,SAAS,CAAC;IAC5C,CAAC;IAED,OAAO,CACL,uBAAC,2BAAI,CAAC,IAAI,IACR,6BAA6B,EAAE,6BAA6B,EAC5D,sBAAsB,EAAE,sBAAsB,KAC1C,IAAI,GACR,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React, { useDeferredValue, useMemo } from 'react';\nimport { View, type ColorValue } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\nimport { Tabs, type TabsHostProps, type TabsScreenAppearance } from 'react-native-screens';\nimport { SafeAreaView } from 'react-native-screens/experimental';\n\nimport {\n createScrollEdgeAppearanceFromOptions,\n createStandardAppearanceFromOptions,\n} from './appearance';\nimport { Color } from '../color';\nimport { NativeTabsBottomAccessory } from './common/elements';\nimport {\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES,\n SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS,\n type NativeTabOptions,\n type NativeTabsViewProps,\n} from './types';\nimport { useTheme } from '../react-navigation/native';\nimport { useBottomAccessoryFunctionFromBottomAccessories } from './utils/bottomAccessory';\nimport {\n convertOptionsIconToRNScreensPropsIcon,\n convertOptionsIconToIOSPropsIcon,\n useAwaitedScreensIcon,\n} from './utils/icon';\nimport { getFirstChildOfType } from '../utils/children';\n\nexport function NativeTabsView(props: NativeTabsViewProps) {\n const {\n minimizeBehavior,\n disableIndicator,\n focusedIndex,\n tabs,\n sidebarAdaptable,\n nonTriggerChildren,\n } = props;\n\n const deferredFocusedIndex = useDeferredValue(focusedIndex);\n // We need to check if the deferred index is not out of bounds\n // This can happen when the focused index is the last tab, and user removes that tab\n // In that case the deferred index will still point to the last tab, but after re-render\n // it will be out of bounds\n const inBoundsDeferredFocusedIndex =\n deferredFocusedIndex < tabs.length ? deferredFocusedIndex : focusedIndex;\n\n const appearances = tabs.map((tab) => ({\n standardAppearance: createStandardAppearanceFromOptions(tab.options),\n scrollEdgeAppearance: createScrollEdgeAppearanceFromOptions(tab.options),\n }));\n\n const options = tabs.map((tab) => tab.options);\n\n const bottomAccessory = useMemo(\n () => getFirstChildOfType(nonTriggerChildren, NativeTabsBottomAccessory),\n [nonTriggerChildren]\n );\n\n const bottomAccessoryFn = useBottomAccessoryFunctionFromBottomAccessories(bottomAccessory);\n\n const children = tabs.map((tab, index) => {\n const isFocused = index === inBoundsDeferredFocusedIndex;\n\n return (\n \n );\n });\n\n const currentTabAppearance = appearances[inBoundsDeferredFocusedIndex]?.standardAppearance;\n const tabBarControllerMode: TabsHostProps['tabBarControllerMode'] = sidebarAdaptable\n ? 'tabSidebar'\n : sidebarAdaptable === false\n ? 'tabBar'\n : 'automatic';\n\n // Material Design 3 dynamic color defaults for Android\n const androidMaterialDefaults =\n process.env.EXPO_OS === 'android'\n ? {\n inactiveColor: Color.android.dynamic.onSurfaceVariant,\n activeIconColor: Color.android.dynamic.onSecondaryContainer,\n activeLabelColor: Color.android.dynamic.onSurface,\n backgroundColor: Color.android.dynamic.surfaceContainer,\n rippleColor: Color.android.dynamic.primary,\n indicatorColor: Color.android.dynamic.secondaryContainer,\n }\n : undefined;\n\n return (\n {\n props.onTabChange(tabKey);\n }}>\n {children}\n \n );\n}\n\nfunction Screen(props: {\n routeKey: string;\n name: string;\n isFocused: boolean;\n options: NativeTabOptions;\n standardAppearance: TabsScreenAppearance;\n scrollEdgeAppearance: TabsScreenAppearance;\n badgeTextColor: ColorValue | undefined;\n contentRenderer: () => React.ReactNode;\n}) {\n const {\n routeKey,\n name,\n options,\n isFocused,\n standardAppearance,\n scrollEdgeAppearance,\n badgeTextColor,\n contentRenderer,\n } = props;\n const title = options.title ?? name;\n\n // We need to await the icon, as VectorIcon will load asynchronously\n const icon = useAwaitedScreensIcon(options.icon);\n const selectedIcon = useAwaitedScreensIcon(options.selectedIcon);\n const { colors } = useTheme();\n\n const content = (\n \n {contentRenderer()}\n \n );\n const wrappedContent = useMemo(() => {\n if (process.env.EXPO_OS === 'android' && !options.disableAutomaticContentInsets) {\n return (\n \n {content}\n \n );\n } else if (process.env.EXPO_OS === 'ios') {\n return {content};\n } else {\n return content;\n }\n }, [content, options.disableAutomaticContentInsets]);\n\n return (\n \n {wrappedContent}\n \n );\n}\n\nconst supportedTabBarMinimizeBehaviorsSet = new Set(SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS);\nconst supportedTabBarItemLabelVisibilityModesSet = new Set(\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES\n);\n\nfunction TabsHostWrapper(props: TabsHostProps) {\n let { tabBarMinimizeBehavior, tabBarItemLabelVisibilityMode, ...rest } = props;\n if (tabBarMinimizeBehavior && !supportedTabBarMinimizeBehaviorsSet.has(tabBarMinimizeBehavior)) {\n console.warn(\n `Unsupported minimizeBehavior: ${tabBarMinimizeBehavior}. Supported values are: ${SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS.map((behavior) => `\"${behavior}\"`).join(', ')}`\n );\n tabBarMinimizeBehavior = undefined;\n }\n if (\n tabBarItemLabelVisibilityMode &&\n !supportedTabBarItemLabelVisibilityModesSet.has(tabBarItemLabelVisibilityMode)\n ) {\n console.warn(\n `Unsupported labelVisibilityMode: ${tabBarItemLabelVisibilityMode}. Supported values are: ${SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES.map((mode) => `\"${mode}\"`).join(', ')}`\n );\n tabBarItemLabelVisibilityMode = undefined;\n }\n\n return (\n \n );\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/native-tabs/NativeTabsView.web.js.map b/packages/expo-router/build/native-tabs/NativeTabsView.web.js.map index 48b7220b682efa..7854577511115b 100644 --- a/packages/expo-router/build/native-tabs/NativeTabsView.web.js.map +++ b/packages/expo-router/build/native-tabs/NativeTabsView.web.js.map @@ -1 +1 @@ -{"version":3,"file":"NativeTabsView.web.js","sourceRoot":"","sources":["../../src/native-tabs/NativeTabsView.web.tsx"],"names":[],"mappings":";;;;;AAMA,wCA6CC;;AAnDD,qDAAgF;AAChF,iCAAgC;AAGhC,iGAAmE;AAEnE,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IACrC,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,IAAA,eAAO,EACxB,GAAG,EAAE,CAAC,UAAU;IAChB,yGAAyG;IACzG,EAAE,CACH,CAAC;IACF,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC;IAElC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAC9B,uBAAC,OAAO,IAEN,QAAQ,EAAE,GAAG,CAAC,QAAQ,EACtB,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,GAAG,CAAC,IAAI,EACpC,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC,UAAU,IAH7B,GAAG,CAAC,QAAQ,CAIjB,CACH,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QAChC,OAAO,CACL,uBAAC,wBAAW,IAEV,KAAK,EAAE,GAAG,CAAC,QAAQ,EACnB,SAAS,EAAE,gCAAgB,CAAC,UAAU,EACtC,UAAU,kBACT,GAAG,CAAC,eAAe,EAAE,IAJjB,GAAG,CAAC,QAAQ,CAKL,CACf,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,CACL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,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 { 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 \n ));\n const children = tabs.map((tab) => {\n return (\n \n {tab.contentRenderer()}\n \n );\n });\n\n return (\n {\n props.onTabChange(value);\n }}\n style={convertNativeTabsPropsToStyleVars(props, currentTab.options)}>\n \n {items}\n \n {children}\n \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 \n {title}\n {badgeValue && (\n \n {badgeValue}\n \n )}\n \n );\n}\n\nfunction convertNativeTabsPropsToStyleVars(\n props: NativeTabsViewProps | undefined,\n currentTabOptions: NativeTabOptions | undefined\n): Record {\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"]} \ No newline at end of file +{"version":3,"file":"NativeTabsView.web.js","sourceRoot":"","sources":["../../src/native-tabs/NativeTabsView.web.tsx"],"names":[],"mappings":";;;;;AAMA,wCA6CC;;AAnDD,qDAAgF;AAChF,iCAAgC;AAGhC,iGAAmE;AA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;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 { 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 \n ));\n const children = tabs.map((tab) => {\n return (\n \n {tab.contentRenderer()}\n \n );\n });\n\n return (\n {\n props.onTabChange(value);\n }}\n style={convertNativeTabsPropsToStyleVars(props, currentTab.options)}>\n \n {items}\n \n {children}\n \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 \n {title}\n {badgeValue && (\n \n {badgeValue}\n \n )}\n \n );\n}\n\nfunction convertNativeTabsPropsToStyleVars(\n props: NativeTabsViewProps | undefined,\n currentTabOptions: NativeTabOptions | undefined\n): Record {\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"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/bottom-tabs/views/BottomTabBar.js.map b/packages/expo-router/build/react-navigation/bottom-tabs/views/BottomTabBar.js.map index c41d98e4d36885..0a6c4e0b40174f 100644 --- a/packages/expo-router/build/react-navigation/bottom-tabs/views/BottomTabBar.js.map +++ b/packages/expo-router/build/react-navigation/bottom-tabs/views/BottomTabBar.js.map @@ -1 +1 @@ -{"version":3,"file":"BottomTabBar.js","sourceRoot":"","sources":["../../../../src/react-navigation/bottom-tabs/views/BottomTabBar.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmIb,oCA6SC;;AA/aD,+CAAmC;AACnC,+CAQsB;AAGtB,6CAA6F;AAC7F,yCAQ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E,CAAC;QACP,aAAa,EAAE,KAAK;KACrB;IACD,WAAW,EAAE;QACX,IAAI,EAAE,CAAC;QACP,aAAa,EAAE,QAAQ;KACxB;IACD,UAAU,EAAE;QACV,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC","sourcesContent":["'use client';\nimport React, { use } from 'react';\nimport {\n Animated,\n type LayoutChangeEvent,\n Platform,\n type StyleProp,\n StyleSheet,\n View,\n type ViewStyle,\n} from 'react-native';\nimport type { EdgeInsets } from 'react-native-safe-area-context';\n\nimport { getDefaultSidebarWidth, getLabel, MissingIcon, useFrameSize } from '../../elements';\nimport {\n CommonActions,\n NavigationProvider,\n type ParamListBase,\n type TabNavigationState,\n useLinkBuilder,\n useLocale,\n useTheme,\n} from '../../native';\nimport type { BottomTabBarProps, BottomTabDescriptorMap } from '../types';\nimport { BottomTabItem } from './BottomTabItem';\nimport { BottomTabBarHeightCallbackContext } from '../utils/BottomTabBarHeightCallbackContext';\nimport { useIsKeyboardShown } from '../utils/useIsKeyboardShown';\n\ntype Props = BottomTabBarProps & {\n style?: Animated.WithAnimatedValue>;\n};\n\nconst TABBAR_HEIGHT_UIKIT = 49;\nconst TABBAR_HEIGHT_UIKIT_COMPACT = 32;\nconst SPACING_UIKIT = 15;\nconst SPACING_MATERIAL = 12;\nconst DEFAULT_MAX_TAB_ITEM_WIDTH = 125;\n\nconst useNativeDriver = Platform.OS !== 'web';\n\ntype Options = {\n state: TabNavigationState;\n descriptors: BottomTabDescriptorMap;\n dimensions: { height: number; width: number };\n};\n\nconst shouldUseHorizontalLabels = ({ state, descriptors, dimensions }: Options) => {\n const { tabBarLabelPosition } = descriptors[state.routes[state.index].key].options;\n\n if (tabBarLabelPosition) {\n switch (tabBarLabelPosition) {\n case 'beside-icon':\n return true;\n case 'below-icon':\n return false;\n }\n }\n\n if (dimensions.width >= 768) {\n // Screen size matches a tablet\n const maxTabWidth = state.routes.reduce((acc, route) => {\n const { tabBarItemStyle } = descriptors[route.key].options;\n const flattenedStyle = StyleSheet.flatten(tabBarItemStyle);\n\n if (flattenedStyle) {\n if (typeof flattenedStyle.width === 'number') {\n return acc + flattenedStyle.width;\n } else if (typeof flattenedStyle.maxWidth === 'number') {\n return acc + flattenedStyle.maxWidth;\n }\n }\n\n return acc + DEFAULT_MAX_TAB_ITEM_WIDTH;\n }, 0);\n\n return maxTabWidth <= dimensions.width;\n } else {\n return dimensions.width > dimensions.height;\n }\n};\n\nconst isCompact = ({ state, descriptors, dimensions }: Options): boolean => {\n const { tabBarPosition, tabBarVariant } = descriptors[state.routes[state.index].key].options;\n\n if (tabBarPosition === 'left' || tabBarPosition === 'right' || tabBarVariant === 'material') {\n return false;\n }\n\n const isLandscape = dimensions.width > dimensions.height;\n const horizontalLabels = shouldUseHorizontalLabels({\n state,\n descriptors,\n dimensions,\n });\n\n if (Platform.OS === 'ios' && !Platform.isPad && isLandscape && horizontalLabels) {\n return true;\n }\n\n return false;\n};\n\nexport const getTabBarHeight = ({\n state,\n descriptors,\n dimensions,\n insets,\n style,\n}: Options & {\n insets: EdgeInsets;\n style: Animated.WithAnimatedValue> | undefined;\n}) => {\n const { tabBarPosition } = descriptors[state.routes[state.index].key].options;\n\n const flattenedStyle = StyleSheet.flatten(style);\n const customHeight =\n flattenedStyle && 'height' in flattenedStyle ? flattenedStyle.height : undefined;\n\n if (typeof customHeight === 'number') {\n return customHeight;\n }\n\n const inset = insets[tabBarPosition === 'top' ? 'top' : 'bottom'];\n\n if (isCompact({ state, descriptors, dimensions })) {\n return TABBAR_HEIGHT_UIKIT_COMPACT + inset;\n }\n\n return TABBAR_HEIGHT_UIKIT + inset;\n};\n\nexport function BottomTabBar({ state, navigation, descriptors, insets, style }: Props) {\n const { colors } = useTheme();\n const { direction } = useLocale();\n const { buildHref } = useLinkBuilder();\n\n const focusedRoute = state.routes[state.index];\n const focusedDescriptor = descriptors[focusedRoute.key];\n const focusedOptions = focusedDescriptor.options;\n\n const {\n tabBarPosition = 'bottom',\n tabBarShowLabel,\n tabBarLabelPosition,\n tabBarHideOnKeyboard = false,\n tabBarVisibilityAnimationConfig,\n tabBarVariant = 'uikit',\n tabBarStyle,\n tabBarBackground,\n tabBarActiveTintColor,\n tabBarInactiveTintColor,\n tabBarActiveBackgroundColor,\n tabBarInactiveBackgroundColor,\n } = focusedOptions;\n\n if (tabBarVariant === 'material' && tabBarPosition !== 'left' && tabBarPosition !== 'right') {\n throw new Error(\n \"The 'material' variant for tab bar is only supported when 'tabBarPosition' is set to 'left' or 'right'.\"\n );\n }\n\n if (\n tabBarLabelPosition === 'below-icon' &&\n tabBarVariant === 'uikit' &&\n (tabBarPosition === 'left' || tabBarPosition === 'right')\n ) {\n throw new Error(\n \"The 'below-icon' label position for tab bar is only supported when 'tabBarPosition' is set to 'top' or 'bottom' when using the 'uikit' variant.\"\n );\n }\n\n const isKeyboardShown = useIsKeyboardShown();\n\n const onHeightChange = use(BottomTabBarHeightCallbackContext);\n\n const shouldShowTabBar = !(tabBarHideOnKeyboard && isKeyboardShown);\n\n const visibilityAnimationConfigRef = React.useRef(tabBarVisibilityAnimationConfig);\n\n React.useEffect(() => {\n visibilityAnimationConfigRef.current = tabBarVisibilityAnimationConfig;\n });\n\n const [isTabBarHidden, setIsTabBarHidden] = React.useState(!shouldShowTabBar);\n\n const [visible] = React.useState(() => new Animated.Value(shouldShowTabBar ? 1 : 0));\n\n React.useEffect(() => {\n const visibilityAnimationConfig = visibilityAnimationConfigRef.current;\n\n if (shouldShowTabBar) {\n const animation =\n visibilityAnimationConfig?.show?.animation === 'spring' ? Animated.spring : Animated.timing;\n\n animation(visible, {\n toValue: 1,\n useNativeDriver,\n duration: 250,\n ...visibilityAnimationConfig?.show?.config,\n }).start(({ finished }) => {\n if (finished) {\n setIsTabBarHidden(false);\n }\n });\n } else {\n setIsTabBarHidden(true);\n\n const animation =\n visibilityAnimationConfig?.hide?.animation === 'spring' ? Animated.spring : Animated.timing;\n\n animation(visible, {\n toValue: 0,\n useNativeDriver,\n duration: 200,\n ...visibilityAnimationConfig?.hide?.config,\n }).start();\n }\n\n return () => visible.stopAnimation();\n }, [visible, shouldShowTabBar]);\n\n const [layout, setLayout] = React.useState({\n height: 0,\n });\n\n const handleLayout = (e: LayoutChangeEvent) => {\n const { height } = e.nativeEvent.layout;\n\n onHeightChange?.(height);\n\n setLayout((layout) => {\n if (height === layout.height) {\n return layout;\n } else {\n return { height };\n }\n });\n };\n\n const { routes } = state;\n\n const tabBarHeight = useFrameSize((dimensions) =>\n getTabBarHeight({\n state,\n descriptors,\n insets,\n dimensions,\n style: [tabBarStyle, style],\n })\n );\n\n const hasHorizontalLabels = useFrameSize((dimensions) =>\n shouldUseHorizontalLabels({\n state,\n descriptors,\n dimensions,\n })\n );\n\n const compact = useFrameSize((dimensions) => isCompact({ state, descriptors, dimensions }));\n\n const sidebar = tabBarPosition === 'left' || tabBarPosition === 'right';\n const spacing = tabBarVariant === 'material' ? SPACING_MATERIAL : SPACING_UIKIT;\n\n const minSidebarWidth = useFrameSize((size) =>\n sidebar && hasHorizontalLabels ? getDefaultSidebarWidth(size) : 0\n );\n\n const tabBarBackgroundElement = tabBarBackground?.();\n\n return (\n \n \n {tabBarBackgroundElement}\n \n \n {routes.map((route, index) => {\n const focused = index === state.index;\n const { options } = descriptors[route.key];\n\n const onPress = () => {\n const event = navigation.emit({\n type: 'tabPress',\n target: route.key,\n canPreventDefault: true,\n });\n\n if (!focused && !event.defaultPrevented) {\n navigation.dispatch({\n ...CommonActions.navigate(route),\n target: state.key,\n });\n }\n };\n\n const onLongPress = () => {\n navigation.emit({\n type: 'tabLongPress',\n target: route.key,\n });\n };\n\n const label =\n typeof options.tabBarLabel === 'function'\n ? options.tabBarLabel\n : getLabel({ label: options.tabBarLabel, title: options.title }, route.name);\n\n const accessibilityLabel =\n options.tabBarAccessibilityLabel !== undefined\n ? options.tabBarAccessibilityLabel\n : typeof label === 'string' && Platform.OS === 'ios'\n ? `${label}, tab, ${index + 1} of ${routes.length}`\n : undefined;\n\n return (\n \n )\n }\n badge={options.tabBarBadge}\n badgeStyle={options.tabBarBadgeStyle}\n label={label}\n showLabel={tabBarShowLabel}\n labelStyle={options.tabBarLabelStyle}\n iconStyle={options.tabBarIconStyle}\n style={[\n sidebar\n ? {\n marginVertical: hasHorizontalLabels\n ? tabBarVariant === 'material'\n ? 0\n : 1\n : spacing / 2,\n }\n : styles.bottomItem,\n options.tabBarItemStyle,\n ]}\n />\n \n );\n })}\n \n \n );\n}\n\nconst styles = StyleSheet.create({\n start: {\n top: 0,\n bottom: 0,\n start: 0,\n },\n end: {\n top: 0,\n bottom: 0,\n end: 0,\n },\n bottom: {\n start: 0,\n end: 0,\n bottom: 0,\n elevation: 8,\n },\n bottomContent: {\n flex: 1,\n flexDirection: 'row',\n },\n sideContent: {\n flex: 1,\n flexDirection: 'column',\n },\n bottomItem: {\n flex: 1,\n },\n});\n"]} \ No newline at end of file +{"version":3,"file":"BottomTabBar.js","sourceRoot":"","sources":["../../../../src/react-navigation/bottom-tabs/views/BottomTabBar.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmIb,oCA6SC;;AA/aD,+CAAmC;AACnC,+CAQsB;AAGtB,6CAA6F;AAC7F,yCAQsB;AAEtB,mDAAgD;AAChD,kGAA+F;AAC/F,oEAAiE;AAMjE,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,2BAA2B,GAAG,EAAE,CAAC;AACvC,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAEvC,MAAM,eAAe,GAAG,uBAAQ,CAAC,EAAE,KAAK,KAAK,CAAC;AAQ9C,MAAM,yBAAyB,GAAG,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAW,EAAE,EAAE;IAChF,MAAM,EAAE,mBAAmB,EAAE,GAAG,WAAW,CAAC,KAAK,CAAC,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,OAAO,CAAC,eAAe,EAClC,KAAK,EAAE;gCACL,OAAO;oCACL,CAAC,CAAC;wCACE,cAAc,EAAE,mBAAmB;4CACjC,CAAC,CAAC,aAAa,KAAK,UAAU;gDAC5B,CAAC,CAAC,CAAC;gDACH,CAAC,CAAC,CAAC;4CACL,CAAC,CAAC,OAAO,GAAG,CAAC;qCAChB;oCACH,CAAC,CAAC,MAAM,CAAC,UAAU;gCACrB,OAAO,CAAC,eAAe;6BACxB,GACD,IA5CG,KAAK,CAAC,GAAG,CA6CK,CACtB,CAAC;gBACJ,CAAC,CAAC,GACG,IACO,CACjB,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE;QACL,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC;KACT;IACD,GAAG,EAAE;QACH,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,CAAC;QACT,GAAG,EAAE,CAAC;KACP;IACD,MAAM,EAAE;QACN,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,CAAC;QACT,SAAS,EAAE,CAAC;KACb;IACD,aAAa,EAAE;QACb,IAAI,EAAE,CAAC;QACP,aAAa,EAAE,KAAK;KACrB;IACD,WAAW,EAAE;QACX,IAAI,EAAE,CAAC;QACP,aAAa,EAAE,QAAQ;KACxB;IACD,UAAU,EAAE;QACV,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC","sourcesContent":["'use client';\nimport React, { use } from 'react';\nimport {\n Animated,\n type LayoutChangeEvent,\n Platform,\n type StyleProp,\n StyleSheet,\n View,\n type ViewStyle,\n} from 'react-native';\nimport type { EdgeInsets } from 'react-native-safe-area-context';\n\nimport { getDefaultSidebarWidth, getLabel, MissingIcon, useFrameSize } from '../../elements';\nimport {\n CommonActions,\n NavigationProvider,\n type ParamListBase,\n type TabNavigationState,\n useLinkBuilder,\n useLocale,\n useTheme,\n} from '../../native';\nimport type { BottomTabBarProps, BottomTabDescriptorMap } from '../types';\nimport { BottomTabItem } from './BottomTabItem';\nimport { BottomTabBarHeightCallbackContext } from '../utils/BottomTabBarHeightCallbackContext';\nimport { useIsKeyboardShown } from '../utils/useIsKeyboardShown';\n\ntype Props = BottomTabBarProps & {\n style?: Animated.WithAnimatedValue>;\n};\n\nconst TABBAR_HEIGHT_UIKIT = 49;\nconst TABBAR_HEIGHT_UIKIT_COMPACT = 32;\nconst SPACING_UIKIT = 15;\nconst SPACING_MATERIAL = 12;\nconst DEFAULT_MAX_TAB_ITEM_WIDTH = 125;\n\nconst useNativeDriver = Platform.OS !== 'web';\n\ntype Options = {\n state: TabNavigationState;\n descriptors: BottomTabDescriptorMap;\n dimensions: { height: number; width: number };\n};\n\nconst shouldUseHorizontalLabels = ({ state, descriptors, dimensions }: Options) => {\n const { tabBarLabelPosition } = descriptors[state.routes[state.index]!.key]!.options;\n\n if (tabBarLabelPosition) {\n switch (tabBarLabelPosition) {\n case 'beside-icon':\n return true;\n case 'below-icon':\n return false;\n }\n }\n\n if (dimensions.width >= 768) {\n // Screen size matches a tablet\n const maxTabWidth = state.routes.reduce((acc, route) => {\n const { tabBarItemStyle } = descriptors[route.key]!.options;\n const flattenedStyle = StyleSheet.flatten(tabBarItemStyle);\n\n if (flattenedStyle) {\n if (typeof flattenedStyle.width === 'number') {\n return acc + flattenedStyle.width;\n } else if (typeof flattenedStyle.maxWidth === 'number') {\n return acc + flattenedStyle.maxWidth;\n }\n }\n\n return acc + DEFAULT_MAX_TAB_ITEM_WIDTH;\n }, 0);\n\n return maxTabWidth <= dimensions.width;\n } else {\n return dimensions.width > dimensions.height;\n }\n};\n\nconst isCompact = ({ state, descriptors, dimensions }: Options): boolean => {\n const { tabBarPosition, tabBarVariant } = descriptors[state.routes[state.index]!.key]!.options;\n\n if (tabBarPosition === 'left' || tabBarPosition === 'right' || tabBarVariant === 'material') {\n return false;\n }\n\n const isLandscape = dimensions.width > dimensions.height;\n const horizontalLabels = shouldUseHorizontalLabels({\n state,\n descriptors,\n dimensions,\n });\n\n if (Platform.OS === 'ios' && !Platform.isPad && isLandscape && horizontalLabels) {\n return true;\n }\n\n return false;\n};\n\nexport const getTabBarHeight = ({\n state,\n descriptors,\n dimensions,\n insets,\n style,\n}: Options & {\n insets: EdgeInsets;\n style: Animated.WithAnimatedValue> | undefined;\n}) => {\n const { tabBarPosition } = descriptors[state.routes[state.index]!.key]!.options;\n\n const flattenedStyle = StyleSheet.flatten(style);\n const customHeight =\n flattenedStyle && 'height' in flattenedStyle ? flattenedStyle.height : undefined;\n\n if (typeof customHeight === 'number') {\n return customHeight;\n }\n\n const inset = insets[tabBarPosition === 'top' ? 'top' : 'bottom'];\n\n if (isCompact({ state, descriptors, dimensions })) {\n return TABBAR_HEIGHT_UIKIT_COMPACT + inset;\n }\n\n return TABBAR_HEIGHT_UIKIT + inset;\n};\n\nexport function BottomTabBar({ state, navigation, descriptors, insets, style }: Props) {\n const { colors } = useTheme();\n const { direction } = useLocale();\n const { buildHref } = useLinkBuilder();\n\n const focusedRoute = state.routes[state.index]!;\n const focusedDescriptor = descriptors[focusedRoute.key]!;\n const focusedOptions = focusedDescriptor.options;\n\n const {\n tabBarPosition = 'bottom',\n tabBarShowLabel,\n tabBarLabelPosition,\n tabBarHideOnKeyboard = false,\n tabBarVisibilityAnimationConfig,\n tabBarVariant = 'uikit',\n tabBarStyle,\n tabBarBackground,\n tabBarActiveTintColor,\n tabBarInactiveTintColor,\n tabBarActiveBackgroundColor,\n tabBarInactiveBackgroundColor,\n } = focusedOptions;\n\n if (tabBarVariant === 'material' && tabBarPosition !== 'left' && tabBarPosition !== 'right') {\n throw new Error(\n \"The 'material' variant for tab bar is only supported when 'tabBarPosition' is set to 'left' or 'right'.\"\n );\n }\n\n if (\n tabBarLabelPosition === 'below-icon' &&\n tabBarVariant === 'uikit' &&\n (tabBarPosition === 'left' || tabBarPosition === 'right')\n ) {\n throw new Error(\n \"The 'below-icon' label position for tab bar is only supported when 'tabBarPosition' is set to 'top' or 'bottom' when using the 'uikit' variant.\"\n );\n }\n\n const isKeyboardShown = useIsKeyboardShown();\n\n const onHeightChange = use(BottomTabBarHeightCallbackContext);\n\n const shouldShowTabBar = !(tabBarHideOnKeyboard && isKeyboardShown);\n\n const visibilityAnimationConfigRef = React.useRef(tabBarVisibilityAnimationConfig);\n\n React.useEffect(() => {\n visibilityAnimationConfigRef.current = tabBarVisibilityAnimationConfig;\n });\n\n const [isTabBarHidden, setIsTabBarHidden] = React.useState(!shouldShowTabBar);\n\n const [visible] = React.useState(() => new Animated.Value(shouldShowTabBar ? 1 : 0));\n\n React.useEffect(() => {\n const visibilityAnimationConfig = visibilityAnimationConfigRef.current;\n\n if (shouldShowTabBar) {\n const animation =\n visibilityAnimationConfig?.show?.animation === 'spring' ? Animated.spring : Animated.timing;\n\n animation(visible, {\n toValue: 1,\n useNativeDriver,\n duration: 250,\n ...visibilityAnimationConfig?.show?.config,\n }).start(({ finished }) => {\n if (finished) {\n setIsTabBarHidden(false);\n }\n });\n } else {\n setIsTabBarHidden(true);\n\n const animation =\n visibilityAnimationConfig?.hide?.animation === 'spring' ? Animated.spring : Animated.timing;\n\n animation(visible, {\n toValue: 0,\n useNativeDriver,\n duration: 200,\n ...visibilityAnimationConfig?.hide?.config,\n }).start();\n }\n\n return () => visible.stopAnimation();\n }, [visible, shouldShowTabBar]);\n\n const [layout, setLayout] = React.useState({\n height: 0,\n });\n\n const handleLayout = (e: LayoutChangeEvent) => {\n const { height } = e.nativeEvent.layout;\n\n onHeightChange?.(height);\n\n setLayout((layout) => {\n if (height === layout.height) {\n return layout;\n } else {\n return { height };\n }\n });\n };\n\n const { routes } = state;\n\n const tabBarHeight = useFrameSize((dimensions) =>\n getTabBarHeight({\n state,\n descriptors,\n insets,\n dimensions,\n style: [tabBarStyle, style],\n })\n );\n\n const hasHorizontalLabels = useFrameSize((dimensions) =>\n shouldUseHorizontalLabels({\n state,\n descriptors,\n dimensions,\n })\n );\n\n const compact = useFrameSize((dimensions) => isCompact({ state, descriptors, dimensions }));\n\n const sidebar = tabBarPosition === 'left' || tabBarPosition === 'right';\n const spacing = tabBarVariant === 'material' ? SPACING_MATERIAL : SPACING_UIKIT;\n\n const minSidebarWidth = useFrameSize((size) =>\n sidebar && hasHorizontalLabels ? getDefaultSidebarWidth(size) : 0\n );\n\n const tabBarBackgroundElement = tabBarBackground?.();\n\n return (\n \n \n {tabBarBackgroundElement}\n \n \n {routes.map((route, index) => {\n const focused = index === state.index;\n const { options } = descriptors[route.key]!;\n\n const onPress = () => {\n const event = navigation.emit({\n type: 'tabPress',\n target: route.key,\n canPreventDefault: true,\n });\n\n if (!focused && !event.defaultPrevented) {\n navigation.dispatch({\n ...CommonActions.navigate(route),\n target: state.key,\n });\n }\n };\n\n const onLongPress = () => {\n navigation.emit({\n type: 'tabLongPress',\n target: route.key,\n });\n };\n\n const label =\n typeof options.tabBarLabel === 'function'\n ? options.tabBarLabel\n : getLabel({ label: options.tabBarLabel, title: options.title }, route.name);\n\n const accessibilityLabel =\n options.tabBarAccessibilityLabel !== undefined\n ? options.tabBarAccessibilityLabel\n : typeof label === 'string' && Platform.OS === 'ios'\n ? `${label}, tab, ${index + 1} of ${routes.length}`\n : undefined;\n\n return (\n \n )\n }\n badge={options.tabBarBadge}\n badgeStyle={options.tabBarBadgeStyle}\n label={label}\n showLabel={tabBarShowLabel}\n labelStyle={options.tabBarLabelStyle}\n iconStyle={options.tabBarIconStyle}\n style={[\n sidebar\n ? {\n marginVertical: hasHorizontalLabels\n ? tabBarVariant === 'material'\n ? 0\n : 1\n : spacing / 2,\n }\n : styles.bottomItem,\n options.tabBarItemStyle,\n ]}\n />\n \n );\n })}\n \n \n );\n}\n\nconst styles = StyleSheet.create({\n start: {\n top: 0,\n bottom: 0,\n start: 0,\n },\n end: {\n top: 0,\n bottom: 0,\n end: 0,\n },\n bottom: {\n start: 0,\n end: 0,\n bottom: 0,\n elevation: 8,\n },\n bottomContent: {\n flex: 1,\n flexDirection: 'row',\n },\n sideContent: {\n flex: 1,\n flexDirection: 'column',\n },\n bottomItem: {\n flex: 1,\n },\n});\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/bottom-tabs/views/BottomTabView.js.map b/packages/expo-router/build/react-navigation/bottom-tabs/views/BottomTabView.js.map index 12a72142d9b913..1f73a9c8abf06b 100644 --- a/packages/expo-router/build/react-navigation/bottom-tabs/views/BottomTabView.js.map +++ b/packages/expo-router/build/react-navigation/bottom-tabs/views/BottomTabView.js.map @@ -1 +1 @@ -{"version":3,"file":"BottomTabView.js","sourceRoot":"","sources":["../../../../src/react-navigation/bottom-tabs/views/BottomTabView.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEb,sCAiPC;;AAjTD,6CAA+B;AAC/B,+CAA8D;AAC9D,mFAAuE;AAEvE,6CAAwF;AACxF,yCAKsB;AACtB,8EAAyF;AAUzF,iDAA+D;AAC/D,qDAAqE;AACrE,kGAA+F;AAC/F,kFAA+E;AAC/E,oEAAiE;AAQjE,MAAM,OAAO,GAAG,IAAI,CAAC;AACrB,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAC3C,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB,MAAM,yBAAyB,GAAG;IAChC,IAAI,EAAE,kCAAc;IACpB,KAAK,EAAE,mCAAe;IACtB,IAAI,EAAE;QACJ,sBAAsB,EAAE,SAAS;QACjC,cAAc,EAAE;YACd,SAAS,EAAE,QAAQ;YACnB,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;SACxB;KACF;CACO,CAAC;AAEX,MAAM,eAAe,GAAG,uBAAQ,CAAC,EAAE,KAAK,KAAK,CAAC;AAE9C,MAAM,YAAY,GAAG,CAAC,OAAmC,EAAE,EAAE;IAC3D,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,O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,EAAE,UAAU,CAAC,UAAU,EACjC,WAAW,EAAE,WAAW,EACxB,qBAAqB,EAAE,qBAAqB,EAC5C,iBAAiB,EAAE,iBAAiB,EACpC,MAAM,EAAE,MAAM,CAAC;oCACb,MAAM,EAAE,UAAU;oCAClB,KAAK,EAAE,UAAU,CAAC,KAAK;oCACvB,UAAU,EAAE,UAAU,CAAC,UAAoD;oCAC3E,OAAO,EAAE,UAAU,CAAC,OAAO;iCAC5B,CAAC,EACF,KAAK,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,IAAI,UAAU,CAAC,YACxD,UAAU,CAAC,MAAM,EAAE,GACb,GAC0B,IAxBhC,KAAK,CAAC,GAAG,CAyBF,CACf,CAAC;gBACJ,CAAC,CAAC,IAjFE,SAAS,CAkFQ,EACtB,cAAc,KAAK,QAAQ,IAAI,cAAc,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,IAC1D,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,QAAQ;KACnB;CACF,CAAC,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { Animated, Platform, StyleSheet } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nimport { getHeaderTitle, Header, SafeAreaProviderCompat, Screen } from '../../elements';\nimport {\n type NavigationAction,\n type ParamListBase,\n StackActions,\n type TabNavigationState,\n} from '../../native';\nimport { FadeTransition, ShiftTransition } from '../TransitionConfigs/TransitionPresets';\nimport type {\n BottomTabBarProps,\n BottomTabDescriptorMap,\n BottomTabHeaderProps,\n BottomTabNavigationConfig,\n BottomTabNavigationHelpers,\n BottomTabNavigationOptions,\n BottomTabNavigationProp,\n} from '../types';\nimport { BottomTabBar, getTabBarHeight } from './BottomTabBar';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\nimport { BottomTabBarHeightCallbackContext } from '../utils/BottomTabBarHeightCallbackContext';\nimport { BottomTabBarHeightContext } from '../utils/BottomTabBarHeightContext';\nimport { useAnimatedHashMap } from '../utils/useAnimatedHashMap';\n\ntype Props = BottomTabNavigationConfig & {\n state: TabNavigationState;\n navigation: BottomTabNavigationHelpers;\n descriptors: BottomTabDescriptorMap;\n};\n\nconst EPSILON = 1e-5;\nconst STATE_INACTIVE = 0;\nconst STATE_TRANSITIONING_OR_BELOW_TOP = 1;\nconst STATE_ON_TOP = 2;\n\nconst NAMED_TRANSITIONS_PRESETS = {\n fade: FadeTransition,\n shift: ShiftTransition,\n none: {\n sceneStyleInterpolator: undefined,\n transitionSpec: {\n animation: 'timing',\n config: { duration: 0 },\n },\n },\n} as const;\n\nconst useNativeDriver = Platform.OS !== 'web';\n\nconst hasAnimation = (options: BottomTabNavigationOptions) => {\n const { animation, transitionSpec } = options;\n\n if (animation) {\n return animation !== 'none';\n }\n\n return Boolean(transitionSpec);\n};\n\nconst renderTabBarDefault = (props: BottomTabBarProps) => ;\n\nexport function BottomTabView(props: Props) {\n const {\n tabBar = renderTabBarDefault,\n state,\n navigation,\n descriptors,\n safeAreaInsets,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n } = props;\n\n const focusedRouteKey = state.routes[state.index].key;\n\n /**\n * List of loaded tabs, tabs will be loaded when navigated to.\n */\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n // Set the current tab to be loaded if it was not loaded before\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const previousRouteKeyRef = React.useRef(focusedRouteKey);\n const tabAnims = useAnimatedHashMap(state);\n\n React.useEffect(() => {\n const previousRouteKey = previousRouteKeyRef.current;\n\n let popToTopAction: NavigationAction | undefined;\n\n if (\n previousRouteKey !== focusedRouteKey &&\n descriptors[previousRouteKey]?.options.popToTopOnBlur\n ) {\n const prevRoute = state.routes.find((route) => route.key === previousRouteKey);\n\n if (prevRoute?.state?.type === 'stack' && prevRoute.state.key) {\n popToTopAction = {\n ...StackActions.popToTop(),\n target: prevRoute.state.key,\n };\n }\n }\n\n const animateToIndex = () => {\n if (previousRouteKey !== focusedRouteKey) {\n navigation.emit({\n type: 'transitionStart',\n target: focusedRouteKey,\n });\n }\n\n Animated.parallel(\n state.routes\n .map((route, index) => {\n const { options } = descriptors[route.key];\n const {\n animation = 'none',\n transitionSpec = NAMED_TRANSITIONS_PRESETS[animation].transitionSpec,\n } = options;\n\n let spec = transitionSpec;\n\n if (route.key !== previousRouteKey && route.key !== focusedRouteKey) {\n // Don't animate if the screen is not previous one or new one\n // This will avoid flicker for screens not involved in the transition\n spec = NAMED_TRANSITIONS_PRESETS.none.transitionSpec;\n }\n\n spec = spec ?? NAMED_TRANSITIONS_PRESETS.none.transitionSpec;\n\n const toValue = index === state.index ? 0 : index >= state.index ? 1 : -1;\n\n return Animated[spec.animation](tabAnims[route.key], {\n ...spec.config,\n toValue,\n useNativeDriver,\n });\n })\n .filter(Boolean) as Animated.CompositeAnimation[]\n ).start(({ finished }) => {\n if (finished && popToTopAction) {\n navigation.dispatch(popToTopAction);\n }\n\n if (previousRouteKey !== focusedRouteKey) {\n navigation.emit({\n type: 'transitionEnd',\n target: focusedRouteKey,\n });\n }\n });\n };\n\n animateToIndex();\n\n previousRouteKeyRef.current = focusedRouteKey;\n }, [descriptors, focusedRouteKey, navigation, state.index, state.routes, tabAnims]);\n\n const dimensions = SafeAreaProviderCompat.initialMetrics.frame;\n const [tabBarHeight, setTabBarHeight] = React.useState(() =>\n getTabBarHeight({\n state,\n descriptors,\n dimensions,\n insets: {\n ...SafeAreaProviderCompat.initialMetrics.insets,\n ...props.safeAreaInsets,\n },\n style: descriptors[state.routes[state.index].key].options.tabBarStyle,\n })\n );\n\n const renderTabBar = () => {\n return (\n \n {(insets) =>\n tabBar({\n state,\n descriptors,\n navigation,\n insets: {\n top: safeAreaInsets?.top ?? insets?.top ?? 0,\n right: safeAreaInsets?.right ?? insets?.right ?? 0,\n bottom: safeAreaInsets?.bottom ?? insets?.bottom ?? 0,\n left: safeAreaInsets?.left ?? insets?.left ?? 0,\n },\n })\n }\n \n );\n };\n\n const { routes } = state;\n\n // If there is no animation, we only have 2 states: visible and invisible\n const hasTwoStates = !routes.some((route) => hasAnimation(descriptors[route.key].options));\n\n const { tabBarPosition = 'bottom' } = descriptors[focusedRouteKey].options;\n\n const tabBarElement = (\n \n {renderTabBar()}\n \n );\n\n return (\n \n {tabBarPosition === 'top' || tabBarPosition === 'left' ? tabBarElement : null}\n \n {routes.map((route, index) => {\n const descriptor = descriptors[route.key];\n const {\n lazy = true,\n animation = 'none',\n sceneStyleInterpolator = NAMED_TRANSITIONS_PRESETS[animation].sceneStyleInterpolator,\n } = descriptor.options;\n const isFocused = state.index === index;\n const isPreloaded = state.preloadedRouteKeys.includes(route.key);\n\n if (lazy && !loaded.includes(route.key) && !isFocused && !isPreloaded) {\n // Don't render a lazy screen if we've never navigated to it or it wasn't preloaded\n return null;\n }\n\n const {\n freezeOnBlur,\n header = ({ layout, options }: BottomTabHeaderProps) => (\n
\n ),\n headerShown,\n headerStatusBarHeight,\n headerTransparent,\n sceneStyle: customSceneStyle,\n } = descriptor.options;\n\n const { sceneStyle } =\n sceneStyleInterpolator?.({\n current: {\n progress: tabAnims[route.key],\n },\n }) ?? {};\n\n const animationEnabled = hasAnimation(descriptor.options);\n const activityState = isFocused\n ? STATE_ON_TOP // the screen is on top after the transition\n : animationEnabled // is animation is not enabled, immediately move to inactive state\n ? tabAnims[route.key].interpolate({\n inputRange: [0, 1 - EPSILON, 1],\n outputRange: [\n STATE_TRANSITIONING_OR_BELOW_TOP, // screen visible during transition\n STATE_TRANSITIONING_OR_BELOW_TOP,\n STATE_INACTIVE, // the screen is detached after transition\n ],\n extrapolate: 'extend',\n })\n : STATE_INACTIVE;\n\n return (\n \n \n ,\n options: descriptor.options,\n })}\n style={[customSceneStyle, animationEnabled && sceneStyle]}>\n {descriptor.render()}\n \n \n \n );\n })}\n \n {tabBarPosition === 'bottom' || tabBarPosition === 'right' ? tabBarElement : null}\n \n );\n}\n\nconst styles = StyleSheet.create({\n screens: {\n flex: 1,\n overflow: 'hidden',\n },\n});\n"]} \ No newline at end of file +{"version":3,"file":"BottomTabView.js","sourceRoot":"","sources":["../../../../src/react-navigation/bottom-tabs/views/BottomTabView.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEb,sCAiPC;;AAjTD,6CAA+B;AAC/B,+CAA8D;AAC9D,mFAAuE;AAEvE,6CAAwF;AACxF,yCAKsB;AACtB,8EAAyF;AAUzF,iDAA+D;AAC/D,qDAAqE;AACrE,kGAA+F;AAC/F,kFAA+E;AAC/E,oEAAiE;AAQjE,MAAM,OAAO,GAAG,IAAI,CAAC;AACrB,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAC3C,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB,MAAM,yBAAyB,GAAG;IAChC,IAAI,EAAE,kCAAc;IACpB,KAAK,EAAE,mCAAe;IACtB,IAAI,EAAE;QACJ,sBAAsB,EAAE,SAAS;QACjC,cAAc,EAAE;YACd,SAAS,EAAE,QAAQ;YACnB,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;SACxB;KACF;CACO,CAAC;AAEX,MAAM,eAAe,GAAG,uBAAQ,CAAC,EAAE,KAAK,KAAK,CAAC;AAE9C,MAAM,YAAY,GAAG,CAAC,OAAmC,EAAE,EAAE;IAC3D,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAE9C,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAS,KAAK,MAAM,CAAC;IAC9B,CAAC;IAED,OAAO,OAAO,CAAC,cAAc,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,m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oCAClB,KAAK,EAAE,UAAU,CAAC,KAAK;oCACvB,UAAU,EAAE,UAAU,CAAC,UAAoD;oCAC3E,OAAO,EAAE,UAAU,CAAC,OAAO;iCAC5B,CAAC,EACF,KAAK,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,IAAI,UAAU,CAAC,YACxD,UAAU,CAAC,MAAM,EAAE,GACb,GAC0B,IAxBhC,KAAK,CAAC,GAAG,CAyBF,CACf,CAAC;gBACJ,CAAC,CAAC,IAjFE,SAAS,CAkFQ,EACtB,cAAc,KAAK,QAAQ,IAAI,cAAc,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,IAC1D,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,QAAQ;KACnB;CACF,CAAC,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { Animated, Platform, StyleSheet } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nimport { getHeaderTitle, Header, SafeAreaProviderCompat, Screen } from '../../elements';\nimport {\n type NavigationAction,\n type ParamListBase,\n StackActions,\n type TabNavigationState,\n} from '../../native';\nimport { FadeTransition, ShiftTransition } from '../TransitionConfigs/TransitionPresets';\nimport type {\n BottomTabBarProps,\n BottomTabDescriptorMap,\n BottomTabHeaderProps,\n BottomTabNavigationConfig,\n BottomTabNavigationHelpers,\n BottomTabNavigationOptions,\n BottomTabNavigationProp,\n} from '../types';\nimport { BottomTabBar, getTabBarHeight } from './BottomTabBar';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\nimport { BottomTabBarHeightCallbackContext } from '../utils/BottomTabBarHeightCallbackContext';\nimport { BottomTabBarHeightContext } from '../utils/BottomTabBarHeightContext';\nimport { useAnimatedHashMap } from '../utils/useAnimatedHashMap';\n\ntype Props = BottomTabNavigationConfig & {\n state: TabNavigationState;\n navigation: BottomTabNavigationHelpers;\n descriptors: BottomTabDescriptorMap;\n};\n\nconst EPSILON = 1e-5;\nconst STATE_INACTIVE = 0;\nconst STATE_TRANSITIONING_OR_BELOW_TOP = 1;\nconst STATE_ON_TOP = 2;\n\nconst NAMED_TRANSITIONS_PRESETS = {\n fade: FadeTransition,\n shift: ShiftTransition,\n none: {\n sceneStyleInterpolator: undefined,\n transitionSpec: {\n animation: 'timing',\n config: { duration: 0 },\n },\n },\n} as const;\n\nconst useNativeDriver = Platform.OS !== 'web';\n\nconst hasAnimation = (options: BottomTabNavigationOptions) => {\n const { animation, transitionSpec } = options;\n\n if (animation) {\n return animation !== 'none';\n }\n\n return Boolean(transitionSpec);\n};\n\nconst renderTabBarDefault = (props: BottomTabBarProps) => ;\n\nexport function BottomTabView(props: Props) {\n const {\n tabBar = renderTabBarDefault,\n state,\n navigation,\n descriptors,\n safeAreaInsets,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n } = props;\n\n const focusedRouteKey = state.routes[state.index]!.key;\n\n /**\n * List of loaded tabs, tabs will be loaded when navigated to.\n */\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n // Set the current tab to be loaded if it was not loaded before\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const previousRouteKeyRef = React.useRef(focusedRouteKey);\n const tabAnims = useAnimatedHashMap(state);\n\n React.useEffect(() => {\n const previousRouteKey = previousRouteKeyRef.current;\n\n let popToTopAction: NavigationAction | undefined;\n\n if (\n previousRouteKey !== focusedRouteKey &&\n descriptors[previousRouteKey]?.options.popToTopOnBlur\n ) {\n const prevRoute = state.routes.find((route) => route.key === previousRouteKey);\n\n if (prevRoute?.state?.type === 'stack' && prevRoute.state.key) {\n popToTopAction = {\n ...StackActions.popToTop(),\n target: prevRoute.state.key,\n };\n }\n }\n\n const animateToIndex = () => {\n if (previousRouteKey !== focusedRouteKey) {\n navigation.emit({\n type: 'transitionStart',\n target: focusedRouteKey,\n });\n }\n\n Animated.parallel(\n state.routes\n .map((route, index) => {\n const { options } = descriptors[route.key]!;\n const {\n animation = 'none',\n transitionSpec = NAMED_TRANSITIONS_PRESETS[animation]!.transitionSpec,\n } = options;\n\n let spec = transitionSpec;\n\n if (route.key !== previousRouteKey && route.key !== focusedRouteKey) {\n // Don't animate if the screen is not previous one or new one\n // This will avoid flicker for screens not involved in the transition\n spec = NAMED_TRANSITIONS_PRESETS.none.transitionSpec;\n }\n\n spec = spec ?? NAMED_TRANSITIONS_PRESETS.none.transitionSpec;\n\n const toValue = index === state.index ? 0 : index >= state.index ? 1 : -1;\n\n return Animated[spec.animation](tabAnims[route.key]!, {\n ...spec.config,\n toValue,\n useNativeDriver,\n });\n })\n .filter(Boolean) as Animated.CompositeAnimation[]\n ).start(({ finished }) => {\n if (finished && popToTopAction) {\n navigation.dispatch(popToTopAction);\n }\n\n if (previousRouteKey !== focusedRouteKey) {\n navigation.emit({\n type: 'transitionEnd',\n target: focusedRouteKey,\n });\n }\n });\n };\n\n animateToIndex();\n\n previousRouteKeyRef.current = focusedRouteKey;\n }, [descriptors, focusedRouteKey, navigation, state.index, state.routes, tabAnims]);\n\n const dimensions = SafeAreaProviderCompat.initialMetrics.frame;\n const [tabBarHeight, setTabBarHeight] = React.useState(() =>\n getTabBarHeight({\n state,\n descriptors,\n dimensions,\n insets: {\n ...SafeAreaProviderCompat.initialMetrics.insets,\n ...props.safeAreaInsets,\n },\n style: descriptors[state.routes[state.index]!.key]!.options.tabBarStyle,\n })\n );\n\n const renderTabBar = () => {\n return (\n \n {(insets) =>\n tabBar({\n state,\n descriptors,\n navigation,\n insets: {\n top: safeAreaInsets?.top ?? insets?.top ?? 0,\n right: safeAreaInsets?.right ?? insets?.right ?? 0,\n bottom: safeAreaInsets?.bottom ?? insets?.bottom ?? 0,\n left: safeAreaInsets?.left ?? insets?.left ?? 0,\n },\n })\n }\n \n );\n };\n\n const { routes } = state;\n\n // If there is no animation, we only have 2 states: visible and invisible\n const hasTwoStates = !routes.some((route) => hasAnimation(descriptors[route.key]!.options));\n\n const { tabBarPosition = 'bottom' } = descriptors[focusedRouteKey]!.options;\n\n const tabBarElement = (\n \n {renderTabBar()}\n \n );\n\n return (\n \n {tabBarPosition === 'top' || tabBarPosition === 'left' ? tabBarElement : null}\n \n {routes.map((route, index) => {\n const descriptor = descriptors[route.key]!;\n const {\n lazy = true,\n animation = 'none',\n sceneStyleInterpolator = NAMED_TRANSITIONS_PRESETS[animation]!.sceneStyleInterpolator,\n } = descriptor.options;\n const isFocused = state.index === index;\n const isPreloaded = state.preloadedRouteKeys.includes(route.key);\n\n if (lazy && !loaded.includes(route.key) && !isFocused && !isPreloaded) {\n // Don't render a lazy screen if we've never navigated to it or it wasn't preloaded\n return null;\n }\n\n const {\n freezeOnBlur,\n header = ({ layout, options }: BottomTabHeaderProps) => (\n
\n ),\n headerShown,\n headerStatusBarHeight,\n headerTransparent,\n sceneStyle: customSceneStyle,\n } = descriptor.options;\n\n const { sceneStyle } =\n sceneStyleInterpolator?.({\n current: {\n progress: tabAnims[route.key]!,\n },\n }) ?? {};\n\n const animationEnabled = hasAnimation(descriptor.options);\n const activityState = isFocused\n ? STATE_ON_TOP // the screen is on top after the transition\n : animationEnabled // is animation is not enabled, immediately move to inactive state\n ? tabAnims[route.key]!.interpolate({\n inputRange: [0, 1 - EPSILON, 1],\n outputRange: [\n STATE_TRANSITIONING_OR_BELOW_TOP, // screen visible during transition\n STATE_TRANSITIONING_OR_BELOW_TOP,\n STATE_INACTIVE, // the screen is detached after transition\n ],\n extrapolate: 'extend',\n })\n : STATE_INACTIVE;\n\n return (\n \n \n ,\n options: descriptor.options,\n })}\n style={[customSceneStyle, animationEnabled && sceneStyle]}>\n {descriptor.render()}\n \n \n \n );\n })}\n \n {tabBarPosition === 'bottom' || tabBarPosition === 'right' ? tabBarElement : null}\n \n );\n}\n\nconst styles = StyleSheet.create({\n screens: {\n flex: 1,\n overflow: 'hidden',\n },\n});\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/core/BaseNavigationContainer.js.map b/packages/expo-router/build/react-navigation/core/BaseNavigationContainer.js.map index d88e8bf424c1ba..c73370dc6fa845 100644 --- a/packages/expo-router/build/react-navigation/core/BaseNavigationContainer.js.map +++ b/packages/expo-router/build/react-navigation/core/BaseNavigationContainer.js.map @@ -1 +1 @@ -{"version":3,"file":"BaseNavigationContainer.js","sourceRoot":"","sources":["../../../src/react-navigation/core/BaseNavigationContainer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFb,0DAsVC;;AA1aD,6CAA+B;AAC/B,iCAA4B;AAE5B,sFAA8D;AAC9D,wCAQoB;AACpB,6FAA0F;AAC1F,mEAAgE;AAChE,yEAAsE;AACtE,mFAAgF;AAChF,yFAAsF;AACtF,qEAAkE;AAClE,qEAAkE;AAClE,yEAAsE;AACtE,2DAAwD;AACxD,iFAAuE;AACvE,yDAAsD;AACtD,2DAAwD;AAMxD,2DAAwD;AACxD,uDAAoD;AACpD,qEAAkE;AAClE,iFAA8E;AAC9E,2DAAwD;AACxD,iDAA8C;AAI9C,MAAM,oBAAoB,GAAa,EAAE,CAAC;AAC1C,MAAM,qBAAqB,GAAa,EAAE,CAAC;AAE3C;;;;GAIG;AACH,MAAM,eAAe,GAAG,CACtB,KAA+B,EACY,EAAE;IAC7C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO;IACT,CAAC;IAED,6DAA6D;IAC7D,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC;IAEnD,OAAO;QACL,GAAG,YAAY;QACf,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACjC,IAAI,KAAK,CAAC,KAAK,KA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from 'react';\n\nimport useLatestCallback from '../../utils/useLatestCallback';\nimport {\n CommonActions,\n type InitialState,\n type NavigationAction,\n type NavigationState,\n type ParamListBase,\n type PartialState,\n type Route,\n} from '../routers';\nimport { DeprecatedNavigationInChildContext } from './DeprecatedNavigationInChildContext';\nimport { EnsureSingleNavigator } from './EnsureSingleNavigator';\nimport { NavigationBuilderContext } from './NavigationBuilderContext';\nimport { NavigationContainerRefContext } from './NavigationContainerRefContext';\nimport { NavigationIndependentTreeContext } from './NavigationIndependentTreeContext';\nimport { NavigationStateContext } from './NavigationStateContext';\nimport { UnhandledActionContext } from './UnhandledActionContext';\nimport { checkDuplicateRouteNames } from './checkDuplicateRouteNames';\nimport { checkSerializable } from './checkSerializable';\nimport { NOT_INITIALIZED_ERROR } from './createNavigationContainerRef';\nimport { findFocusedRoute } from './findFocusedRoute';\nimport { ThemeProvider } from './theming/ThemeProvider';\nimport type {\n NavigationContainerEventMap,\n NavigationContainerProps,\n NavigationContainerRef,\n} from './types';\nimport { useChildListeners } from './useChildListeners';\nimport { useEventEmitter } from './useEventEmitter';\nimport { useKeyedChildListeners } from './useKeyedChildListeners';\nimport { useNavigationIndependentTree } from './useNavigationIndependentTree';\nimport { useOptionsGetters } from './useOptionsGetters';\nimport { useSyncState } from './useSyncState';\n\ntype State = NavigationState | PartialState | undefined;\n\nconst serializableWarnings: string[] = [];\nconst duplicateNameWarnings: string[] = [];\n\n/**\n * Remove `key` and `routeNames` from the state objects recursively to get partial state.\n *\n * @param state Initial state object.\n */\nconst getPartialState = (\n state: InitialState | undefined\n): PartialState | undefined => {\n if (state === undefined) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { key, routeNames, ...partialState } = state;\n\n return {\n ...partialState,\n stale: true,\n routes: state.routes.map((route) => {\n if (route.state === undefined) {\n return route as Route & {\n state?: PartialState;\n };\n }\n\n return { ...route, state: getPartialState(route.state) };\n }),\n };\n};\n\n/**\n * Container component which holds the navigation state.\n * This should be rendered at the root wrapping the whole app.\n *\n * @param props.initialState Initial state object for the navigation tree.\n * @param props.onReady Callback which is called after the navigation tree mounts.\n * @param props.onStateChange Callback which is called with the latest navigation state when it changes.\n * @param props.onUnhandledAction Callback which is called when an action is not handled.\n * @param props.theme Theme object for the UI elements.\n * @param props.children Child elements to render the content.\n * @param props.ref Ref object which refers to the navigation object containing helper methods.\n */\nexport function BaseNavigationContainer({\n ref,\n initialState,\n onStateChange,\n onReady,\n onUnhandledAction,\n navigationInChildEnabled = false,\n theme,\n children,\n}: NavigationContainerProps & { ref?: React.Ref> }) {\n const parent = use(NavigationStateContext);\n const independent = useNavigationIndependentTree();\n\n if (!parent.isDefault && !independent) {\n throw new Error(\n \"Looks like you have nested a 'NavigationContainer' inside another. Normally you need only one container at the root of the app, so this was probably an error. If this was intentional, wrap the container in 'NavigationIndependentTree' explicitly. Note that this will make the child navigators disconnected from the parent and you won't be able to navigate between them.\"\n );\n }\n\n const { state, getState, setState, scheduleUpdate, flushUpdates } = useSyncState(() =>\n getPartialState(initialState == null ? undefined : initialState)\n );\n\n const isFirstMountRef = React.useRef(true);\n\n const navigatorKeyRef = React.useRef(undefined);\n\n const getKey = React.useCallback(() => navigatorKeyRef.current, []);\n\n const setKey = React.useCallback((key: string) => {\n navigatorKeyRef.current = key;\n }, []);\n\n const { listeners, addListener } = useChildListeners();\n\n const { keyedListeners, addKeyedListener } = useKeyedChildListeners();\n\n const dispatch = useLatestCallback(\n (action: NavigationAction | ((state: NavigationState) => NavigationAction)) => {\n if (listeners.focus[0] == null) {\n console.error(NOT_INITIALIZED_ERROR);\n } else {\n listeners.focus[0]((navigation) => navigation.dispatch(action));\n }\n }\n );\n\n const canGoBack = useLatestCallback(() => {\n if (listeners.focus[0] == null) {\n return false;\n }\n\n const { result, handled } = listeners.focus[0]((navigation) => navigation.canGoBack());\n\n if (handled) {\n return result;\n } else {\n return false;\n }\n });\n\n const resetRoot = useLatestCallback((state?: PartialState | NavigationState) => {\n const target = state?.key ?? keyedListeners.getState.root?.().key;\n\n if (target == null) {\n console.error(NOT_INITIALIZED_ERROR);\n } else {\n listeners.focus[0]((navigation) =>\n navigation.dispatch({\n ...CommonActions.reset(state),\n target,\n })\n );\n }\n });\n\n const getRootState = useLatestCallback(() => {\n return keyedListeners.getState.root?.();\n });\n\n const getCurrentRoute = useLatestCallback(() => {\n const state = getRootState();\n\n if (state == null) {\n return undefined;\n }\n\n const route = findFocusedRoute(state);\n\n return route as Route | undefined;\n });\n\n const isReady = useLatestCallback(() => listeners.focus[0] != null);\n\n const emitter = useEventEmitter();\n\n const { addOptionsGetter, getCurrentOptions } = useOptionsGetters({});\n\n const navigation: NavigationContainerRef = React.useMemo(\n () => ({\n ...Object.keys(CommonActions).reduce((acc, name) => {\n acc[name] = (...args: any[]) =>\n // @ts-expect-error: this is ok\n dispatch(CommonActions[name](...args));\n return acc;\n }, {}),\n ...emitter.create('root'),\n dispatch,\n resetRoot,\n isFocused: () => true,\n canGoBack,\n getParent: () => undefined,\n getState,\n getRootState,\n getCurrentRoute,\n getCurrentOptions,\n isReady,\n setOptions: () => {\n throw new Error('Cannot call setOptions outside a screen');\n },\n }),\n [\n canGoBack,\n dispatch,\n emitter,\n getCurrentOptions,\n getCurrentRoute,\n getRootState,\n getState,\n isReady,\n resetRoot,\n ]\n );\n\n React.useImperativeHandle(ref, () => navigation, [navigation]);\n\n const onDispatchAction = useLatestCallback((action: NavigationAction, noop: boolean) => {\n emitter.emit({\n type: '__unsafe_action__',\n data: { action, noop, stack: stackRef.current },\n });\n });\n\n const lastEmittedOptionsRef = React.useRef(undefined);\n\n const onOptionsChange = useLatestCallback((options: object) => {\n if (lastEmittedOptionsRef.current === options) {\n return;\n }\n\n lastEmittedOptionsRef.current = options;\n\n emitter.emit({\n type: 'options',\n data: { options },\n });\n });\n\n const stackRef = React.useRef(undefined);\n\n const builderContext = React.useMemo(\n () => ({\n addListener,\n addKeyedListener,\n onDispatchAction,\n onOptionsChange,\n scheduleUpdate,\n flushUpdates,\n stackRef,\n }),\n [addListener, addKeyedListener, onDispatchAction, onOptionsChange, scheduleUpdate, flushUpdates]\n );\n\n const isInitialRef = React.useRef(true);\n\n const getIsInitial = React.useCallback(() => isInitialRef.current, []);\n\n const context = React.useMemo(\n () => ({\n state,\n getState,\n setState,\n getKey,\n setKey,\n getIsInitial,\n addOptionsGetter,\n }),\n [state, getState, setState, getKey, setKey, getIsInitial, addOptionsGetter]\n );\n\n const onReadyRef = React.useRef(onReady);\n const onStateChangeRef = React.useRef(onStateChange);\n\n React.useEffect(() => {\n isInitialRef.current = false;\n onStateChangeRef.current = onStateChange;\n onReadyRef.current = onReady;\n });\n\n const onReadyCalledRef = React.useRef(false);\n\n React.useEffect(() => {\n if (!onReadyCalledRef.current && isReady()) {\n onReadyCalledRef.current = true;\n onReadyRef.current?.();\n emitter.emit({ type: 'ready' });\n }\n }, [state, isReady, emitter]);\n\n React.useEffect(() => {\n const hydratedState = getRootState();\n\n if (process.env.NODE_ENV !== 'production') {\n if (hydratedState !== undefined) {\n const serializableResult = checkSerializable(hydratedState);\n\n if (!serializableResult.serializable) {\n const { location, reason } = serializableResult;\n\n let path = '';\n let pointer: Record = hydratedState;\n let params = false;\n\n for (let i = 0; i < location.length; i++) {\n const curr = location[i];\n const prev = location[i - 1];\n\n pointer = pointer[curr];\n\n if (!params && curr === 'state') {\n continue;\n } else if (!params && curr === 'routes') {\n if (path) {\n path += ' > ';\n }\n } else if (!params && typeof curr === 'number' && prev === 'routes') {\n path += pointer?.name;\n } else if (!params) {\n path += ` > ${curr}`;\n params = true;\n } else {\n if (typeof curr === 'number' || /^[0-9]+$/.test(curr)) {\n path += `[${curr}]`;\n } else if (/^[a-z$_]+$/i.test(curr)) {\n path += `.${curr}`;\n } else {\n path += `[${JSON.stringify(curr)}]`;\n }\n }\n }\n\n const message = `Non-serializable values were found in the navigation state. Check:\\n\\n${path} (${reason})\\n\\nThis can break usage such as persisting and restoring state. This might happen if you passed non-serializable values such as function, class instances etc. in params. If you need to use components with callbacks in your options, you can use 'navigation.setOptions' instead. See https://reactnavigation.org/docs/troubleshooting#i-get-the-warning-non-serializable-values-were-found-in-the-navigation-state for more details.`;\n\n if (!serializableWarnings.includes(message)) {\n serializableWarnings.push(message);\n console.warn(message);\n }\n }\n\n const duplicateRouteNamesResult = checkDuplicateRouteNames(hydratedState);\n\n if (duplicateRouteNamesResult.length) {\n const message = `Found screens with the same name nested inside one another. Check:\\n${duplicateRouteNamesResult.map(\n (locations) => `\\n${locations.join(', ')}`\n )}\\n\\nThis can cause confusing behavior during navigation. Consider using unique names for each screen instead.`;\n\n if (!duplicateNameWarnings.includes(message)) {\n duplicateNameWarnings.push(message);\n console.warn(message);\n }\n }\n }\n }\n\n emitter.emit({ type: 'state', data: { state } });\n\n if (!isFirstMountRef.current && onStateChangeRef.current) {\n onStateChangeRef.current(hydratedState);\n }\n\n isFirstMountRef.current = false;\n }, [getRootState, emitter, state]);\n\n const defaultOnUnhandledAction = useLatestCallback((action: NavigationAction) => {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n\n const payload: Record | undefined = action.payload;\n\n let message = `The action '${action.type}'${\n payload ? ` with payload ${JSON.stringify(action.payload)}` : ''\n } was not handled by any navigator.`;\n\n switch (action.type) {\n case 'PRELOAD':\n case 'NAVIGATE':\n case 'PUSH':\n case 'REPLACE':\n case 'POP_TO':\n case 'JUMP_TO':\n if (payload?.name) {\n message += `\\n\\nDo you have a screen named '${payload.name}'?\\n\\nIf you're trying to navigate to a screen in a nested navigator, see https://reactnavigation.org/docs/nesting-navigators#navigating-to-a-screen-in-a-nested-navigator.\\n\\nIf you're using conditional rendering, navigation will happen automatically and you shouldn't navigate manually, see.`;\n } else {\n message += `\\n\\nYou need to pass the name of the screen to navigate to.\\n\\nSee https://reactnavigation.org/docs/navigation-actions for usage.`;\n }\n\n break;\n case 'GO_BACK':\n case 'POP':\n case 'POP_TO_TOP':\n message += `\\n\\nIs there any screen to go back to?`;\n break;\n case 'OPEN_DRAWER':\n case 'CLOSE_DRAWER':\n case 'TOGGLE_DRAWER':\n message += `\\n\\nIs your screen inside a Drawer navigator?`;\n break;\n }\n\n message += `\\n\\nThis is a development-only warning and won't be shown in production.`;\n\n console.error(message);\n });\n\n return (\n \n \n \n \n \n \n \n {children}\n \n \n \n \n \n \n \n );\n}\n"]} \ No newline at end of file +{"version":3,"file":"BaseNavigationContainer.js","sourceRoot":"","sources":["../../../src/react-navigation/core/BaseNavigationContainer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFb,0DAsVC;;AA1aD,6CAA+B;AAC/B,iCAA4B;AAE5B,sFAA8D;AAC9D,wCAQoB;AACpB,6FAA0F;AAC1F,mEAAgE;AAChE,yEAAsE;AACtE,mFAAgF;AAChF,yFAAsF;AACtF,qEAAkE;AAClE,qEAAkE;AAClE,yEAAsE;AACtE,2DAAwD;AACxD,iFAAuE;AACvE,yDAAsD;AACtD,2DAAwD;AAMxD,2DAAwD;AACxD,uDAAoD;AACpD,qEAAkE;AAClE,iFAA8E;AAC9E,2DAAwD;AACxD,iDAA8C;AAI9C,MAAM,oBAAoB,GAAa,EAAE,CAAC;AAC1C,MAAM,qBAAqB,GAAa,EAAE,CAAC;AAE3C;;;;GAIG;AACH,MAAM,eAAe,GAAG,CACtB,KAA+B,EACY,EAAE;IAC7C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO;IACT,CAAC;IAED,6DAA6D;IAC7D,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC;IAEnD,OAAO;QACL,GAAG,YAAY;QACf,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACjC,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;gBAC9B,OAAO,KAEN,CAAC;YACJ,CAAC;YAED,OA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AC;YACZ,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS;gBACZ,IAAI,OAAO,EAAE,IAAI,EAAE,CAAC;oBAClB,OAAO,IAAI,mCAAmC,OAAO,CAAC,IAAI,sSAAsS,CAAC;gBACnW,CAAC;qBAAM,CAAC;oBACN,OAAO,IAAI,mIAAmI,CAAC;gBACjJ,CAAC;gBAED,MAAM;YACR,KAAK,SAAS,CAAC;YACf,KAAK,KAAK,CAAC;YACX,KAAK,YAAY;gBACf,OAAO,IAAI,wCAAwC,CAAC;gBACpD,MAAM;YACR,KAAK,aAAa,CAAC;YACnB,KAAK,cAAc,CAAC;YACpB,KAAK,eAAe;gBAClB,OAAO,IAAI,+CAA+C,CAAC;gBAC3D,MAAM;QACV,CAAC;QAED,OAAO,IAAI,0EAA0E,CAAC;QAEtF,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,uBAAC,mEAAgC,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACrD,uBAAC,6DAA6B,CAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,YACvD,uBAAC,mDAAwB,CAAC,QAAQ,IAAC,KAAK,EAAE,cAAc,YACtD,uBAAC,+CAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,YAC7C,uBAAC,+CAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,iBAAiB,IAAI,wBAAwB,YACnF,uBAAC,uEAAkC,CAAC,QAAQ,IAAC,KAAK,EAAE,wBAAwB,YAC1E,uBAAC,6CAAqB,cACpB,uBAAC,6BAAa,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiB,GACjC,GACoB,GACd,GACF,GACA,GACG,GACC,CAC7C,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { use } from 'react';\n\nimport useLatestCallback from '../../utils/useLatestCallback';\nimport {\n CommonActions,\n type InitialState,\n type NavigationAction,\n type NavigationState,\n type ParamListBase,\n type PartialState,\n type Route,\n} from '../routers';\nimport { DeprecatedNavigationInChildContext } from './DeprecatedNavigationInChildContext';\nimport { EnsureSingleNavigator } from './EnsureSingleNavigator';\nimport { NavigationBuilderContext } from './NavigationBuilderContext';\nimport { NavigationContainerRefContext } from './NavigationContainerRefContext';\nimport { NavigationIndependentTreeContext } from './NavigationIndependentTreeContext';\nimport { NavigationStateContext } from './NavigationStateContext';\nimport { UnhandledActionContext } from './UnhandledActionContext';\nimport { checkDuplicateRouteNames } from './checkDuplicateRouteNames';\nimport { checkSerializable } from './checkSerializable';\nimport { NOT_INITIALIZED_ERROR } from './createNavigationContainerRef';\nimport { findFocusedRoute } from './findFocusedRoute';\nimport { ThemeProvider } from './theming/ThemeProvider';\nimport type {\n NavigationContainerEventMap,\n NavigationContainerProps,\n NavigationContainerRef,\n} from './types';\nimport { useChildListeners } from './useChildListeners';\nimport { useEventEmitter } from './useEventEmitter';\nimport { useKeyedChildListeners } from './useKeyedChildListeners';\nimport { useNavigationIndependentTree } from './useNavigationIndependentTree';\nimport { useOptionsGetters } from './useOptionsGetters';\nimport { useSyncState } from './useSyncState';\n\ntype State = NavigationState | PartialState | undefined;\n\nconst serializableWarnings: string[] = [];\nconst duplicateNameWarnings: string[] = [];\n\n/**\n * Remove `key` and `routeNames` from the state objects recursively to get partial state.\n *\n * @param state Initial state object.\n */\nconst getPartialState = (\n state: InitialState | undefined\n): PartialState | undefined => {\n if (state === undefined) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { key, routeNames, ...partialState } = state;\n\n return {\n ...partialState,\n stale: true,\n routes: state.routes.map((route) => {\n if (route.state === undefined) {\n return route as Route & {\n state?: PartialState;\n };\n }\n\n return { ...route, state: getPartialState(route.state) };\n }),\n };\n};\n\n/**\n * Container component which holds the navigation state.\n * This should be rendered at the root wrapping the whole app.\n *\n * @param props.initialState Initial state object for the navigation tree.\n * @param props.onReady Callback which is called after the navigation tree mounts.\n * @param props.onStateChange Callback which is called with the latest navigation state when it changes.\n * @param props.onUnhandledAction Callback which is called when an action is not handled.\n * @param props.theme Theme object for the UI elements.\n * @param props.children Child elements to render the content.\n * @param props.ref Ref object which refers to the navigation object containing helper methods.\n */\nexport function BaseNavigationContainer({\n ref,\n initialState,\n onStateChange,\n onReady,\n onUnhandledAction,\n navigationInChildEnabled = false,\n theme,\n children,\n}: NavigationContainerProps & { ref?: React.Ref> }) {\n const parent = use(NavigationStateContext);\n const independent = useNavigationIndependentTree();\n\n if (!parent.isDefault && !independent) {\n throw new Error(\n \"Looks like you have nested a 'NavigationContainer' inside another. Normally you need only one container at the root of the app, so this was probably an error. If this was intentional, wrap the container in 'NavigationIndependentTree' explicitly. Note that this will make the child navigators disconnected from the parent and you won't be able to navigate between them.\"\n );\n }\n\n const { state, getState, setState, scheduleUpdate, flushUpdates } = useSyncState(() =>\n getPartialState(initialState == null ? undefined : initialState)\n );\n\n const isFirstMountRef = React.useRef(true);\n\n const navigatorKeyRef = React.useRef(undefined);\n\n const getKey = React.useCallback(() => navigatorKeyRef.current, []);\n\n const setKey = React.useCallback((key: string) => {\n navigatorKeyRef.current = key;\n }, []);\n\n const { listeners, addListener } = useChildListeners();\n\n const { keyedListeners, addKeyedListener } = useKeyedChildListeners();\n\n const dispatch = useLatestCallback(\n (action: NavigationAction | ((state: NavigationState) => NavigationAction)) => {\n if (listeners.focus[0] == null) {\n console.error(NOT_INITIALIZED_ERROR);\n } else {\n listeners.focus[0]((navigation) => navigation.dispatch(action));\n }\n }\n );\n\n const canGoBack = useLatestCallback(() => {\n if (listeners.focus[0] == null) {\n return false;\n }\n\n const { result, handled } = listeners.focus[0]((navigation) => navigation.canGoBack());\n\n if (handled) {\n return result;\n } else {\n return false;\n }\n });\n\n const resetRoot = useLatestCallback((state?: PartialState | NavigationState) => {\n const target = state?.key ?? keyedListeners.getState.root?.().key;\n\n if (target == null) {\n console.error(NOT_INITIALIZED_ERROR);\n } else {\n listeners.focus[0]!((navigation) =>\n navigation.dispatch({\n ...CommonActions.reset(state),\n target,\n })\n );\n }\n });\n\n const getRootState = useLatestCallback(() => {\n return keyedListeners.getState.root?.();\n });\n\n const getCurrentRoute = useLatestCallback(() => {\n const state = getRootState();\n\n if (state == null) {\n return undefined;\n }\n\n const route = findFocusedRoute(state);\n\n return route as Route | undefined;\n });\n\n const isReady = useLatestCallback(() => listeners.focus[0] != null);\n\n const emitter = useEventEmitter();\n\n const { addOptionsGetter, getCurrentOptions } = useOptionsGetters({});\n\n const navigation: NavigationContainerRef = React.useMemo(\n () => ({\n ...Object.keys(CommonActions).reduce((acc, name) => {\n acc[name] = (...args: any[]) =>\n // @ts-expect-error: this is ok\n dispatch(CommonActions[name](...args));\n return acc;\n }, {}),\n ...emitter.create('root'),\n dispatch,\n resetRoot,\n isFocused: () => true,\n canGoBack,\n getParent: () => undefined,\n getState,\n getRootState,\n getCurrentRoute,\n getCurrentOptions,\n isReady,\n setOptions: () => {\n throw new Error('Cannot call setOptions outside a screen');\n },\n }),\n [\n canGoBack,\n dispatch,\n emitter,\n getCurrentOptions,\n getCurrentRoute,\n getRootState,\n getState,\n isReady,\n resetRoot,\n ]\n );\n\n React.useImperativeHandle(ref, () => navigation, [navigation]);\n\n const onDispatchAction = useLatestCallback((action: NavigationAction, noop: boolean) => {\n emitter.emit({\n type: '__unsafe_action__',\n data: { action, noop, stack: stackRef.current },\n });\n });\n\n const lastEmittedOptionsRef = React.useRef(undefined);\n\n const onOptionsChange = useLatestCallback((options: object) => {\n if (lastEmittedOptionsRef.current === options) {\n return;\n }\n\n lastEmittedOptionsRef.current = options;\n\n emitter.emit({\n type: 'options',\n data: { options },\n });\n });\n\n const stackRef = React.useRef(undefined);\n\n const builderContext = React.useMemo(\n () => ({\n addListener,\n addKeyedListener,\n onDispatchAction,\n onOptionsChange,\n scheduleUpdate,\n flushUpdates,\n stackRef,\n }),\n [addListener, addKeyedListener, onDispatchAction, onOptionsChange, scheduleUpdate, flushUpdates]\n );\n\n const isInitialRef = React.useRef(true);\n\n const getIsInitial = React.useCallback(() => isInitialRef.current, []);\n\n const context = React.useMemo(\n () => ({\n state,\n getState,\n setState,\n getKey,\n setKey,\n getIsInitial,\n addOptionsGetter,\n }),\n [state, getState, setState, getKey, setKey, getIsInitial, addOptionsGetter]\n );\n\n const onReadyRef = React.useRef(onReady);\n const onStateChangeRef = React.useRef(onStateChange);\n\n React.useEffect(() => {\n isInitialRef.current = false;\n onStateChangeRef.current = onStateChange;\n onReadyRef.current = onReady;\n });\n\n const onReadyCalledRef = React.useRef(false);\n\n React.useEffect(() => {\n if (!onReadyCalledRef.current && isReady()) {\n onReadyCalledRef.current = true;\n onReadyRef.current?.();\n emitter.emit({ type: 'ready' });\n }\n }, [state, isReady, emitter]);\n\n React.useEffect(() => {\n const hydratedState = getRootState();\n\n if (process.env.NODE_ENV !== 'production') {\n if (hydratedState !== undefined) {\n const serializableResult = checkSerializable(hydratedState);\n\n if (!serializableResult.serializable) {\n const { location, reason } = serializableResult;\n\n let path = '';\n let pointer: Record = hydratedState;\n let params = false;\n\n for (let i = 0; i < location.length; i++) {\n const curr = location[i]!;\n const prev = location[i - 1];\n\n pointer = pointer[curr];\n\n if (!params && curr === 'state') {\n continue;\n } else if (!params && curr === 'routes') {\n if (path) {\n path += ' > ';\n }\n } else if (!params && typeof curr === 'number' && prev === 'routes') {\n path += pointer?.name;\n } else if (!params) {\n path += ` > ${curr}`;\n params = true;\n } else {\n if (typeof curr === 'number' || /^[0-9]+$/.test(curr)) {\n path += `[${curr}]`;\n } else if (/^[a-z$_]+$/i.test(curr)) {\n path += `.${curr}`;\n } else {\n path += `[${JSON.stringify(curr)}]`;\n }\n }\n }\n\n const message = `Non-serializable values were found in the navigation state. Check:\\n\\n${path} (${reason})\\n\\nThis can break usage such as persisting and restoring state. This might happen if you passed non-serializable values such as function, class instances etc. in params. If you need to use components with callbacks in your options, you can use 'navigation.setOptions' instead. See https://reactnavigation.org/docs/troubleshooting#i-get-the-warning-non-serializable-values-were-found-in-the-navigation-state for more details.`;\n\n if (!serializableWarnings.includes(message)) {\n serializableWarnings.push(message);\n console.warn(message);\n }\n }\n\n const duplicateRouteNamesResult = checkDuplicateRouteNames(hydratedState);\n\n if (duplicateRouteNamesResult.length) {\n const message = `Found screens with the same name nested inside one another. Check:\\n${duplicateRouteNamesResult.map(\n (locations) => `\\n${locations.join(', ')}`\n )}\\n\\nThis can cause confusing behavior during navigation. Consider using unique names for each screen instead.`;\n\n if (!duplicateNameWarnings.includes(message)) {\n duplicateNameWarnings.push(message);\n console.warn(message);\n }\n }\n }\n }\n\n emitter.emit({ type: 'state', data: { state } });\n\n if (!isFirstMountRef.current && onStateChangeRef.current) {\n onStateChangeRef.current(hydratedState);\n }\n\n isFirstMountRef.current = false;\n }, [getRootState, emitter, state]);\n\n const defaultOnUnhandledAction = useLatestCallback((action: NavigationAction) => {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n\n const payload: Record | undefined = action.payload;\n\n let message = `The action '${action.type}'${\n payload ? ` with payload ${JSON.stringify(action.payload)}` : ''\n } was not handled by any navigator.`;\n\n switch (action.type) {\n case 'PRELOAD':\n case 'NAVIGATE':\n case 'PUSH':\n case 'REPLACE':\n case 'POP_TO':\n case 'JUMP_TO':\n if (payload?.name) {\n message += `\\n\\nDo you have a screen named '${payload.name}'?\\n\\nIf you're trying to navigate to a screen in a nested navigator, see https://reactnavigation.org/docs/nesting-navigators#navigating-to-a-screen-in-a-nested-navigator.\\n\\nIf you're using conditional rendering, navigation will happen automatically and you shouldn't navigate manually, see.`;\n } else {\n message += `\\n\\nYou need to pass the name of the screen to navigate to.\\n\\nSee https://reactnavigation.org/docs/navigation-actions for usage.`;\n }\n\n break;\n case 'GO_BACK':\n case 'POP':\n case 'POP_TO_TOP':\n message += `\\n\\nIs there any screen to go back to?`;\n break;\n case 'OPEN_DRAWER':\n case 'CLOSE_DRAWER':\n case 'TOGGLE_DRAWER':\n message += `\\n\\nIs your screen inside a Drawer navigator?`;\n break;\n }\n\n message += `\\n\\nThis is a development-only warning and won't be shown in production.`;\n\n console.error(message);\n });\n\n return (\n \n \n \n \n \n \n \n {children}\n \n \n \n \n \n \n \n );\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/core/findFocusedRoute.js.map b/packages/expo-router/build/react-navigation/core/findFocusedRoute.js.map index 686da54d789195..823ea2da365289 100644 --- a/packages/expo-router/build/react-navigation/core/findFocusedRoute.js.map +++ b/packages/expo-router/build/react-navigation/core/findFocusedRoute.js.map @@ -1 +1 @@ -{"version":3,"file":"findFocusedRoute.js","sourceRoot":"","sources":["../../../src/react-navigation/core/findFocusedRoute.tsx"],"names":[],"mappings":";;AAWA,4CAUC;AAVD,SAAgB,gBAAgB,CAAC,KAAmB;IAClD,IAAI,OAAO,GAA6B,KAAK,CAAC;IAE9C,OAAO,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;QACzD,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACrD,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;IAEnD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import type { InitialState } from '../routers';\n\ntype Result =\n | {\n key?: string;\n name: string;\n params?: object;\n path?: string;\n }\n | undefined;\n\nexport function findFocusedRoute(state: InitialState): Result {\n let current: InitialState | undefined = state;\n\n while (current?.routes[current.index ?? 0].state != null) {\n current = current.routes[current.index ?? 0].state;\n }\n\n const route = current?.routes[current?.index ?? 0];\n\n return route;\n}\n"]} \ No newline at end of file +{"version":3,"file":"findFocusedRoute.js","sourceRoot":"","sources":["../../../src/react-navigation/core/findFocusedRoute.tsx"],"names":[],"mappings":";;AAWA,4CAUC;AAVD,SAAgB,gBAAgB,CAAC,KAAmB;IAClD,IAAI,OAAO,GAA6B,KAAK,CAAC;IAE9C,OAAO,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAE,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;QAC1D,OAAO,GAAG,OAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAE,CAAC,KAAK,CAAC;IACvD,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;IAEnD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import type { InitialState } from '../routers';\n\ntype Result =\n | {\n key?: string;\n name: string;\n params?: object;\n path?: string;\n }\n | undefined;\n\nexport function findFocusedRoute(state: InitialState): Result {\n let current: InitialState | undefined = state;\n\n while (current?.routes[current.index ?? 0]!.state != null) {\n current = current!.routes[current.index ?? 0]!.state;\n }\n\n const route = current?.routes[current?.index ?? 0];\n\n return route;\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/core/getActionFromState.d.ts.map b/packages/expo-router/build/react-navigation/core/getActionFromState.d.ts.map index a85a58070f9258..95998f978cda56 100644 --- a/packages/expo-router/build/react-navigation/core/getActionFromState.d.ts.map +++ b/packages/expo-router/build/react-navigation/core/getActionFromState.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"getActionFromState.d.ts","sourceRoot":"","sources":["../../../src/react-navigation/core/getActionFromState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAGf,YAAY,EAEb,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,qBAAqB,EAAc,aAAa,EAAE,MAAM,SAAS,CAAC;AAOhF,KAAK,OAAO,GAAG;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAChC,CAAC;AAEF,KAAK,cAAc,CAAC,KAAK,SAAS,eAAe,IAAI;IACnD,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,qBAAqB,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,CAAC,eAAe,CAAC,EACpC,OAAO,CAAC,EAAE,OAAO,GAChB,cAAc,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC,MAAM,GAAG,SAAS,CA6HpE"} \ No newline at end of file +{"version":3,"file":"getActionFromState.d.ts","sourceRoot":"","sources":["../../../src/react-navigation/core/getActionFromState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAiB,YAAY,EAAE,MAAM,YAAY,CAAC;AAC9F,OAAO,KAAK,EAAE,qBAAqB,EAAc,aAAa,EAAE,MAAM,SAAS,CAAC;AAOhF,KAAK,OAAO,GAAG;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAChC,CAAC;AAEF,KAAK,cAAc,CAAC,KAAK,SAAS,eAAe,IAAI;IACnD,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,qBAAqB,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,CAAC,eAAe,CAAC,EACpC,OAAO,CAAC,EAAE,OAAO,GAChB,cAAc,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC,MAAM,GAAG,SAAS,CA+HpE"} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/core/getActionFromState.js b/packages/expo-router/build/react-navigation/core/getActionFromState.js index 98ac648f37051b..e0655c6666d5c7 100644 --- a/packages/expo-router/build/react-navigation/core/getActionFromState.js +++ b/packages/expo-router/build/react-navigation/core/getActionFromState.js @@ -21,9 +21,10 @@ function getActionFromState(state, options) { }; } const route = state.routes[state.index ?? state.routes.length - 1]; + // TODO(@kitten): The `route` here was treated as optional, but `config` is treated as non-optional. Looks fishy let current = route?.state; - let config = normalizedConfig?.screens?.[route?.name]; - let params = { ...route.params }; + let config = route != null ? normalizedConfig?.screens?.[route.name] : undefined; + let params = { ...route?.params }; const payload = route ? { name: route.name, path: route.path, params } : undefined; // If the screen contains a navigator, pop other screens to navigate to it // This avoid pushing multiple instances of navigators onto a stack diff --git a/packages/expo-router/build/react-navigation/core/getActionFromState.js.map b/packages/expo-router/build/react-navigation/core/getActionFromState.js.map index c7447d9ba3ffd6..94e81a2ddcf32c 100644 --- a/packages/expo-router/build/react-navigation/core/getActionFromState.js.map +++ b/packages/expo-router/build/react-navigation/core/getActionFromState.js.map @@ -1 +1 @@ -{"version":3,"file":"getActionFromState.js","sourceRoot":"","sources":["../../../src/react-navigation/core/getActionFromState.tsx"],"names":[],"mappings":";;AA6BA,gDAgIC;AAhID,SAAgB,kBAAkB,CAChC,KAAoC,EACpC,OAAiB;IAEjB,iEAAiE;IACjE,MAAM,gBAAgB,GAAG,OAAO;QAC9B,CAAC,CAAC,0BAA0B,CAAC,OAAsC,CAAC;QACpE,CAAC,CAAC,EAAE,CAAC;IAEP,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;IAE3F,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IACE,CAAC,C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,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;KACtF;IACH,CAAC,CAAC,EAAE,CAAC;AAET,MAAM,uBAAuB,GAAG,CAAC,OAA8B,EAAE,EAAE,CACjE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAA6B,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;IACzE,GAAG,CAAC,CAAC,CAAC,GAAG,0BAA0B,CAAC,CAAC,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC;AACb,CAAC,EAAE,EAAE,CAAC,CAAC","sourcesContent":["import type {\n CommonActions,\n NavigationState,\n ParamListBase,\n PartialRoute,\n PartialState,\n Route,\n} from '../routers';\nimport type { NavigatorScreenParams, PathConfig, PathConfigMap } from './types';\n\ntype ConfigItem = {\n initialRouteName?: string;\n screens?: Record;\n};\n\ntype Options = {\n initialRouteName?: string;\n screens: PathConfigMap;\n};\n\ntype NavigateAction = {\n type: 'NAVIGATE';\n payload: {\n name: string;\n params?: NavigatorScreenParams;\n path?: string;\n };\n};\n\nexport function getActionFromState(\n state: PartialState,\n options?: Options\n): NavigateAction | CommonActions.Action | undefined {\n // Create a normalized configs object which will be easier to use\n const normalizedConfig = options\n ? createNormalizedConfigItem(options as PathConfig | string)\n : {};\n\n const routes = state.index != null ? state.routes.slice(0, state.index + 1) : state.routes;\n\n if (routes.length === 0) {\n return undefined;\n }\n\n if (\n !(\n (routes.length === 1 && routes[0].key === undefined) ||\n (routes.length === 2 &&\n routes[0].key === undefined &&\n routes[0].name === normalizedConfig?.initialRouteName &&\n routes[1].key === undefined)\n )\n ) {\n return {\n type: 'RESET',\n payload: state,\n };\n }\n\n const route = state.routes[state.index ?? state.routes.length - 1];\n\n let current: PartialState | undefined = route?.state;\n let config: ConfigItem | undefined = normalizedConfig?.screens?.[route?.name];\n let params = { ...route.params } as NavigatorScreenParams;\n\n const payload:\n | {\n name: string;\n params: NavigatorScreenParams;\n path?: string;\n pop?: boolean;\n }\n | undefined = route ? { name: route.name, path: route.path, params } : undefined;\n\n // If the screen contains a navigator, pop other screens to navigate to it\n // This avoid pushing multiple instances of navigators onto a stack\n //\n // For example:\n // - RootStack\n // - BottomTabs\n // - SomeScreen\n //\n // In this case, if deep linking to `BottomTabs`, we should pop `SomeScreen`\n // Otherwise, we'll end up with 2 instances of `BottomTabs` in the stack\n //\n // There are 2 ways we can detect if a screen contains a navigator:\n // - The route contains nested state in `route.state`\n // - Nested screens are defined in the config\n if (payload && config?.screens && Object.keys(config.screens).length) {\n payload.pop = true;\n }\n\n while (current) {\n if (current.routes.length === 0) {\n return undefined;\n }\n\n const routes =\n current.index != null ? current.routes.slice(0, current.index + 1) : current.routes;\n\n const route: Route | PartialRoute> = routes[routes.length - 1];\n\n // Explicitly set to override existing value when merging params\n Object.assign(params, {\n initial: undefined,\n screen: undefined,\n params: undefined,\n state: undefined,\n });\n\n if (routes.length === 1 && routes[0].key === undefined) {\n params.initial = true;\n params.screen = route.name;\n } else if (\n routes.length === 2 &&\n routes[0].key === undefined &&\n routes[0].name === config?.initialRouteName &&\n routes[1].key === undefined\n ) {\n params.initial = false;\n params.screen = route.name;\n } else {\n params.state = current;\n break;\n }\n\n if (route.state) {\n params.params = { ...route.params };\n params.pop = true;\n params = params.params as NavigatorScreenParams;\n } else {\n params.path = route.path;\n params.params = route.params;\n }\n\n current = route.state;\n config = config?.screens?.[route.name];\n\n if (config?.screens && Object.keys(config.screens).length) {\n params.pop = true;\n }\n }\n\n if (payload?.params.screen || payload?.params.state) {\n payload.pop = true;\n }\n\n if (!payload) {\n return;\n }\n\n // Try to construct payload for a `NAVIGATE` action from the state\n // This lets us preserve the navigation state and not lose it\n return {\n type: 'NAVIGATE',\n payload,\n };\n}\n\nconst createNormalizedConfigItem = (config: PathConfig | string) =>\n typeof config === 'object' && config != null\n ? {\n initialRouteName: config.initialRouteName,\n screens: config.screens != null ? createNormalizedConfigs(config.screens) : undefined,\n }\n : {};\n\nconst createNormalizedConfigs = (options: PathConfigMap) =>\n Object.entries(options).reduce>((acc, [k, v]) => {\n acc[k] = createNormalizedConfigItem(v);\n return acc;\n }, {});\n"]} \ No newline at end of file +{"version":3,"file":"getActionFromState.js","sourceRoot":"","sources":["../../../src/react-navigation/core/getActionFromState.tsx"],"names":[],"mappings":";;AAsBA,gDAkIC;AAlID,SAAgB,kBAAkB,CAChC,KAAoC,EACpC,OAAiB;IAEjB,iEAAiE;IACjE,MAAM,gBAAgB,GAAG,OAAO;QAC9B,CAAC,CAAC,0BAA0B,CAAC,OAAsC,CAAC;QACpE,CAAC,CAAC,EAAE,CAAC;IAEP,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;IAE3F,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IACE,CAAC,CACC,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,CAAC,CAAE,CAAC,GAAG,KAAK,SAAS,CAAC;QACrD,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;YAClB,MAAM,CAAC,CAAC,CAAE,CAAC,GAAG,KAAK,SAAS;YAC5B,MAAM,CAAC,CAAC,CAAE,CAAC,IAAI,KAAK,gBAAgB,EAAE,gBAAgB;YACtD,MAAM,CAAC,CAAC,CAAE,CAAC,GAAG,KAAK,SAAS,CAAC,CAChC,EACD,CAAC;QACD,OAAO;YACL,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,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AK,CAAC,IAAI,CAAC,CAAC;QAEvC,IAAI,MAAM,EAAE,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;YAC1D,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC;QACpB,CAAC;IACH,CAAC;IAED,IAAI,OAAO,EAAE,MAAM,CAAC,MAAM,IAAI,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;QACpD,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;IACT,CAAC;IAED,kEAAkE;IAClE,6DAA6D;IAC7D,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,OAAO;KACR,CAAC;AACJ,CAAC;AAED,MAAM,0BAA0B,GAAG,CAAC,MAAmC,EAAE,EAAE,CACzE,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,IAAI;IAC1C,CAAC,CAAC;QACE,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,uBAAuB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;KACtF;IACH,CAAC,CAAC,EAAE,CAAC;AAET,MAAM,uBAAuB,GAAG,CAAC,OAA8B,EAAE,EAAE,CACjE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAA6B,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;IACzE,GAAG,CAAC,CAAC,CAAC,GAAG,0BAA0B,CAAC,CAAC,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC;AACb,CAAC,EAAE,EAAE,CAAC,CAAC","sourcesContent":["import type { CommonActions, NavigationState, ParamListBase, PartialState } from '../routers';\nimport type { NavigatorScreenParams, PathConfig, PathConfigMap } from './types';\n\ntype ConfigItem = {\n initialRouteName?: string;\n screens?: Record;\n};\n\ntype Options = {\n initialRouteName?: string;\n screens: PathConfigMap;\n};\n\ntype NavigateAction = {\n type: 'NAVIGATE';\n payload: {\n name: string;\n params?: NavigatorScreenParams;\n path?: string;\n };\n};\n\nexport function getActionFromState(\n state: PartialState,\n options?: Options\n): NavigateAction | CommonActions.Action | undefined {\n // Create a normalized configs object which will be easier to use\n const normalizedConfig = options\n ? createNormalizedConfigItem(options as PathConfig | string)\n : {};\n\n const routes = state.index != null ? state.routes.slice(0, state.index + 1) : state.routes;\n\n if (routes.length === 0) {\n return undefined;\n }\n\n if (\n !(\n (routes.length === 1 && routes[0]!.key === undefined) ||\n (routes.length === 2 &&\n routes[0]!.key === undefined &&\n routes[0]!.name === normalizedConfig?.initialRouteName &&\n routes[1]!.key === undefined)\n )\n ) {\n return {\n type: 'RESET',\n payload: state,\n };\n }\n\n const route = state.routes[state.index ?? state.routes.length - 1];\n\n // TODO(@kitten): The `route` here was treated as optional, but `config` is treated as non-optional. Looks fishy\n let current: PartialState | undefined = route?.state;\n let config: ConfigItem | undefined =\n route != null ? normalizedConfig?.screens?.[route.name] : undefined;\n let params = { ...route?.params } as NavigatorScreenParams;\n\n const payload:\n | {\n name: string;\n params: NavigatorScreenParams;\n path?: string;\n pop?: boolean;\n }\n | undefined = route ? { name: route.name, path: route.path, params } : undefined;\n\n // If the screen contains a navigator, pop other screens to navigate to it\n // This avoid pushing multiple instances of navigators onto a stack\n //\n // For example:\n // - RootStack\n // - BottomTabs\n // - SomeScreen\n //\n // In this case, if deep linking to `BottomTabs`, we should pop `SomeScreen`\n // Otherwise, we'll end up with 2 instances of `BottomTabs` in the stack\n //\n // There are 2 ways we can detect if a screen contains a navigator:\n // - The route contains nested state in `route.state`\n // - Nested screens are defined in the config\n if (payload && config?.screens && Object.keys(config.screens).length) {\n payload.pop = true;\n }\n\n while (current) {\n if (current.routes.length === 0) {\n return undefined;\n }\n\n const routes =\n current.index != null ? current.routes.slice(0, current.index + 1) : current.routes;\n\n const route = routes[routes.length - 1]!;\n\n // Explicitly set to override existing value when merging params\n Object.assign(params, {\n initial: undefined,\n screen: undefined,\n params: undefined,\n state: undefined,\n });\n\n if (routes.length === 1 && routes[0]!.key === undefined) {\n params.initial = true;\n params.screen = route.name;\n } else if (\n routes.length === 2 &&\n routes[0]!.key === undefined &&\n routes[0]!.name === config?.initialRouteName &&\n routes[1]!.key === undefined\n ) {\n params.initial = false;\n params.screen = route.name;\n } else {\n params.state = current;\n break;\n }\n\n if (route.state!) {\n params.params = { ...route.params };\n params.pop = true;\n params = params.params as NavigatorScreenParams;\n } else {\n params.path = route.path;\n params.params = route.params;\n }\n\n current = route.state!;\n config = config?.screens?.[route.name];\n\n if (config?.screens && Object.keys(config.screens).length) {\n params.pop = true;\n }\n }\n\n if (payload?.params.screen || payload?.params.state) {\n payload.pop = true;\n }\n\n if (!payload) {\n return;\n }\n\n // Try to construct payload for a `NAVIGATE` action from the state\n // This lets us preserve the navigation state and not lose it\n return {\n type: 'NAVIGATE',\n payload,\n };\n}\n\nconst createNormalizedConfigItem = (config: PathConfig | string) =>\n typeof config === 'object' && config != null\n ? {\n initialRouteName: config.initialRouteName,\n screens: config.screens != null ? createNormalizedConfigs(config.screens) : undefined,\n }\n : {};\n\nconst createNormalizedConfigs = (options: PathConfigMap) =>\n Object.entries(options).reduce>((acc, [k, v]) => {\n acc[k] = createNormalizedConfigItem(v);\n return acc;\n }, {});\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/core/getPathFromState.d.ts.map b/packages/expo-router/build/react-navigation/core/getPathFromState.d.ts.map index fe0aa9548d13ca..47ce305dcd1eed 100644 --- a/packages/expo-router/build/react-navigation/core/getPathFromState.d.ts.map +++ b/packages/expo-router/build/react-navigation/core/getPathFromState.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"getPathFromState.d.ts","sourceRoot":"","sources":["../../../src/react-navigation/core/getPathFromState.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAS,MAAM,YAAY,CAAC;AAEvE,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,SAAS,CAAC;AAGzD,KAAK,OAAO,CAAC,SAAS,SAAS,MAAM,IAAI;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACnC,CAAC;AAEF,KAAK,KAAK,GAAG,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC,CAAC;AAuC5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,SAAS,MAAM,EACvD,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAC3B,MAAM,CA2LR"} \ No newline at end of file +{"version":3,"file":"getPathFromState.d.ts","sourceRoot":"","sources":["../../../src/react-navigation/core/getPathFromState.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAS,MAAM,YAAY,CAAC;AAEvE,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,SAAS,CAAC;AAGzD,KAAK,OAAO,CAAC,SAAS,SAAS,MAAM,IAAI;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACnC,CAAC;AAEF,KAAK,KAAK,GAAG,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC,CAAC;AAqC5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,SAAS,MAAM,EACvD,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAC3B,MAAM,CA2LR"} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/core/getPathFromState.js b/packages/expo-router/build/react-navigation/core/getPathFromState.js index 75e7f6a94a0f65..43fb0dc87387d9 100644 --- a/packages/expo-router/build/react-navigation/core/getPathFromState.js +++ b/packages/expo-router/build/react-navigation/core/getPathFromState.js @@ -38,9 +38,7 @@ const queryString = __importStar(require("query-string")); const getPatternParts_1 = require("./getPatternParts"); const validatePathConfig_1 = require("./validatePathConfig"); const getActiveRoute = (state) => { - const route = typeof state.index === 'number' - ? state.routes[state.index] - : state.routes[state.routes.length - 1]; + const route = state.index != null ? state.routes[state.index] : state.routes[state.routes.length - 1]; if (route.state) { return getActiveRoute(route.state); } diff --git a/packages/expo-router/build/react-navigation/core/getPathFromState.js.map b/packages/expo-router/build/react-navigation/core/getPathFromState.js.map index 017581c333e0c8..d58db7e89b8f7f 100644 --- a/packages/expo-router/build/react-navigation/core/getPathFromState.js.map +++ b/packages/expo-router/build/react-navigation/core/getPathFromState.js.map @@ -1 +1 @@ -{"version":3,"file":"getPathFromState.js","sourceRoot":"","sources":["../../../src/react-navigation/core/getPathFromState.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,4CA8LC;AA/QD,0DAA4C;AAG5C,uDAAsE;AAEtE,6DAA0D;AAkB1D,MAAM,cAAc,GAAG,CAAC,KAAY,EAAqC,EAAE;IACzE,MAAM,KAAK,GACT,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;QAC7B,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;QAC3B,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE5C,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED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S,CAAC;IAE5F,OAAO;QACL,KAAK;QACL,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,OAAO;KACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAC9B,OAA8B,EAC9B,KAAqB,EACO,EAAE,CAC9B,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE;IACxC,MAAM,MAAM,GAAG,gBAAgB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAE1C,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACxB,CAAC,CAAC,CACH,CAAC","sourcesContent":["import * as queryString from 'query-string';\n\nimport type { NavigationState, PartialState, Route } from '../routers';\nimport { getPatternParts, type PatternPart } from './getPatternParts';\nimport type { PathConfig, PathConfigMap } from './types';\nimport { validatePathConfig } from './validatePathConfig';\n\ntype Options = {\n path?: string;\n initialRouteName?: string;\n screens: PathConfigMap;\n};\n\ntype State = NavigationState | Omit, 'stale'>;\n\ntype StringifyConfig = Record string>;\n\ntype ConfigItem = {\n parts?: PatternPart[];\n stringify?: StringifyConfig;\n screens?: Record;\n};\n\nconst getActiveRoute = (state: State): { name: string; params?: object } => {\n const route =\n typeof state.index === 'number'\n ? state.routes[state.index]\n : state.routes[state.routes.length - 1];\n\n if (route.state) {\n return getActiveRoute(route.state);\n }\n\n return route;\n};\n\nconst cachedNormalizedConfigs = new WeakMap, Record>();\n\nconst getNormalizedConfigs = (options?: Options) => {\n if (!options?.screens) return {};\n\n const cached = cachedNormalizedConfigs.get(options?.screens);\n\n if (cached) return cached;\n\n const normalizedConfigs = createNormalizedConfigs(options.screens);\n\n cachedNormalizedConfigs.set(options.screens, normalizedConfigs);\n\n return normalizedConfigs;\n};\n\n/**\n * Utility to serialize a navigation state object to a path string.\n *\n * @example\n * ```js\n * getPathFromState(\n * {\n * routes: [\n * {\n * name: 'Chat',\n * params: { author: 'Jane', id: 42 },\n * },\n * ],\n * },\n * {\n * screens: {\n * Chat: {\n * path: 'chat/:author/:id',\n * stringify: { author: author => author.toLowerCase() }\n * }\n * }\n * }\n * )\n * ```\n *\n * @param state Navigation state to serialize.\n * @param options Extra options to fine-tune how to serialize the path.\n * @returns Path representing the state, e.g. /foo/bar?count=42.\n */\nexport function getPathFromState(\n state: State,\n options?: Options\n): string {\n if (state == null) {\n throw Error(\n `Got '${String(state)}' for the navigation state. You must pass a valid state object.`\n );\n }\n\n if (options) {\n validatePathConfig(options);\n }\n\n const configs = getNormalizedConfigs(options);\n\n let path = '/';\n let current: State | undefined = state;\n\n const allParams: Record = {};\n\n while (current) {\n let index = typeof current.index === 'number' ? current.index : 0;\n let route = current.routes[index] as Route & {\n state?: State;\n };\n\n let parts: PatternPart[] | undefined;\n\n let focusedParams: Record | undefined;\n let currentOptions = configs;\n\n const focusedRoute = getActiveRoute(state);\n\n // Keep all the route names that appeared during going deeper in config in case the pattern is resolved to undefined\n const nestedRouteNames = [];\n\n let hasNext = true;\n\n while (route.name in currentOptions && hasNext) {\n parts = currentOptions[route.name].parts;\n\n nestedRouteNames.push(route.name);\n\n if (route.params) {\n const options = currentOptions[route.name];\n\n const currentParams = Object.fromEntries(\n Object.entries(route.params)\n .map(([key, value]): [string, string] | null => {\n if (value === undefined) {\n if (options) {\n const optional = options.parts?.find((part) => part.param === key)?.optional;\n\n if (optional) {\n return null;\n }\n } else {\n return null;\n }\n }\n\n const stringify = options?.stringify?.[key] ?? String;\n\n return [key, stringify(value)];\n })\n .filter((entry) => entry != null)\n );\n\n if (parts?.length) {\n Object.assign(allParams, currentParams);\n }\n\n if (focusedRoute === route) {\n // If this is the focused route, keep the params for later use\n // We save it here since it's been stringified already\n focusedParams = { ...currentParams };\n\n parts\n // eslint-disable-next-line no-loop-func\n ?.forEach(({ param }) => {\n if (param) {\n // Remove the params present in the pattern since we'll only use the rest for query string\n if (focusedParams) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete focusedParams[param];\n }\n }\n });\n }\n }\n\n // If there is no `screens` property or no nested state, we return pattern\n if (!currentOptions[route.name].screens || route.state === undefined) {\n hasNext = false;\n } else {\n index =\n typeof route.state.index === 'number' ? route.state.index : route.state.routes.length - 1;\n\n const nextRoute = route.state.routes[index];\n const nestedConfig = currentOptions[route.name].screens;\n\n // if there is config for next route name, we go deeper\n if (nestedConfig && nextRoute.name in nestedConfig) {\n route = nextRoute as Route & { state?: State };\n currentOptions = nestedConfig;\n } else {\n // If not, there is no sense in going deeper in config\n hasNext = false;\n }\n }\n }\n\n if (currentOptions[route.name] !== undefined) {\n path += parts\n ?.map(({ segment, param, optional }) => {\n // We don't know what to show for wildcard patterns\n // Showing the route name seems ok, though whatever we show here will be incorrect\n // Since the page doesn't actually exist\n if (segment === '*') {\n return route.name;\n }\n\n // If the path has a pattern for a param, put the param in the path\n if (param) {\n const value = allParams[param];\n\n if (value === undefined && optional) {\n // Optional params without value assigned in route.params should be ignored\n return '';\n }\n\n // Valid characters according to\n // https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 (see pchar definition)\n return Array.from(String(value))\n .map((char) =>\n /[^A-Za-z0-9\\-._~!$&'()*+,;=:@]/g.test(char) ? encodeURIComponent(char) : char\n )\n .join('');\n }\n\n return encodeURIComponent(segment);\n })\n .join('/');\n } else {\n path += encodeURIComponent(route.name);\n }\n\n if (!focusedParams && focusedRoute.params) {\n focusedParams = Object.fromEntries(\n Object.entries(focusedRoute.params).map(([key, value]) => [key, String(value)])\n );\n }\n\n if (route.state) {\n path += '/';\n } else if (focusedParams) {\n for (const param in focusedParams) {\n if (focusedParams[param] === 'undefined') {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete focusedParams[param];\n }\n }\n\n const query = queryString.stringify(focusedParams, { sort: false });\n\n if (query) {\n path += `?${query}`;\n }\n }\n\n current = route.state;\n }\n\n // Include the root path if specified\n if (options?.path) {\n path = `${options.path}/${path}`;\n }\n\n // Remove multiple as well as trailing slashes\n path = path.replace(/\\/+/g, '/');\n path = path.length > 1 ? path.replace(/\\/$/, '') : path;\n\n // If path doesn't start with a slash, add it\n // This makes sure that history.pushState will update the path correctly instead of appending\n if (!path.startsWith('/')) {\n path = `/${path}`;\n }\n\n return path;\n}\n\nconst createConfigItem = (\n config: PathConfig | string,\n parentParts?: PatternPart[]\n): ConfigItem => {\n if (typeof config === 'string') {\n // If a string is specified as the value of the key(e.g. Foo: '/path'), use it as the pattern\n const parts = getPatternParts(config);\n\n if (parentParts) {\n return { parts: [...parentParts, ...parts] };\n }\n\n return { parts };\n }\n\n if (config.exact && config.path === undefined) {\n throw new Error(\n \"A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.\"\n );\n }\n\n // If an object is specified as the value (e.g. Foo: { ... }),\n // It can have `path` property and `screens` prop which has nested configs\n const parts =\n config.exact !== true\n ? [...(parentParts || []), ...(config.path ? getPatternParts(config.path) : [])]\n : config.path\n ? getPatternParts(config.path)\n : undefined;\n\n const screens = config.screens ? createNormalizedConfigs(config.screens, parts) : undefined;\n\n return {\n parts,\n stringify: config.stringify,\n screens,\n };\n};\n\nconst createNormalizedConfigs = (\n options: PathConfigMap,\n parts?: PatternPart[]\n): Record =>\n Object.fromEntries(\n Object.entries(options).map(([name, c]) => {\n const result = createConfigItem(c, parts);\n\n return [name, result];\n })\n );\n"]} \ No newline at end of file +{"version":3,"file":"getPathFromState.js","sourceRoot":"","sources":["../../../src/react-navigation/core/getPathFromState.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,4CA8LC;AA7QD,0DAA4C;AAG5C,uDAAsE;AAEtE,6DAA0D;AAkB1D,MAAM,cAAc,GAAG,CAAC,KAAY,EAAqC,EAAE;IACzE,MAAM,KAAK,GACT,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CA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M,CAAC,IAAI;YACX,CAAC,CAAC,IAAA,iCAAe,EAAC,MAAM,CAAC,IAAI,CAAC;YAC9B,CAAC,CAAC,SAAS,CAAC;IAElB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAuB,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE5F,OAAO;QACL,KAAK;QACL,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,OAAO;KACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAC9B,OAA8B,EAC9B,KAAqB,EACO,EAAE,CAC9B,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE;IACxC,MAAM,MAAM,GAAG,gBAAgB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAE1C,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACxB,CAAC,CAAC,CACH,CAAC","sourcesContent":["import * as queryString from 'query-string';\n\nimport type { NavigationState, PartialState, Route } from '../routers';\nimport { getPatternParts, type PatternPart } from './getPatternParts';\nimport type { PathConfig, PathConfigMap } from './types';\nimport { validatePathConfig } from './validatePathConfig';\n\ntype Options = {\n path?: string;\n initialRouteName?: string;\n screens: PathConfigMap;\n};\n\ntype State = NavigationState | Omit, 'stale'>;\n\ntype StringifyConfig = Record string>;\n\ntype ConfigItem = {\n parts?: PatternPart[];\n stringify?: StringifyConfig;\n screens?: Record;\n};\n\nconst getActiveRoute = (state: State): { name: string; params?: object } => {\n const route =\n state.index != null ? state.routes[state.index]! : state.routes[state.routes.length - 1]!;\n\n if (route.state) {\n return getActiveRoute(route.state);\n }\n\n return route;\n};\n\nconst cachedNormalizedConfigs = new WeakMap, Record>();\n\nconst getNormalizedConfigs = (options?: Options) => {\n if (!options?.screens) return {};\n\n const cached = cachedNormalizedConfigs.get(options?.screens);\n\n if (cached) return cached;\n\n const normalizedConfigs = createNormalizedConfigs(options.screens);\n\n cachedNormalizedConfigs.set(options.screens, normalizedConfigs);\n\n return normalizedConfigs;\n};\n\n/**\n * Utility to serialize a navigation state object to a path string.\n *\n * @example\n * ```js\n * getPathFromState(\n * {\n * routes: [\n * {\n * name: 'Chat',\n * params: { author: 'Jane', id: 42 },\n * },\n * ],\n * },\n * {\n * screens: {\n * Chat: {\n * path: 'chat/:author/:id',\n * stringify: { author: author => author.toLowerCase() }\n * }\n * }\n * }\n * )\n * ```\n *\n * @param state Navigation state to serialize.\n * @param options Extra options to fine-tune how to serialize the path.\n * @returns Path representing the state, e.g. /foo/bar?count=42.\n */\nexport function getPathFromState(\n state: State,\n options?: Options\n): string {\n if (state == null) {\n throw Error(\n `Got '${String(state)}' for the navigation state. You must pass a valid state object.`\n );\n }\n\n if (options) {\n validatePathConfig(options);\n }\n\n const configs = getNormalizedConfigs(options);\n\n let path = '/';\n let current: State | undefined = state;\n\n const allParams: Record = {};\n\n while (current) {\n let index = typeof current.index === 'number' ? current.index : 0;\n let route = current.routes[index] as Route & {\n state?: State;\n };\n\n let parts: PatternPart[] | undefined;\n\n let focusedParams: Record | undefined;\n let currentOptions = configs;\n\n const focusedRoute = getActiveRoute(state);\n\n // Keep all the route names that appeared during going deeper in config in case the pattern is resolved to undefined\n const nestedRouteNames = [];\n\n let hasNext = true;\n\n while (route.name in currentOptions && hasNext) {\n parts = currentOptions[route.name]!.parts;\n\n nestedRouteNames.push(route.name);\n\n if (route.params) {\n const options = currentOptions[route.name];\n\n const currentParams = Object.fromEntries(\n Object.entries(route.params)\n .map(([key, value]): [string, string] | null => {\n if (value === undefined) {\n if (options) {\n const optional = options.parts?.find((part) => part.param === key)?.optional;\n\n if (optional) {\n return null;\n }\n } else {\n return null;\n }\n }\n\n const stringify = options?.stringify?.[key] ?? String;\n\n return [key, stringify(value)];\n })\n .filter((entry) => entry != null)\n );\n\n if (parts?.length) {\n Object.assign(allParams, currentParams);\n }\n\n if (focusedRoute === route) {\n // If this is the focused route, keep the params for later use\n // We save it here since it's been stringified already\n focusedParams = { ...currentParams };\n\n parts\n // eslint-disable-next-line no-loop-func\n ?.forEach(({ param }) => {\n if (param) {\n // Remove the params present in the pattern since we'll only use the rest for query string\n if (focusedParams) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete focusedParams[param];\n }\n }\n });\n }\n }\n\n // If there is no `screens` property or no nested state, we return pattern\n if (!currentOptions[route.name]!.screens || route.state === undefined) {\n hasNext = false;\n } else {\n index =\n typeof route.state.index === 'number' ? route.state.index : route.state.routes.length - 1;\n\n const nextRoute = route.state.routes[index];\n const nestedConfig = currentOptions[route.name]!.screens;\n\n // if there is config for next route name, we go deeper\n if (nestedConfig && nextRoute!.name in nestedConfig) {\n route = nextRoute as Route & { state?: State };\n currentOptions = nestedConfig;\n } else {\n // If not, there is no sense in going deeper in config\n hasNext = false;\n }\n }\n }\n\n if (currentOptions[route.name] !== undefined) {\n path += parts\n ?.map(({ segment, param, optional }) => {\n // We don't know what to show for wildcard patterns\n // Showing the route name seems ok, though whatever we show here will be incorrect\n // Since the page doesn't actually exist\n if (segment === '*') {\n return route.name;\n }\n\n // If the path has a pattern for a param, put the param in the path\n if (param) {\n const value = allParams[param];\n\n if (value === undefined && optional) {\n // Optional params without value assigned in route.params should be ignored\n return '';\n }\n\n // Valid characters according to\n // https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 (see pchar definition)\n return Array.from(String(value))\n .map((char) =>\n /[^A-Za-z0-9\\-._~!$&'()*+,;=:@]/g.test(char) ? encodeURIComponent(char) : char\n )\n .join('');\n }\n\n return encodeURIComponent(segment);\n })\n .join('/');\n } else {\n path += encodeURIComponent(route.name);\n }\n\n if (!focusedParams && focusedRoute.params) {\n focusedParams = Object.fromEntries(\n Object.entries(focusedRoute.params).map(([key, value]) => [key, String(value)])\n );\n }\n\n if (route.state) {\n path += '/';\n } else if (focusedParams) {\n for (const param in focusedParams) {\n if (focusedParams[param] === 'undefined') {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete focusedParams[param];\n }\n }\n\n const query = queryString.stringify(focusedParams, { sort: false });\n\n if (query) {\n path += `?${query}`;\n }\n }\n\n current = route.state;\n }\n\n // Include the root path if specified\n if (options?.path) {\n path = `${options.path}/${path}`;\n }\n\n // Remove multiple as well as trailing slashes\n path = path.replace(/\\/+/g, '/');\n path = path.length > 1 ? path.replace(/\\/$/, '') : path;\n\n // If path doesn't start with a slash, add it\n // This makes sure that history.pushState will update the path correctly instead of appending\n if (!path.startsWith('/')) {\n path = `/${path}`;\n }\n\n return path;\n}\n\nconst createConfigItem = (\n config: PathConfig | string,\n parentParts?: PatternPart[]\n): ConfigItem => {\n if (typeof config === 'string') {\n // If a string is specified as the value of the key(e.g. Foo: '/path'), use it as the pattern\n const parts = getPatternParts(config);\n\n if (parentParts) {\n return { parts: [...parentParts, ...parts] };\n }\n\n return { parts };\n }\n\n if (config.exact && config.path === undefined) {\n throw new Error(\n \"A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.\"\n );\n }\n\n // If an object is specified as the value (e.g. Foo: { ... }),\n // It can have `path` property and `screens` prop which has nested configs\n const parts =\n config.exact !== true\n ? [...(parentParts || []), ...(config.path ? getPatternParts(config.path) : [])]\n : config.path\n ? getPatternParts(config.path)\n : undefined;\n\n const screens = config.screens ? createNormalizedConfigs(config.screens, parts) : undefined;\n\n return {\n parts,\n stringify: config.stringify,\n screens,\n };\n};\n\nconst createNormalizedConfigs = (\n options: PathConfigMap,\n parts?: PatternPart[]\n): Record =>\n Object.fromEntries(\n Object.entries(options).map(([name, c]) => {\n const result = createConfigItem(c, parts);\n\n return [name, result];\n })\n );\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/core/getStateFromPath.js b/packages/expo-router/build/react-navigation/core/getStateFromPath.js index bca62b155d8ab4..2a1e1ffd76cfc9 100644 --- a/packages/expo-router/build/react-navigation/core/getStateFromPath.js +++ b/packages/expo-router/build/react-navigation/core/getStateFromPath.js @@ -493,6 +493,9 @@ const createNestedStateObject = (path, routes, initialRoutes, flatConfig) => { }; const parseQueryParams = (path, parseConfig) => { const query = path.split('?')[1]; + if (!query) { + return undefined; + } const params = queryString.parse(query); if (parseConfig) { Object.keys(params).forEach((name) => { diff --git a/packages/expo-router/build/react-navigation/core/getStateFromPath.js.map b/packages/expo-router/build/react-navigation/core/getStateFromPath.js.map index 4aedc54b82b161..34c176ab9394c9 100644 --- a/packages/expo-router/build/react-navigation/core/getStateFromPath.js.map +++ b/packages/expo-router/build/react-navigation/core/getStateFromPath.js.map @@ -1 +1 @@ -{"version":3,"file":"getStateFromPath.js","sourceRoot":"","sources":["../../../src/react-navigation/core/getStateFromPath.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,4CAoFC;AA3JD,gFAA0C;AAC1C,0DAA4C;AAG5C,uDAAoD;AACpD,yDAAsD;AACtD,uDAAsE;AACtE,iDAA8C;AAE9C,6DAA0D;AAwC1D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,mEAAmE;AACnE,SAAgB,gBAAgB,CAC9B,IAAY,EACZ,OAA4B;IAE5B,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAE/D,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,CAAC;IAEjC,IAAI,SAAS,GAAG,IAAI;SACjB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,+CAA+C;SACpE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,6BAA6B;SAChD,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,iDAAiD;IAE1E,sCAAsC;IACtC,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,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I,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;YACjD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACzD,CAAC,CAAC","sourcesContent":["import escape from 'escape-string-regexp';\nimport * as queryString from 'query-string';\n\nimport type { InitialState, NavigationState, ParamListBase, PartialState } from '../routers';\nimport { arrayStartsWith } from './arrayStartsWith';\nimport { findFocusedRoute } from './findFocusedRoute';\nimport { getPatternParts, type PatternPart } from './getPatternParts';\nimport { isArrayEqual } from './isArrayEqual';\nimport type { PathConfig, PathConfigMap } from './types';\nimport { validatePathConfig } from './validatePathConfig';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ntype Options = {\n path?: string;\n initialRouteName?: string;\n screens: PathConfigMap;\n};\n\ntype ParseConfig = Record unknown>;\n\ntype RouteConfig = {\n screen: string;\n regex?: RegExp;\n segments: string[];\n params: { screen: string; name?: string; index: number }[];\n routeNames: string[];\n parse?: ParseConfig;\n};\n\ntype InitialRouteConfig = {\n initialRouteName: string;\n parentScreens: string[];\n};\n\ntype ResultState = PartialState & {\n state?: ResultState;\n};\n\ntype ParsedRoute = {\n name: string;\n path?: string;\n params?: Record | undefined;\n};\n\ntype ConfigResources = {\n initialRoutes: InitialRouteConfig[];\n configs: RouteConfig[];\n};\n\n/**\n * Utility to parse a path string to initial state object accepted by the container.\n * This is useful for deep linking when we need to handle the incoming URL.\n *\n * @example\n * ```js\n * getStateFromPath(\n * '/chat/jane/42',\n * {\n * screens: {\n * Chat: {\n * path: 'chat/:author/:id',\n * parse: { id: Number }\n * }\n * }\n * }\n * )\n * ```\n * @param path Path string to parse and convert, e.g. /foo/bar?count=42.\n * @param options Extra options to fine-tune how to parse the path.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport function getStateFromPath(\n path: string,\n options?: Options\n): ResultState | undefined {\n const { initialRoutes, configs } = getConfigResources(options);\n\n const screens = options?.screens;\n\n let remaining = path\n .replace(/\\/+/g, '/') // Replace multiple slash (//) with single ones\n .replace(/^\\//, '') // Remove extra leading slash\n .replace(/\\?.*$/, ''); // Remove query params which we will handle later\n\n // Make sure there is a trailing slash\n remaining = remaining.endsWith('/') ? remaining : `${remaining}/`;\n\n const prefix = options?.path?.replace(/^\\//, ''); // Remove extra leading slash\n\n if (prefix) {\n // Make sure there is a trailing slash\n const normalizedPrefix = prefix.endsWith('/') ? prefix : `${prefix}/`;\n\n // If the path doesn't start with the prefix, it's not a match\n if (!remaining.startsWith(normalizedPrefix)) {\n return undefined;\n }\n\n // Remove the prefix from the path\n remaining = remaining.replace(normalizedPrefix, '');\n }\n\n if (screens === undefined) {\n // When no config is specified, use the path segments as route names\n const routes = remaining\n .split('/')\n .filter(Boolean)\n .map((segment) => {\n const name = decodeURIComponent(segment);\n return { name };\n });\n\n if (routes.length) {\n return createNestedStateObject(path, routes, initialRoutes);\n }\n\n return undefined;\n }\n\n if (remaining === '/') {\n // We need to add special handling of empty path so navigation to empty path also works\n // When handling empty path, we should only look at the root level config\n const match = configs.find((config) => config.segments.join('/') === '');\n\n if (match) {\n return createNestedStateObject(\n path,\n match.routeNames.map((name) => ({ name })),\n initialRoutes,\n configs\n );\n }\n\n return undefined;\n }\n\n let result: PartialState | undefined;\n let current: PartialState | undefined;\n\n // We match the whole path against the regex instead of segments\n // This makes sure matches such as wildcard will catch any unmatched routes, even if nested\n const { routes, remainingPath } = matchAgainstConfigs(remaining, configs);\n\n if (routes !== undefined) {\n // This will always be empty if full path matched\n current = createNestedStateObject(path, routes, initialRoutes, configs);\n remaining = remainingPath;\n result = current;\n }\n\n if (current == null || result == null) {\n return undefined;\n }\n\n return result;\n}\n\n/**\n * Reference to the last used config resources. This is used to avoid recomputing the config resources when the options are the same.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nconst cachedConfigResources = new WeakMap, ConfigResources>();\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nfunction getConfigResources(options: Options | undefined) {\n if (!options) return prepareConfigResources();\n\n const cached = cachedConfigResources.get(options);\n\n if (cached) return cached;\n\n const resources = prepareConfigResources(options);\n\n cachedConfigResources.set(options, resources);\n\n return resources;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nfunction prepareConfigResources(options?: Options<{}>) {\n if (options) {\n validatePathConfig(options);\n }\n\n const initialRoutes = getInitialRoutes(options);\n const configs = getSortedNormalizedConfigs(initialRoutes, options?.screens);\n\n checkForDuplicatedConfigs(configs);\n\n const configWithRegexes = getConfigsWithRegexes(configs);\n\n return {\n initialRoutes,\n configs,\n configWithRegexes,\n };\n}\n\nfunction getInitialRoutes(options?: Options) {\n const initialRoutes: InitialRouteConfig[] = [];\n\n if (options?.initialRouteName) {\n initialRoutes.push({\n initialRouteName: options.initialRouteName,\n parentScreens: [],\n });\n }\n\n return initialRoutes;\n}\n\nfunction getSortedNormalizedConfigs(\n initialRoutes: InitialRouteConfig[],\n screens: Record> = {}\n) {\n // Create a normalized configs array which will be easier to use\n return ([] as RouteConfig[])\n .concat(\n ...Object.keys(screens).map((key) =>\n createNormalizedConfigs(key, screens, initialRoutes, [], [], [])\n )\n )\n .sort((a, b) => {\n // Sort config from most specific to least specific:\n // - more segments\n // - static segments\n // - params with regex\n // - regular params\n // - wildcard\n\n // If 2 patterns are same, move the one with less route names up\n // This is an error state, so it's only useful for consistent error messages\n if (isArrayEqual(a.segments, b.segments)) {\n return b.routeNames.join('>').localeCompare(a.routeNames.join('>'));\n }\n\n // If one of the patterns starts with the other, it's more exhaustive\n // So move it up\n if (arrayStartsWith(a.segments, b.segments)) {\n return -1;\n }\n\n if (arrayStartsWith(b.segments, a.segments)) {\n return 1;\n }\n\n for (let i = 0; i < Math.max(a.segments.length, b.segments.length); i++) {\n // if b is longer, b gets higher priority\n if (a.segments[i] == null) {\n return 1;\n }\n\n // if a is longer, a gets higher priority\n if (b.segments[i] == null) {\n return -1;\n }\n\n const aWildCard = a.segments[i] === '*';\n const bWildCard = b.segments[i] === '*';\n const aParam = a.segments[i].startsWith(':');\n const bParam = b.segments[i].startsWith(':');\n const aRegex = aParam && a.segments[i].includes('(');\n const bRegex = bParam && b.segments[i].includes('(');\n\n // if both are wildcard or regex, we compare next component\n if ((aWildCard && bWildCard) || (aRegex && bRegex)) {\n continue;\n }\n\n // if only a is wildcard, b gets higher priority\n if (aWildCard && !bWildCard) {\n return 1;\n }\n\n // if only b is wildcard, a gets higher priority\n if (bWildCard && !aWildCard) {\n return -1;\n }\n\n // If only a has a param, b gets higher priority\n if (aParam && !bParam) {\n return 1;\n }\n\n // If only b has a param, a gets higher priority\n if (bParam && !aParam) {\n return -1;\n }\n\n // if only a has regex, a gets higher priority\n if (aRegex && !bRegex) {\n return -1;\n }\n\n // if only b has regex, b gets higher priority\n if (bRegex && !aRegex) {\n return 1;\n }\n }\n\n return a.segments.length - b.segments.length;\n });\n}\n\nfunction checkForDuplicatedConfigs(configs: RouteConfig[]) {\n // Check for duplicate patterns in the config\n configs.reduce>((acc, config) => {\n const pattern = config.segments.join('/');\n\n if (acc[pattern]) {\n const a = acc[pattern].routeNames;\n const b = config.routeNames;\n\n // It's not a problem if the path string omitted from a inner most screen\n // For example, it's ok if a path resolves to `A > B > C` or `A > B`\n const intersects =\n a.length > b.length ? b.every((it, i) => a[i] === it) : a.every((it, i) => b[i] === it);\n\n if (!intersects) {\n throw new Error(\n `Found conflicting screens with the same pattern. The pattern '${\n pattern\n }' resolves to both '${a.join(' > ')}' and '${b.join(\n ' > '\n )}'. Patterns must be unique and cannot resolve to more than one screen.`\n );\n }\n }\n\n return Object.assign(acc, {\n [pattern]: config,\n });\n }, {});\n}\n\nfunction getConfigsWithRegexes(configs: RouteConfig[]) {\n return configs.map((c) => ({\n ...c,\n // Add `$` to the regex to make sure it matches till end of the path and not just beginning\n regex: c.regex ? new RegExp(c.regex.source + '$') : undefined,\n }));\n}\n\nconst matchAgainstConfigs = (remaining: string, configs: RouteConfig[]) => {\n let routes: ParsedRoute[] | undefined;\n let remainingPath = remaining;\n\n // Go through all configs, and see if the next path segment matches our regex\n for (const config of configs) {\n if (!config.regex) {\n continue;\n }\n\n const match = remainingPath.match(config.regex);\n\n // If our regex matches, we need to extract params from the path\n if (match) {\n routes = config.routeNames.map((routeName) => {\n const routeConfig = configs.find((c) => {\n // Check matching name AND pattern in case same screen is used at different levels in config\n return c.screen === routeName && arrayStartsWith(config.segments, c.segments);\n });\n\n const params =\n routeConfig && match.groups\n ? Object.fromEntries(\n Object.entries(match.groups)\n .map(([key, value]) => {\n const index = Number(key.replace('param_', ''));\n const param = routeConfig.params.find((it) => it.index === index);\n\n if (param?.screen === routeName && param?.name) {\n return [param.name, value];\n }\n\n return null;\n })\n .filter((it) => it != null)\n .map(([key, value]) => {\n if (value == null) {\n return [key, undefined];\n }\n\n const decoded = decodeURIComponent(value);\n const parsed = routeConfig.parse?.[key]\n ? routeConfig.parse[key](decoded)\n : decoded;\n\n return [key, parsed];\n })\n )\n : undefined;\n\n if (params && Object.keys(params).length) {\n return { name: routeName, params };\n }\n\n return { name: routeName };\n });\n\n remainingPath = remainingPath.replace(match[0], '');\n\n break;\n }\n }\n\n return { routes, remainingPath };\n};\n\nconst createNormalizedConfigs = (\n screen: string,\n routeConfig: Record>,\n initials: InitialRouteConfig[],\n paths: { screen: string; path: string }[],\n parentScreens: string[],\n routeNames: string[]\n): RouteConfig[] => {\n const configs: RouteConfig[] = [];\n\n routeNames.push(screen);\n\n parentScreens.push(screen);\n\n const config = routeConfig[screen];\n\n if (typeof config === 'string') {\n paths.push({ screen, path: config });\n configs.push(createConfigItem(screen, [...routeNames], [...paths]));\n } else if (typeof config === 'object') {\n // if an object is specified as the value (e.g. Foo: { ... }),\n // it can have `path` property and\n // it could have `screens` prop which has nested configs\n if (typeof config.path === 'string') {\n if (config.exact && config.path == null) {\n throw new Error(\n `Screen '${screen}' doesn't specify a 'path'. A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. \\`path: ''\\`.`\n );\n }\n\n // We should add alias configs after the main config\n // So unless they are more specific, main config will be matched first\n const aliasConfigs = [];\n\n if (config.alias) {\n for (const alias of config.alias) {\n if (typeof alias === 'string') {\n aliasConfigs.push(\n createConfigItem(\n screen,\n [...routeNames],\n [...paths, { screen, path: alias }],\n config.parse\n )\n );\n } else if (typeof alias === 'object') {\n aliasConfigs.push(\n createConfigItem(\n screen,\n [...routeNames],\n alias.exact\n ? [{ screen, path: alias.path }]\n : [...paths, { screen, path: alias.path }],\n alias.parse\n )\n );\n }\n }\n }\n\n if (config.exact) {\n // If it's an exact path, we don't need to keep track of the parent screens\n // So we can clear it\n paths.length = 0;\n }\n\n paths.push({ screen, path: config.path });\n configs.push(createConfigItem(screen, [...routeNames], [...paths], config.parse));\n\n configs.push(...aliasConfigs);\n }\n\n if (typeof config !== 'string' && typeof config.path !== 'string' && config.alias?.length) {\n throw new Error(\n `Screen '${screen}' doesn't specify a 'path'. A 'path' needs to be specified in order to use 'alias'.`\n );\n }\n\n if (config.screens) {\n // property `initialRouteName` without `screens` has no purpose\n if (config.initialRouteName) {\n initials.push({\n initialRouteName: config.initialRouteName,\n parentScreens,\n });\n }\n\n Object.keys(config.screens).forEach((nestedConfig) => {\n const result = createNormalizedConfigs(\n nestedConfig,\n config.screens as Record>,\n initials,\n [...paths],\n [...parentScreens],\n routeNames\n );\n\n configs.push(...result);\n });\n }\n }\n\n routeNames.pop();\n\n return configs;\n};\n\nconst createConfigItem = (\n screen: string,\n routeNames: string[],\n paths: { screen: string; path: string }[],\n parse?: ParseConfig\n): RouteConfig => {\n const parts: (PatternPart & { screen: string })[] = [];\n\n // Parse the path string into parts for easier matching\n for (const { screen, path } of paths) {\n parts.push(...getPatternParts(path).map((part) => ({ ...part, screen })));\n }\n\n const regex = parts.length\n ? new RegExp(\n `^(${parts\n .map((it, i) => {\n if (it.param) {\n const reg = it.regex || '[^/]+';\n\n return `(((?${reg})\\\\/)${it.optional ? '?' : ''})`;\n }\n\n return `${it.segment === '*' ? '.*' : escape(it.segment)}\\\\/`;\n })\n .join('')})$`\n )\n : undefined;\n\n const segments = parts.map((it) => it.segment);\n const params = parts\n .map((it, i) =>\n it.param\n ? {\n index: i,\n screen: it.screen,\n name: it.param,\n }\n : null\n )\n .filter((it) => it != null);\n\n return {\n screen,\n regex,\n segments,\n params,\n routeNames,\n parse,\n };\n};\n\nconst findParseConfigForRoute = (\n routeName: string,\n flatConfig: RouteConfig[]\n): ParseConfig | undefined => {\n for (const config of flatConfig) {\n if (routeName === config.routeNames[config.routeNames.length - 1]) {\n return config.parse;\n }\n }\n\n return undefined;\n};\n\n// Try to find an initial route connected with the one passed\nconst findInitialRoute = (\n routeName: string,\n parentScreens: string[],\n initialRoutes: InitialRouteConfig[]\n): string | undefined => {\n for (const config of initialRoutes) {\n if (parentScreens.length === config.parentScreens.length) {\n let sameParents = true;\n for (let i = 0; i < parentScreens.length; i++) {\n if (parentScreens[i].localeCompare(config.parentScreens[i]) !== 0) {\n sameParents = false;\n break;\n }\n }\n if (sameParents) {\n return routeName !== config.initialRouteName ? config.initialRouteName : undefined;\n }\n }\n }\n return undefined;\n};\n\n// returns state object with values depending on whether\n// it is the end of state and if there is initialRoute for this level\nconst createStateObject = (\n initialRoute: string | undefined,\n route: ParsedRoute,\n isEmpty: boolean\n): InitialState => {\n if (isEmpty) {\n if (initialRoute) {\n return {\n index: 1,\n routes: [{ name: initialRoute }, route],\n };\n } else {\n return {\n routes: [route],\n };\n }\n } else {\n if (initialRoute) {\n return {\n index: 1,\n routes: [{ name: initialRoute }, { ...route, state: { routes: [] } }],\n };\n } else {\n return {\n routes: [{ ...route, state: { routes: [] } }],\n };\n }\n }\n};\n\nconst createNestedStateObject = (\n path: string,\n routes: ParsedRoute[],\n initialRoutes: InitialRouteConfig[],\n flatConfig?: RouteConfig[]\n) => {\n let route = routes.shift() as ParsedRoute;\n const parentScreens: string[] = [];\n\n let initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);\n\n parentScreens.push(route.name);\n\n const state: InitialState = createStateObject(initialRoute, route, routes.length === 0);\n\n if (routes.length > 0) {\n let nestedState = state;\n\n while ((route = routes.shift() as ParsedRoute)) {\n initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);\n\n const nestedStateIndex = nestedState.index || nestedState.routes.length - 1;\n\n nestedState.routes[nestedStateIndex].state = createStateObject(\n initialRoute,\n route,\n routes.length === 0\n );\n\n if (routes.length > 0) {\n nestedState = nestedState.routes[nestedStateIndex].state as InitialState;\n }\n\n parentScreens.push(route.name);\n }\n }\n\n route = findFocusedRoute(state) as ParsedRoute;\n route.path = path.replace(/\\/$/, '');\n\n const params = parseQueryParams(\n path,\n flatConfig ? findParseConfigForRoute(route.name, flatConfig) : undefined\n );\n\n if (params) {\n route.params = { ...route.params, ...params };\n }\n\n return state;\n};\n\nconst parseQueryParams = (\n path: string,\n parseConfig?: Record unknown>\n) => {\n const query = path.split('?')[1];\n const params: Record = queryString.parse(query);\n\n if (parseConfig) {\n Object.keys(params).forEach((name) => {\n if (Object.hasOwnProperty.call(parseConfig, name) && typeof params[name] === 'string') {\n params[name] = parseConfig[name](params[name]);\n }\n });\n }\n\n return Object.keys(params).length ? params : undefined;\n};\n"]} \ No newline at end of file +{"version":3,"file":"getStateFromPath.js","sourceRoot":"","sources":["../../../src/react-navigation/core/getStateFromPath.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,4CAoFC;AA3JD,gFAA0C;AAC1C,0DAA4C;AAG5C,uDAAoD;AACpD,yDAAsD;AACtD,uDAAsE;AACtE,iDAA8C;AAE9C,6DAA0D;AAwC1D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,mEAAmE;AACnE,SAAgB,gBAAgB,CAC9B,IAAY,EACZ,OAA4B;IAE5B,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,GA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,CAAC;IACjC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAA4B,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjE,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACnC,IAAI,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACtF,MAAM,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,IAAI,CAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAE,CAAC;YACnD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACzD,CAAC,CAAC","sourcesContent":["import escape from 'escape-string-regexp';\nimport * as queryString from 'query-string';\n\nimport type { InitialState, NavigationState, ParamListBase, PartialState } from '../routers';\nimport { arrayStartsWith } from './arrayStartsWith';\nimport { findFocusedRoute } from './findFocusedRoute';\nimport { getPatternParts, type PatternPart } from './getPatternParts';\nimport { isArrayEqual } from './isArrayEqual';\nimport type { PathConfig, PathConfigMap } from './types';\nimport { validatePathConfig } from './validatePathConfig';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ntype Options = {\n path?: string;\n initialRouteName?: string;\n screens: PathConfigMap;\n};\n\ntype ParseConfig = Record unknown>;\n\ntype RouteConfig = {\n screen: string;\n regex?: RegExp;\n segments: string[];\n params: { screen: string; name?: string; index: number }[];\n routeNames: string[];\n parse?: ParseConfig;\n};\n\ntype InitialRouteConfig = {\n initialRouteName: string;\n parentScreens: string[];\n};\n\ntype ResultState = PartialState & {\n state?: ResultState;\n};\n\ntype ParsedRoute = {\n name: string;\n path?: string;\n params?: Record | undefined;\n};\n\ntype ConfigResources = {\n initialRoutes: InitialRouteConfig[];\n configs: RouteConfig[];\n};\n\n/**\n * Utility to parse a path string to initial state object accepted by the container.\n * This is useful for deep linking when we need to handle the incoming URL.\n *\n * @example\n * ```js\n * getStateFromPath(\n * '/chat/jane/42',\n * {\n * screens: {\n * Chat: {\n * path: 'chat/:author/:id',\n * parse: { id: Number }\n * }\n * }\n * }\n * )\n * ```\n * @param path Path string to parse and convert, e.g. /foo/bar?count=42.\n * @param options Extra options to fine-tune how to parse the path.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport function getStateFromPath(\n path: string,\n options?: Options\n): ResultState | undefined {\n const { initialRoutes, configs } = getConfigResources(options);\n\n const screens = options?.screens;\n\n let remaining = path\n .replace(/\\/+/g, '/') // Replace multiple slash (//) with single ones\n .replace(/^\\//, '') // Remove extra leading slash\n .replace(/\\?.*$/, ''); // Remove query params which we will handle later\n\n // Make sure there is a trailing slash\n remaining = remaining.endsWith('/') ? remaining : `${remaining}/`;\n\n const prefix = options?.path?.replace(/^\\//, ''); // Remove extra leading slash\n\n if (prefix) {\n // Make sure there is a trailing slash\n const normalizedPrefix = prefix.endsWith('/') ? prefix : `${prefix}/`;\n\n // If the path doesn't start with the prefix, it's not a match\n if (!remaining.startsWith(normalizedPrefix)) {\n return undefined;\n }\n\n // Remove the prefix from the path\n remaining = remaining.replace(normalizedPrefix, '');\n }\n\n if (screens === undefined) {\n // When no config is specified, use the path segments as route names\n const routes = remaining\n .split('/')\n .filter(Boolean)\n .map((segment) => {\n const name = decodeURIComponent(segment);\n return { name };\n });\n\n if (routes.length) {\n return createNestedStateObject(path, routes, initialRoutes);\n }\n\n return undefined;\n }\n\n if (remaining === '/') {\n // We need to add special handling of empty path so navigation to empty path also works\n // When handling empty path, we should only look at the root level config\n const match = configs.find((config) => config.segments.join('/') === '');\n\n if (match) {\n return createNestedStateObject(\n path,\n match.routeNames.map((name) => ({ name })),\n initialRoutes,\n configs\n );\n }\n\n return undefined;\n }\n\n let result: PartialState | undefined;\n let current: PartialState | undefined;\n\n // We match the whole path against the regex instead of segments\n // This makes sure matches such as wildcard will catch any unmatched routes, even if nested\n const { routes, remainingPath } = matchAgainstConfigs(remaining, configs);\n\n if (routes !== undefined) {\n // This will always be empty if full path matched\n current = createNestedStateObject(path, routes, initialRoutes, configs);\n remaining = remainingPath;\n result = current;\n }\n\n if (current == null || result == null) {\n return undefined;\n }\n\n return result;\n}\n\n/**\n * Reference to the last used config resources. This is used to avoid recomputing the config resources when the options are the same.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nconst cachedConfigResources = new WeakMap, ConfigResources>();\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nfunction getConfigResources(options: Options | undefined) {\n if (!options) return prepareConfigResources();\n\n const cached = cachedConfigResources.get(options);\n\n if (cached) return cached;\n\n const resources = prepareConfigResources(options);\n\n cachedConfigResources.set(options, resources);\n\n return resources;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nfunction prepareConfigResources(options?: Options<{}>) {\n if (options) {\n validatePathConfig(options);\n }\n\n const initialRoutes = getInitialRoutes(options);\n const configs = getSortedNormalizedConfigs(initialRoutes, options?.screens);\n\n checkForDuplicatedConfigs(configs);\n\n const configWithRegexes = getConfigsWithRegexes(configs);\n\n return {\n initialRoutes,\n configs,\n configWithRegexes,\n };\n}\n\nfunction getInitialRoutes(options?: Options) {\n const initialRoutes: InitialRouteConfig[] = [];\n\n if (options?.initialRouteName) {\n initialRoutes.push({\n initialRouteName: options.initialRouteName,\n parentScreens: [],\n });\n }\n\n return initialRoutes;\n}\n\nfunction getSortedNormalizedConfigs(\n initialRoutes: InitialRouteConfig[],\n screens: Record> = {}\n) {\n // Create a normalized configs array which will be easier to use\n return ([] as RouteConfig[])\n .concat(\n ...Object.keys(screens).map((key) =>\n createNormalizedConfigs(key, screens, initialRoutes, [], [], [])\n )\n )\n .sort((a, b) => {\n // Sort config from most specific to least specific:\n // - more segments\n // - static segments\n // - params with regex\n // - regular params\n // - wildcard\n\n // If 2 patterns are same, move the one with less route names up\n // This is an error state, so it's only useful for consistent error messages\n if (isArrayEqual(a.segments, b.segments)) {\n return b.routeNames.join('>').localeCompare(a.routeNames.join('>'));\n }\n\n // If one of the patterns starts with the other, it's more exhaustive\n // So move it up\n if (arrayStartsWith(a.segments, b.segments)) {\n return -1;\n }\n\n if (arrayStartsWith(b.segments, a.segments)) {\n return 1;\n }\n\n for (let i = 0; i < Math.max(a.segments.length, b.segments.length); i++) {\n // if b is longer, b gets higher priority\n if (a.segments[i] == null) {\n return 1;\n }\n\n // if a is longer, a gets higher priority\n if (b.segments[i] == null) {\n return -1;\n }\n\n const aWildCard = a.segments[i] === '*';\n const bWildCard = b.segments[i] === '*';\n const aParam = a.segments[i]!.startsWith(':');\n const bParam = b.segments[i]!.startsWith(':');\n const aRegex = aParam && a.segments[i]!.includes('(');\n const bRegex = bParam && b.segments[i]!.includes('(');\n\n // if both are wildcard or regex, we compare next component\n if ((aWildCard && bWildCard) || (aRegex && bRegex)) {\n continue;\n }\n\n // if only a is wildcard, b gets higher priority\n if (aWildCard && !bWildCard) {\n return 1;\n }\n\n // if only b is wildcard, a gets higher priority\n if (bWildCard && !aWildCard) {\n return -1;\n }\n\n // If only a has a param, b gets higher priority\n if (aParam && !bParam) {\n return 1;\n }\n\n // If only b has a param, a gets higher priority\n if (bParam && !aParam) {\n return -1;\n }\n\n // if only a has regex, a gets higher priority\n if (aRegex && !bRegex) {\n return -1;\n }\n\n // if only b has regex, b gets higher priority\n if (bRegex && !aRegex) {\n return 1;\n }\n }\n\n return a.segments.length - b.segments.length;\n });\n}\n\nfunction checkForDuplicatedConfigs(configs: RouteConfig[]) {\n // Check for duplicate patterns in the config\n configs.reduce>((acc, config) => {\n const pattern = config.segments.join('/');\n\n if (acc[pattern]) {\n const a = acc[pattern].routeNames;\n const b = config.routeNames;\n\n // It's not a problem if the path string omitted from a inner most screen\n // For example, it's ok if a path resolves to `A > B > C` or `A > B`\n const intersects =\n a.length > b.length ? b.every((it, i) => a[i] === it) : a.every((it, i) => b[i] === it);\n\n if (!intersects) {\n throw new Error(\n `Found conflicting screens with the same pattern. The pattern '${\n pattern\n }' resolves to both '${a.join(' > ')}' and '${b.join(\n ' > '\n )}'. Patterns must be unique and cannot resolve to more than one screen.`\n );\n }\n }\n\n return Object.assign(acc, {\n [pattern]: config,\n });\n }, {});\n}\n\nfunction getConfigsWithRegexes(configs: RouteConfig[]) {\n return configs.map((c) => ({\n ...c,\n // Add `$` to the regex to make sure it matches till end of the path and not just beginning\n regex: c.regex ? new RegExp(c.regex.source + '$') : undefined,\n }));\n}\n\nconst matchAgainstConfigs = (remaining: string, configs: RouteConfig[]) => {\n let routes: ParsedRoute[] | undefined;\n let remainingPath = remaining;\n\n // Go through all configs, and see if the next path segment matches our regex\n for (const config of configs) {\n if (!config.regex) {\n continue;\n }\n\n const match = remainingPath.match(config.regex);\n\n // If our regex matches, we need to extract params from the path\n if (match) {\n routes = config.routeNames.map((routeName) => {\n const routeConfig = configs.find((c) => {\n // Check matching name AND pattern in case same screen is used at different levels in config\n return c.screen === routeName && arrayStartsWith(config.segments, c.segments);\n });\n\n const params =\n routeConfig && match.groups\n ? Object.fromEntries(\n Object.entries(match.groups)\n .map(([key, value]) => {\n const index = Number(key.replace('param_', ''));\n const param = routeConfig.params.find((it) => it.index === index);\n\n if (param?.screen === routeName && param?.name) {\n return [param.name, value];\n }\n\n return null;\n })\n .filter((it) => it != null)\n .map(([key, value]) => {\n if (value == null) {\n return [key, undefined];\n }\n\n const decoded = decodeURIComponent(value);\n const parsed = routeConfig.parse?.[key!]\n ? routeConfig.parse[key!]!(decoded)\n : decoded;\n\n return [key, parsed];\n })\n )\n : undefined;\n\n if (params && Object.keys(params).length) {\n return { name: routeName, params };\n }\n\n return { name: routeName };\n });\n\n remainingPath = remainingPath.replace(match[0], '');\n\n break;\n }\n }\n\n return { routes, remainingPath };\n};\n\nconst createNormalizedConfigs = (\n screen: string,\n routeConfig: Record>,\n initials: InitialRouteConfig[],\n paths: { screen: string; path: string }[],\n parentScreens: string[],\n routeNames: string[]\n): RouteConfig[] => {\n const configs: RouteConfig[] = [];\n\n routeNames.push(screen);\n\n parentScreens.push(screen);\n\n const config = routeConfig[screen];\n\n if (typeof config === 'string') {\n paths.push({ screen, path: config });\n configs.push(createConfigItem(screen, [...routeNames], [...paths]));\n } else if (typeof config === 'object') {\n // if an object is specified as the value (e.g. Foo: { ... }),\n // it can have `path` property and\n // it could have `screens` prop which has nested configs\n if (typeof config.path === 'string') {\n if (config.exact && config.path == null) {\n throw new Error(\n `Screen '${screen}' doesn't specify a 'path'. A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. \\`path: ''\\`.`\n );\n }\n\n // We should add alias configs after the main config\n // So unless they are more specific, main config will be matched first\n const aliasConfigs = [];\n\n if (config.alias) {\n for (const alias of config.alias) {\n if (typeof alias === 'string') {\n aliasConfigs.push(\n createConfigItem(\n screen,\n [...routeNames],\n [...paths, { screen, path: alias }],\n config.parse\n )\n );\n } else if (typeof alias === 'object') {\n aliasConfigs.push(\n createConfigItem(\n screen,\n [...routeNames],\n alias.exact\n ? [{ screen, path: alias.path }]\n : [...paths, { screen, path: alias.path }],\n alias.parse\n )\n );\n }\n }\n }\n\n if (config.exact) {\n // If it's an exact path, we don't need to keep track of the parent screens\n // So we can clear it\n paths.length = 0;\n }\n\n paths.push({ screen, path: config.path });\n configs.push(createConfigItem(screen, [...routeNames], [...paths], config.parse));\n\n configs.push(...aliasConfigs);\n }\n\n if (typeof config !== 'string' && typeof config.path !== 'string' && config.alias?.length) {\n throw new Error(\n `Screen '${screen}' doesn't specify a 'path'. A 'path' needs to be specified in order to use 'alias'.`\n );\n }\n\n if (config.screens) {\n // property `initialRouteName` without `screens` has no purpose\n if (config.initialRouteName) {\n initials.push({\n initialRouteName: config.initialRouteName,\n parentScreens,\n });\n }\n\n Object.keys(config.screens).forEach((nestedConfig) => {\n const result = createNormalizedConfigs(\n nestedConfig,\n config.screens as Record>,\n initials,\n [...paths],\n [...parentScreens],\n routeNames\n );\n\n configs.push(...result);\n });\n }\n }\n\n routeNames.pop();\n\n return configs;\n};\n\nconst createConfigItem = (\n screen: string,\n routeNames: string[],\n paths: { screen: string; path: string }[],\n parse?: ParseConfig\n): RouteConfig => {\n const parts: (PatternPart & { screen: string })[] = [];\n\n // Parse the path string into parts for easier matching\n for (const { screen, path } of paths) {\n parts.push(...getPatternParts(path).map((part) => ({ ...part, screen })));\n }\n\n const regex = parts.length\n ? new RegExp(\n `^(${parts\n .map((it, i) => {\n if (it.param) {\n const reg = it.regex || '[^/]+';\n\n return `(((?${reg})\\\\/)${it.optional ? '?' : ''})`;\n }\n\n return `${it.segment === '*' ? '.*' : escape(it.segment)}\\\\/`;\n })\n .join('')})$`\n )\n : undefined;\n\n const segments = parts.map((it) => it.segment);\n const params = parts\n .map((it, i) =>\n it.param\n ? {\n index: i,\n screen: it.screen,\n name: it.param,\n }\n : null\n )\n .filter((it) => it != null);\n\n return {\n screen,\n regex,\n segments,\n params,\n routeNames,\n parse,\n };\n};\n\nconst findParseConfigForRoute = (\n routeName: string,\n flatConfig: RouteConfig[]\n): ParseConfig | undefined => {\n for (const config of flatConfig) {\n if (routeName === config.routeNames[config.routeNames.length - 1]) {\n return config.parse;\n }\n }\n\n return undefined;\n};\n\n// Try to find an initial route connected with the one passed\nconst findInitialRoute = (\n routeName: string,\n parentScreens: string[],\n initialRoutes: InitialRouteConfig[]\n): string | undefined => {\n for (const config of initialRoutes) {\n if (parentScreens.length === config.parentScreens.length) {\n let sameParents = true;\n for (let i = 0; i < parentScreens.length; i++) {\n if (parentScreens[i]!.localeCompare(config.parentScreens[i]!) !== 0) {\n sameParents = false;\n break;\n }\n }\n if (sameParents) {\n return routeName !== config.initialRouteName ? config.initialRouteName : undefined;\n }\n }\n }\n return undefined;\n};\n\n// returns state object with values depending on whether\n// it is the end of state and if there is initialRoute for this level\nconst createStateObject = (\n initialRoute: string | undefined,\n route: ParsedRoute,\n isEmpty: boolean\n): InitialState => {\n if (isEmpty) {\n if (initialRoute) {\n return {\n index: 1,\n routes: [{ name: initialRoute }, route],\n };\n } else {\n return {\n routes: [route],\n };\n }\n } else {\n if (initialRoute) {\n return {\n index: 1,\n routes: [{ name: initialRoute }, { ...route, state: { routes: [] } }],\n };\n } else {\n return {\n routes: [{ ...route, state: { routes: [] } }],\n };\n }\n }\n};\n\nconst createNestedStateObject = (\n path: string,\n routes: ParsedRoute[],\n initialRoutes: InitialRouteConfig[],\n flatConfig?: RouteConfig[]\n) => {\n let route = routes.shift() as ParsedRoute;\n const parentScreens: string[] = [];\n\n let initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);\n\n parentScreens.push(route.name);\n\n const state: InitialState = createStateObject(initialRoute, route, routes.length === 0);\n\n if (routes.length > 0) {\n let nestedState = state;\n\n while ((route = routes.shift() as ParsedRoute)) {\n initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);\n\n const nestedStateIndex = nestedState.index || nestedState.routes.length - 1;\n\n nestedState.routes[nestedStateIndex]!.state = createStateObject(\n initialRoute,\n route,\n routes.length === 0\n );\n\n if (routes.length > 0) {\n nestedState = nestedState.routes[nestedStateIndex]!.state as InitialState;\n }\n\n parentScreens.push(route.name);\n }\n }\n\n route = findFocusedRoute(state) as ParsedRoute;\n route.path = path.replace(/\\/$/, '');\n\n const params = parseQueryParams(\n path,\n flatConfig ? findParseConfigForRoute(route.name, flatConfig) : undefined\n );\n\n if (params) {\n route.params = { ...route.params, ...params };\n }\n\n return state;\n};\n\nconst parseQueryParams = (\n path: string,\n parseConfig?: Record unknown>\n) => {\n const query = path.split('?')[1];\n if (!query) {\n return undefined;\n }\n\n const params: Record = queryString.parse(query);\n if (parseConfig) {\n Object.keys(params).forEach((name) => {\n if (Object.hasOwnProperty.call(parseConfig, name) && typeof params[name] === 'string') {\n params[name] = parseConfig[name]!(params[name])!;\n }\n });\n }\n\n return Object.keys(params).length ? params : undefined;\n};\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/core/useCurrentRender.js.map b/packages/expo-router/build/react-navigation/core/useCurrentRender.js.map index 999ada17becfdb..53f1c1ec1b9612 100644 --- a/packages/expo-router/build/react-navigation/core/useCurrentRender.js.map +++ b/packages/expo-router/build/react-navigation/core/useCurrentRender.js.map @@ -1 +1 @@ -{"version":3,"file":"useCurrentRender.js","sourceRoot":"","sources":["../../../src/react-navigation/core/useCurrentRender.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAoBb,4CAMC;AAzBD,iCAA4B;AAG5B,iEAA8D;AAY9D;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAW;IAC1E,MAAM,OAAO,GAAG,IAAA,WAAG,EAAC,2CAAoB,CAAC,CAAC;IAE1C,IAAI,OAAO,IAAI,UAAU,CAAC,SAAS,EAAE,EAAE,CAAC;QACtC,OAAO,CAAC,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;IACvE,CAAC;AACH,CAAC","sourcesContent":["'use client';\nimport { use } from 'react';\n\nimport type { NavigationState, ParamListBase } from '../routers';\nimport { CurrentRenderContext } from './CurrentRenderContext';\nimport type { Descriptor, NavigationHelpers, NavigationProp, RouteProp } from './types';\n\ntype Options = {\n state: NavigationState;\n navigation: NavigationHelpers;\n descriptors: Record<\n string,\n Descriptor, RouteProp>\n >;\n};\n\n/**\n * Write the current options, so that server renderer can get current values\n * Mutating values like this is not safe in async mode, but it doesn't apply to SSR\n */\nexport function useCurrentRender({ state, navigation, descriptors }: Options) {\n const current = use(CurrentRenderContext);\n\n if (current && navigation.isFocused()) {\n current.options = descriptors[state.routes[state.index].key].options;\n }\n}\n"]} \ No newline at end of file +{"version":3,"file":"useCurrentRender.js","sourceRoot":"","sources":["../../../src/react-navigation/core/useCurrentRender.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAoBb,4CAMC;AAzBD,iCAA4B;AAG5B,iEAA8D;AAY9D;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAW;IAC1E,MAAM,OAAO,GAAG,IAAA,WAAG,EAAC,2CAAoB,CAAC,CAAC;IAE1C,IAAI,OAAO,IAAI,UAAU,CAAC,SAAS,EAAE,EAAE,CAAC;QACtC,OAAO,CAAC,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAE,CAAC,GAAG,CAAE,CAAC,OAAO,CAAC;IACzE,CAAC;AACH,CAAC","sourcesContent":["'use client';\nimport { use } from 'react';\n\nimport type { NavigationState, ParamListBase } from '../routers';\nimport { CurrentRenderContext } from './CurrentRenderContext';\nimport type { Descriptor, NavigationHelpers, NavigationProp, RouteProp } from './types';\n\ntype Options = {\n state: NavigationState;\n navigation: NavigationHelpers;\n descriptors: Record<\n string,\n Descriptor, RouteProp>\n >;\n};\n\n/**\n * Write the current options, so that server renderer can get current values\n * Mutating values like this is not safe in async mode, but it doesn't apply to SSR\n */\nexport function useCurrentRender({ state, navigation, descriptors }: Options) {\n const current = use(CurrentRenderContext);\n\n if (current && navigation.isFocused()) {\n current.options = descriptors[state.routes[state.index]!.key]!.options;\n }\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/core/useDescriptors.js.map b/packages/expo-router/build/react-navigation/core/useDescriptors.js.map index 88209b45e70031..9f2fcc35298026 100644 --- a/packages/expo-router/build/react-navigation/core/useDescriptors.js.map +++ b/packages/expo-router/build/react-navigation/core/useDescriptors.js.map @@ -1 +1 @@ -{"version":3,"file":"useDescriptors.js","sourceRoot":"","sources":["../../../src/react-navigation/core/useDescriptors.tsx"],"names":[],"mappings":";AAAA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EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEhF,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG;YACf,KAAK;YACL,2DAA2D;YAC3D,UAAU;YACV,MAAM;gBACJ,OAAO,OAAO,CAAC;YACjB,CAAC;YACD,OAAO,EAAE,aAA8B;SACxC,CAAC;QAEF,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP;;;;;;OAMG;IACH,MAAM,QAAQ,GAAG,CAAC,KAA+B,EAAE,WAAoB,EAAE,EAAE;QACzE,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,WAAW,CAAC,EAAE,CAAC;gBAChC,MAAM,IAAI,KAAK,CAAC,sCAAsC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;YACtE,CAAC;YAED,OAAO,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAChC,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC;QACxB,MAAM,aAAa,GAAG,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;QACxD,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;QAEpE,OAAO;YACL,KAAK;YACL,UAAU;YACV,MAAM;gBACJ,OAAO,OAAO,CAAC;YACjB,CAAC;YACD,OAAO,EAAE,aAA8B;SACxC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,QAAQ;QACR,WAAW;KACZ,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { use } from 'react';\n\nimport type {\n NavigationAction,\n NavigationState,\n ParamListBase,\n PartialState,\n Router,\n} from '../routers';\nimport {\n type AddKeyedListener,\n type AddListener,\n NavigationBuilderContext,\n} from './NavigationBuilderContext';\nimport { NavigationProvider } from './NavigationProvider';\nimport { SceneView } from './SceneView';\nimport { ThemeContext } from './theming/ThemeContext';\nimport type {\n Descriptor,\n EventMapBase,\n NavigationHelpers,\n NavigationProp,\n RouteConfig,\n RouteProp,\n} from './types';\nimport type { NavigationEventEmitter } from './useEventEmitter';\nimport { useNavigationCache } from './useNavigationCache';\nimport { useRouteCache } from './useRouteCache';\n\nexport type ScreenConfigWithParent<\n State extends NavigationState,\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n ScreenOptions extends {},\n EventMap extends EventMapBase,\n> = {\n keys: (string | undefined)[];\n options: (ScreenOptionsOrCallback | undefined)[] | undefined;\n layout: ScreenLayout | undefined;\n props: RouteConfig;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ntype ScreenLayout = (props: {\n route: RouteProp;\n options: ScreenOptions;\n navigation: any;\n theme: ReactNavigation.Theme;\n children: React.ReactElement;\n}) => React.ReactElement;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ntype ScreenOptionsOrCallback =\n | ScreenOptions\n | ((props: {\n route: RouteProp;\n navigation: any;\n theme: ReactNavigation.Theme;\n }) => ScreenOptions);\n\ntype Options<\n State extends NavigationState,\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n ScreenOptions extends {},\n EventMap extends EventMapBase,\n> = {\n state: State;\n screens: Record>;\n navigation: NavigationHelpers;\n screenOptions: ScreenOptionsOrCallback | undefined;\n screenLayout: ScreenLayout | undefined;\n onAction: (action: NavigationAction) => boolean;\n getState: () => State;\n setState: (state: State) => void;\n addListener: AddListener;\n addKeyedListener: AddKeyedListener;\n onRouteFocus: (key: string) => void;\n router: Router;\n emitter: NavigationEventEmitter;\n};\n\n/**\n * Hook to create descriptor objects for the child routes.\n *\n * A descriptor object provides 3 things:\n * - Helper method to render a screen\n * - Options specified by the screen for the navigator\n * - Navigation object intended for the route\n */\nexport function useDescriptors<\n State extends NavigationState,\n ActionHelpers extends Record void>,\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n ScreenOptions extends {},\n EventMap extends EventMapBase,\n>({\n state,\n screens,\n navigation,\n screenOptions,\n screenLayout,\n onAction,\n getState,\n setState,\n addListener,\n addKeyedListener,\n onRouteFocus,\n router,\n emitter,\n}: Options) {\n const theme = use(ThemeContext);\n const [options, setOptions] = React.useState>({});\n const { onDispatchAction, onOptionsChange, scheduleUpdate, flushUpdates, stackRef } =\n use(NavigationBuilderContext);\n\n const context = React.useMemo(\n () => ({\n navigation,\n onAction,\n addListener,\n addKeyedListener,\n onRouteFocus,\n onDispatchAction,\n onOptionsChange,\n scheduleUpdate,\n flushUpdates,\n stackRef,\n }),\n [\n navigation,\n onAction,\n addListener,\n addKeyedListener,\n onRouteFocus,\n onDispatchAction,\n onOptionsChange,\n scheduleUpdate,\n flushUpdates,\n stackRef,\n ]\n );\n\n const { base, navigations } = useNavigationCache({\n state,\n getState,\n navigation,\n setOptions,\n router,\n emitter,\n });\n\n const routes = useRouteCache(state.routes);\n\n const getOptions = (\n route: RouteProp,\n navigation: NavigationProp<\n ParamListBase,\n string,\n string | undefined,\n State,\n ScreenOptions,\n EventMap\n >,\n overrides: Record\n ) => {\n const config = screens[route.name];\n const screen = config.props;\n\n const optionsList = [\n // The default `screenOptions` passed to the navigator\n screenOptions,\n // The `screenOptions` props passed to `Group` elements\n ...((config.options\n ? config.options.filter(Boolean)\n : []) as ScreenOptionsOrCallback[]),\n // The `options` prop passed to `Screen` elements,\n screen.options,\n // The options set via `navigation.setOptions`\n overrides,\n ];\n\n return optionsList.reduce(\n (acc, curr) =>\n Object.assign(\n acc,\n // @ts-expect-error: we check for function but TS still complains\n typeof curr !== 'function' ? curr : curr({ route, navigation, theme })\n ),\n {} as ScreenOptions\n );\n };\n\n const render = (\n route: RouteProp,\n navigation: NavigationProp<\n ParamListBase,\n string,\n string | undefined,\n State,\n ScreenOptions,\n EventMap\n >,\n customOptions: ScreenOptions,\n routeState: NavigationState | PartialState | undefined\n ) => {\n const config = screens[route.name];\n const screen = config.props;\n\n const clearOptions = () =>\n setOptions((o) => {\n if (route.key in o) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [route.key]: _, ...rest } = o;\n return rest;\n }\n\n return o;\n });\n\n const layout =\n // The `layout` prop passed to `Screen` elements,\n screen.layout ??\n // The `screenLayout` props passed to `Group` elements\n config.layout ??\n // The default `screenLayout` passed to the navigator\n screenLayout;\n\n let element = (\n \n );\n\n if (layout != null) {\n element = layout({\n route,\n navigation,\n options: customOptions,\n // @ts-expect-error: in practice `theme` will be defined\n theme,\n children: element,\n });\n }\n\n return (\n \n \n {element}\n \n \n );\n };\n\n const descriptors = routes.reduce<\n Record<\n string,\n Descriptor<\n ScreenOptions,\n NavigationProp &\n ActionHelpers,\n RouteProp\n >\n >\n >((acc, route, i) => {\n const navigation = navigations[route.key];\n const customOptions = getOptions(route, navigation, options[route.key]);\n const element = render(route, navigation, customOptions, state.routes[i].state);\n\n acc[route.key] = {\n route,\n // @ts-expect-error: it's missing action helpers, fix later\n navigation,\n render() {\n return element;\n },\n options: customOptions as ScreenOptions,\n };\n\n return acc;\n }, {});\n\n /**\n * Create a descriptor object for a route.\n *\n * @param route Route object for which the descriptor should be created\n * @param placeholder Whether the descriptor should be a placeholder, e.g. for a route not yet in the state\n * @returns Descriptor object\n */\n const describe = (route: RouteProp, placeholder: boolean) => {\n if (!placeholder) {\n if (!(route.key in descriptors)) {\n throw new Error(`Couldn't find a route with the key ${route.key}.`);\n }\n\n return descriptors[route.key];\n }\n\n const navigation = base;\n const customOptions = getOptions(route, navigation, {});\n const element = render(route, navigation, customOptions, undefined);\n\n return {\n route,\n navigation,\n render() {\n return element;\n },\n options: customOptions as ScreenOptions,\n };\n };\n\n return {\n describe,\n descriptors,\n };\n}\n"]} \ No newline at end of file +{"version":3,"file":"useDescriptors.js","sourceRoot":"","sources":["../../../src/react-navigation/core/useDescriptors.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC,CAAC;QAEjF,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG;YACf,KAAK;YACL,2DAA2D;YAC3D,UAAU;YACV,MAAM;gBACJ,OAAO,OAAO,CAAC;YACjB,CAAC;YACD,OAAO,EAAE,aAA8B;SACxC,CAAC;QAEF,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP;;;;;;OAMG;IACH,MAAM,QAAQ,GAAG,CAAC,KAA+B,EAAE,WAAoB,EAAE,EAAE;QACzE,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,WAAW,CAAC,EAAE,CAAC;gBAChC,MAAM,IAAI,KAAK,CAAC,sCAAsC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;YACtE,CAAC;YAED,OAAO,WAAW,CAAC,KAAK,CAAC,GAAG,CAAE,CAAC;QACjC,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC;QACxB,MAAM,aAAa,GAAG,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;QACxD,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;QAEpE,OAAO;YACL,KAAK;YACL,UAAU;YACV,MAAM;gBACJ,OAAO,OAAO,CAAC;YACjB,CAAC;YACD,OAAO,EAAE,aAA8B;SACxC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,QAAQ;QACR,WAAW;KACZ,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { use } from 'react';\n\nimport type {\n NavigationAction,\n NavigationState,\n ParamListBase,\n PartialState,\n Router,\n} from '../routers';\nimport {\n type AddKeyedListener,\n type AddListener,\n NavigationBuilderContext,\n} from './NavigationBuilderContext';\nimport { NavigationProvider } from './NavigationProvider';\nimport { SceneView } from './SceneView';\nimport { ThemeContext } from './theming/ThemeContext';\nimport type {\n Descriptor,\n EventMapBase,\n NavigationHelpers,\n NavigationProp,\n RouteConfig,\n RouteProp,\n} from './types';\nimport type { NavigationEventEmitter } from './useEventEmitter';\nimport { useNavigationCache } from './useNavigationCache';\nimport { useRouteCache } from './useRouteCache';\n\nexport type ScreenConfigWithParent<\n State extends NavigationState,\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n ScreenOptions extends {},\n EventMap extends EventMapBase,\n> = {\n keys: (string | undefined)[];\n options: (ScreenOptionsOrCallback | undefined)[] | undefined;\n layout: ScreenLayout | undefined;\n props: RouteConfig;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ntype ScreenLayout = (props: {\n route: RouteProp;\n options: ScreenOptions;\n navigation: any;\n theme: ReactNavigation.Theme;\n children: React.ReactElement;\n}) => React.ReactElement;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ntype ScreenOptionsOrCallback =\n | ScreenOptions\n | ((props: {\n route: RouteProp;\n navigation: any;\n theme: ReactNavigation.Theme;\n }) => ScreenOptions);\n\ntype Options<\n State extends NavigationState,\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n ScreenOptions extends {},\n EventMap extends EventMapBase,\n> = {\n state: State;\n screens: Record>;\n navigation: NavigationHelpers;\n screenOptions: ScreenOptionsOrCallback | undefined;\n screenLayout: ScreenLayout | undefined;\n onAction: (action: NavigationAction) => boolean;\n getState: () => State;\n setState: (state: State) => void;\n addListener: AddListener;\n addKeyedListener: AddKeyedListener;\n onRouteFocus: (key: string) => void;\n router: Router;\n emitter: NavigationEventEmitter;\n};\n\n/**\n * Hook to create descriptor objects for the child routes.\n *\n * A descriptor object provides 3 things:\n * - Helper method to render a screen\n * - Options specified by the screen for the navigator\n * - Navigation object intended for the route\n */\nexport function useDescriptors<\n State extends NavigationState,\n ActionHelpers extends Record void>,\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n ScreenOptions extends {},\n EventMap extends EventMapBase,\n>({\n state,\n screens,\n navigation,\n screenOptions,\n screenLayout,\n onAction,\n getState,\n setState,\n addListener,\n addKeyedListener,\n onRouteFocus,\n router,\n emitter,\n}: Options) {\n const theme = use(ThemeContext);\n const [options, setOptions] = React.useState>({});\n const { onDispatchAction, onOptionsChange, scheduleUpdate, flushUpdates, stackRef } =\n use(NavigationBuilderContext);\n\n const context = React.useMemo(\n () => ({\n navigation,\n onAction,\n addListener,\n addKeyedListener,\n onRouteFocus,\n onDispatchAction,\n onOptionsChange,\n scheduleUpdate,\n flushUpdates,\n stackRef,\n }),\n [\n navigation,\n onAction,\n addListener,\n addKeyedListener,\n onRouteFocus,\n onDispatchAction,\n onOptionsChange,\n scheduleUpdate,\n flushUpdates,\n stackRef,\n ]\n );\n\n const { base, navigations } = useNavigationCache({\n state,\n getState,\n navigation,\n setOptions,\n router,\n emitter,\n });\n\n const routes = useRouteCache(state.routes);\n\n const getOptions = (\n route: RouteProp,\n navigation: NavigationProp<\n ParamListBase,\n string,\n string | undefined,\n State,\n ScreenOptions,\n EventMap\n >,\n overrides: Record\n ) => {\n const config = screens[route.name]!;\n const screen = config.props;\n\n const optionsList = [\n // The default `screenOptions` passed to the navigator\n screenOptions,\n // The `screenOptions` props passed to `Group` elements\n ...((config.options\n ? config.options.filter(Boolean)\n : []) as ScreenOptionsOrCallback[]),\n // The `options` prop passed to `Screen` elements,\n screen.options,\n // The options set via `navigation.setOptions`\n overrides,\n ];\n\n return optionsList.reduce(\n (acc, curr) =>\n Object.assign(\n acc,\n // @ts-expect-error: we check for function but TS still complains\n typeof curr !== 'function' ? curr : curr({ route, navigation, theme })\n ),\n {} as ScreenOptions\n );\n };\n\n const render = (\n route: RouteProp,\n navigation: NavigationProp<\n ParamListBase,\n string,\n string | undefined,\n State,\n ScreenOptions,\n EventMap\n >,\n customOptions: ScreenOptions,\n routeState: NavigationState | PartialState | undefined\n ) => {\n const config = screens[route.name]!;\n const screen = config.props;\n\n const clearOptions = () =>\n setOptions((o) => {\n if (route.key in o) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [route.key]: _, ...rest } = o;\n return rest;\n }\n\n return o;\n });\n\n const layout =\n // The `layout` prop passed to `Screen` elements,\n screen.layout ??\n // The `screenLayout` props passed to `Group` elements\n config.layout ??\n // The default `screenLayout` passed to the navigator\n screenLayout;\n\n let element = (\n \n );\n\n if (layout != null) {\n element = layout({\n route,\n navigation,\n options: customOptions,\n // @ts-expect-error: in practice `theme` will be defined\n theme,\n children: element,\n });\n }\n\n return (\n \n \n {element}\n \n \n );\n };\n\n const descriptors = routes.reduce<\n Record<\n string,\n Descriptor<\n ScreenOptions,\n NavigationProp &\n ActionHelpers,\n RouteProp\n >\n >\n >((acc, route, i) => {\n const navigation = navigations[route.key]!;\n const customOptions = getOptions(route, navigation, options[route.key]!);\n const element = render(route, navigation, customOptions, state.routes[i]!.state);\n\n acc[route.key] = {\n route,\n // @ts-expect-error: it's missing action helpers, fix later\n navigation,\n render() {\n return element;\n },\n options: customOptions as ScreenOptions,\n };\n\n return acc;\n }, {});\n\n /**\n * Create a descriptor object for a route.\n *\n * @param route Route object for which the descriptor should be created\n * @param placeholder Whether the descriptor should be a placeholder, e.g. for a route not yet in the state\n * @returns Descriptor object\n */\n const describe = (route: RouteProp, placeholder: boolean) => {\n if (!placeholder) {\n if (!(route.key in descriptors)) {\n throw new Error(`Couldn't find a route with the key ${route.key}.`);\n }\n\n return descriptors[route.key]!;\n }\n\n const navigation = base;\n const customOptions = getOptions(route, navigation, {});\n const element = render(route, navigation, customOptions, undefined);\n\n return {\n route,\n navigation,\n render() {\n return element;\n },\n options: customOptions as ScreenOptions,\n };\n };\n\n return {\n describe,\n descriptors,\n };\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/core/useEventEmitter.js.map b/packages/expo-router/build/react-navigation/core/useEventEmitter.js.map index 2c1c98ebf73c7e..a338ad038d7735 100644 --- a/packages/expo-router/build/react-navigation/core/useEventEmitter.js.map +++ b/packages/expo-router/build/react-navigation/core/use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IAAI;gBACN,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC;QAEF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE;gBACrC,UAAU,EAAE,IAAI;gBAChB,GAAG;oBACD,OAAO,MAAM,CAAC;gBAChB,CAAC;aACF,CAAC,CAAC;QACL,CAAC;QAED,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE;gBACnC,UAAU,EAAE,IAAI;gBAChB,GAAG;oBACD,OAAO,IAAI,CAAC;gBACd,CAAC;aACF,CAAC,CAAC;QACL,CAAC;QAED,IAAI,iBAAiB,EAAE,CAAC;YACtB,IAAI,gBAAgB,GAAG,KAAK,CAAC;YAE7B,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE;gBAC7B,gBAAgB,EAAE;oBAChB,UAAU,EAAE,IAAI;oBAChB,GAAG;wBACD,OAAO,gBAAgB,CAAC;oBAC1B,CAAC;iBACF;gBACD,cAAc,EAAE;oBACd,UAAU,EAAE,IAAI;oBAChB,KAAK;wBACH,gBAAgB,GAAG,IAAI,CAAC;oBAC1B,CAAC;iBACF;aACF,CAAC,CAAC;QACL,CAAC;QAED,SAAS,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;QAE3B,SAAS,EAAE,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAEtC,OAAO,KAAY,CAAC;IACtB,CAAC,EACD,EAAE,CACH,CAAC;IAEF,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\n\nimport type { EventArg, EventConsumer, EventEmitter } from './types';\n\nexport type NavigationEventEmitter> = EventEmitter & {\n create: (target: string) => EventConsumer;\n};\n\ntype Listeners = ((e: any) => void)[];\n\n/**\n * Hook to manage the event system used by the navigator to notify screens of various events.\n */\nexport function useEventEmitter>(\n listen?: (e: any) => void\n): NavigationEventEmitter {\n const listenRef = React.useRef(listen);\n\n React.useEffect(() => {\n listenRef.current = listen;\n });\n\n const listeners = React.useRef>>(Object.create(null));\n\n const create = React.useCallback((target: string) => {\n const removeListener = (type: string, callback: (data: any) => void) => {\n const callbacks = listeners.current[type] ? listeners.current[type][target] : undefined;\n\n if (!callbacks) {\n return;\n }\n\n const index = callbacks.indexOf(callback);\n\n if (index > -1) {\n callbacks.splice(index, 1);\n }\n };\n\n const addListener = (type: string, callback: (data: any) => void) => {\n listeners.current[type] = listeners.current[type] || {};\n listeners.current[type][target] = listeners.current[type][target] || [];\n listeners.current[type][target].push(callback);\n\n let removed = false;\n return () => {\n // Prevent removing other listeners when unsubscribing same listener multiple times\n if (!removed) {\n removed = true;\n removeListener(type, callback);\n }\n };\n };\n\n return {\n addListener,\n removeListener,\n };\n }, []);\n\n const emit = React.useCallback(\n ({\n type,\n data,\n target,\n canPreventDefault,\n }: {\n type: string;\n data?: any;\n target?: string;\n canPreventDefault?: boolean;\n }) => {\n const items = listeners.current[type] || {};\n\n // Copy the current list of callbacks in case they are mutated during execution\n const callbacks =\n target !== undefined\n ? items[target]?.slice()\n : ([] as Listeners)\n .concat(...Object.keys(items).map((t) => items[t]))\n .filter((cb, i, self) => self.lastIndexOf(cb) === i);\n\n const event: EventArg = {\n get type() {\n return type;\n },\n };\n\n if (target !== undefined) {\n Object.defineProperty(event, 'target', {\n enumerable: true,\n get() {\n return target;\n },\n });\n }\n\n if (data !== undefined) {\n Object.defineProperty(event, 'data', {\n enumerable: true,\n get() {\n return data;\n },\n });\n }\n\n if (canPreventDefault) {\n let defaultPrevented = false;\n\n Object.defineProperties(event, {\n defaultPrevented: {\n enumerable: true,\n get() {\n return defaultPrevented;\n },\n },\n preventDefault: {\n enumerable: true,\n value() {\n defaultPrevented = true;\n },\n },\n });\n }\n\n listenRef.current?.(event);\n\n callbacks?.forEach((cb) => cb(event));\n\n return event as any;\n },\n []\n );\n\n return React.useMemo(() => ({ create, emit }), [create, emit]);\n}\n"]} \ No newline at end of file +{"version":3,"file":"useEventEmitter.js","sourceRoot":"","sources":["../../../src/react-navigation/core/useEventEmitter.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcb,0CA0HC;AAvID,6CAA+B;AAU/B;;GAEG;AACH,SAAgB,eAAe,CAC7B,MAAyB;IAEzB,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEvC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAA4C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAE/F,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,MAAc,EAAE,EAAE;QAClD,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,QAA6B,EAAE,EAAE;YACrE,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAExF,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,OAAO;YACT,CAAC;YAED,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAE1C,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;gBACf,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAC7B,C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AAE,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\n\nimport type { EventArg, EventConsumer, EventEmitter } from './types';\n\nexport type NavigationEventEmitter> = EventEmitter & {\n create: (target: string) => EventConsumer;\n};\n\ntype Listeners = ((e: any) => void)[];\n\n/**\n * Hook to manage the event system used by the navigator to notify screens of various events.\n */\nexport function useEventEmitter>(\n listen?: (e: any) => void\n): NavigationEventEmitter {\n const listenRef = React.useRef(listen);\n\n React.useEffect(() => {\n listenRef.current = listen;\n });\n\n const listeners = React.useRef>>(Object.create(null));\n\n const create = React.useCallback((target: string) => {\n const removeListener = (type: string, callback: (data: any) => void) => {\n const callbacks = listeners.current[type] ? listeners.current[type][target] : undefined;\n\n if (!callbacks) {\n return;\n }\n\n const index = callbacks.indexOf(callback);\n\n if (index > -1) {\n callbacks.splice(index, 1);\n }\n };\n\n const addListener = (type: string, callback: (data: any) => void) => {\n listeners.current[type] = listeners.current[type] || {};\n listeners.current[type][target] = listeners.current[type][target] || [];\n listeners.current[type][target].push(callback);\n\n let removed = false;\n return () => {\n // Prevent removing other listeners when unsubscribing same listener multiple times\n if (!removed) {\n removed = true;\n removeListener(type, callback);\n }\n };\n };\n\n return {\n addListener,\n removeListener,\n };\n }, []);\n\n const emit = React.useCallback(\n ({\n type,\n data,\n target,\n canPreventDefault,\n }: {\n type: string;\n data?: any;\n target?: string;\n canPreventDefault?: boolean;\n }) => {\n const items = listeners.current[type] || {};\n\n // Copy the current list of callbacks in case they are mutated during execution\n const callbacks =\n target !== undefined\n ? items[target]?.slice()\n : ([] as Listeners)\n .concat(...Object.keys(items).map((t) => items[t]!))\n .filter((cb, i, self) => self.lastIndexOf(cb) === i);\n\n const event: EventArg = {\n get type() {\n return type;\n },\n };\n\n if (target !== undefined) {\n Object.defineProperty(event, 'target', {\n enumerable: true,\n get() {\n return target;\n },\n });\n }\n\n if (data !== undefined) {\n Object.defineProperty(event, 'data', {\n enumerable: true,\n get() {\n return data;\n },\n });\n }\n\n if (canPreventDefault) {\n let defaultPrevented = false;\n\n Object.defineProperties(event, {\n defaultPrevented: {\n enumerable: true,\n get() {\n return defaultPrevented;\n },\n },\n preventDefault: {\n enumerable: true,\n value() {\n defaultPrevented = true;\n },\n },\n });\n }\n\n listenRef.current?.(event);\n\n callbacks?.forEach((cb) => cb(event));\n\n return event as any;\n },\n []\n );\n\n return React.useMemo(() => ({ create, emit }), [create, emit]);\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/core/useFocusEvents.js.map b/packages/expo-router/build/react-navigation/core/useFocusEvents.js.map index a681fc515482d3..8f31fb7fc209e3 100644 --- a/packages/expo-router/build/react-navigation/core/useFocusEvents.js.map +++ b/packages/expo-router/build/react-navigation/core/useFocusEvents.js.map @@ -1 +1 @@ -{"version":3,"file":"useFocusEvents.js","sourceRoot":"","sources":["../../../src/react-navigation/core/useFocusEvents.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBb,wCAmDC;AAnED,6CAA+B;AAC/B,iCAA4B;AAG5B,2DAAwD;AASxD;;GAEG;AACH,SAAgB,cAAc,CAAgC,EAAE,KAAK,EAAE,OAAO,EAAkB;IAC9F,MAAM,UAAU,GAAG,IAAA,WAAG,EAAC,qCAAiB,CAAC,CAAC;IAC1C,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAqB,SAAS,CAAC,CAAC;IAEtE,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;IAExD,uFAAuF;IACvF,6EAA6E;IAC7E,KAAK,CAAC,SAAS,CACb,GAAG,EAAE,CACH,UAAU,EAAE,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE;QACpC,iBAAiB,CAAC,OAAO,GAAG,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AO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC7D,CAAC,EAAE,CAAC,iBAAiB,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { use } from 'react';\n\nimport type { NavigationState } from '../routers';\nimport { NavigationContext } from './NavigationContext';\nimport type { EventMapCore } from './types';\nimport type { NavigationEventEmitter } from './useEventEmitter';\n\ntype Options = {\n state: State;\n emitter: NavigationEventEmitter>;\n};\n\n/**\n * Hook to take care of emitting `focus` and `blur` events.\n */\nexport function useFocusEvents({ state, emitter }: Options) {\n const navigation = use(NavigationContext);\n const lastFocusedKeyRef = React.useRef(undefined);\n\n const currentFocusedKey = state.routes[state.index].key;\n\n // When the parent screen changes its focus state, we also need to change child's focus\n // Coz the child screen can't be focused if the parent screen is out of focus\n React.useEffect(\n () =>\n navigation?.addListener('focus', () => {\n lastFocusedKeyRef.current = currentFocusedKey;\n emitter.emit({ type: 'focus', target: currentFocusedKey });\n }),\n [currentFocusedKey, emitter, navigation]\n );\n\n React.useEffect(\n () =>\n navigation?.addListener('blur', () => {\n lastFocusedKeyRef.current = undefined;\n emitter.emit({ type: 'blur', target: currentFocusedKey });\n }),\n [currentFocusedKey, emitter, navigation]\n );\n\n React.useEffect(() => {\n const lastFocusedKey = lastFocusedKeyRef.current;\n\n lastFocusedKeyRef.current = currentFocusedKey;\n\n // We wouldn't have `lastFocusedKey` on initial mount\n // Fire focus event for the current route on mount if there's no parent navigator\n if (lastFocusedKey === undefined && !navigation) {\n emitter.emit({ type: 'focus', target: currentFocusedKey });\n }\n\n // We should only emit events when the focused key changed and navigator is focused\n // When navigator is not focused, screens inside shouldn't receive focused status either\n if (lastFocusedKey === currentFocusedKey || !(navigation ? navigation.isFocused() : true)) {\n return;\n }\n\n if (lastFocusedKey === undefined) {\n // Only fire events after initial mount\n return;\n }\n\n emitter.emit({ type: 'blur', target: lastFocusedKey });\n emitter.emit({ type: 'focus', target: currentFocusedKey });\n }, [currentFocusedKey, emitter, navigation]);\n}\n"]} \ No newline at end of file +{"version":3,"file":"useFocusEvents.js","sourceRoot":"","sources":["../../../src/react-navigation/core/useFocusEvents.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBb,wCAmDC;AAnED,6CAA+B;AAC/B,iCAA4B;AAG5B,2DAAwD;AASxD;;GAEG;AACH,SAAgB,cAAc,CAAgC,EAAE,KAAK,EAAE,OAAO,EAAkB;IAC9F,MAAM,UAAU,GAAG,IAAA,WAAG,EAAC,qCAAiB,CAAC,CAAC;IAC1C,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAqB,SAAS,CAAC,CAAC;IAEtE,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAE,CAAC,GAAG,CAAC;IAEzD,uFAAuF;IACvF,6EAA6E;IAC7E,KAAK,CAAC,SAAS,CACb,GAAG,EAAE,CACH,UAAU,EAAE,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE;QACpC,iBAAiB,CAAC,OAAO,GAAG,iBAAiB,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,EACJ,CAAC,iBAAiB,EAAE,OAAO,EAAE,UAAU,CAAC,CACzC,CAAC;IAEF,KAAK,CAAC,SAAS,CACb,GAAG,EAAE,CACH,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE;QACnC,iBAAiB,CAAC,OAAO,GAAG,SAAS,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,EACJ,CAAC,iBAAiB,EAAE,OAAO,EAAE,UAAU,CAAC,CACzC,CAAC;IAEF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,cAAc,GAAG,iBAAiB,CAAC,OAAO,CAAC;QAEjD,iBAAiB,CAAC,OAAO,GAAG,iBAAiB,CAAC;QAE9C,qDAAqD;QACrD,iFAAiF;QACjF,IAAI,cAAc,KAAK,SAAS,IAAI,CAAC,UAAU,EAAE,CAAC;YAChD,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,mFAAmF;QACnF,wFAAwF;QACxF,IAAI,cAAc,KAAK,iBAAiB,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1F,OAAO;QACT,CAAC;QAED,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;YACjC,uCAAuC;YACvC,OAAO;QACT,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC7D,CAAC,EAAE,CAAC,iBAAiB,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { use } from 'react';\n\nimport type { NavigationState } from '../routers';\nimport { NavigationContext } from './NavigationContext';\nimport type { EventMapCore } from './types';\nimport type { NavigationEventEmitter } from './useEventEmitter';\n\ntype Options = {\n state: State;\n emitter: NavigationEventEmitter>;\n};\n\n/**\n * Hook to take care of emitting `focus` and `blur` events.\n */\nexport function useFocusEvents({ state, emitter }: Options) {\n const navigation = use(NavigationContext);\n const lastFocusedKeyRef = React.useRef(undefined);\n\n const currentFocusedKey = state.routes[state.index]!.key;\n\n // When the parent screen changes its focus state, we also need to change child's focus\n // Coz the child screen can't be focused if the parent screen is out of focus\n React.useEffect(\n () =>\n navigation?.addListener('focus', () => {\n lastFocusedKeyRef.current = currentFocusedKey;\n emitter.emit({ type: 'focus', target: currentFocusedKey });\n }),\n [currentFocusedKey, emitter, navigation]\n );\n\n React.useEffect(\n () =>\n navigation?.addListener('blur', () => {\n lastFocusedKeyRef.current = undefined;\n emitter.emit({ type: 'blur', target: currentFocusedKey });\n }),\n [currentFocusedKey, emitter, navigation]\n );\n\n React.useEffect(() => {\n const lastFocusedKey = lastFocusedKeyRef.current;\n\n lastFocusedKeyRef.current = currentFocusedKey;\n\n // We wouldn't have `lastFocusedKey` on initial mount\n // Fire focus event for the current route on mount if there's no parent navigator\n if (lastFocusedKey === undefined && !navigation) {\n emitter.emit({ type: 'focus', target: currentFocusedKey });\n }\n\n // We should only emit events when the focused key changed and navigator is focused\n // When navigator is not focused, screens inside shouldn't receive focused status either\n if (lastFocusedKey === currentFocusedKey || !(navigation ? navigation.isFocused() : true)) {\n return;\n }\n\n if (lastFocusedKey === undefined) {\n // Only fire events after initial mount\n return;\n }\n\n emitter.emit({ type: 'blur', target: lastFocusedKey });\n emitter.emit({ type: 'focus', target: currentFocusedKey });\n }, [currentFocusedKey, emitter, navigation]);\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/core/useNavigationBuilder.js.map b/packages/expo-router/build/react-navigation/core/useNavigationBuilder.js.map index 63160c04848677..94c2d4c6fe0e15 100644 --- a/packages/expo-router/build/react-navigation/core/useNavigationBuilder.js.map +++ b/packages/expo-router/build/react-navigation/core/useNavigationBuilder.js.map @@ -1 +1 @@ -{"version":3,"file":"useNavigationBuilder.js","sourceRoot":"","sources":["../../../src/react-navigation/core/useNavigationBuilder.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;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ACZ,WAAW;QACX,gBAAgB;QAChB,MAAM;QACN,8FAA8F;QAC9F,OAAO;KACR,CAAC,CAAC;IAEH,IAAA,mCAAgB,EAAC;QACf,KAAK;QACL,UAAU;QACV,WAAW;KACZ,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,IAAA,2BAAY,EAAC,CAAC,QAAyB,EAAE,EAAE;QACnE,MAAM,OAAO,GACX,MAAM,IAAI,IAAI;YACZ,CAAC,CAAC,MAAM,CAAC;gBACL,KAAK;gBACL,WAAW;gBACX,UAAU;gBACV,QAAQ;aACT,CAAC;YACJ,CAAC,CAAC,QAAQ,CAAC;QAEf,OAAO,CACL,uBAAC,6CAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,SAAS,YAC9C,uBAAC,mDAAwB,CAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,YAClD,uBAAC,oDAA+B,IAAC,KAAK,EAAE,KAAK,YAC3C,uBAAC,qCAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,YACnE,uBAAC,6CAAqB,cAAE,OAAO,GAAyB,GACxB,GACF,GACA,GACL,CAClC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,KAAK;QACL,UAAU;QACV,QAAQ;QACR,WAAW;QACX,iBAAiB;KAClB,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport deepEqual from 'fast-deep-equal';\nimport * as React from 'react';\nimport { use } from 'react';\n// TODO(@ubax) - RN Migration: remove this dependency and just add this function to our codebase\nimport { isValidElementType } from 'react-is';\n\nimport useLatestCallback from '../../utils/useLatestCallback';\nimport {\n CommonActions,\n type DefaultRouterOptions,\n type NavigationAction,\n type NavigationState,\n type ParamListBase,\n type PartialState,\n type Route,\n type Router,\n type RouterConfigOptions,\n type RouterFactory,\n} from '../routers';\nimport { Group } from './Group';\nimport { NavigationHelpersContext } from './NavigationHelpersContext';\nimport { NavigationMetaContext } from './NavigationMetaContext';\nimport { NavigationRouteContext } from './NavigationProvider';\nimport { NavigationStateContext } from './NavigationStateContext';\nimport { PreventRemoveProvider } from './PreventRemoveProvider';\nimport { Screen } from './Screen';\nimport { UnhandledActionContext } from './UnhandledActionContext';\nimport { deepFreeze } from './deepFreeze';\nimport { isArrayEqual } from './isArrayEqual';\nimport { isRecordEqual } from './isRecordEqual';\nimport {\n type DefaultNavigatorOptions,\n type EventMapBase,\n type EventMapCore,\n type NavigatorScreenParams,\n PrivateValueStore,\n type RouteConfig,\n} from './types';\nimport { useChildListeners } from './useChildListeners';\nimport { useClientLayoutEffect } from './useClientLayoutEffect';\nimport { useComponent } from './useComponent';\nimport { useCurrentRender } from './useCurrentRender';\nimport { type ScreenConfigWithParent, useDescriptors } from './useDescriptors';\nimport { useEventEmitter } from './useEventEmitter';\nimport { useFocusEvents } from './useFocusEvents';\nimport { useFocusedListenersChildrenAdapter } from './useFocusedListenersChildrenAdapter';\nimport { FocusedRouteKeyContext } from './useIsFocused';\nimport { useKeyedChildListeners } from './useKeyedChildListeners';\nimport { useLazyValue } from './useLazyValue';\nimport { useNavigationHelpers } from './useNavigationHelpers';\nimport { NavigationStateListenerProvider } from './useNavigationState';\nimport { useOnAction } from './useOnAction';\nimport { useOnGetState } from './useOnGetState';\nimport { useOnRouteFocus } from './useOnRouteFocus';\nimport { useRegisterNavigator } from './useRegisterNavigator';\nimport { useScheduleUpdate } from './useScheduleUpdate';\n\n// This is to make TypeScript compiler happy\n// eslint-disable-next-line @typescript-eslint/no-unused-expressions\nPrivateValueStore;\n\ntype NavigatorRoute = {\n key: string;\n params?: NavigatorScreenParams;\n};\n\nconst CONSUMED_PARAMS = Symbol('CONSUMED_PARAMS');\n\nconst isScreen = (\n child: React.ReactElement\n): child is React.ReactElement<{\n name?: unknown;\n navigationKey?: unknown;\n}> => {\n return child.type === Screen;\n};\n\nconst isGroup = (\n child: React.ReactElement\n): child is React.ReactElement<{\n navigationKey?: unknown;\n screenOptions?: unknown;\n screenLayout?: unknown;\n children?: unknown;\n}> => {\n return child.type === React.Fragment || child.type === Group;\n};\n\nconst isValidKey = (key: unknown): key is string | undefined =>\n key === undefined || (typeof key === 'string' && key !== '');\n\n/**\n * Extract route config object from React children elements.\n *\n * @param children React Elements to extract the config from.\n */\nconst getRouteConfigsFromChildren = <\n State extends NavigationState,\n ScreenOptions extends object,\n EventMap extends EventMapBase,\n>(\n children: React.ReactNode,\n groupKey?: string,\n groupOptions?: ScreenConfigWithParent['options'],\n groupLayout?: ScreenConfigWithParent['layout']\n) => {\n const configs = React.Children.toArray(children).reduce<\n ScreenConfigWithParent[]\n >((acc, child) => {\n if (React.isValidElement(child)) {\n if (isScreen(child)) {\n // We can only extract the config from `Screen` elements\n // If something else was rendered, it's probably a bug\n\n if (typeof child.props !== 'object' || child.props === null) {\n throw new Error(`Got an invalid element for screen.`);\n }\n\n if (typeof child.props.name !== 'string' || child.props.name === '') {\n throw new Error(\n `Got an invalid name (${JSON.stringify(\n child.props.name\n )}) for the screen. It must be a non-empty string.`\n );\n }\n\n if (\n child.props.navigationKey !== undefined &&\n (typeof child.props.navigationKey !== 'string' || child.props.navigationKey === '')\n ) {\n throw new Error(\n `Got an invalid 'navigationKey' prop (${JSON.stringify(\n child.props.navigationKey\n )}) for the screen '${child.props.name}'. It must be a non-empty string or 'undefined'.`\n );\n }\n\n acc.push({\n keys: [groupKey, child.props.navigationKey],\n options: groupOptions,\n layout: groupLayout,\n props: child.props as RouteConfig<\n ParamListBase,\n string,\n State,\n ScreenOptions,\n EventMap,\n unknown\n >,\n });\n\n return acc;\n }\n\n if (isGroup(child)) {\n if (!isValidKey(child.props.navigationKey)) {\n throw new Error(\n `Got an invalid 'navigationKey' prop (${JSON.stringify(\n child.props.navigationKey\n )}) for the group. It must be a non-empty string or 'undefined'.`\n );\n }\n\n // When we encounter a fragment or group, we need to dive into its children to extract the configs\n // This is handy to conditionally define a group of screens\n acc.push(\n ...getRouteConfigsFromChildren(\n child.props.children as React.ReactNode,\n child.props.navigationKey,\n // FIXME\n // @ts-expect-error: add validation\n child.type !== Group\n ? groupOptions\n : groupOptions != null\n ? [...groupOptions, child.props.screenOptions]\n : [child.props.screenOptions],\n typeof child.props.screenLayout === 'function' ? child.props.screenLayout : groupLayout\n )\n );\n\n return acc;\n }\n }\n\n throw new Error(\n `A navigator can only contain 'Screen', 'Group' or 'React.Fragment' as its direct children (found ${\n React.isValidElement(child)\n ? `'${typeof child.type === 'string' ? child.type : child.type?.name}'${\n child.props != null &&\n typeof child.props === 'object' &&\n 'name' in child.props &&\n child.props?.name\n ? ` for the screen '${child.props.name}'`\n : ''\n }`\n : typeof child === 'object'\n ? JSON.stringify(child)\n : `'${String(child)}'`\n }). To render this component in the navigator, pass it in the 'component' prop to 'Screen'.`\n );\n }, []);\n\n if (process.env.NODE_ENV !== 'production') {\n configs.forEach((config) => {\n const { name, children, component, getComponent } = config.props;\n\n if (children != null || component !== undefined || getComponent !== undefined) {\n if (children != null && component !== undefined) {\n throw new Error(\n `Got both 'component' and 'children' props for the screen '${name}'. You must pass only one of them.`\n );\n }\n\n if (children != null && getComponent !== undefined) {\n throw new Error(\n `Got both 'getComponent' and 'children' props for the screen '${name}'. You must pass only one of them.`\n );\n }\n\n if (component !== undefined && getComponent !== undefined) {\n throw new Error(\n `Got both 'component' and 'getComponent' props for the screen '${name}'. You must pass only one of them.`\n );\n }\n\n if (children != null && typeof children !== 'function') {\n throw new Error(\n `Got an invalid value for 'children' prop for the screen '${name}'. It must be a function returning a React Element.`\n );\n }\n\n if (component !== undefined && !isValidElementType(component)) {\n throw new Error(\n `Got an invalid value for 'component' prop for the screen '${name}'. It must be a valid React Component.`\n );\n }\n\n if (getComponent !== undefined && typeof getComponent !== 'function') {\n throw new Error(\n `Got an invalid value for 'getComponent' prop for the screen '${name}'. It must be a function returning a React Component.`\n );\n }\n\n if (typeof component === 'function') {\n if (component.name === 'component') {\n // Inline anonymous functions passed in the `component` prop will have the name of the prop\n // It's relatively safe to assume that it's not a component since it should also have PascalCase name\n // We won't catch all scenarios here, but this should catch a good chunk of incorrect use.\n console.warn(\n `Looks like you're passing an inline function for 'component' prop for the screen '${name}' (e.g. component={() => }). Passing an inline function will cause the component state to be lost on re-render and cause perf issues since it's re-created every render. You can pass the function as children to 'Screen' instead to achieve the desired behaviour.`\n );\n } else if (/^[a-z]/.test(component.name)) {\n console.warn(\n `Got a component with the name '${component.name}' for the screen '${name}'. React Components must start with an uppercase letter. If you're passing a regular function and not a component, pass it as children to 'Screen' instead. Otherwise capitalize your component's name.`\n );\n }\n }\n } else {\n throw new Error(\n `Couldn't find a 'component', 'getComponent' or 'children' prop for the screen '${name}'. This can happen if you passed 'undefined'. You likely forgot to export your component from the file it's defined in, or mixed up default import and named import when importing.`\n );\n }\n });\n }\n\n return configs;\n};\n\nconst getStateFromParams = (params: NavigatorRoute['params']) => {\n if (params?.state != null) {\n return params.state;\n } else if (typeof params?.screen === 'string' && params?.initial !== false) {\n return {\n routes: [\n {\n name: params.screen,\n params: params.params,\n path: params.path,\n },\n ],\n };\n }\n\n return undefined;\n};\n\n/**\n * Hook for building navigators.\n *\n * @param createRouter Factory method which returns router object.\n * @param options Options object containing `children` and additional options for the router.\n * @returns An object containing `state`, `navigation`, `descriptors` objects.\n */\nexport function useNavigationBuilder<\n State extends NavigationState,\n RouterOptions extends DefaultRouterOptions,\n ActionHelpers extends Record void>,\n ScreenOptions extends object,\n EventMap extends Record,\n>(\n createRouter: RouterFactory,\n options: DefaultNavigatorOptions<\n ParamListBase,\n string | undefined,\n State,\n ScreenOptions,\n EventMap,\n any\n > &\n RouterOptions\n) {\n const navigatorKey = useRegisterNavigator();\n\n const route = use(NavigationRouteContext) as NavigatorRoute | undefined;\n\n const isNestedParamsConsumed =\n typeof route?.params === 'object' && route.params != null\n ? CONSUMED_PARAMS in route.params && route.params[CONSUMED_PARAMS] === route.params\n : false;\n\n const {\n children,\n layout,\n screenOptions,\n screenLayout,\n screenListeners,\n UNSTABLE_router,\n ...rest\n } = options;\n\n const routeConfigs = getRouteConfigsFromChildren(children);\n\n const router = useLazyValue>(() => {\n if (\n rest.initialRouteName != null &&\n routeConfigs.every((config) => config.props.name !== rest.initialRouteName)\n ) {\n throw new Error(\n `Couldn't find a screen named '${rest.initialRouteName}' to use as 'initialRouteName'.`\n );\n }\n\n const original = createRouter(rest as unknown as RouterOptions);\n\n if (UNSTABLE_router != null) {\n const overrides = UNSTABLE_router(original);\n\n return {\n ...original,\n ...overrides,\n };\n }\n\n return original;\n });\n\n const screens = routeConfigs.reduce<\n Record>\n >((acc, config) => {\n if (config.props.name in acc) {\n throw new Error(\n `A navigator cannot contain multiple 'Screen' components with the same name (found duplicate screen named '${config.props.name}')`\n );\n }\n\n acc[config.props.name] = config;\n return acc;\n }, {});\n\n const routeNames = routeConfigs.map((config) => config.props.name);\n const routeKeyList = routeNames.reduce>((acc, curr) => {\n acc[curr] = screens[curr].keys.map((key) => key ?? '').join(':');\n return acc;\n }, {});\n const routeParamList = routeNames.reduce>((acc, curr) => {\n const { initialParams } = screens[curr].props;\n acc[curr] = initialParams;\n return acc;\n }, {});\n const routeGetIdList = routeNames.reduce(\n (acc, curr) =>\n Object.assign(acc, {\n [curr]: screens[curr].props.getId,\n }),\n {}\n );\n\n if (!routeNames.length) {\n throw new Error(\n \"Couldn't find any screens for the navigator. Have you defined any screens as its children?\"\n );\n }\n\n const isStateValid = React.useCallback(\n (state: NavigationState | PartialState) =>\n state.type === undefined || state.type === router.type,\n [router.type]\n );\n\n const isStateInitialized = React.useCallback(\n (state: T | PartialState | undefined): state is T =>\n state !== undefined && state.stale === false && isStateValid(state),\n [isStateValid]\n );\n\n const doesStateHaveOnlyInvalidRoutes = React.useCallback(\n (state: NavigationState | PartialState) =>\n state.routes.every((r) => !routeNames.includes(r.name)),\n [routeNames]\n );\n\n const {\n state: currentState,\n getState: getCurrentState,\n setState: setCurrentState,\n setKey,\n getKey,\n getIsInitial,\n } = use(NavigationStateContext);\n\n const stateCleanupRef = React.useRef(false);\n const lastStateRef = React.useRef | undefined>(undefined);\n\n const setState = useLatestCallback((state: State | PartialState | undefined) => {\n if (stateCleanupRef.current) {\n // Store the state locally in case the current navigator is in `Activity`\n lastStateRef.current = state;\n\n // State might have been already cleaned up due to unmount\n // We don't want to update `route.state` in parent\n // Otherwise it will be reused if a new navigator gets mounted\n return;\n }\n\n setCurrentState(state);\n });\n\n const [\n stateBeforeInitialization,\n initializedState,\n isFirstStateInitialization,\n paramsUsedForInitialization,\n ] = React.useMemo((): [\n PartialState | undefined,\n State | undefined,\n boolean,\n object | undefined,\n ] => {\n // If the state was already cleaned up, but we have it stored in ref,\n // It likely got cleaned up due to ``\n // We should reuse this state to avoid remounting screens\n if (stateCleanupRef.current && lastStateRef.current && isStateValid(lastStateRef.current)) {\n const state: State = isStateInitialized(lastStateRef.current)\n ? lastStateRef.current\n : router.getRehydratedState(lastStateRef.current, {\n routeNames,\n routeParamList,\n routeGetIdList,\n });\n\n return [undefined, state, false, undefined];\n }\n\n const initialRouteParamList = routeNames.reduce>(\n (acc, curr) => {\n const { initialParams } = screens[curr].props;\n const initialParamsFromParams =\n route?.params?.state == null &&\n route?.params?.initial !== false &&\n route?.params?.screen === curr\n ? route.params.params\n : undefined;\n\n acc[curr] =\n initialParams !== undefined || initialParamsFromParams !== undefined\n ? {\n ...initialParams,\n ...initialParamsFromParams,\n }\n : undefined;\n\n return acc;\n },\n {}\n );\n\n // If the current state isn't initialized on first render, we initialize it\n // We also need to re-initialize it if the state passed from parent was changed (maybe due to reset)\n // Otherwise assume that the state was provided as initial state\n // So we need to rehydrate it to make it usable\n if (\n (currentState === undefined || !isStateValid(currentState)) &&\n route?.params?.state == null &&\n !(typeof route?.params?.screen === 'string' && route?.params?.initial !== false) &&\n !isNestedParamsConsumed\n ) {\n return [\n undefined,\n router.getInitialState({\n routeNames,\n routeParamList: initialRouteParamList,\n routeGetIdList,\n }),\n true,\n undefined,\n ];\n } else {\n const paramsForState = isNestedParamsConsumed ? undefined : route?.params;\n const stateFromParams = paramsForState ? getStateFromParams(paramsForState) : undefined;\n\n const stateBeforeInitialization = (stateFromParams ?? currentState) as\n | PartialState\n | undefined;\n\n const hydratedState =\n stateBeforeInitialization == null\n ? router.getInitialState({\n routeNames,\n routeParamList: initialRouteParamList,\n routeGetIdList,\n })\n : router.getRehydratedState(stateBeforeInitialization, {\n routeNames,\n routeParamList: initialRouteParamList,\n routeGetIdList,\n });\n\n if (\n stateBeforeInitialization != null &&\n options.UNSTABLE_routeNamesChangeBehavior === 'lastUnhandled' &&\n doesStateHaveOnlyInvalidRoutes(stateBeforeInitialization)\n ) {\n return [stateBeforeInitialization, hydratedState, true, paramsForState];\n }\n\n return [undefined, hydratedState, false, paramsForState];\n }\n // We explicitly don't include routeNames, route.params etc. in the dep list\n // below. We want to avoid forcing a new state to be calculated in those cases\n // Instead, we handle changes to these in the nextState code below. Note\n // that some changes to routeConfigs are explicitly ignored, such as changes\n // to initialParams\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentState, router, isStateValid]);\n\n const previousRouteKeyListRef = React.useRef(routeKeyList);\n\n React.useEffect(() => {\n previousRouteKeyListRef.current = routeKeyList;\n });\n\n const previousRouteKeyList = previousRouteKeyListRef.current;\n\n const [unhandledState, setUnhandledState] = React.useState<\n NavigationState | PartialState | undefined\n >(stateBeforeInitialization);\n\n // An unhandled state is state that didn't have any valid routes\n // So it was unhandled, i.e. not used for initializing the state\n // It's possible that they were absent due to conditional render\n // Store this state so we can reuse it if the routes change later\n if (\n options.UNSTABLE_routeNamesChangeBehavior === 'lastUnhandled' &&\n stateBeforeInitialization &&\n unhandledState !== stateBeforeInitialization\n ) {\n setUnhandledState(stateBeforeInitialization);\n }\n\n let state =\n // If the state isn't initialized, or stale, use the state we initialized instead\n // The state won't update until there's a change needed in the state we have initialized locally\n // So it'll be `undefined` or stale until the first navigation event happens\n isStateInitialized(currentState) ? (currentState as State) : (initializedState as State);\n\n let nextState: State = state;\n let shouldClearUnhandledState = false;\n\n // Previously unhandled state is now valid again\n // And current state no longer has any valid routes\n // We should reuse the unhandled state instead of re-calculating the state\n if (\n unhandledState?.routes.every((r) => routeNames.includes(r.name)) &&\n state?.routes.every((r) => !routeNames.includes(r.name))\n ) {\n shouldClearUnhandledState = true;\n nextState = router.getRehydratedState(unhandledState as PartialState, {\n routeNames,\n routeParamList,\n routeGetIdList,\n });\n } else if (\n !isArrayEqual(state.routeNames, routeNames) ||\n !isRecordEqual(routeKeyList, previousRouteKeyList)\n ) {\n // When the list of route names change, the router should handle it to remove invalid routes\n nextState = router.getStateForRouteNamesChange(state, {\n routeNames,\n routeParamList,\n routeGetIdList,\n routeKeyChanges: Object.keys(routeKeyList).filter(\n (name) => name in previousRouteKeyList && routeKeyList[name] !== previousRouteKeyList[name]\n ),\n });\n }\n\n let didConsumeNestedParams = route?.params === paramsUsedForInitialization;\n\n if (route?.params && !didConsumeNestedParams) {\n let action: CommonActions.Action | undefined;\n\n if (\n typeof route.params.state === 'object' &&\n route.params.state != null &&\n !isNestedParamsConsumed\n ) {\n didConsumeNestedParams = true;\n\n if (\n options.UNSTABLE_routeNamesChangeBehavior === 'lastUnhandled' &&\n doesStateHaveOnlyInvalidRoutes(route.params.state)\n ) {\n if (route.params.state !== unhandledState) {\n setUnhandledState(route.params.state);\n }\n } else {\n // If the route was updated with new state, we should reset to it\n action = CommonActions.reset(route.params.state);\n }\n } else if (\n typeof route.params.screen === 'string' &&\n ((route.params.initial === false && isFirstStateInitialization) || !isNestedParamsConsumed)\n ) {\n didConsumeNestedParams = true;\n\n if (\n options.UNSTABLE_routeNamesChangeBehavior === 'lastUnhandled' &&\n !routeNames.includes(route.params.screen)\n ) {\n const state = getStateFromParams(route.params);\n\n if (state != null && !deepEqual(state, unhandledState)) {\n setUnhandledState(state);\n }\n } else {\n // If the route was updated with new screen name and/or params, we should navigate there\n action = CommonActions.navigate({\n name: route.params.screen,\n params: route.params.params,\n path: route.params.path,\n merge: route.params.merge,\n pop: route.params.pop,\n });\n }\n }\n\n // The update should be limited to current navigator only, so we call the router manually\n const updatedState = action\n ? router.getStateForAction(nextState, action, {\n routeNames,\n routeParamList,\n routeGetIdList,\n })\n : null;\n\n nextState =\n updatedState !== null\n ? router.getRehydratedState(updatedState, {\n routeNames,\n routeParamList,\n routeGetIdList,\n })\n : nextState;\n }\n\n React.useEffect(() => {\n if (didConsumeNestedParams && typeof route?.params === 'object' && route.params != null) {\n // Track whether the params have been already consumed\n // Set it to the same object, so merged params can be handled again\n Object.defineProperty(route.params, CONSUMED_PARAMS, {\n value: route.params,\n enumerable: false,\n });\n }\n }, [didConsumeNestedParams, route?.params]);\n\n const shouldUpdate = state !== nextState;\n\n useScheduleUpdate(() => {\n if (shouldUpdate) {\n // Schedule an update if the state needs to be updated\n setState(nextState);\n\n if (shouldClearUnhandledState) {\n setUnhandledState(undefined);\n }\n }\n });\n\n // The up-to-date state will come in next render, but we don't need to wait for it\n // We can't use the outdated state since the screens have changed, which will cause error due to mismatched config\n // So we override the state object we return to use the latest state as soon as possible\n state = nextState;\n\n // Last state to reuse if component gets cleaned up due to ``\n React.useEffect(() => {\n lastStateRef.current = state;\n });\n\n const lastNotifiedStateRef = React.useRef(null);\n\n React.useEffect(() => {\n // In strict mode, React will double-invoke effects.\n // So we need to reset the flag if component was not unmounted\n stateCleanupRef.current = false;\n\n setKey(navigatorKey);\n\n if (!getIsInitial() && lastNotifiedStateRef.current !== state) {\n // If it's not initial render, we need to update the state\n // This will make sure that our container gets notifier of state changes due to new mounts\n // This is necessary for proper screen tracking, URL updates etc.\n // We only notify if the state is different what we already notified\n // Otherwise this goes into a loop when inside ``\n setState(state);\n lastNotifiedStateRef.current = state;\n }\n\n return () => {\n // We need to clean up state for this navigator on unmount\n if (getCurrentState() !== undefined && getKey() === navigatorKey) {\n setCurrentState(undefined);\n stateCleanupRef.current = true;\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // In some cases (e.g. route names change), internal state might have changed\n // But it hasn't been committed yet, so hasn't propagated to the sync external store\n // During this time, we need to return the internal state in `getState`\n // Otherwise it can result in inconsistent state during render in children\n // To avoid this, we use a ref for render phase, and immediately clear it on commit\n const stateRef = React.useRef(state);\n\n stateRef.current = state;\n\n useClientLayoutEffect(() => {\n stateRef.current = null;\n });\n\n const getState = useLatestCallback((): State => {\n const currentState = getCurrentState();\n\n return deepFreeze(\n (isStateInitialized(currentState) ? currentState : initializedState) as State\n );\n });\n\n const emitter = useEventEmitter>((e) => {\n const routeNames = [];\n\n let route: Route | undefined;\n\n if (e.target) {\n route = state.routes.find((route) => route.key === e.target);\n\n if (route?.name) {\n routeNames.push(route.name);\n }\n } else {\n route = state.routes[state.index];\n routeNames.push(...Object.keys(screens).filter((name) => route?.name === name));\n }\n\n if (route == null) {\n return;\n }\n\n const navigation = descriptors[route.key].navigation;\n\n const listeners = ([] as (((e: any) => void) | undefined)[])\n .concat(\n // Get an array of listeners for all screens + common listeners on navigator\n ...[\n screenListeners,\n ...routeNames.map((name) => {\n const { listeners } = screens[name].props;\n return listeners;\n }),\n ].map((listeners) => {\n const map =\n typeof listeners === 'function'\n ? listeners({ route: route as any, navigation })\n : listeners;\n\n return map\n ? Object.keys(map)\n .filter((type) => type === e.type)\n .map((type) => map?.[type])\n : undefined;\n })\n )\n // We don't want same listener to be called multiple times for same event\n // So we remove any duplicate functions from the array\n .filter((cb, i, self) => cb && self.lastIndexOf(cb) === i);\n\n listeners.forEach((listener) => listener?.(e));\n });\n\n useFocusEvents({ state, emitter });\n\n React.useEffect(() => {\n emitter.emit({ type: 'state', data: { state } });\n }, [emitter, state]);\n\n const { listeners: childListeners, addListener } = useChildListeners();\n\n const { keyedListeners, addKeyedListener } = useKeyedChildListeners();\n\n const onAction = useOnAction({\n router,\n getState,\n setState,\n key: route?.key,\n actionListeners: childListeners.action,\n beforeRemoveListeners: keyedListeners.beforeRemove,\n routerConfigOptions: {\n routeNames,\n routeParamList,\n routeGetIdList,\n },\n emitter,\n });\n\n const onRouteFocus = useOnRouteFocus({\n router,\n key: route?.key,\n getState,\n setState,\n });\n\n const onUnhandledActionParent = use(UnhandledActionContext);\n\n const onUnhandledAction = useLatestCallback((action: NavigationAction) => {\n if (\n options.UNSTABLE_routeNamesChangeBehavior === 'lastUnhandled' &&\n action.type === 'NAVIGATE' &&\n action.payload != null &&\n 'name' in action.payload &&\n typeof action.payload.name === 'string' &&\n !routeNames.includes(action.payload.name)\n ) {\n const state = {\n routes: [\n {\n name: action.payload.name,\n params:\n 'params' in action.payload &&\n typeof action.payload.params === 'object' &&\n action.payload.params !== null\n ? action.payload.params\n : undefined,\n path:\n 'path' in action.payload && typeof action.payload.path === 'string'\n ? action.payload.path\n : undefined,\n },\n ],\n };\n\n setUnhandledState(state);\n }\n\n onUnhandledActionParent?.(action);\n });\n\n const navigation = useNavigationHelpers({\n id: options.id,\n onAction,\n onUnhandledAction,\n getState,\n emitter,\n router,\n stateRef,\n });\n\n useFocusedListenersChildrenAdapter({\n navigation,\n focusedListeners: childListeners.focus,\n });\n\n useOnGetState({\n getState,\n getStateListeners: keyedListeners.getState,\n });\n\n const { describe, descriptors } = useDescriptors({\n state,\n screens,\n navigation,\n screenOptions,\n screenLayout,\n onAction,\n getState,\n setState,\n onRouteFocus,\n addListener,\n addKeyedListener,\n router,\n // @ts-expect-error: this should have both core and custom events, but too much work right now\n emitter,\n });\n\n useCurrentRender({\n state,\n navigation,\n descriptors,\n });\n\n const NavigationContent = useComponent((children: React.ReactNode) => {\n const element =\n layout != null\n ? layout({\n state,\n descriptors,\n navigation,\n children,\n })\n : children;\n\n return (\n \n \n \n \n {element}\n \n \n \n \n );\n });\n\n return {\n state,\n navigation,\n describe,\n descriptors,\n NavigationContent,\n };\n}\n"]} \ No newline at end of file +{"version":3,"file":"useNavigationBuilder.js","sourceRoot":"","sources":["../../../src/react-navigation/core/useNavigationBuilder.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsSb,oDAk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AAM;QACN,8FAA8F;QAC9F,OAAO;KACR,CAAC,CAAC;IAEH,IAAA,mCAAgB,EAAC;QACf,KAAK;QACL,UAAU;QACV,WAAW;KACZ,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,IAAA,2BAAY,EAAC,CAAC,QAAyB,EAAE,EAAE;QACnE,MAAM,OAAO,GACX,MAAM,IAAI,IAAI;YACZ,CAAC,CAAC,MAAM,CAAC;gBACL,KAAK;gBACL,WAAW;gBACX,UAAU;gBACV,QAAQ;aACT,CAAC;YACJ,CAAC,CAAC,QAAQ,CAAC;QAEf,OAAO,CACL,uBAAC,6CAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,SAAS,YAC9C,uBAAC,mDAAwB,CAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,YAClD,uBAAC,oDAA+B,IAAC,KAAK,EAAE,KAAK,YAC3C,uBAAC,qCAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAE,CAAC,GAAG,YACpE,uBAAC,6CAAqB,cAAE,OAAO,GAAyB,GACxB,GACF,GACA,GACL,CAClC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,KAAK;QACL,UAAU;QACV,QAAQ;QACR,WAAW;QACX,iBAAiB;KAClB,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport deepEqual from 'fast-deep-equal';\nimport * as React from 'react';\nimport { use } from 'react';\n// TODO(@ubax) - RN Migration: remove this dependency and just add this function to our codebase\nimport { isValidElementType } from 'react-is';\n\nimport useLatestCallback from '../../utils/useLatestCallback';\nimport {\n CommonActions,\n type DefaultRouterOptions,\n type NavigationAction,\n type NavigationState,\n type ParamListBase,\n type PartialState,\n type Route,\n type Router,\n type RouterConfigOptions,\n type RouterFactory,\n} from '../routers';\nimport { Group } from './Group';\nimport { NavigationHelpersContext } from './NavigationHelpersContext';\nimport { NavigationMetaContext } from './NavigationMetaContext';\nimport { NavigationRouteContext } from './NavigationProvider';\nimport { NavigationStateContext } from './NavigationStateContext';\nimport { PreventRemoveProvider } from './PreventRemoveProvider';\nimport { Screen } from './Screen';\nimport { UnhandledActionContext } from './UnhandledActionContext';\nimport { deepFreeze } from './deepFreeze';\nimport { isArrayEqual } from './isArrayEqual';\nimport { isRecordEqual } from './isRecordEqual';\nimport {\n type DefaultNavigatorOptions,\n type EventMapBase,\n type EventMapCore,\n type NavigatorScreenParams,\n PrivateValueStore,\n type RouteConfig,\n} from './types';\nimport { useChildListeners } from './useChildListeners';\nimport { useClientLayoutEffect } from './useClientLayoutEffect';\nimport { useComponent } from './useComponent';\nimport { useCurrentRender } from './useCurrentRender';\nimport { type ScreenConfigWithParent, useDescriptors } from './useDescriptors';\nimport { useEventEmitter } from './useEventEmitter';\nimport { useFocusEvents } from './useFocusEvents';\nimport { useFocusedListenersChildrenAdapter } from './useFocusedListenersChildrenAdapter';\nimport { FocusedRouteKeyContext } from './useIsFocused';\nimport { useKeyedChildListeners } from './useKeyedChildListeners';\nimport { useLazyValue } from './useLazyValue';\nimport { useNavigationHelpers } from './useNavigationHelpers';\nimport { NavigationStateListenerProvider } from './useNavigationState';\nimport { useOnAction } from './useOnAction';\nimport { useOnGetState } from './useOnGetState';\nimport { useOnRouteFocus } from './useOnRouteFocus';\nimport { useRegisterNavigator } from './useRegisterNavigator';\nimport { useScheduleUpdate } from './useScheduleUpdate';\n\n// This is to make TypeScript compiler happy\n// eslint-disable-next-line @typescript-eslint/no-unused-expressions\nPrivateValueStore;\n\ntype NavigatorRoute = {\n key: string;\n params?: NavigatorScreenParams;\n};\n\nconst CONSUMED_PARAMS = Symbol('CONSUMED_PARAMS');\n\nconst isScreen = (\n child: React.ReactElement\n): child is React.ReactElement<{\n name?: unknown;\n navigationKey?: unknown;\n}> => {\n return child.type === Screen;\n};\n\nconst isGroup = (\n child: React.ReactElement\n): child is React.ReactElement<{\n navigationKey?: unknown;\n screenOptions?: unknown;\n screenLayout?: unknown;\n children?: unknown;\n}> => {\n return child.type === React.Fragment || child.type === Group;\n};\n\nconst isValidKey = (key: unknown): key is string | undefined =>\n key === undefined || (typeof key === 'string' && key !== '');\n\n/**\n * Extract route config object from React children elements.\n *\n * @param children React Elements to extract the config from.\n */\nconst getRouteConfigsFromChildren = <\n State extends NavigationState,\n ScreenOptions extends object,\n EventMap extends EventMapBase,\n>(\n children: React.ReactNode,\n groupKey?: string,\n groupOptions?: ScreenConfigWithParent['options'],\n groupLayout?: ScreenConfigWithParent['layout']\n) => {\n const configs = React.Children.toArray(children).reduce<\n ScreenConfigWithParent[]\n >((acc, child) => {\n if (React.isValidElement(child)) {\n if (isScreen(child)) {\n // We can only extract the config from `Screen` elements\n // If something else was rendered, it's probably a bug\n\n if (typeof child.props !== 'object' || child.props === null) {\n throw new Error(`Got an invalid element for screen.`);\n }\n\n if (typeof child.props.name !== 'string' || child.props.name === '') {\n throw new Error(\n `Got an invalid name (${JSON.stringify(\n child.props.name\n )}) for the screen. It must be a non-empty string.`\n );\n }\n\n if (\n child.props.navigationKey !== undefined &&\n (typeof child.props.navigationKey !== 'string' || child.props.navigationKey === '')\n ) {\n throw new Error(\n `Got an invalid 'navigationKey' prop (${JSON.stringify(\n child.props.navigationKey\n )}) for the screen '${child.props.name}'. It must be a non-empty string or 'undefined'.`\n );\n }\n\n acc.push({\n keys: [groupKey, child.props.navigationKey],\n options: groupOptions,\n layout: groupLayout,\n props: child.props as RouteConfig<\n ParamListBase,\n string,\n State,\n ScreenOptions,\n EventMap,\n unknown\n >,\n });\n\n return acc;\n }\n\n if (isGroup(child)) {\n if (!isValidKey(child.props.navigationKey)) {\n throw new Error(\n `Got an invalid 'navigationKey' prop (${JSON.stringify(\n child.props.navigationKey\n )}) for the group. It must be a non-empty string or 'undefined'.`\n );\n }\n\n // When we encounter a fragment or group, we need to dive into its children to extract the configs\n // This is handy to conditionally define a group of screens\n acc.push(\n ...getRouteConfigsFromChildren(\n child.props.children as React.ReactNode,\n child.props.navigationKey,\n // FIXME\n // @ts-expect-error: add validation\n child.type !== Group\n ? groupOptions\n : groupOptions != null\n ? [...groupOptions, child.props.screenOptions]\n : [child.props.screenOptions],\n typeof child.props.screenLayout === 'function' ? child.props.screenLayout : groupLayout\n )\n );\n\n return acc;\n }\n }\n\n throw new Error(\n `A navigator can only contain 'Screen', 'Group' or 'React.Fragment' as its direct children (found ${\n React.isValidElement(child)\n ? `'${typeof child.type === 'string' ? child.type : child.type?.name}'${\n child.props != null &&\n typeof child.props === 'object' &&\n 'name' in child.props &&\n child.props?.name\n ? ` for the screen '${child.props.name}'`\n : ''\n }`\n : typeof child === 'object'\n ? JSON.stringify(child)\n : `'${String(child)}'`\n }). To render this component in the navigator, pass it in the 'component' prop to 'Screen'.`\n );\n }, []);\n\n if (process.env.NODE_ENV !== 'production') {\n configs.forEach((config) => {\n const { name, children, component, getComponent } = config.props;\n\n if (children != null || component !== undefined || getComponent !== undefined) {\n if (children != null && component !== undefined) {\n throw new Error(\n `Got both 'component' and 'children' props for the screen '${name}'. You must pass only one of them.`\n );\n }\n\n if (children != null && getComponent !== undefined) {\n throw new Error(\n `Got both 'getComponent' and 'children' props for the screen '${name}'. You must pass only one of them.`\n );\n }\n\n if (component !== undefined && getComponent !== undefined) {\n throw new Error(\n `Got both 'component' and 'getComponent' props for the screen '${name}'. You must pass only one of them.`\n );\n }\n\n if (children != null && typeof children !== 'function') {\n throw new Error(\n `Got an invalid value for 'children' prop for the screen '${name}'. It must be a function returning a React Element.`\n );\n }\n\n if (component !== undefined && !isValidElementType(component)) {\n throw new Error(\n `Got an invalid value for 'component' prop for the screen '${name}'. It must be a valid React Component.`\n );\n }\n\n if (getComponent !== undefined && typeof getComponent !== 'function') {\n throw new Error(\n `Got an invalid value for 'getComponent' prop for the screen '${name}'. It must be a function returning a React Component.`\n );\n }\n\n if (typeof component === 'function') {\n if (component.name === 'component') {\n // Inline anonymous functions passed in the `component` prop will have the name of the prop\n // It's relatively safe to assume that it's not a component since it should also have PascalCase name\n // We won't catch all scenarios here, but this should catch a good chunk of incorrect use.\n console.warn(\n `Looks like you're passing an inline function for 'component' prop for the screen '${name}' (e.g. component={() => }). Passing an inline function will cause the component state to be lost on re-render and cause perf issues since it's re-created every render. You can pass the function as children to 'Screen' instead to achieve the desired behaviour.`\n );\n } else if (/^[a-z]/.test(component.name)) {\n console.warn(\n `Got a component with the name '${component.name}' for the screen '${name}'. React Components must start with an uppercase letter. If you're passing a regular function and not a component, pass it as children to 'Screen' instead. Otherwise capitalize your component's name.`\n );\n }\n }\n } else {\n throw new Error(\n `Couldn't find a 'component', 'getComponent' or 'children' prop for the screen '${name}'. This can happen if you passed 'undefined'. You likely forgot to export your component from the file it's defined in, or mixed up default import and named import when importing.`\n );\n }\n });\n }\n\n return configs;\n};\n\nconst getStateFromParams = (params: NavigatorRoute['params']) => {\n if (params?.state != null) {\n return params.state;\n } else if (typeof params?.screen === 'string' && params?.initial !== false) {\n return {\n routes: [\n {\n name: params.screen,\n params: params.params,\n path: params.path,\n },\n ],\n };\n }\n\n return undefined;\n};\n\n/**\n * Hook for building navigators.\n *\n * @param createRouter Factory method which returns router object.\n * @param options Options object containing `children` and additional options for the router.\n * @returns An object containing `state`, `navigation`, `descriptors` objects.\n */\nexport function useNavigationBuilder<\n State extends NavigationState,\n RouterOptions extends DefaultRouterOptions,\n ActionHelpers extends Record void>,\n ScreenOptions extends object,\n EventMap extends Record,\n>(\n createRouter: RouterFactory,\n options: DefaultNavigatorOptions<\n ParamListBase,\n string | undefined,\n State,\n ScreenOptions,\n EventMap,\n any\n > &\n RouterOptions\n) {\n const navigatorKey = useRegisterNavigator();\n\n const route = use(NavigationRouteContext) as NavigatorRoute | undefined;\n\n const isNestedParamsConsumed =\n typeof route?.params === 'object' && route.params != null\n ? CONSUMED_PARAMS in route.params && route.params[CONSUMED_PARAMS] === route.params\n : false;\n\n const {\n children,\n layout,\n screenOptions,\n screenLayout,\n screenListeners,\n UNSTABLE_router,\n ...rest\n } = options;\n\n const routeConfigs = getRouteConfigsFromChildren(children);\n\n const router = useLazyValue>(() => {\n if (\n rest.initialRouteName != null &&\n routeConfigs.every((config) => config.props.name !== rest.initialRouteName)\n ) {\n throw new Error(\n `Couldn't find a screen named '${rest.initialRouteName}' to use as 'initialRouteName'.`\n );\n }\n\n const original = createRouter(rest as unknown as RouterOptions);\n\n if (UNSTABLE_router != null) {\n const overrides = UNSTABLE_router(original);\n\n return {\n ...original,\n ...overrides,\n };\n }\n\n return original;\n });\n\n const screens = routeConfigs.reduce<\n Record>\n >((acc, config) => {\n if (config.props.name in acc) {\n throw new Error(\n `A navigator cannot contain multiple 'Screen' components with the same name (found duplicate screen named '${config.props.name}')`\n );\n }\n\n acc[config.props.name] = config;\n return acc;\n }, {});\n\n const routeNames = routeConfigs.map((config) => config.props.name);\n const routeKeyList = routeNames.reduce>((acc, curr) => {\n acc[curr] = screens[curr]!.keys.map((key) => key ?? '').join(':');\n return acc;\n }, {});\n const routeParamList = routeNames.reduce>((acc, curr) => {\n const { initialParams } = screens[curr]!.props;\n acc[curr] = initialParams;\n return acc;\n }, {});\n const routeGetIdList = routeNames.reduce(\n (acc, curr) =>\n Object.assign(acc, {\n [curr]: screens[curr]!.props.getId,\n }),\n {}\n );\n\n if (!routeNames.length) {\n throw new Error(\n \"Couldn't find any screens for the navigator. Have you defined any screens as its children?\"\n );\n }\n\n const isStateValid = React.useCallback(\n (state: NavigationState | PartialState) =>\n state.type === undefined || state.type === router.type,\n [router.type]\n );\n\n const isStateInitialized = React.useCallback(\n (state: T | PartialState | undefined): state is T =>\n state !== undefined && state.stale === false && isStateValid(state),\n [isStateValid]\n );\n\n const doesStateHaveOnlyInvalidRoutes = React.useCallback(\n (state: NavigationState | PartialState) =>\n state.routes.every((r) => !routeNames.includes(r.name)),\n [routeNames]\n );\n\n const {\n state: currentState,\n getState: getCurrentState,\n setState: setCurrentState,\n setKey,\n getKey,\n getIsInitial,\n } = use(NavigationStateContext);\n\n const stateCleanupRef = React.useRef(false);\n const lastStateRef = React.useRef | undefined>(undefined);\n\n const setState = useLatestCallback((state: State | PartialState | undefined) => {\n if (stateCleanupRef.current) {\n // Store the state locally in case the current navigator is in `Activity`\n lastStateRef.current = state;\n\n // State might have been already cleaned up due to unmount\n // We don't want to update `route.state` in parent\n // Otherwise it will be reused if a new navigator gets mounted\n return;\n }\n\n setCurrentState(state);\n });\n\n const [\n stateBeforeInitialization,\n initializedState,\n isFirstStateInitialization,\n paramsUsedForInitialization,\n ] = React.useMemo((): [\n PartialState | undefined,\n State | undefined,\n boolean,\n object | undefined,\n ] => {\n // If the state was already cleaned up, but we have it stored in ref,\n // It likely got cleaned up due to ``\n // We should reuse this state to avoid remounting screens\n if (stateCleanupRef.current && lastStateRef.current && isStateValid(lastStateRef.current)) {\n const state: State = isStateInitialized(lastStateRef.current)\n ? lastStateRef.current\n : router.getRehydratedState(lastStateRef.current, {\n routeNames,\n routeParamList,\n routeGetIdList,\n });\n\n return [undefined, state, false, undefined];\n }\n\n const initialRouteParamList = routeNames.reduce>(\n (acc, curr) => {\n const { initialParams } = screens[curr]!.props;\n const initialParamsFromParams =\n route?.params?.state == null &&\n route?.params?.initial !== false &&\n route?.params?.screen === curr\n ? route.params.params\n : undefined;\n\n acc[curr] =\n initialParams !== undefined || initialParamsFromParams !== undefined\n ? {\n ...initialParams,\n ...initialParamsFromParams,\n }\n : undefined;\n\n return acc;\n },\n {}\n );\n\n // If the current state isn't initialized on first render, we initialize it\n // We also need to re-initialize it if the state passed from parent was changed (maybe due to reset)\n // Otherwise assume that the state was provided as initial state\n // So we need to rehydrate it to make it usable\n if (\n (currentState === undefined || !isStateValid(currentState)) &&\n route?.params?.state == null &&\n !(typeof route?.params?.screen === 'string' && route?.params?.initial !== false) &&\n !isNestedParamsConsumed\n ) {\n return [\n undefined,\n router.getInitialState({\n routeNames,\n routeParamList: initialRouteParamList,\n routeGetIdList,\n }),\n true,\n undefined,\n ];\n } else {\n const paramsForState = isNestedParamsConsumed ? undefined : route?.params;\n const stateFromParams = paramsForState ? getStateFromParams(paramsForState) : undefined;\n\n const stateBeforeInitialization = (stateFromParams ?? currentState) as\n | PartialState\n | undefined;\n\n const hydratedState =\n stateBeforeInitialization == null\n ? router.getInitialState({\n routeNames,\n routeParamList: initialRouteParamList,\n routeGetIdList,\n })\n : router.getRehydratedState(stateBeforeInitialization, {\n routeNames,\n routeParamList: initialRouteParamList,\n routeGetIdList,\n });\n\n if (\n stateBeforeInitialization != null &&\n options.UNSTABLE_routeNamesChangeBehavior === 'lastUnhandled' &&\n doesStateHaveOnlyInvalidRoutes(stateBeforeInitialization)\n ) {\n return [stateBeforeInitialization, hydratedState, true, paramsForState];\n }\n\n return [undefined, hydratedState, false, paramsForState];\n }\n // We explicitly don't include routeNames, route.params etc. in the dep list\n // below. We want to avoid forcing a new state to be calculated in those cases\n // Instead, we handle changes to these in the nextState code below. Note\n // that some changes to routeConfigs are explicitly ignored, such as changes\n // to initialParams\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentState, router, isStateValid]);\n\n const previousRouteKeyListRef = React.useRef(routeKeyList);\n\n React.useEffect(() => {\n previousRouteKeyListRef.current = routeKeyList;\n });\n\n const previousRouteKeyList = previousRouteKeyListRef.current;\n\n const [unhandledState, setUnhandledState] = React.useState<\n NavigationState | PartialState | undefined\n >(stateBeforeInitialization);\n\n // An unhandled state is state that didn't have any valid routes\n // So it was unhandled, i.e. not used for initializing the state\n // It's possible that they were absent due to conditional render\n // Store this state so we can reuse it if the routes change later\n if (\n options.UNSTABLE_routeNamesChangeBehavior === 'lastUnhandled' &&\n stateBeforeInitialization &&\n unhandledState !== stateBeforeInitialization\n ) {\n setUnhandledState(stateBeforeInitialization);\n }\n\n let state =\n // If the state isn't initialized, or stale, use the state we initialized instead\n // The state won't update until there's a change needed in the state we have initialized locally\n // So it'll be `undefined` or stale until the first navigation event happens\n isStateInitialized(currentState) ? (currentState as State) : (initializedState as State);\n\n let nextState: State = state;\n let shouldClearUnhandledState = false;\n\n // Previously unhandled state is now valid again\n // And current state no longer has any valid routes\n // We should reuse the unhandled state instead of re-calculating the state\n if (\n unhandledState?.routes.every((r) => routeNames.includes(r.name)) &&\n state?.routes.every((r) => !routeNames.includes(r.name))\n ) {\n shouldClearUnhandledState = true;\n nextState = router.getRehydratedState(unhandledState as PartialState, {\n routeNames,\n routeParamList,\n routeGetIdList,\n });\n } else if (\n !isArrayEqual(state.routeNames, routeNames) ||\n !isRecordEqual(routeKeyList, previousRouteKeyList)\n ) {\n // When the list of route names change, the router should handle it to remove invalid routes\n nextState = router.getStateForRouteNamesChange(state, {\n routeNames,\n routeParamList,\n routeGetIdList,\n routeKeyChanges: Object.keys(routeKeyList).filter(\n (name) => name in previousRouteKeyList && routeKeyList[name] !== previousRouteKeyList[name]\n ),\n });\n }\n\n let didConsumeNestedParams = route?.params === paramsUsedForInitialization;\n\n if (route?.params && !didConsumeNestedParams) {\n let action: CommonActions.Action | undefined;\n\n if (\n typeof route.params.state === 'object' &&\n route.params.state != null &&\n !isNestedParamsConsumed\n ) {\n didConsumeNestedParams = true;\n\n if (\n options.UNSTABLE_routeNamesChangeBehavior === 'lastUnhandled' &&\n doesStateHaveOnlyInvalidRoutes(route.params.state)\n ) {\n if (route.params.state !== unhandledState) {\n setUnhandledState(route.params.state);\n }\n } else {\n // If the route was updated with new state, we should reset to it\n action = CommonActions.reset(route.params.state);\n }\n } else if (\n typeof route.params.screen === 'string' &&\n ((route.params.initial === false && isFirstStateInitialization) || !isNestedParamsConsumed)\n ) {\n didConsumeNestedParams = true;\n\n if (\n options.UNSTABLE_routeNamesChangeBehavior === 'lastUnhandled' &&\n !routeNames.includes(route.params.screen)\n ) {\n const state = getStateFromParams(route.params);\n\n if (state != null && !deepEqual(state, unhandledState)) {\n setUnhandledState(state);\n }\n } else {\n // If the route was updated with new screen name and/or params, we should navigate there\n action = CommonActions.navigate({\n name: route.params.screen,\n params: route.params.params,\n path: route.params.path,\n merge: route.params.merge,\n pop: route.params.pop,\n });\n }\n }\n\n // The update should be limited to current navigator only, so we call the router manually\n const updatedState = action\n ? router.getStateForAction(nextState, action, {\n routeNames,\n routeParamList,\n routeGetIdList,\n })\n : null;\n\n nextState =\n updatedState !== null\n ? router.getRehydratedState(updatedState, {\n routeNames,\n routeParamList,\n routeGetIdList,\n })\n : nextState;\n }\n\n React.useEffect(() => {\n if (didConsumeNestedParams && typeof route?.params === 'object' && route.params != null) {\n // Track whether the params have been already consumed\n // Set it to the same object, so merged params can be handled again\n Object.defineProperty(route.params, CONSUMED_PARAMS, {\n value: route.params,\n enumerable: false,\n });\n }\n }, [didConsumeNestedParams, route?.params]);\n\n const shouldUpdate = state !== nextState;\n\n useScheduleUpdate(() => {\n if (shouldUpdate) {\n // Schedule an update if the state needs to be updated\n setState(nextState);\n\n if (shouldClearUnhandledState) {\n setUnhandledState(undefined);\n }\n }\n });\n\n // The up-to-date state will come in next render, but we don't need to wait for it\n // We can't use the outdated state since the screens have changed, which will cause error due to mismatched config\n // So we override the state object we return to use the latest state as soon as possible\n state = nextState;\n\n // Last state to reuse if component gets cleaned up due to ``\n React.useEffect(() => {\n lastStateRef.current = state;\n });\n\n const lastNotifiedStateRef = React.useRef(null);\n\n React.useEffect(() => {\n // In strict mode, React will double-invoke effects.\n // So we need to reset the flag if component was not unmounted\n stateCleanupRef.current = false;\n\n setKey(navigatorKey);\n\n if (!getIsInitial() && lastNotifiedStateRef.current !== state) {\n // If it's not initial render, we need to update the state\n // This will make sure that our container gets notifier of state changes due to new mounts\n // This is necessary for proper screen tracking, URL updates etc.\n // We only notify if the state is different what we already notified\n // Otherwise this goes into a loop when inside ``\n setState(state);\n lastNotifiedStateRef.current = state;\n }\n\n return () => {\n // We need to clean up state for this navigator on unmount\n if (getCurrentState() !== undefined && getKey() === navigatorKey) {\n setCurrentState(undefined);\n stateCleanupRef.current = true;\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // In some cases (e.g. route names change), internal state might have changed\n // But it hasn't been committed yet, so hasn't propagated to the sync external store\n // During this time, we need to return the internal state in `getState`\n // Otherwise it can result in inconsistent state during render in children\n // To avoid this, we use a ref for render phase, and immediately clear it on commit\n const stateRef = React.useRef(state);\n\n stateRef.current = state;\n\n useClientLayoutEffect(() => {\n stateRef.current = null;\n });\n\n const getState = useLatestCallback((): State => {\n const currentState = getCurrentState();\n\n return deepFreeze(\n (isStateInitialized(currentState) ? currentState : initializedState) as State\n );\n });\n\n const emitter = useEventEmitter>((e) => {\n const routeNames = [];\n\n let route: Route | undefined;\n\n if (e.target) {\n route = state.routes.find((route) => route.key === e.target);\n\n if (route?.name) {\n routeNames.push(route.name);\n }\n } else {\n route = state.routes[state.index];\n routeNames.push(...Object.keys(screens).filter((name) => route?.name === name));\n }\n\n if (route == null) {\n return;\n }\n\n const navigation = descriptors[route.key]!.navigation;\n\n const listeners = ([] as (((e: any) => void) | undefined)[])\n .concat(\n // Get an array of listeners for all screens + common listeners on navigator\n ...[\n screenListeners,\n ...routeNames.map((name) => {\n const { listeners } = screens[name]!.props;\n return listeners;\n }),\n ].map((listeners) => {\n const map =\n typeof listeners === 'function'\n ? listeners({ route: route as any, navigation })\n : listeners;\n\n return map\n ? Object.keys(map)\n .filter((type) => type === e.type)\n .map((type) => map?.[type])\n : undefined;\n })\n )\n // We don't want same listener to be called multiple times for same event\n // So we remove any duplicate functions from the array\n .filter((cb, i, self) => cb && self.lastIndexOf(cb) === i);\n\n listeners.forEach((listener) => listener?.(e));\n });\n\n useFocusEvents({ state, emitter });\n\n React.useEffect(() => {\n emitter.emit({ type: 'state', data: { state } });\n }, [emitter, state]);\n\n const { listeners: childListeners, addListener } = useChildListeners();\n\n const { keyedListeners, addKeyedListener } = useKeyedChildListeners();\n\n const onAction = useOnAction({\n router,\n getState,\n setState,\n key: route?.key,\n actionListeners: childListeners.action,\n beforeRemoveListeners: keyedListeners.beforeRemove,\n routerConfigOptions: {\n routeNames,\n routeParamList,\n routeGetIdList,\n },\n emitter,\n });\n\n const onRouteFocus = useOnRouteFocus({\n router,\n key: route?.key,\n getState,\n setState,\n });\n\n const onUnhandledActionParent = use(UnhandledActionContext);\n\n const onUnhandledAction = useLatestCallback((action: NavigationAction) => {\n if (\n options.UNSTABLE_routeNamesChangeBehavior === 'lastUnhandled' &&\n action.type === 'NAVIGATE' &&\n action.payload != null &&\n 'name' in action.payload &&\n typeof action.payload.name === 'string' &&\n !routeNames.includes(action.payload.name)\n ) {\n const state = {\n routes: [\n {\n name: action.payload.name,\n params:\n 'params' in action.payload &&\n typeof action.payload.params === 'object' &&\n action.payload.params !== null\n ? action.payload.params\n : undefined,\n path:\n 'path' in action.payload && typeof action.payload.path === 'string'\n ? action.payload.path\n : undefined,\n },\n ],\n };\n\n setUnhandledState(state);\n }\n\n onUnhandledActionParent?.(action);\n });\n\n const navigation = useNavigationHelpers({\n id: options.id,\n onAction,\n onUnhandledAction,\n getState,\n emitter,\n router,\n stateRef,\n });\n\n useFocusedListenersChildrenAdapter({\n navigation,\n focusedListeners: childListeners.focus,\n });\n\n useOnGetState({\n getState,\n getStateListeners: keyedListeners.getState,\n });\n\n const { describe, descriptors } = useDescriptors({\n state,\n screens,\n navigation,\n screenOptions,\n screenLayout,\n onAction,\n getState,\n setState,\n onRouteFocus,\n addListener,\n addKeyedListener,\n router,\n // @ts-expect-error: this should have both core and custom events, but too much work right now\n emitter,\n });\n\n useCurrentRender({\n state,\n navigation,\n descriptors,\n });\n\n const NavigationContent = useComponent((children: React.ReactNode) => {\n const element =\n layout != null\n ? layout({\n state,\n descriptors,\n navigation,\n children,\n })\n : children;\n\n return (\n \n \n \n \n {element}\n \n \n \n \n );\n });\n\n return {\n state,\n navigation,\n describe,\n descriptors,\n NavigationContent,\n };\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/core/useNavigationCache.js.map b/packages/expo-router/build/react-navigation/core/useNavigationCache.js.map index 50c9b78e539cd8..11f95a197f550a 100644 --- a/packages/expo-router/build/react-navigation/core/useNavigationCache.js.map +++ b/packages/expo-router/build/react-navigation/core/useNavigationCache.js.map @@ -1 +1 @@ -{"version":3,"file":"useNavigationCache.js","sourceRoot":"","sources":["../../../src/react-navigation/core/useNavigationCache.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDb,gDAsKC;AArND,6CAA+B;AAC/B,iCAA4B;AAE5B,wCAMoB;AACpB,yEAAsE;AAgCtE;;;;GAIG;AACH,SAAgB,kBAAkB,CAKhC,EACA,KAAK,EACL,QAAQ,EACR,UAAU,EACV,UAAU,EACV,MAAM,EACN,OAAO,GACiC;IACxC,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,WAAG,EAAC,mDAAwB,CAAC,CAAC;IAEnD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,GAAmE,EAAE;QAC9F,6DAA6D;QAC7D,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,UAAU,CAAC;QAErC,MAAM,OAAO,GAAG;YACd,GAAG,MAAM,CAAC,cAAc;YACxB,GAAG,uBAAa;SACjB,CAAC;QAEF,MAAM,QAAQ,GAAG,GAAG,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAC7E,CAAC,CAAC;QAEF,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAA6B,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACpF,GAAG,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;YAErB,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAkB,CAAC;QAExB,OAAO;YACL,GAAG,IAAI;YACP,GAAG,OAAO;YACV,WAAW,EAAE,GAAG,EAAE;gBAChB,4DAA4D;gBAE5D,OAAO,GAAG,EAAE;oBACV,iBAAiB;gBACnB,CAAC,CAAC;YACJ,CAAC;YACD,cAAc,EAAE,GAAG,EAAE;gBACnB,4DAA4D;YAC9D,CAAC;YACD,QAAQ;YAC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E,KAAK,CAAC,OAAO;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { use } from 'react';\n\nimport {\n CommonActions,\n type NavigationAction,\n type NavigationState,\n type ParamListBase,\n type Router,\n} from '../routers';\nimport { NavigationBuilderContext } from './NavigationBuilderContext';\nimport type { NavigationHelpers, NavigationProp } from './types';\nimport type { NavigationEventEmitter } from './useEventEmitter';\n\ntype Options<\n State extends NavigationState,\n ScreenOptions extends object,\n EventMap extends Record,\n> = {\n state: State;\n getState: () => State;\n navigation: NavigationHelpers &\n Partial>;\n setOptions: (\n cb: (options: Record) => Record\n ) => void;\n router: Router;\n emitter: NavigationEventEmitter;\n};\n\ntype NavigationItem<\n State extends NavigationState,\n ScreenOptions extends object,\n EventMap extends Record,\n> = NavigationProp;\n\ntype NavigationCache<\n State extends NavigationState,\n ScreenOptions extends object,\n EventMap extends Record,\n> = Record>;\n\n/**\n * Hook to cache navigation objects for each screen in the navigator.\n * It's important to cache them to make sure navigation objects don't change between renders.\n * This lets us apply optimizations like `React.memo` to minimize re-rendering screens.\n */\nexport function useNavigationCache<\n State extends NavigationState,\n ScreenOptions extends object,\n EventMap extends Record,\n ActionHelpers extends Record void>,\n>({\n state,\n getState,\n navigation,\n setOptions,\n router,\n emitter,\n}: Options) {\n const { stackRef } = use(NavigationBuilderContext);\n\n const base = React.useMemo((): NavigationItem & ActionHelpers => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { emit, ...rest } = navigation;\n\n const actions = {\n ...router.actionCreators,\n ...CommonActions,\n };\n\n const dispatch = () => {\n throw new Error('Actions cannot be dispatched from a placeholder screen.');\n };\n\n const helpers = Object.keys(actions).reduce void>>((acc, name) => {\n acc[name] = dispatch;\n\n return acc;\n }, {}) as ActionHelpers;\n\n return {\n ...rest,\n ...helpers,\n addListener: () => {\n // Event listeners are not supported for placeholder screens\n\n return () => {\n // Empty function\n };\n },\n removeListener: () => {\n // Event listeners are not supported for placeholder screens\n },\n dispatch,\n getParent: (id?: string) => {\n if (id !== undefined && id === rest.getId()) {\n return base;\n }\n\n return rest.getParent(id);\n },\n setOptions: () => {\n throw new Error('Options cannot be set from a placeholder screen.');\n },\n isFocused: () => false,\n };\n }, [navigation, router.actionCreators]);\n\n // Cache object which holds navigation objects for each screen\n // We use `React.useMemo` instead of `React.useRef` coz we want to invalidate it when deps change\n // In reality, these deps will rarely change, if ever\n const cache = React.useMemo(\n () => ({ current: {} as NavigationCache }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [base, getState, navigation, setOptions, emitter]\n );\n\n cache.current = state.routes.reduce>(\n (acc, route) => {\n const previous = cache.current[route.key];\n\n type Thunk = NavigationAction | ((state: State) => NavigationAction | null | undefined);\n\n if (previous) {\n // If a cached navigation object already exists, reuse it\n acc[route.key] = previous;\n } else {\n const dispatch = (thunk: Thunk) => {\n const action = typeof thunk === 'function' ? thunk(getState()) : thunk;\n\n if (action != null) {\n navigation.dispatch({ source: route.key, ...action });\n }\n };\n\n const withStack = (callback: () => void) => {\n let isStackSet = false;\n\n try {\n if (process.env.NODE_ENV !== 'production' && stackRef && !stackRef.current) {\n // Capture the stack trace for devtools\n stackRef.current = new Error().stack;\n isStackSet = true;\n }\n\n callback();\n } finally {\n if (isStackSet && stackRef) {\n stackRef.current = undefined;\n }\n }\n };\n\n const actions = {\n ...router.actionCreators,\n ...CommonActions,\n };\n\n const helpers = Object.keys(actions).reduce void>>((acc, name) => {\n acc[name] = (...args: any) =>\n withStack(() =>\n // @ts-expect-error: name is a valid key, but TypeScript is dumb\n dispatch(actions[name](...args))\n );\n\n return acc;\n }, {});\n\n acc[route.key] = {\n ...base,\n ...helpers,\n // FIXME: too much work to fix the types for now\n ...(emitter.create(route.key) as any),\n dispatch: (thunk: Thunk) => withStack(() => dispatch(thunk)),\n getParent: (id?: string) => {\n if (id !== undefined && id === base.getId()) {\n // If the passed id is the same as the current navigation id,\n // we return the cached navigation object for the relevant route\n return acc[route.key];\n }\n\n return base.getParent(id);\n },\n setOptions: (options: object) => {\n setOptions((o) => ({\n ...o,\n [route.key]: { ...o[route.key], ...options },\n }));\n },\n isFocused: () => {\n const state = base.getState();\n\n if (state.routes[state.index].key !== route.key) {\n return false;\n }\n\n // If the current screen is focused, we also need to check if parent navigator is focused\n // This makes sure that we return the focus state in the whole tree, not just this navigator\n return navigation ? navigation.isFocused() : true;\n },\n };\n }\n\n return acc;\n },\n {}\n );\n\n return {\n base,\n navigations: cache.current,\n };\n}\n"]} \ No newline at end of file +{"version":3,"file":"useNavigationCache.js","sourceRoot":"","sources":["../../../src/react-navigation/core/useNavigationCache.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDb,gDAsKC;AArND,6CAA+B;AAC/B,iCAA4B;AAE5B,wCAMoB;AACpB,yEAAsE;AAgCtE;;;;GAIG;AACH,SAAgB,kBAAkB,CAKhC,EACA,KAAK,EACL,QAAQ,EACR,UAAU,EACV,UAAU,EACV,MAAM,EACN,OAAO,GACiC;IACxC,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,WAAG,EAAC,mDAAwB,CAAC,CAAC;IAEnD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,GAAmE,EAAE;QAC9F,6DAA6D;QAC7D,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,UAAU,CAAC;QAErC,MAAM,OAAO,GAAG;YACd,GAAG,MAAM,CAAC,cAAc;YACxB,GAAG,uBAAa;SACjB,CAAC;QAEF,MAAM,QAAQ,GAAG,GAAG,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAC7E,CAAC,CAAC;QAEF,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAA6B,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACpF,GAAG,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;YAErB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wBACjD,OAAO,KAAK,CAAC;oBACf,CAAC;oBAED,yFAAyF;oBACzF,4FAA4F;oBAC5F,OAAO,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;gBACpD,CAAC;aACF,CAAC;QACJ,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAE,CACH,CAAC;IAEF,OAAO;QACL,IAAI;QACJ,WAAW,EAAE,KAAK,CAAC,OAAO;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { use } from 'react';\n\nimport {\n CommonActions,\n type NavigationAction,\n type NavigationState,\n type ParamListBase,\n type Router,\n} from '../routers';\nimport { NavigationBuilderContext } from './NavigationBuilderContext';\nimport type { NavigationHelpers, NavigationProp } from './types';\nimport type { NavigationEventEmitter } from './useEventEmitter';\n\ntype Options<\n State extends NavigationState,\n ScreenOptions extends object,\n EventMap extends Record,\n> = {\n state: State;\n getState: () => State;\n navigation: NavigationHelpers &\n Partial>;\n setOptions: (\n cb: (options: Record) => Record\n ) => void;\n router: Router;\n emitter: NavigationEventEmitter;\n};\n\ntype NavigationItem<\n State extends NavigationState,\n ScreenOptions extends object,\n EventMap extends Record,\n> = NavigationProp;\n\ntype NavigationCache<\n State extends NavigationState,\n ScreenOptions extends object,\n EventMap extends Record,\n> = Record>;\n\n/**\n * Hook to cache navigation objects for each screen in the navigator.\n * It's important to cache them to make sure navigation objects don't change between renders.\n * This lets us apply optimizations like `React.memo` to minimize re-rendering screens.\n */\nexport function useNavigationCache<\n State extends NavigationState,\n ScreenOptions extends object,\n EventMap extends Record,\n ActionHelpers extends Record void>,\n>({\n state,\n getState,\n navigation,\n setOptions,\n router,\n emitter,\n}: Options) {\n const { stackRef } = use(NavigationBuilderContext);\n\n const base = React.useMemo((): NavigationItem & ActionHelpers => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { emit, ...rest } = navigation;\n\n const actions = {\n ...router.actionCreators,\n ...CommonActions,\n };\n\n const dispatch = () => {\n throw new Error('Actions cannot be dispatched from a placeholder screen.');\n };\n\n const helpers = Object.keys(actions).reduce void>>((acc, name) => {\n acc[name] = dispatch;\n\n return acc;\n }, {}) as ActionHelpers;\n\n return {\n ...rest,\n ...helpers,\n addListener: () => {\n // Event listeners are not supported for placeholder screens\n\n return () => {\n // Empty function\n };\n },\n removeListener: () => {\n // Event listeners are not supported for placeholder screens\n },\n dispatch,\n getParent: (id?: string) => {\n if (id !== undefined && id === rest.getId()) {\n return base;\n }\n\n return rest.getParent(id);\n },\n setOptions: () => {\n throw new Error('Options cannot be set from a placeholder screen.');\n },\n isFocused: () => false,\n };\n }, [navigation, router.actionCreators]);\n\n // Cache object which holds navigation objects for each screen\n // We use `React.useMemo` instead of `React.useRef` coz we want to invalidate it when deps change\n // In reality, these deps will rarely change, if ever\n const cache = React.useMemo(\n () => ({ current: {} as NavigationCache }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [base, getState, navigation, setOptions, emitter]\n );\n\n cache.current = state.routes.reduce>(\n (acc, route) => {\n const previous = cache.current[route.key];\n\n type Thunk = NavigationAction | ((state: State) => NavigationAction | null | undefined);\n\n if (previous) {\n // If a cached navigation object already exists, reuse it\n acc[route.key] = previous;\n } else {\n const dispatch = (thunk: Thunk) => {\n const action = typeof thunk === 'function' ? thunk(getState()) : thunk;\n\n if (action != null) {\n navigation.dispatch({ source: route.key, ...action });\n }\n };\n\n const withStack = (callback: () => void) => {\n let isStackSet = false;\n\n try {\n if (process.env.NODE_ENV !== 'production' && stackRef && !stackRef.current) {\n // Capture the stack trace for devtools\n stackRef.current = new Error().stack;\n isStackSet = true;\n }\n\n callback();\n } finally {\n if (isStackSet && stackRef) {\n stackRef.current = undefined;\n }\n }\n };\n\n const actions = {\n ...router.actionCreators,\n ...CommonActions,\n };\n\n const helpers = Object.keys(actions).reduce void>>((acc, name) => {\n acc[name] = (...args: any) =>\n withStack(() =>\n // @ts-expect-error: name is a valid key, but TypeScript is dumb\n dispatch(actions[name](...args))\n );\n\n return acc;\n }, {});\n\n acc[route.key] = {\n ...base,\n ...helpers,\n // FIXME: too much work to fix the types for now\n ...(emitter.create(route.key) as any),\n dispatch: (thunk: Thunk) => withStack(() => dispatch(thunk)),\n getParent: (id?: string) => {\n if (id !== undefined && id === base.getId()) {\n // If the passed id is the same as the current navigation id,\n // we return the cached navigation object for the relevant route\n return acc[route.key];\n }\n\n return base.getParent(id);\n },\n setOptions: (options: object) => {\n setOptions((o) => ({\n ...o,\n [route.key]: { ...o[route.key]!, ...options },\n }));\n },\n isFocused: () => {\n const state = base.getState();\n\n if (state.routes[state.index]!.key !== route.key) {\n return false;\n }\n\n // If the current screen is focused, we also need to check if parent navigator is focused\n // This makes sure that we return the focus state in the whole tree, not just this navigator\n return navigation ? navigation.isFocused() : true;\n },\n };\n }\n\n return acc;\n },\n {}\n );\n\n return {\n base,\n navigations: cache.current,\n };\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/core/useOnAction.d.ts.map b/packages/expo-router/build/react-navigation/core/useOnAction.d.ts.map index 1372e651f65d7f..4e9e68c34d8dcb 100644 --- a/packages/expo-router/build/react-navigation/core/useOnAction.d.ts.map +++ b/packages/expo-router/build/react-navigation/core/useOnAction.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"useOnAction.d.ts","sourceRoot":"","sources":["../../../src/react-navigation/core/useOnAction.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,MAAM,EACN,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAE/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAGhE,KAAK,OAAO,CAAC,KAAK,SAAS,eAAe,IAAI;IAC5C,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,KAAK,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;IACvD,eAAe,EAAE,mBAAmB,EAAE,CAAC;IACvC,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,GAAG,SAAS,CAAC,CAAC;IAC7E,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;CACpD,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,SAAS,eAAe,EAAE,EACzD,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,OAAO,GACR,EAAE,OAAO,CAAC,KAAK,CAAC,YAgBJ,gBAAgB,sBAAqB,GAAG,CAAC,MAAM,CAAC,aAqG5D"} \ No newline at end of file +{"version":3,"file":"useOnAction.d.ts","sourceRoot":"","sources":["../../../src/react-navigation/core/useOnAction.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,MAAM,EACN,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAE/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAGhE,KAAK,OAAO,CAAC,KAAK,SAAS,eAAe,IAAI;IAC5C,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,KAAK,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;IACvD,eAAe,EAAE,mBAAmB,EAAE,CAAC;IACvC,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,GAAG,SAAS,CAAC,CAAC;IAC7E,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;CACpD,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,SAAS,eAAe,EAAE,EACzD,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,OAAO,GACR,EAAE,OAAO,CAAC,KAAK,CAAC,YAgBJ,gBAAgB,sBAAqB,GAAG,CAAC,MAAM,CAAC,aAoG5D"} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/core/useOnAction.js.map b/packages/expo-router/build/react-navigation/core/useOnAction.js.map index 7eabbceb8d155c..706e93f73566b7 100644 --- a/packages/expo-router/build/react-navigation/core/useOnAction.js.map +++ b/packages/expo-router/build/react-navigation/core/useOnAction.js.map @@ -1 +1 @@ -{"version":3,"file":"useOnAction.js","sourceRoot":"","sources":["../../../src/react-navigation/core/useOnAction.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCb,kCA8HC;AAtKD,6CAA+B;AAC/B,iCAA4B;AAS5B,6FAA0F;AAC1F,yEAIoC;AAGpC,6DAA+E;AAa/E;;;;;;;;GAQG;AACH,SAAgB,WAAW,CAAgC,EACzD,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,eAAe,EACf,qBAAqB,EAC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AAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC,EACD;QACE,eAAe;QACf,qBAAqB;QACrB,OAAO;QACP,QAAQ;QACR,wBAAwB;QACxB,GAAG;QACH,cAAc;QACd,gBAAgB;QAChB,kBAAkB;QAClB,MAAM;QACN,QAAQ;KACT,CACF,CAAC;IAEF,IAAA,uCAAkB,EAAC;QACjB,QAAQ;QACR,OAAO;QACP,qBAAqB;KACtB,CAAC,CAAC;IAEH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,iBAAiB,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE9F,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { use } from 'react';\n\nimport type {\n NavigationAction,\n NavigationState,\n PartialState,\n Router,\n RouterConfigOptions,\n} from '../routers';\nimport { DeprecatedNavigationInChildContext } from './DeprecatedNavigationInChildContext';\nimport {\n type ChildActionListener,\n type ChildBeforeRemoveListener,\n NavigationBuilderContext,\n} from './NavigationBuilderContext';\nimport type { EventMapCore } from './types';\nimport type { NavigationEventEmitter } from './useEventEmitter';\nimport { shouldPreventRemove, useOnPreventRemove } from './useOnPreventRemove';\n\ntype Options = {\n router: Router;\n key?: string;\n getState: () => State;\n setState: (state: State | PartialState) => void;\n actionListeners: ChildActionListener[];\n beforeRemoveListeners: Record;\n routerConfigOptions: RouterConfigOptions;\n emitter: NavigationEventEmitter>;\n};\n\n/**\n * Hook to handle actions for a navigator, including state updates and bubbling.\n *\n * Bubbling an action is achieved in 2 ways:\n * 1. To bubble action to parent, we expose the action handler in context and then access the parent context\n * 2. To bubble action to child, child adds event listeners subscribing to actions from parent\n *\n * When the action handler handles as action, it returns `true`, otherwise `false`.\n */\nexport function useOnAction({\n router,\n getState,\n setState,\n key,\n actionListeners,\n beforeRemoveListeners,\n routerConfigOptions,\n emitter,\n}: Options) {\n const {\n onAction: onActionParent,\n onRouteFocus: onRouteFocusParent,\n addListener: addListenerParent,\n onDispatchAction,\n } = use(NavigationBuilderContext);\n const navigationInChildEnabled = use(DeprecatedNavigationInChildContext);\n\n const routerConfigOptionsRef = React.useRef(routerConfigOptions);\n\n React.useEffect(() => {\n routerConfigOptionsRef.current = routerConfigOptions;\n });\n\n const onAction = React.useCallback(\n (action: NavigationAction, visitedNavigators: Set = new Set()) => {\n const state = getState();\n\n // Since actions can bubble both up and down, they could come to the same navigator again\n // We keep track of navigators which have already tried to handle the action and return if it's already visited\n if (visitedNavigators.has(state.key)) {\n return false;\n }\n\n visitedNavigators.add(state.key);\n\n if (typeof action.target !== 'string' || action.target === state.key) {\n let result = router.getStateForAction(state, action, routerConfigOptionsRef.current);\n\n // If a target is specified and set to current navigator, the action shouldn't bubble\n // So instead of `null`, we use the state object for such cases to signal that action was handled\n result = result === null && action.target === state.key ? state : result;\n\n if (result !== null) {\n onDispatchAction(action, state === result);\n\n if (state !== result) {\n const isPrevented = shouldPreventRemove(\n emitter,\n beforeRemoveListeners,\n state.routes,\n result.routes,\n action\n );\n\n if (isPrevented) {\n return true;\n }\n\n setState(result);\n }\n\n if (onRouteFocusParent !== undefined) {\n // Some actions such as `NAVIGATE` also want to bring the navigated route to focus in the whole tree\n // This means we need to focus all of the parent navigators of this navigator as well\n const shouldFocus = router.shouldActionChangeFocus(action);\n\n if (shouldFocus && key !== undefined) {\n onRouteFocusParent(key);\n }\n }\n\n return true;\n }\n }\n\n if (onActionParent !== undefined) {\n // Bubble action to the parent if the current navigator didn't handle it\n if (onActionParent(action, visitedNavigators)) {\n return true;\n }\n }\n\n if (\n typeof action.target === 'string' ||\n // For backward compatibility\n action.type === 'NAVIGATE_DEPRECATED' ||\n navigationInChildEnabled\n ) {\n // If the action wasn't handled by current navigator or a parent navigator, let children handle it\n // Handling this when target isn't specified is deprecated and will be removed in the future\n for (let i = actionListeners.length - 1; i >= 0; i--) {\n const listener = actionListeners[i];\n\n if (listener(action, visitedNavigators)) {\n return true;\n }\n }\n }\n\n return false;\n },\n [\n actionListeners,\n beforeRemoveListeners,\n emitter,\n getState,\n navigationInChildEnabled,\n key,\n onActionParent,\n onDispatchAction,\n onRouteFocusParent,\n router,\n setState,\n ]\n );\n\n useOnPreventRemove({\n getState,\n emitter,\n beforeRemoveListeners,\n });\n\n React.useEffect(() => addListenerParent?.('action', onAction), [addListenerParent, onAction]);\n\n return onAction;\n}\n"]} \ No newline at end of file +{"version":3,"file":"useOnAction.js","sourceRoot":"","sources":["../../../src/react-navigation/core/useOnAction.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCb,kCA6HC;AArKD,6CAA+B;AAC/B,iCAA4B;AAS5B,6FAA0F;AAC1F,yEAIoC;AAGpC,6DAA+E;AAa/E;;;;;;;;GAQG;AACH,SAAgB,WAAW,CAAgC,EACzD,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,OAAO,GACQ;IACf,MAAM,EACJ,QAAQ,EAAE,cAAc,EACxB,YAAY,EAAE,kBAAkB,EAChC,WAAW,EAAE,iBAAiB,EAC9B,gBAAgB,GACjB,GAAG,IAAA,WAAG,EAAC,mDAAwB,CAAC,CAAC;IAClC,MAAM,wBAAwB,GAAG,IAAA,WAAG,EAAC,uEAAkC,CAAC,CAAC;IAEzE,MAAM,sBAAsB,GAAG,KAAK,CAAC,MAAM,CAAsB,mBAAmB,CAAC,CAAC;IAEtF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,sBAAsB,CAAC,OAAO,GAAG,mBAAmB,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAChC,CAAC,MAAwB,EAAE,oBAAiC,IAAI,GAAG,EAAU,EAAE,EAAE;QAC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';\n\nimport type {\n NavigationAction,\n NavigationState,\n PartialState,\n Router,\n RouterConfigOptions,\n} from '../routers';\nimport { DeprecatedNavigationInChildContext } from './DeprecatedNavigationInChildContext';\nimport {\n type ChildActionListener,\n type ChildBeforeRemoveListener,\n NavigationBuilderContext,\n} from './NavigationBuilderContext';\nimport type { EventMapCore } from './types';\nimport type { NavigationEventEmitter } from './useEventEmitter';\nimport { shouldPreventRemove, useOnPreventRemove } from './useOnPreventRemove';\n\ntype Options = {\n router: Router;\n key?: string;\n getState: () => State;\n setState: (state: State | PartialState) => void;\n actionListeners: ChildActionListener[];\n beforeRemoveListeners: Record;\n routerConfigOptions: RouterConfigOptions;\n emitter: NavigationEventEmitter>;\n};\n\n/**\n * Hook to handle actions for a navigator, including state updates and bubbling.\n *\n * Bubbling an action is achieved in 2 ways:\n * 1. To bubble action to parent, we expose the action handler in context and then access the parent context\n * 2. To bubble action to child, child adds event listeners subscribing to actions from parent\n *\n * When the action handler handles as action, it returns `true`, otherwise `false`.\n */\nexport function useOnAction({\n router,\n getState,\n setState,\n key,\n actionListeners,\n beforeRemoveListeners,\n routerConfigOptions,\n emitter,\n}: Options) {\n const {\n onAction: onActionParent,\n onRouteFocus: onRouteFocusParent,\n addListener: addListenerParent,\n onDispatchAction,\n } = use(NavigationBuilderContext);\n const navigationInChildEnabled = use(DeprecatedNavigationInChildContext);\n\n const routerConfigOptionsRef = React.useRef(routerConfigOptions);\n\n React.useEffect(() => {\n routerConfigOptionsRef.current = routerConfigOptions;\n });\n\n const onAction = React.useCallback(\n (action: NavigationAction, visitedNavigators: Set = new Set()) => {\n const state = getState();\n\n // Since actions can bubble both up and down, they could come to the same navigator again\n // We keep track of navigators which have already tried to handle the action and return if it's already visited\n if (visitedNavigators.has(state.key)) {\n return false;\n }\n\n visitedNavigators.add(state.key);\n\n if (typeof action.target !== 'string' || action.target === state.key) {\n let result = router.getStateForAction(state, action, routerConfigOptionsRef.current);\n\n // If a target is specified and set to current navigator, the action shouldn't bubble\n // So instead of `null`, we use the state object for such cases to signal that action was handled\n result = result === null && action.target === state.key ? state : result;\n\n if (result !== null) {\n onDispatchAction(action, state === result);\n\n if (state !== result) {\n const isPrevented = shouldPreventRemove(\n emitter,\n beforeRemoveListeners,\n state.routes,\n result.routes,\n action\n );\n\n if (isPrevented) {\n return true;\n }\n\n setState(result);\n }\n\n if (onRouteFocusParent !== undefined) {\n // Some actions such as `NAVIGATE` also want to bring the navigated route to focus in the whole tree\n // This means we need to focus all of the parent navigators of this navigator as well\n const shouldFocus = router.shouldActionChangeFocus(action);\n\n if (shouldFocus && key !== undefined) {\n onRouteFocusParent(key);\n }\n }\n\n return true;\n }\n }\n\n if (onActionParent !== undefined) {\n // Bubble action to the parent if the current navigator didn't handle it\n if (onActionParent(action, visitedNavigators)) {\n return true;\n }\n }\n\n if (\n typeof action.target === 'string' ||\n // For backward compatibility\n action.type === 'NAVIGATE_DEPRECATED' ||\n navigationInChildEnabled\n ) {\n // If the action wasn't handled by current navigator or a parent navigator, let children handle it\n // Handling this when target isn't specified is deprecated and will be removed in the future\n for (let i = actionListeners.length - 1; i >= 0; i--) {\n const listener = actionListeners[i]!;\n if (listener(action, visitedNavigators)) {\n return true;\n }\n }\n }\n\n return false;\n },\n [\n actionListeners,\n beforeRemoveListeners,\n emitter,\n getState,\n navigationInChildEnabled,\n key,\n onActionParent,\n onDispatchAction,\n onRouteFocusParent,\n router,\n setState,\n ]\n );\n\n useOnPreventRemove({\n getState,\n emitter,\n beforeRemoveListeners,\n });\n\n React.useEffect(() => addListenerParent?.('action', onAction), [addListenerParent, onAction]);\n\n return onAction;\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/drawer/views/DrawerContent.js.map b/packages/expo-router/build/react-navigation/drawer/views/DrawerContent.js.map index 08297ff111f91b..e782e00cf8fa5f 100644 --- a/packages/expo-router/build/react-navigation/drawer/views/DrawerContent.js.map +++ b/packages/expo-router/build/react-navigation/drawer/views/DrawerContent.js.map @@ -1 +1 @@ -{"version":3,"file":"DrawerContent.js","sourceRoot":"","sources":["../../../../src/react-navigation/drawer/views/DrawerContent.tsx"],"names":[],"mappings":";;AAIA,sCAeC;;AAlBD,uEAAoE;AACpE,qDAAkD;AAElD,SAAgB,aAAa,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,IAAI,EAA+B;IACxF,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,iBAAiB,GAAG,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACxD,MAAM,cAAc,GAAG,iBAAiB,CAAC,OAAO,CAAC;IAEjD,MAAM,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,GAAG,cAAc,CAAC;IAE3E,OAAO,CACL,uBAAC,iDAAuB,OAClB,IAAI,EACR,qBAAqB,EAAE,2BAA2B,EAClD,KAAK,EAAE,kBAAkB,YACzB,uBAAC,+BAAc,IAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,KAAM,IAAI,GAAI,GAC5C,CAC3B,CAAC;AACJ,CAAC","sourcesContent":["import type { DrawerContentComponentProps } from '../types';\nimport { DrawerContentScrollView } from './DrawerContentScrollView';\nimport { DrawerItemList } from './DrawerItemList';\n\nexport function DrawerContent({ descriptors, state, ...rest }: DrawerContentComponentProps) {\n const focusedRoute = state.routes[state.index];\n const focusedDescriptor = descriptors[focusedRoute.key];\n const focusedOptions = focusedDescriptor.options;\n\n const { drawerContentStyle, drawerContentContainerStyle } = focusedOptions;\n\n return (\n \n \n \n );\n}\n"]} \ No newline at end of file +{"version":3,"file":"DrawerContent.js","sourceRoot":"","sources":["../../../../src/react-navigation/drawer/views/DrawerContent.tsx"],"names":[],"mappings":";;AAIA,sCAeC;;AAlBD,uEAAoE;AACpE,qDAAkD;AAElD,SAAgB,aAAa,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,IAAI,EAA+B;IACxF,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAE,CAAC;IAChD,MAAM,iBAAiB,GAAG,WAAW,CAAC,YAAY,CAAC,GAAG,CAAE,CAAC;IACzD,MAAM,cAAc,GAAG,iBAAiB,CAAC,OAAO,CAAC;IAEjD,MAAM,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,GAAG,cAAc,CAAC;IAE3E,OAAO,CACL,uBAAC,iDAAuB,OAClB,IAAI,EACR,qBAAqB,EAAE,2BAA2B,EAClD,KAAK,EAAE,kBAAkB,YACzB,uBAAC,+BAAc,IAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,KAAM,IAAI,GAAI,GAC5C,CAC3B,CAAC;AACJ,CAAC","sourcesContent":["import type { DrawerContentComponentProps } from '../types';\nimport { DrawerContentScrollView } from './DrawerContentScrollView';\nimport { DrawerItemList } from './DrawerItemList';\n\nexport function DrawerContent({ descriptors, state, ...rest }: DrawerContentComponentProps) {\n const focusedRoute = state.routes[state.index]!;\n const focusedDescriptor = descriptors[focusedRoute.key]!;\n const focusedOptions = focusedDescriptor.options;\n\n const { drawerContentStyle, drawerContentContainerStyle } = focusedOptions;\n\n return (\n \n \n \n );\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/drawer/views/DrawerItemList.js.map b/packages/expo-router/build/react-navigation/drawer/views/DrawerItemList.js.map index 100f174b42579f..12eaf41ec0841a 100644 --- a/packages/expo-router/build/react-navigation/drawer/views/DrawerItemList.js.map +++ b/packages/expo-router/build/react-navigation/drawer/views/DrawerItemList.js.map @@ -1 +1 @@ -{"version":3,"file":"DrawerItemList.js","sourceRoot":"","sources":["../../../../src/react-navigation/drawer/views/DrawerItemList.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAsBb,wCA4DC;;AA/ED,yCAMsB;AAEtB,6CAA0C;AAQ1C;;GAEG;AACH,SAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAS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CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EACzC,KAAK,EAAE,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EACzF,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,qBAAqB,EACtC,iBAAiB,EAAE,uBAAuB,EAC1C,qBAAqB,EAAE,2BAA2B,EAClD,uBAAuB,EAAE,6BAA6B,EACtD,gBAAgB,EAAE,sBAAsB,EACxC,UAAU,EAAE,gBAAgB,EAC5B,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,OAAO,IAbX,KAAK,CAAC,GAAG,CAcd,CACH,CAAC;IACJ,CAAC,CAA0C,CAAC;AAC9C,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\n\nimport {\n CommonActions,\n DrawerActions,\n type DrawerNavigationState,\n type ParamListBase,\n useLinkBuilder,\n} from '../../native';\nimport type { DrawerDescriptorMap, DrawerNavigationHelpers } from '../types';\nimport { DrawerItem } from './DrawerItem';\n\ntype Props = {\n state: DrawerNavigationState;\n navigation: DrawerNavigationHelpers;\n descriptors: DrawerDescriptorMap;\n};\n\n/**\n * Component that renders the navigation list in the drawer.\n */\nexport function DrawerItemList({ state, navigation, descriptors }: Props) {\n const { buildHref } = useLinkBuilder();\n\n const focusedRoute = state.routes[state.index];\n const focusedDescriptor = descriptors[focusedRoute.key];\n const focusedOptions = focusedDescriptor.options;\n\n const {\n drawerActiveTintColor,\n drawerInactiveTintColor,\n drawerActiveBackgroundColor,\n drawerInactiveBackgroundColor,\n } = focusedOptions;\n\n return state.routes.map((route, i) => {\n const focused = i === state.index;\n\n const onPress = () => {\n const event = navigation.emit({\n type: 'drawerItemPress',\n target: route.key,\n canPreventDefault: true,\n });\n\n if (!event.defaultPrevented) {\n navigation.dispatch({\n ...(focused ? DrawerActions.closeDrawer() : CommonActions.navigate(route)),\n target: state.key,\n });\n }\n };\n\n const {\n title,\n drawerLabel,\n drawerIcon,\n drawerLabelStyle,\n drawerItemStyle,\n drawerAllowFontScaling,\n } = descriptors[route.key].options;\n\n return (\n \n );\n }) as React.ReactNode as React.ReactElement;\n}\n"]} \ No newline at end of file +{"version":3,"file":"DrawerItemList.js","sourceRoot":"","sources":["../../../../src/react-navigation/drawer/views/DrawerItemList.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAsBb,wCA4DC;;AA/ED,yCAMsB;AAEtB,6CAA0C;AAQ1C;;GAEG;AACH,SAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAS;IACtE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,uBAAc,GAAE,CAAC;IAEvC,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAE,CAAC;IAChD,MAAM,iBAAiB,GAAG,WAAW,CAAC,YAAa,CAAC,GAAG,CAAE,CAAC;IAC1D,MAAM,cAAc,GAAG,iBAAiB,CAAC,OAAO,CAAC;IAEjD,MAAM,EACJ,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,EAC3B,6BAA6B,GAC9B,GAAG,cAAc,CAAC;IAEnB,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QACnC,MAAM,OAAO,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC;QAElC,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC;gBAC5B,IAAI,EAAE,iBAAiB;gBACvB,MAAM,EAAE,KAAK,CAAC,GAAG;gBACjB,iBAAiB,EAAE,IAAI;aACxB,CAAC,CAAC;YAEH,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;gBAC5B,UAAU,CAAC,QAAQ,CAAC;oBAClB,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,sBAAa,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,sBAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;oBAC1E,MAAM,EAAE,KAAK,CAAC,GAAG;iBAClB,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,sBAAsB,GACvB,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAE,CAAC,OAAO,CAAC;QAEpC,OAAO,CACL,uBAAC,uBAAU,IAET,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EACzC,KAAK,EAAE,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EACzF,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,qBAAqB,EACtC,iBAAiB,EAAE,uBAAuB,EAC1C,qBAAqB,EAAE,2BAA2B,EAClD,uBAAuB,EAAE,6BAA6B,EACtD,gBAAgB,EAAE,sBAAsB,EACxC,UAAU,EAAE,gBAAgB,EAC5B,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,OAAO,IAbX,KAAK,CAAC,GAAG,CAcd,CACH,CAAC;IACJ,CAAC,CAA0C,CAAC;AAC9C,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\n\nimport {\n CommonActions,\n DrawerActions,\n type DrawerNavigationState,\n type ParamListBase,\n useLinkBuilder,\n} from '../../native';\nimport type { DrawerDescriptorMap, DrawerNavigationHelpers } from '../types';\nimport { DrawerItem } from './DrawerItem';\n\ntype Props = {\n state: DrawerNavigationState;\n navigation: DrawerNavigationHelpers;\n descriptors: DrawerDescriptorMap;\n};\n\n/**\n * Component that renders the navigation list in the drawer.\n */\nexport function DrawerItemList({ state, navigation, descriptors }: Props) {\n const { buildHref } = useLinkBuilder();\n\n const focusedRoute = state.routes[state.index]!;\n const focusedDescriptor = descriptors[focusedRoute!.key]!;\n const focusedOptions = focusedDescriptor.options;\n\n const {\n drawerActiveTintColor,\n drawerInactiveTintColor,\n drawerActiveBackgroundColor,\n drawerInactiveBackgroundColor,\n } = focusedOptions;\n\n return state.routes.map((route, i) => {\n const focused = i === state.index;\n\n const onPress = () => {\n const event = navigation.emit({\n type: 'drawerItemPress',\n target: route.key,\n canPreventDefault: true,\n });\n\n if (!event.defaultPrevented) {\n navigation.dispatch({\n ...(focused ? DrawerActions.closeDrawer() : CommonActions.navigate(route)),\n target: state.key,\n });\n }\n };\n\n const {\n title,\n drawerLabel,\n drawerIcon,\n drawerLabelStyle,\n drawerItemStyle,\n drawerAllowFontScaling,\n } = descriptors[route.key]!.options;\n\n return (\n \n );\n }) as React.ReactNode as React.ReactElement;\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/drawer/views/DrawerView.js.map b/packages/expo-router/build/react-navigation/drawer/views/DrawerView.js.map index 23afb58d1a6aca..4186b7b1db6c35 100644 --- a/packages/expo-router/build/react-navigation/drawer/views/DrawerView.js.map +++ b/packages/expo-router/build/react-navigation/drawer/views/DrawerView.js.map @@ -1 +1 @@ -{"version":3,"file":"DrawerView.js","sourceRoot":"","sources":["../../../../src/react-navigation/drawer/views/DrawerView.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8Ub,gCAMC;;AAnVD,6CAA+B;AAC/B,+CAAoD;AACpD,2EAAoD;AAEpD,yFAAiE;AACjE,yCAQsB;AAStB,mDAAgD;AAChD,6DAA0D;AAC1D,qDAAqE;AACrE,6CAMwB;AACxB,0EAAuE;AACvE,sEAAmE;AACnE,kEAA+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,uBAAC,cAAc,IAAC,UAAU,EAAE,UAAU,KAAM,IAAI,GAAI,GAC7B,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { Platform, StyleSheet } from 'react-native';\nimport { Drawer } from 'react-native-drawer-layout';\n\nimport useLatestCallback from '../../../utils/useLatestCallback';\nimport {\n DrawerActions,\n type DrawerNavigationState,\n type DrawerStatus,\n type ParamListBase,\n StackActions,\n useLocale,\n useTheme,\n} from '../../native';\nimport type {\n DrawerContentComponentProps,\n DrawerDescriptorMap,\n DrawerHeaderProps,\n DrawerNavigationConfig,\n DrawerNavigationHelpers,\n DrawerNavigationProp,\n} from '../types';\nimport { DrawerContent } from './DrawerContent';\nimport { DrawerToggleButton } from './DrawerToggleButton';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\nimport {\n getHeaderTitle,\n Header,\n SafeAreaProviderCompat,\n Screen,\n useFrameSize,\n} from '../../elements';\nimport { DrawerPositionContext } from '../utils/DrawerPositionContext';\nimport { DrawerStatusContext } from '../utils/DrawerStatusContext';\nimport { addCancelListener } from '../utils/addCancelListener';\nimport { getDrawerStatusFromState } from '../utils/getDrawerStatusFromState';\n\ntype Props = DrawerNavigationConfig & {\n defaultStatus: DrawerStatus;\n state: DrawerNavigationState;\n navigation: DrawerNavigationHelpers;\n descriptors: DrawerDescriptorMap;\n};\n\nconst DRAWER_BORDER_RADIUS = 16;\n\nconst renderDrawerContentDefault = (props: DrawerContentComponentProps) => (\n \n);\n\nfunction DrawerViewBase({\n state,\n navigation,\n descriptors,\n defaultStatus,\n drawerContent = renderDrawerContentDefault,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n}: Props) {\n const { direction } = useLocale();\n\n const focusedRouteKey = state.routes[state.index].key;\n const {\n drawerHideStatusBarOnOpen,\n drawerPosition = direction === 'rtl' ? 'right' : 'left',\n drawerStatusBarAnimation,\n drawerStyle,\n drawerType = Platform.select({ ios: 'slide', default: 'front' }),\n configureGestureHandler,\n keyboardDismissMode,\n overlayColor = 'rgba(0, 0, 0, 0.5)',\n swipeEdgeWidth,\n swipeEnabled = Platform.OS !== 'web' && Platform.OS !== 'windows' && Platform.OS !== 'macos',\n swipeMinDistance,\n overlayAccessibilityLabel,\n } = descriptors[focusedRouteKey].options;\n\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const previousRouteKeyRef = React.useRef(focusedRouteKey);\n\n React.useEffect(() => {\n const previousRouteKey = previousRouteKeyRef.current;\n\n if (\n previousRouteKey !== focusedRouteKey &&\n descriptors[previousRouteKey]?.options.popToTopOnBlur\n ) {\n const prevRoute = state.routes.find((route) => route.key === previousRouteKey);\n\n if (prevRoute?.state?.type === 'stack' && prevRoute.state.key) {\n navigation.dispatch({\n ...StackActions.popToTop(),\n target: prevRoute.state.key,\n });\n }\n }\n\n previousRouteKeyRef.current = focusedRouteKey;\n }, [descriptors, focusedRouteKey, navigation, state.routes]);\n\n const dimensions = useFrameSize((size) => size, true);\n\n const { colors } = useTheme();\n\n const drawerStatus = getDrawerStatusFromState(state);\n\n const handleDrawerOpen = useLatestCallback(() => {\n navigation.dispatch({\n ...DrawerActions.openDrawer(),\n target: state.key,\n });\n });\n\n const handleDrawerClose = useLatestCallback(() => {\n navigation.dispatch({\n ...DrawerActions.closeDrawer(),\n target: state.key,\n });\n });\n\n const handleGestureStart = useLatestCallback(() => {\n navigation.emit({\n type: 'gestureStart',\n target: state.key,\n });\n });\n\n const handleGestureEnd = useLatestCallback(() => {\n navigation.emit({\n type: 'gestureEnd',\n target: state.key,\n });\n });\n\n const handleGestureCancel = useLatestCallback(() => {\n navigation.emit({\n type: 'gestureCancel',\n target: state.key,\n });\n });\n\n const handleTransitionStart = useLatestCallback((closing: boolean) => {\n navigation.emit({\n type: 'transitionStart',\n data: { closing },\n target: state.key,\n });\n });\n\n const handleTransitionEnd = useLatestCallback((closing: boolean) => {\n navigation.emit({\n type: 'transitionEnd',\n data: { closing },\n target: state.key,\n });\n });\n\n React.useEffect(() => {\n if (drawerStatus === defaultStatus || drawerType === 'permanent') {\n return;\n }\n\n const handleHardwareBack = () => {\n // We shouldn't handle the back button if the parent screen isn't focused\n // This will avoid the drawer overriding event listeners from a focused screen\n if (!navigation.isFocused()) {\n return false;\n }\n\n if (defaultStatus === 'open') {\n handleDrawerOpen();\n } else {\n handleDrawerClose();\n }\n\n return true;\n };\n\n // We only add the listeners when drawer opens\n // This way we can make sure that the listener is added as late as possible\n // This will make sure that our handler will run first when back button is pressed\n return addCancelListener(handleHardwareBack);\n }, [defaultStatus, drawerStatus, drawerType, handleDrawerClose, handleDrawerOpen, navigation]);\n\n const renderDrawerContent = () => {\n return (\n \n {drawerContent({\n state,\n navigation,\n descriptors,\n })}\n \n );\n };\n\n const renderSceneContent = () => {\n return (\n \n {state.routes.map((route, index) => {\n const descriptor = descriptors[route.key];\n const { lazy = true } = descriptor.options;\n const isFocused = state.index === index;\n const isPreloaded = state.preloadedRouteKeys.includes(route.key);\n\n if (lazy && !loaded.includes(route.key) && !isFocused && !isPreloaded) {\n // Don't render a lazy screen if we've never navigated to it or it wasn't preloaded\n return null;\n }\n\n const {\n freezeOnBlur,\n header = ({ layout, options }: DrawerHeaderProps) => (\n \n : options.headerLeft\n }\n headerRight={\n drawerPosition === 'right' && options.headerRight == null\n ? (props) => \n : options.headerRight\n }\n />\n ),\n headerShown,\n headerStatusBarHeight,\n headerTransparent,\n sceneStyle,\n } = descriptor.options;\n\n return (\n \n ,\n options: descriptor.options,\n })}\n style={sceneStyle}>\n {descriptor.render()}\n \n \n );\n })}\n \n );\n };\n\n return (\n \n \n {renderSceneContent()}\n \n \n );\n}\n\nexport function DrawerView({ navigation, ...rest }: Props) {\n return (\n \n \n \n );\n}\n\nconst styles = StyleSheet.create({\n content: {\n flex: 1,\n },\n});\n"]} \ No newline at end of file +{"version":3,"file":"DrawerView.js","sourceRoot":"","sources":["../../../../src/react-navigation/drawer/views/DrawerView.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8Ub,gCAMC;;AAnVD,6CAA+B;AAC/B,+CAAoD;AACpD,2EAAoD;AAEpD,yFAAiE;AACjE,yCAQsB;AAStB,mDAAgD;AAChD,6DAA0D;AAC1D,qDAAqE;AACrE,6CAMwB;AACxB,0EAAuE;AACvE,sEAAmE;AACnE,kEAA+D;AAC/D,gFAA6E;AAS7E,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,MAAM,0BAA0B,GAAG,CAAC,KAAkC,EAAE,EAAE,CAAC,CACzE,uBAAC,6BAAa,OAAK,KAAK,GAAI,CAC7B,CAAC;AAEF,SAAS,cAAc,CAAC,EACtB,KAAK,EACL,UAAU,EACV,WAAW,EACX,aAAa,EACb,aAAa,GAAG,0BAA0B,EAC1C,qBAAqB,GAAG,uBAAQ,CAAC,EAAE,KAAK,KAAK;IAC3C,uBAAQ,CAAC,EAAE,KAAK,SAAS;IACzB,uBAAQ,CAAC,EAAE,KAAK,KAAK,GACjB;IACN,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,kBAAS,GAAE,CAAC;IAElC,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAE,CAAC,GAAG,CAAC;IACvD,MAAM,EACJ,yBAAyB,EACzB,cAAc,GAAG,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EACvD,wBAAwB,EACxB,WAAW,EACX,UAAU,GAAG,uBAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,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,KAAK,MAAM;wBACxB,CAAC,CAAC;4BACE,oBAAoB,EAAE,oBAAoB;4BAC1C,uBAAuB,EAAE,oBAAoB;yBAC9C;wBACH,CAAC,CAAC;4BACE,mBAAmB,EAAE,oBAAoB;4BACzC,sBAAsB,EAAE,oBAAoB;yBAC7C,CAAC;gBACR,WAAW;aACZ,EACD,YAAY,EAAE,EAAE,eAAe,EAAE,YAAY,EAAE,EAC/C,mBAAmB,EAAE,mBAAmB,YACvC,kBAAkB,EAAE,GACd,GACoB,CAChC,CAAC;AACJ,CAAC;AAED,SAAgB,UAAU,CAAC,EAAE,UAAU,EAAE,GAAG,IAAI,EAAS;IACvD,OAAO,CACL,uBAAC,iCAAsB,cACrB,uBAAC,cAAc,IAAC,UAAU,EAAE,UAAU,KAAM,IAAI,GAAI,GAC7B,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { Platform, StyleSheet } from 'react-native';\nimport { Drawer } from 'react-native-drawer-layout';\n\nimport useLatestCallback from '../../../utils/useLatestCallback';\nimport {\n DrawerActions,\n type DrawerNavigationState,\n type DrawerStatus,\n type ParamListBase,\n StackActions,\n useLocale,\n useTheme,\n} from '../../native';\nimport type {\n DrawerContentComponentProps,\n DrawerDescriptorMap,\n DrawerHeaderProps,\n DrawerNavigationConfig,\n DrawerNavigationHelpers,\n DrawerNavigationProp,\n} from '../types';\nimport { DrawerContent } from './DrawerContent';\nimport { DrawerToggleButton } from './DrawerToggleButton';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\nimport {\n getHeaderTitle,\n Header,\n SafeAreaProviderCompat,\n Screen,\n useFrameSize,\n} from '../../elements';\nimport { DrawerPositionContext } from '../utils/DrawerPositionContext';\nimport { DrawerStatusContext } from '../utils/DrawerStatusContext';\nimport { addCancelListener } from '../utils/addCancelListener';\nimport { getDrawerStatusFromState } from '../utils/getDrawerStatusFromState';\n\ntype Props = DrawerNavigationConfig & {\n defaultStatus: DrawerStatus;\n state: DrawerNavigationState;\n navigation: DrawerNavigationHelpers;\n descriptors: DrawerDescriptorMap;\n};\n\nconst DRAWER_BORDER_RADIUS = 16;\n\nconst renderDrawerContentDefault = (props: DrawerContentComponentProps) => (\n \n);\n\nfunction DrawerViewBase({\n state,\n navigation,\n descriptors,\n defaultStatus,\n drawerContent = renderDrawerContentDefault,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n}: Props) {\n const { direction } = useLocale();\n\n const focusedRouteKey = state.routes[state.index]!.key;\n const {\n drawerHideStatusBarOnOpen,\n drawerPosition = direction === 'rtl' ? 'right' : 'left',\n drawerStatusBarAnimation,\n drawerStyle,\n drawerType = Platform.select({ ios: 'slide', default: 'front' }),\n configureGestureHandler,\n keyboardDismissMode,\n overlayColor = 'rgba(0, 0, 0, 0.5)',\n swipeEdgeWidth,\n swipeEnabled = Platform.OS !== 'web' && Platform.OS !== 'windows' && Platform.OS !== 'macos',\n swipeMinDistance,\n overlayAccessibilityLabel,\n } = descriptors[focusedRouteKey]!.options;\n\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const previousRouteKeyRef = React.useRef(focusedRouteKey);\n\n React.useEffect(() => {\n const previousRouteKey = previousRouteKeyRef.current;\n\n if (\n previousRouteKey !== focusedRouteKey &&\n descriptors[previousRouteKey]?.options.popToTopOnBlur\n ) {\n const prevRoute = state.routes.find((route) => route.key === previousRouteKey);\n\n if (prevRoute?.state?.type === 'stack' && prevRoute.state.key) {\n navigation.dispatch({\n ...StackActions.popToTop(),\n target: prevRoute.state.key,\n });\n }\n }\n\n previousRouteKeyRef.current = focusedRouteKey;\n }, [descriptors, focusedRouteKey, navigation, state.routes]);\n\n const dimensions = useFrameSize((size) => size, true);\n\n const { colors } = useTheme();\n\n const drawerStatus = getDrawerStatusFromState(state);\n\n const handleDrawerOpen = useLatestCallback(() => {\n navigation.dispatch({\n ...DrawerActions.openDrawer(),\n target: state.key,\n });\n });\n\n const handleDrawerClose = useLatestCallback(() => {\n navigation.dispatch({\n ...DrawerActions.closeDrawer(),\n target: state.key,\n });\n });\n\n const handleGestureStart = useLatestCallback(() => {\n navigation.emit({\n type: 'gestureStart',\n target: state.key,\n });\n });\n\n const handleGestureEnd = useLatestCallback(() => {\n navigation.emit({\n type: 'gestureEnd',\n target: state.key,\n });\n });\n\n const handleGestureCancel = useLatestCallback(() => {\n navigation.emit({\n type: 'gestureCancel',\n target: state.key,\n });\n });\n\n const handleTransitionStart = useLatestCallback((closing: boolean) => {\n navigation.emit({\n type: 'transitionStart',\n data: { closing },\n target: state.key,\n });\n });\n\n const handleTransitionEnd = useLatestCallback((closing: boolean) => {\n navigation.emit({\n type: 'transitionEnd',\n data: { closing },\n target: state.key,\n });\n });\n\n React.useEffect(() => {\n if (drawerStatus === defaultStatus || drawerType === 'permanent') {\n return;\n }\n\n const handleHardwareBack = () => {\n // We shouldn't handle the back button if the parent screen isn't focused\n // This will avoid the drawer overriding event listeners from a focused screen\n if (!navigation.isFocused()) {\n return false;\n }\n\n if (defaultStatus === 'open') {\n handleDrawerOpen();\n } else {\n handleDrawerClose();\n }\n\n return true;\n };\n\n // We only add the listeners when drawer opens\n // This way we can make sure that the listener is added as late as possible\n // This will make sure that our handler will run first when back button is pressed\n return addCancelListener(handleHardwareBack);\n }, [defaultStatus, drawerStatus, drawerType, handleDrawerClose, handleDrawerOpen, navigation]);\n\n const renderDrawerContent = () => {\n return (\n \n {drawerContent({\n state,\n navigation,\n descriptors,\n })}\n \n );\n };\n\n const renderSceneContent = () => {\n return (\n \n {state.routes.map((route, index) => {\n const descriptor = descriptors[route.key]!;\n const { lazy = true } = descriptor.options;\n const isFocused = state.index === index;\n const isPreloaded = state.preloadedRouteKeys.includes(route.key);\n\n if (lazy && !loaded.includes(route.key) && !isFocused && !isPreloaded) {\n // Don't render a lazy screen if we've never navigated to it or it wasn't preloaded\n return null;\n }\n\n const {\n freezeOnBlur,\n header = ({ layout, options }: DrawerHeaderProps) => (\n \n : options.headerLeft\n }\n headerRight={\n drawerPosition === 'right' && options.headerRight == null\n ? (props) => \n : options.headerRight\n }\n />\n ),\n headerShown,\n headerStatusBarHeight,\n headerTransparent,\n sceneStyle,\n } = descriptor.options;\n\n return (\n \n ,\n options: descriptor.options,\n })}\n style={sceneStyle}>\n {descriptor.render()}\n \n \n );\n })}\n \n );\n };\n\n return (\n \n \n {renderSceneContent()}\n \n \n );\n}\n\nexport function DrawerView({ navigation, ...rest }: Props) {\n return (\n \n \n \n );\n}\n\nconst styles = StyleSheet.create({\n content: {\n flex: 1,\n },\n});\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/material-top-tabs/views/MaterialTopTabView.d.ts.map b/packages/expo-router/build/react-navigation/material-top-tabs/views/MaterialTopTabView.d.ts.map index 13c8649a3b62d9..2ce62bb0af9b8b 100644 --- a/packages/expo-router/build/react-navigation/material-top-tabs/views/MaterialTopTabView.d.ts.map +++ b/packages/expo-router/build/react-navigation/material-top-tabs/views/MaterialTopTabView.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"MaterialTopTabView.d.ts","sourceRoot":"","sources":["../../../../src/react-navigation/material-top-tabs/views/MaterialTopTabView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,kBAAkB,EAGxB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAEV,2BAA2B,EAC3B,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,UAAU,CAAC;AAgBlB,KAAK,KAAK,GAAG,8BAA8B,GAAG;IAC5C,KAAK,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACzC,UAAU,EAAE,+BAA+B,CAAC;IAC5C,WAAW,EAAE,2BAA2B,CAAC;CAC1C,CAAC;AAIF,wBAAgB,kBAAkB,CAAC,EACjC,MAA4B,EAC5B,KAAK,EACL,UAAU,EACV,WAAW,EACX,GAAG,IAAI,EACR,EAAE,KAAK,2CAkEP"} \ No newline at end of file +{"version":3,"file":"MaterialTopTabView.d.ts","sourceRoot":"","sources":["../../../../src/react-navigation/material-top-tabs/views/MaterialTopTabView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,kBAAkB,EAGxB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAEV,2BAA2B,EAC3B,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,UAAU,CAAC;AAgBlB,KAAK,KAAK,GAAG,8BAA8B,GAAG;IAC5C,KAAK,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACzC,UAAU,EAAE,+BAA+B,CAAC;IAC5C,WAAW,EAAE,2BAA2B,CAAC;CAC1C,CAAC;AAIF,wBAAgB,kBAAkB,CAAC,EACjC,MAA4B,EAC5B,KAAK,EACL,UAAU,EACV,WAAW,EACX,GAAG,IAAI,EACR,EAAE,KAAK,2CAgEP"} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/material-top-tabs/views/MaterialTopTabView.js b/packages/expo-router/build/react-navigation/material-top-tabs/views/MaterialTopTabView.js index d236a0837619e2..5bdac7de2d9685 100644 --- a/packages/expo-router/build/react-navigation/material-top-tabs/views/MaterialTopTabView.js +++ b/packages/expo-router/build/react-navigation/material-top-tabs/views/MaterialTopTabView.js @@ -33,9 +33,8 @@ function MaterialTopTabView({ tabBar = renderTabBarDefault, state, navigation, d }; const focusedOptions = descriptors[state.routes[state.index].key].options; return ((0, jsx_runtime_1.jsx)(TabView, { ...rest, onIndexChange: (index) => { - const route = state.routes[index]; navigation.dispatch({ - ...native_1.CommonActions.navigate(route), + ...native_1.CommonActions.navigate(state.routes[index]), target: state.key, }); }, renderScene: ({ route, position }) => ((0, jsx_runtime_1.jsx)(TabAnimationContext_1.TabAnimationContext.Provider, { value: { position }, children: descriptors[route.key].render() })), navigationState: state, renderTabBar: renderTabBar, renderLazyPlaceholder: ({ route }) => descriptors[route.key].options.lazyPlaceholder?.() ?? null, lazy: ({ route }) => descriptors[route.key].options.lazy === true && diff --git a/packages/expo-router/build/react-navigation/material-top-tabs/views/MaterialTopTabView.js.map b/packages/expo-router/build/react-navigation/material-top-tabs/views/MaterialTopTabView.js.map index b6de9914256a44..0a92e88897f912 100644 --- a/packages/expo-router/build/react-navigation/material-top-tabs/views/MaterialTopTabView.js.map +++ b/packages/expo-router/build/react-navigation/material-top-tabs/views/MaterialTopTabView.js.map @@ -1 +1 @@ -{"version":3,"file":"MaterialTopTabView.js","sourceRoot":"","sources":["../../../../src/react-navigation/material-top-tabs/views/MaterialTopTabView.tsx"],"names":[],"mappings":";;AAqCA,gDAwEC;;AA7GD,yCAOsB;AAOtB,2DAAwD;AACxD,sEAAmE;AAEnE,iFAAiF;AACjF,mDAAmD;AACnD,IAAI,OAAY,CAAC;AACjB,IAAI,CAAC;IACH,MAAM,aAAa,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACvD,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;AAClC,CAAC;AAAC,OAAO,CAAC,EAAE,CAAC;IACX,MAAM,IAAI,KAAK,CACb,yGAAyG,CAC1G,CAAC;AACJ,CAAC;AAQD,MAAM,mBAAmB,GAAG,CAAC,KAA6B,EAAE,EAAE,CAAC,uBAAC,qCAAiB,OAAK,KAAK,GAAI,CAAC;AAEhG,SAAgB,kBAAkB,CAAC,EACjC,MAAM,GAAG,mBAAmB,EAC5B,KAAK,EACL,UAAU,EACV,WAAW,EACX,GAAG,IAAI,EACD;IACN,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,iBAAQ,GAAE,CAAC;IAC9B,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,kBAAS,GAAE,CAAC;IAElC,MAAM,YAAY,GAA8C,CAAC;IAC/D,sD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C,mBAAmB,EAAE,cAAc,CAAC,mBAAmB,EACvD,YAAY,EAAE,cAAc,CAAC,YAAY,EACzC,gBAAgB,EAAE,cAAc,CAAC,gBAAgB,EACjD,YAAY,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,EAC3D,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EACvD,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,MAAM,CAAC,WAAW,CACzB,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACzB,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;YAEhD,OAAO;gBACL,KAAK,CAAC,GAAG;gBACT;oBACE,UAAU,EAAE,CAAC,EAAE,eAAe,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC;iBAC1E;aACF,CAAC;QACJ,CAAC,CAAC,CACH,GACD,CACH,CAAC;AACJ,CAAC","sourcesContent":["import {\n CommonActions,\n type ParamListBase,\n type Route,\n type TabNavigationState,\n useLocale,\n useTheme,\n} from '../../native';\nimport type {\n MaterialTopTabBarProps,\n MaterialTopTabDescriptorMap,\n MaterialTopTabNavigationConfig,\n MaterialTopTabNavigationHelpers,\n} from '../types';\nimport { MaterialTopTabBar } from './MaterialTopTabBar';\nimport { TabAnimationContext } from '../utils/TabAnimationContext';\n\n// Use dynamic import to avoid having direct dependency on react-native-tab-view.\n// import { TabView } from 'react-native-tab-view';\nlet TabView: any;\ntry {\n const tabViewModule = require('react-native-tab-view');\n TabView = tabViewModule.TabView;\n} catch (e) {\n throw new Error(\n \"Install the 'react-native-tab-view' package and its peer dependencies to use the Expo Router's TopTabs.\"\n );\n}\n\ntype Props = MaterialTopTabNavigationConfig & {\n state: TabNavigationState;\n navigation: MaterialTopTabNavigationHelpers;\n descriptors: MaterialTopTabDescriptorMap;\n};\n\nconst renderTabBarDefault = (props: MaterialTopTabBarProps) => ;\n\nexport function MaterialTopTabView({\n tabBar = renderTabBarDefault,\n state,\n navigation,\n descriptors,\n ...rest\n}: Props) {\n const { colors } = useTheme();\n const { direction } = useLocale();\n\n const renderTabBar: React.ComponentProps['renderTabBar'] = ({\n /* eslint-disable @typescript-eslint/no-unused-vars */\n navigationState,\n options,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...rest\n }: any) => {\n return tabBar({\n ...rest,\n state,\n navigation,\n descriptors,\n });\n };\n\n const focusedOptions = descriptors[state.routes[state.index].key].options;\n\n return (\n >\n {...rest}\n onIndexChange={(index: number) => {\n const route = state.routes[index];\n\n navigation.dispatch({\n ...CommonActions.navigate(route),\n target: state.key,\n });\n }}\n renderScene={({ route, position }: any) => (\n \n {descriptors[route.key].render()}\n \n )}\n navigationState={state}\n renderTabBar={renderTabBar}\n renderLazyPlaceholder={({ route }: any) =>\n descriptors[route.key].options.lazyPlaceholder?.() ?? null\n }\n lazy={({ route }: any) =>\n descriptors[route.key].options.lazy === true &&\n !state.preloadedRouteKeys.includes(route.key)\n }\n lazyPreloadDistance={focusedOptions.lazyPreloadDistance}\n swipeEnabled={focusedOptions.swipeEnabled}\n animationEnabled={focusedOptions.animationEnabled}\n onSwipeStart={() => navigation.emit({ type: 'swipeStart' })}\n onSwipeEnd={() => navigation.emit({ type: 'swipeEnd' })}\n direction={direction}\n options={Object.fromEntries(\n state.routes.map((route) => {\n const options = descriptors[route.key]?.options;\n\n return [\n route.key,\n {\n sceneStyle: [{ backgroundColor: colors.background }, options?.sceneStyle],\n },\n ];\n })\n )}\n />\n );\n}\n"]} \ No newline at end of file +{"version":3,"file":"MaterialTopTabView.js","sourceRoot":"","sources":["../../../../src/react-navigation/material-top-tabs/views/MaterialTopTabView.tsx"],"names":[],"mappings":";;AAqCA,gDAsEC;;AA3GD,yCAOsB;AAOtB,2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,MAAM,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC;iBAC1E;aACF,CAAC;QACJ,CAAC,CAAC,CACH,GACD,CACH,CAAC;AACJ,CAAC","sourcesContent":["import {\n CommonActions,\n type ParamListBase,\n type Route,\n type TabNavigationState,\n useLocale,\n useTheme,\n} from '../../native';\nimport type {\n MaterialTopTabBarProps,\n MaterialTopTabDescriptorMap,\n MaterialTopTabNavigationConfig,\n MaterialTopTabNavigationHelpers,\n} from '../types';\nimport { MaterialTopTabBar } from './MaterialTopTabBar';\nimport { TabAnimationContext } from '../utils/TabAnimationContext';\n\n// Use dynamic import to avoid having direct dependency on react-native-tab-view.\n// import { TabView } from 'react-native-tab-view';\nlet TabView: any;\ntry {\n const tabViewModule = require('react-native-tab-view');\n TabView = tabViewModule.TabView;\n} catch (e) {\n throw new Error(\n \"Install the 'react-native-tab-view' package and its peer dependencies to use the Expo Router's TopTabs.\"\n );\n}\n\ntype Props = MaterialTopTabNavigationConfig & {\n state: TabNavigationState;\n navigation: MaterialTopTabNavigationHelpers;\n descriptors: MaterialTopTabDescriptorMap;\n};\n\nconst renderTabBarDefault = (props: MaterialTopTabBarProps) => ;\n\nexport function MaterialTopTabView({\n tabBar = renderTabBarDefault,\n state,\n navigation,\n descriptors,\n ...rest\n}: Props) {\n const { colors } = useTheme();\n const { direction } = useLocale();\n\n const renderTabBar: React.ComponentProps['renderTabBar'] = ({\n /* eslint-disable @typescript-eslint/no-unused-vars */\n navigationState,\n options,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...rest\n }: any) => {\n return tabBar({\n ...rest,\n state,\n navigation,\n descriptors,\n });\n };\n\n const focusedOptions = descriptors[state.routes[state.index]!.key]!.options;\n\n return (\n >\n {...rest}\n onIndexChange={(index: number) => {\n navigation.dispatch({\n ...CommonActions.navigate(state.routes[index]!),\n target: state.key,\n });\n }}\n renderScene={({ route, position }: any) => (\n \n {descriptors[route.key]!.render()}\n \n )}\n navigationState={state}\n renderTabBar={renderTabBar}\n renderLazyPlaceholder={({ route }: any) =>\n descriptors[route.key]!.options.lazyPlaceholder?.() ?? null\n }\n lazy={({ route }: any) =>\n descriptors[route.key]!.options.lazy === true &&\n !state.preloadedRouteKeys.includes(route.key)\n }\n lazyPreloadDistance={focusedOptions.lazyPreloadDistance}\n swipeEnabled={focusedOptions.swipeEnabled}\n animationEnabled={focusedOptions.animationEnabled}\n onSwipeStart={() => navigation.emit({ type: 'swipeStart' })}\n onSwipeEnd={() => navigation.emit({ type: 'swipeEnd' })}\n direction={direction}\n options={Object.fromEntries(\n state.routes.map((route) => {\n const options = descriptors[route.key]?.options;\n\n return [\n route.key,\n {\n sceneStyle: [{ backgroundColor: colors.background }, options?.sceneStyle],\n },\n ];\n })\n )}\n />\n );\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/native-stack/utils/useInvalidPreventRemoveError.js.map b/packages/expo-router/build/react-navigation/native-stack/utils/useInvalidPreventRemoveError.js.map index ab11cee13b00fb..46ea0e46a6b097 100644 --- a/packages/expo-router/build/react-navigation/native-stack/utils/useInvalidPreventRemoveError.js.map +++ b/packages/expo-router/build/react-navigation/native-stack/utils/useInvalidPreventRemoveError.js.map @@ -1 +1 @@ -{"version":3,"file":"useInvalidPreventRemoveError.js","sourceRoot":"","sources":["../../../../src/react-navigation/native-stack/utils/useInvalidPreventRemoveError.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMb,oEAgBC;AArBD,6CAA+B;AAE/B,yCAAuD;AAGvD,SAAgB,4BAA4B,CAAC,WAAqC;IAChF,MAAM,EAAE,eAAe,EAAE,GAAG,IAAA,gCAAuB,GAAE,CAAC;IACtD,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,MAAM,mBAAmB,GAAG,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAC3D,MAAM,8CAA8C,GAClD,mBAAmB,EAAE,OAAO,EAAE,2BAA2B,CAAC;IAC5D,MAAM,kBAAkB,GAAG,mBAAmB,EAAE,KAAK,EAAE,IAAI,CAAC;IAE5D,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,iBAAiB,IAAI,IAAI,IAAI,8CAA8C,EAAE,CAAC;YAChF,MAAM,OAAO,GACX,cAAc,kBAAkB,2GAA2G;gBAC3I,8DAA8D,kBAAkB,mCAAmC,CAAC;YACtH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC;IACH,CAAC,EAAE,CAAC,iBAAiB,EAAE,8CAA8C,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAC9F,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\n\nimport { usePreventRemoveContext } from '../../native';\nimport type { NativeStackDescriptorMap } from '../types';\n\nexport function useInvalidPreventRemoveError(descriptors: NativeStackDescriptorMap) {\n const { preventedRoutes } = usePreventRemoveContext();\n const preventedRouteKey = Object.keys(preventedRoutes)[0];\n const preventedDescriptor = descriptors[preventedRouteKey];\n const isHeaderBackButtonMenuEnabledOnPreventedScreen =\n preventedDescriptor?.options?.headerBackButtonMenuEnabled;\n const preventedRouteName = preventedDescriptor?.route?.name;\n\n React.useEffect(() => {\n if (preventedRouteKey != null && isHeaderBackButtonMenuEnabledOnPreventedScreen) {\n const message =\n `The screen ${preventedRouteName} uses 'usePreventRemove' hook alongside 'headerBackButtonMenuEnabled: true', which is not supported. \\n\\n` +\n `Consider removing 'headerBackButtonMenuEnabled: true' from ${preventedRouteName} screen to get rid of this error.`;\n console.error(message);\n }\n }, [preventedRouteKey, isHeaderBackButtonMenuEnabledOnPreventedScreen, preventedRouteName]);\n}\n"]} \ No newline at end of file +{"version":3,"file":"useInvalidPreventRemoveError.js","sourceRoot":"","sources":["../../../../src/react-navigation/native-stack/utils/useInvalidPreventRemoveError.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMb,oEAgBC;AArBD,6CAA+B;AAE/B,yCAAuD;AAGvD,SAAgB,4BAA4B,CAAC,WAAqC;IAChF,MAAM,EAAE,eAAe,EAAE,GAAG,IAAA,gCAAuB,GAAE,CAAC;IACtD,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,MAAM,mBAAmB,GAAG,WAAW,CAAC,iBAAkB,CAAC,CAAC;IAC5D,MAAM,8CAA8C,GAClD,mBAAmB,EAAE,OAAO,EAAE,2BAA2B,CAAC;IAC5D,MAAM,kBAAkB,GAAG,mBAAmB,EAAE,KAAK,EAAE,IAAI,CAAC;IAE5D,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,iBAAiB,IAAI,IAAI,IAAI,8CAA8C,EAAE,CAAC;YAChF,MAAM,OAAO,GACX,cAAc,kBAAkB,2GAA2G;gBAC3I,8DAA8D,kBAAkB,mCAAmC,CAAC;YACtH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC;IACH,CAAC,EAAE,CAAC,iBAAiB,EAAE,8CAA8C,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAC9F,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\n\nimport { usePreventRemoveContext } from '../../native';\nimport type { NativeStackDescriptorMap } from '../types';\n\nexport function useInvalidPreventRemoveError(descriptors: NativeStackDescriptorMap) {\n const { preventedRoutes } = usePreventRemoveContext();\n const preventedRouteKey = Object.keys(preventedRoutes)[0];\n const preventedDescriptor = descriptors[preventedRouteKey!];\n const isHeaderBackButtonMenuEnabledOnPreventedScreen =\n preventedDescriptor?.options?.headerBackButtonMenuEnabled;\n const preventedRouteName = preventedDescriptor?.route?.name;\n\n React.useEffect(() => {\n if (preventedRouteKey != null && isHeaderBackButtonMenuEnabledOnPreventedScreen) {\n const message =\n `The screen ${preventedRouteName} uses 'usePreventRemove' hook alongside 'headerBackButtonMenuEnabled: true', which is not supported. \\n\\n` +\n `Consider removing 'headerBackButtonMenuEnabled: true' from ${preventedRouteName} screen to get rid of this error.`;\n console.error(message);\n }\n }, [preventedRouteKey, isHeaderBackButtonMenuEnabledOnPreventedScreen, preventedRouteName]);\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.js b/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.js index 3007ccb6e8940c..c79e1fe6893001 100644 --- a/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.js +++ b/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.js @@ -56,7 +56,8 @@ function NativeStackView({ state, descriptors, describe }) { const nextKey = state.routes[i + 1]?.key; const previousDescriptor = previousKey ? descriptors[previousKey] : undefined; const nextDescriptor = nextKey ? descriptors[nextKey] : undefined; - const { options, navigation, render } = descriptors[route.key] ?? preloadedDescriptors[route.key]; + const { options, navigation, render } = (descriptors[route.key] ?? + preloadedDescriptors[route.key]); const headerBack = previousDescriptor ? { title: (0, elements_1.getHeaderTitle)(previousDescriptor.options, previousDescriptor.route.name), diff --git a/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.js.map b/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.js.map index 55df10e8417dca..256c8c02a519b4 100644 --- a/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.js.map +++ b/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.js.map @@ -1 +1 @@ -{"version":3,"file":"NativeStackView.js","sourceRoot":"","sources":["../../../../src/react-navigation/native-stack/views/NativeStackView.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCb,0CAkIC;;AAtKD,6CAA+B;AAC/B,iCAA4B;AAC5B,+CAAiE;AAEjE,6CAQwB;AACxB,yCAKsB;AAMtB,8EAA+E;AAU/E,MAAM,yBAAyB,GAAG,CAAC,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,IAAC,KAAK,EAAE,UAAU,YAC3C,uBAAC,4BAA4B,cAC3B,uBAAC,mBAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,gBAAgB,EAAE,YAAY,CAAC,YAAG,MAAM,EAAE,GAAQ,GAC1C,GACJ,IAxExB,KAAK,CAAC,GAAG,CAyEP,CACV,CAAC;QACJ,CAAC,CAAC,GACqB,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,4BAA4B,GAAG,CAAC,EAAE,QAAQ,EAAiC,EAAE,EAAE;IACnF,MAAM,YAAY,GAAG,IAAA,0BAAe,GAAE,CAAC;IACvC,MAAM,CAAC,oBAAoB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,uBAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,oBAAoB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC9C,CAAC,EAAE,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC,CAAC;IAEzC,OAAO,CACL,uBAAC,qDAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,oBAAoB,YAC9D,QAAQ,GAC4B,CACxC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,gBAAgB,EAAE;QAChB,IAAI,EAAE,CAAC;KACR;IACD,SAAS,EAAE;QACT,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,CAAC;KACV;CACF,CAAC,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { use } from 'react';\nimport { Animated, Image, StyleSheet, View } from 'react-native';\n\nimport {\n getHeaderTitle,\n Header,\n HeaderBackButton,\n HeaderBackContext,\n SafeAreaProviderCompat,\n Screen,\n useHeaderHeight,\n} from '../../elements';\nimport {\n type ParamListBase,\n type RouteProp,\n type StackNavigationState,\n useLinkBuilder,\n} from '../../native';\nimport type {\n NativeStackDescriptor,\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n} from '../types';\nimport { AnimatedHeaderHeightContext } from '../utils/useAnimatedHeaderHeight';\n\ntype Props = {\n state: StackNavigationState;\n // This is used for the native implementation of the stack.\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n describe: (route: RouteProp, placeholder: boolean) => NativeStackDescriptor;\n};\n\nconst TRANSPARENT_PRESENTATIONS = ['transparentModal', 'containedTransparentModal'];\n\nexport function NativeStackView({ state, descriptors, describe }: Props) {\n const parentHeaderBack = use(HeaderBackContext);\n const { buildHref } = useLinkBuilder();\n\n const preloadedDescriptors = state.preloadedRoutes.reduce(\n (acc, route) => {\n acc[route.key] = acc[route.key] || describe(route, true);\n return acc;\n },\n {}\n );\n\n return (\n \n {state.routes.concat(state.preloadedRoutes).map((route, i) => {\n const isFocused = state.index === i;\n const previousKey = state.routes[i - 1]?.key;\n const nextKey = state.routes[i + 1]?.key;\n const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;\n const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;\n const { options, navigation, render } =\n descriptors[route.key] ?? preloadedDescriptors[route.key];\n\n const headerBack = previousDescriptor\n ? {\n title: getHeaderTitle(previousDescriptor.options, previousDescriptor.route.name),\n href: buildHref(previousDescriptor.route.name, previousDescriptor.route.params),\n }\n : parentHeaderBack;\n\n const canGoBack = headerBack != null;\n\n const {\n header,\n headerShown,\n headerBackIcon,\n headerBackImageSource,\n headerLeft,\n headerTransparent,\n headerBackTitle,\n presentation,\n contentStyle,\n ...rest\n } = options;\n\n const nextPresentation = nextDescriptor?.options.presentation;\n\n const isPreloaded =\n preloadedDescriptors[route.key] !== undefined && descriptors[route.key] === undefined;\n\n return (\n \n headerLeft({\n ...rest,\n label: headerBackTitle ?? label,\n })\n : headerLeft === undefined && canGoBack\n ? ({ tintColor, label, ...rest }) => (\n (\n \n )\n : undefined\n }\n onPress={navigation.goBack}\n />\n )\n : headerLeft\n }\n headerTransparent={headerTransparent}\n />\n )\n }\n style={[\n StyleSheet.absoluteFill,\n {\n display:\n (isFocused ||\n (nextPresentation != null &&\n TRANSPARENT_PRESENTATIONS.includes(nextPresentation))) &&\n !isPreloaded\n ? 'flex'\n : 'none',\n },\n presentation != null && TRANSPARENT_PRESENTATIONS.includes(presentation)\n ? { backgroundColor: 'transparent' }\n : null,\n ]}>\n \n \n {render()}\n \n \n \n );\n })}\n \n );\n}\n\nconst AnimatedHeaderHeightProvider = ({ children }: { children: React.ReactNode }) => {\n const headerHeight = useHeaderHeight();\n const [animatedHeaderHeight] = React.useState(() => new Animated.Value(headerHeight));\n\n React.useEffect(() => {\n animatedHeaderHeight.setValue(headerHeight);\n }, [animatedHeaderHeight, headerHeight]);\n\n return (\n \n {children}\n \n );\n};\n\nconst styles = StyleSheet.create({\n contentContainer: {\n flex: 1,\n },\n backImage: {\n height: 24,\n width: 24,\n margin: 3,\n },\n});\n"]} \ No newline at end of file +{"version":3,"file":"NativeStackView.js","sourceRoot":"","sources":["../../../../src/react-navigation/native-stack/views/NativeStackView.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCb,0CAkIC;;AAtKD,6CAA+B;AAC/B,iCAA4B;AAC5B,+CAAiE;AAEjE,6CAQwB;AACxB,yCAKsB;AAMtB,8EAA+E;AAU/E,MAAM,yBAAyB,GAAG,CAAC,kBAAkB,EAAE,2BAA2B,CAAC,CAAC;AAEpF,SAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAS;IACrE,MAAM,gBAAgB,GAAG,IAAA,WAAG,EAAC,4BAAiB,CAAC,CAAC;IAChD,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,uBAAc,GAAE,CAAC;IAEvC,MAAM,oBAAoB,GAAG,KAAK,CAAC,eAAe,CAAC,MAAM,CACvD,CAAC,GAAG,E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C,EAAE,QAAQ,EAAiC,EAAE,EAAE;IACnF,MAAM,YAAY,GAAG,IAAA,0BAAe,GAAE,CAAC;IACvC,MAAM,CAAC,oBAAoB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,uBAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,oBAAoB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC9C,CAAC,EAAE,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC,CAAC;IAEzC,OAAO,CACL,uBAAC,qDAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,oBAAoB,YAC9D,QAAQ,GAC4B,CACxC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,gBAAgB,EAAE;QAChB,IAAI,EAAE,CAAC;KACR;IACD,SAAS,EAAE;QACT,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,CAAC;KACV;CACF,CAAC,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { use } from 'react';\nimport { Animated, Image, StyleSheet, View } from 'react-native';\n\nimport {\n getHeaderTitle,\n Header,\n HeaderBackButton,\n HeaderBackContext,\n SafeAreaProviderCompat,\n Screen,\n useHeaderHeight,\n} from '../../elements';\nimport {\n type ParamListBase,\n type RouteProp,\n type StackNavigationState,\n useLinkBuilder,\n} from '../../native';\nimport type {\n NativeStackDescriptor,\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n} from '../types';\nimport { AnimatedHeaderHeightContext } from '../utils/useAnimatedHeaderHeight';\n\ntype Props = {\n state: StackNavigationState;\n // This is used for the native implementation of the stack.\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n describe: (route: RouteProp, placeholder: boolean) => NativeStackDescriptor;\n};\n\nconst TRANSPARENT_PRESENTATIONS = ['transparentModal', 'containedTransparentModal'];\n\nexport function NativeStackView({ state, descriptors, describe }: Props) {\n const parentHeaderBack = use(HeaderBackContext);\n const { buildHref } = useLinkBuilder();\n\n const preloadedDescriptors = state.preloadedRoutes.reduce(\n (acc, route) => {\n acc[route.key] = acc[route.key] || describe(route, true);\n return acc;\n },\n {}\n );\n\n return (\n \n {state.routes.concat(state.preloadedRoutes).map((route, i) => {\n const isFocused = state.index === i;\n const previousKey = state.routes[i - 1]?.key;\n const nextKey = state.routes[i + 1]?.key;\n const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;\n const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;\n const { options, navigation, render } = (descriptors[route.key] ??\n preloadedDescriptors[route.key])!;\n\n const headerBack = previousDescriptor\n ? {\n title: getHeaderTitle(previousDescriptor.options, previousDescriptor.route.name),\n href: buildHref(previousDescriptor.route.name, previousDescriptor.route.params),\n }\n : parentHeaderBack;\n\n const canGoBack = headerBack != null;\n\n const {\n header,\n headerShown,\n headerBackIcon,\n headerBackImageSource,\n headerLeft,\n headerTransparent,\n headerBackTitle,\n presentation,\n contentStyle,\n ...rest\n } = options;\n\n const nextPresentation = nextDescriptor?.options.presentation;\n\n const isPreloaded =\n preloadedDescriptors[route.key] !== undefined && descriptors[route.key] === undefined;\n\n return (\n \n headerLeft({\n ...rest,\n label: headerBackTitle ?? label,\n })\n : headerLeft === undefined && canGoBack\n ? ({ tintColor, label, ...rest }) => (\n (\n \n )\n : undefined\n }\n onPress={navigation.goBack}\n />\n )\n : headerLeft\n }\n headerTransparent={headerTransparent}\n />\n )\n }\n style={[\n StyleSheet.absoluteFill,\n {\n display:\n (isFocused ||\n (nextPresentation != null &&\n TRANSPARENT_PRESENTATIONS.includes(nextPresentation))) &&\n !isPreloaded\n ? 'flex'\n : 'none',\n },\n presentation != null && TRANSPARENT_PRESENTATIONS.includes(presentation)\n ? { backgroundColor: 'transparent' }\n : null,\n ]}>\n \n \n {render()}\n \n \n \n );\n })}\n \n );\n}\n\nconst AnimatedHeaderHeightProvider = ({ children }: { children: React.ReactNode }) => {\n const headerHeight = useHeaderHeight();\n const [animatedHeaderHeight] = React.useState(() => new Animated.Value(headerHeight));\n\n React.useEffect(() => {\n animatedHeaderHeight.setValue(headerHeight);\n }, [animatedHeaderHeight, headerHeight]);\n\n return (\n \n {children}\n \n );\n};\n\nconst styles = StyleSheet.create({\n contentContainer: {\n flex: 1,\n },\n backImage: {\n height: 24,\n width: 24,\n margin: 3,\n },\n});\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.native.js b/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.native.js index 4a4e486680bab8..2c64f33d42cc24 100644 --- a/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.native.js +++ b/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.native.js @@ -248,7 +248,7 @@ function NativeStackView({ state, navigation, descriptors, describe }) { return acc; }, {}); return ((0, jsx_runtime_1.jsx)(elements_1.SafeAreaProviderCompat, { children: (0, jsx_runtime_1.jsx)(react_native_screens_1.ScreenStack, { style: styles.container, children: state.routes.concat(state.preloadedRoutes).map((route, index) => { - const descriptor = descriptors[route.key] ?? preloadedDescriptors[route.key]; + const descriptor = (descriptors[route.key] ?? preloadedDescriptors[route.key]); const isFocused = state.index === index; const isBelowFocused = state.index - 1 === index; const previousKey = state.routes[index - 1]?.key; diff --git a/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.native.js.map b/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.native.js.map index dcbc23d23d6917..63373fdfe6ce2e 100644 --- a/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.native.js.map +++ b/packages/expo-router/build/react-navigation/native-stack/views/NativeStackView.native.js.map @@ -1 +1 @@ -{"version":3,"file":"NativeStackView.native.js","sourceRoot":"","sources":["../../../../src/react-navigation/native-stack/views/NativeStackView.native.tsx"],"names":[],"mappings":";AAAA,YAAY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CAAC;oBACL,CAAC,IA3EI,KAAK,CAAC,GAAG,CA4Ed,CACH,CAAC;YACJ,CAAC,CAAC,GACU,GACS,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;KACR;IACD,MAAM,EAAE;QACN,MAAM,EAAE,CAAC;KACV;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;KACP;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,CAAC;QACT,SAAS,EAAE,CAAC;KACb;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,QAAQ;KACnB;CACF,CAAC,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { use } from 'react';\nimport { Animated, Platform, StatusBar, StyleSheet, useAnimatedValue, View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport {\n compatibilityFlags,\n type ScreenProps,\n ScreenStack,\n ScreenStackItem,\n} from 'react-native-screens';\n\nimport {\n getDefaultHeaderHeight,\n getHeaderTitle,\n HeaderBackContext,\n HeaderHeightContext,\n HeaderShownContext,\n SafeAreaProviderCompat,\n useFrameSize,\n} from '../../elements';\nimport type {\n NativeStackDescriptor,\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n} from '../types';\nimport { useHeaderConfigProps } from './useHeaderConfigProps';\nimport {\n NavigationProvider,\n type ParamListBase,\n type RouteProp,\n StackActions,\n type StackNavigationState,\n usePreventRemoveContext,\n useTheme,\n} from '../../native';\nimport { debounce } from '../utils/debounce';\nimport { getModalRouteKeys } from '../utils/getModalRoutesKeys';\nimport { AnimatedHeaderHeightContext } from '../utils/useAnimatedHeaderHeight';\nimport { useDismissedRouteError } from '../utils/useDismissedRouteError';\nimport { useInvalidPreventRemoveError } from '../utils/useInvalidPreventRemoveError';\n\nconst ANDROID_DEFAULT_HEADER_HEIGHT = 56;\n\nfunction isFabric() {\n return 'nativeFabricUIManager' in global;\n}\n\ntype SceneViewProps = {\n index: number;\n focused: boolean;\n shouldFreeze: boolean;\n descriptor: NativeStackDescriptor;\n previousDescriptor?: NativeStackDescriptor;\n nextDescriptor?: NativeStackDescriptor;\n isPresentationModal?: boolean;\n isPreloaded?: boolean;\n onWillDisappear: () => void;\n onWillAppear: () => void;\n onAppear: () => void;\n onDisappear: () => void;\n onDismissed: ScreenProps['onDismissed'];\n onHeaderBackButtonClicked: ScreenProps['onHeaderBackButtonClicked'];\n onNativeDismissCancelled: ScreenProps['onDismissed'];\n onGestureCancel: ScreenProps['onGestureCancel'];\n onSheetDetentChanged: ScreenProps['onSheetDetentChanged'];\n};\n\nconst useNativeDriver = Platform.OS !== 'web';\n\nconst SceneView = ({\n index,\n focused,\n shouldFreeze,\n descriptor,\n previousDescriptor,\n nextDescriptor,\n isPresentationModal,\n isPreloaded,\n onWillDisappear,\n onWillAppear,\n onAppear,\n onDisappear,\n onDismissed,\n onHeaderBackButtonClicked,\n onNativeDismissCancelled,\n onGestureCancel,\n onSheetDetentChanged,\n}: SceneViewProps) => {\n const { route, navigation, options, render } = descriptor;\n\n let {\n animation,\n animationMatchesGesture,\n presentation = isPresentationModal ? 'modal' : 'card',\n fullScreenGestureEnabled,\n } = options;\n\n const {\n animationDuration,\n animationTypeForReplace = 'push',\n fullScreenGestureShadowEnabled = true,\n gestureEnabled,\n gestureDirection = presentation === 'card' ? 'horizontal' : 'vertical',\n gestureResponseDistance,\n header,\n headerBackButtonMenuEnabled,\n headerShown,\n headerBackground,\n headerTransparent,\n autoHideHomeIndicator,\n keyboardHandlingEnabled,\n navigationBarColor,\n navigationBarTranslucent,\n navigationBarHidden,\n orientation,\n sheetAllowedDetents = [1.0],\n sheetLargestUndimmedDetentIndex = -1,\n sheetGrabberVisible = false,\n sheetCornerRadius = -1.0,\n sheetElevation = 24,\n sheetExpandsWhenScrolledToEdge = true,\n sheetInitialDetentIndex = 0,\n sheetShouldOverflowTopInset = false,\n sheetResizeAnimationEnabled = true,\n statusBarAnimation,\n statusBarHidden,\n statusBarStyle,\n statusBarTranslucent,\n statusBarBackgroundColor,\n unstable_sheetFooter,\n scrollEdgeEffects,\n freezeOnBlur,\n contentStyle,\n } = options;\n\n if (gestureDirection === 'vertical' && Platform.OS === 'ios') {\n // for `vertical` direction to work, we need to set `fullScreenGestureEnabled` to `true`\n // so the screen can be dismissed from any point on screen.\n // `animationMatchesGesture` needs to be set to `true` so the `animation` set by user can be used,\n // otherwise `simple_push` will be used.\n // Also, the default animation for this direction seems to be `slide_from_bottom`.\n if (fullScreenGestureEnabled === undefined) {\n fullScreenGestureEnabled = true;\n }\n\n if (animationMatchesGesture === undefined) {\n animationMatchesGesture = true;\n }\n\n if (animation === undefined) {\n animation = 'slide_from_bottom';\n }\n }\n\n // workaround for rn-screens where gestureDirection has to be set on both\n // current and previous screen - software-mansion/react-native-screens/pull/1509\n const nextGestureDirection = nextDescriptor?.options.gestureDirection;\n const gestureDirectionOverride =\n nextGestureDirection != null ? nextGestureDirection : gestureDirection;\n\n if (index === 0) {\n // first screen should always be treated as `card`, it resolves problems with no header animation\n // for navigator with first screen as `modal` and the next as `card`\n presentation = 'card';\n }\n\n const { colors } = useTheme();\n const insets = useSafeAreaInsets();\n\n // `modal`, `formSheet` and `pageSheet` presentations do not take whole screen, so should not take the inset.\n const isModal =\n presentation === 'modal' || presentation === 'formSheet' || presentation === 'pageSheet';\n\n // Modals are fullscreen in landscape only on iPhone\n const isIPhone = Platform.OS === 'ios' && !(Platform.isPad || Platform.isTV);\n\n const isParentHeaderShown = use(HeaderShownContext);\n const parentHeaderHeight = use(HeaderHeightContext);\n const parentHeaderBack = use(HeaderBackContext);\n\n const isLandscape = useFrameSize((frame) => frame.width > frame.height);\n\n const topInset =\n isParentHeaderShown || (Platform.OS === 'ios' && isModal) || (isIPhone && isLandscape)\n ? 0\n : insets.top;\n\n const defaultHeaderHeight = useFrameSize((frame) =>\n Platform.select({\n // FIXME: Currently screens isn't using Material 3\n // So our `getDefaultHeaderHeight` doesn't return the correct value\n // So we hardcode the value here for now until screens is updated\n android: ANDROID_DEFAULT_HEADER_HEIGHT + topInset,\n default: getDefaultHeaderHeight(frame, isModal, topInset),\n })\n );\n\n const { preventedRoutes } = usePreventRemoveContext();\n\n const [headerHeight, setHeaderHeight] = React.useState(defaultHeaderHeight);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const setHeaderHeightDebounced = React.useCallback(\n // Debounce the header height updates to avoid excessive re-renders\n debounce(setHeaderHeight, 100),\n []\n );\n\n const hasCustomHeader = header != null;\n\n const usesNewAndroidHeaderHeightImplementation =\n 'usesNewAndroidHeaderHeightImplementation' in compatibilityFlags &&\n compatibilityFlags['usesNewAndroidHeaderHeightImplementation'] === true;\n\n let headerHeightCorrectionOffset = 0;\n\n if (Platform.OS === 'android' && !hasCustomHeader && !usesNewAndroidHeaderHeightImplementation) {\n const statusBarHeight = StatusBar.currentHeight ?? 0;\n\n // On Android, the native header height is not correctly calculated\n // It includes status bar height even if statusbar is not translucent\n // And the statusbar value itself doesn't match the actual status bar height\n // So we subtract the bogus status bar height and add the actual top inset\n headerHeightCorrectionOffset = -statusBarHeight + topInset;\n }\n\n const rawAnimatedHeaderHeight = useAnimatedValue(defaultHeaderHeight);\n const animatedHeaderHeight = React.useMemo(\n () => Animated.add(rawAnimatedHeaderHeight, headerHeightCorrectionOffset),\n [headerHeightCorrectionOffset, rawAnimatedHeaderHeight]\n );\n\n // During the very first render topInset is > 0 when running\n // in non edge-to-edge mode on Android, while on every consecutive render\n // topInset === 0, causing header content to jump, as we add padding on the first frame,\n // just to remove it in next one. To prevent this, when statusBarTranslucent is set,\n // we apply additional padding in header only if its true.\n // For more details see: https://github.com/react-navigation/react-navigation/pull/12014\n const headerTopInsetEnabled =\n typeof statusBarTranslucent === 'boolean' ? statusBarTranslucent : topInset !== 0;\n\n const canGoBack = previousDescriptor != null || parentHeaderBack != null;\n const backTitle = previousDescriptor\n ? getHeaderTitle(previousDescriptor.options, previousDescriptor.route.name)\n : parentHeaderBack?.title;\n\n const headerBack = React.useMemo(() => {\n if (canGoBack) {\n return {\n href: undefined, // No href needed for native\n title: backTitle,\n };\n }\n\n return undefined;\n }, [canGoBack, backTitle]);\n\n const isRemovePrevented = preventedRoutes[route.key]?.preventRemove;\n\n const headerConfig = useHeaderConfigProps({\n ...options,\n route,\n headerBackButtonMenuEnabled:\n isRemovePrevented !== undefined ? !isRemovePrevented : headerBackButtonMenuEnabled,\n headerBackTitle: options.headerBackTitle !== undefined ? options.headerBackTitle : undefined,\n headerHeight,\n headerShown: header !== undefined ? false : headerShown,\n headerTopInsetEnabled,\n headerTransparent,\n headerBack,\n });\n\n const onHeaderHeightChange = hasCustomHeader\n ? // If we have a custom header, don't use native header height\n undefined\n : // On Fabric, there's a bug where native event drivers for Animated objects\n // are created after the first notifications about the header height\n // from the native side, `onHeaderHeightChange` event does not notify\n // `animatedHeaderHeight` about initial values on appearing screens at the moment.\n Animated.event(\n [\n {\n nativeEvent: {\n headerHeight: rawAnimatedHeaderHeight,\n },\n },\n ],\n {\n useNativeDriver,\n listener: (e) => {\n if (\n e.nativeEvent &&\n typeof e.nativeEvent === 'object' &&\n 'headerHeight' in e.nativeEvent &&\n typeof e.nativeEvent.headerHeight === 'number'\n ) {\n const headerHeight = e.nativeEvent.headerHeight;\n\n // Only debounce if header has large title or search bar\n // As it's the only case where the header height can change frequently\n const doesHeaderAnimate =\n Platform.OS === 'ios' &&\n (options.headerLargeTitleEnabled || options.headerSearchBarOptions);\n\n if (doesHeaderAnimate) {\n setHeaderHeightDebounced(headerHeight);\n } else {\n if (\n Platform.OS === 'android' &&\n headerHeight !== 0 &&\n // On some devices, height maybe slightly off (e.g. 56.17 instead of 56)\n Math.round(headerHeight) <= ANDROID_DEFAULT_HEADER_HEIGHT\n ) {\n // FIXME: On Android, events may get delivered out-of-order\n // https://github.com/facebook/react-native/issues/54636\n // We seem to get header height without status bar height first,\n // and then the correct height with status bar height included\n // But due to out-of-order delivery, we may get the correct height first\n // and then the one without status bar height\n // This is hack to include status bar height if it's not already included\n // It only works because header height doesn't change dynamically on Android\n setHeaderHeight(headerHeight + insets.top);\n } else {\n setHeaderHeight(headerHeight);\n }\n }\n }\n },\n }\n );\n\n return (\n \n \n \n \n {headerBackground != null ? (\n /**\n * To show a custom header background, we render it at the top of the screen below the header\n * The header also needs to be positioned absolutely (with `translucent` style)\n */\n \n {headerBackground()}\n \n ) : null}\n {header != null && headerShown !== false ? (\n {\n const headerHeight = e.nativeEvent.layout.height;\n\n setHeaderHeight(headerHeight);\n rawAnimatedHeaderHeight.setValue(headerHeight);\n }}\n style={[styles.header, headerTransparent ? styles.absolute : null]}>\n {header({\n back: headerBack,\n options,\n route,\n navigation,\n })}\n \n ) : null}\n \n {render()}\n \n \n \n \n \n );\n};\n\ntype Props = {\n state: StackNavigationState;\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n describe: (route: RouteProp, placeholder: boolean) => NativeStackDescriptor;\n};\n\nexport function NativeStackView({ state, navigation, descriptors, describe }: Props) {\n const { setNextDismissedKey } = useDismissedRouteError(state);\n\n useInvalidPreventRemoveError(descriptors);\n\n const modalRouteKeys = getModalRouteKeys(state.routes, descriptors);\n\n const preloadedDescriptors = state.preloadedRoutes.reduce(\n (acc, route) => {\n acc[route.key] = acc[route.key] || describe(route, true);\n return acc;\n },\n {}\n );\n\n return (\n \n \n {state.routes.concat(state.preloadedRoutes).map((route, index) => {\n const descriptor = descriptors[route.key] ?? preloadedDescriptors[route.key];\n const isFocused = state.index === index;\n const isBelowFocused = state.index - 1 === index;\n const previousKey = state.routes[index - 1]?.key;\n const nextKey = state.routes[index + 1]?.key;\n const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;\n const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;\n\n const isModal = modalRouteKeys.includes(route.key);\n const isModalOnIos = isModal && Platform.OS === 'ios';\n\n const isPreloaded =\n preloadedDescriptors[route.key] !== undefined && descriptors[route.key] === undefined;\n\n // On Fabric, when screen is frozen, animated and reanimated values are not updated\n // due to component being unmounted. To avoid this, we don't freeze the previous screen there\n const shouldFreeze = isFabric()\n ? !isPreloaded && !isFocused && !isBelowFocused && !isModalOnIos\n : !isPreloaded && !isFocused && !isModalOnIos;\n\n return (\n {\n navigation.emit({\n type: 'transitionStart',\n data: { closing: true },\n target: route.key,\n });\n }}\n onWillAppear={() => {\n navigation.emit({\n type: 'transitionStart',\n data: { closing: false },\n target: route.key,\n });\n }}\n onAppear={() => {\n navigation.emit({\n type: 'transitionEnd',\n data: { closing: false },\n target: route.key,\n });\n }}\n onDisappear={() => {\n navigation.emit({\n type: 'transitionEnd',\n data: { closing: true },\n target: route.key,\n });\n }}\n onDismissed={(event) => {\n navigation.dispatch({\n ...StackActions.pop(event.nativeEvent.dismissCount),\n source: route.key,\n target: state.key,\n });\n\n setNextDismissedKey(route.key);\n }}\n onHeaderBackButtonClicked={() => {\n navigation.dispatch({\n ...StackActions.pop(),\n source: route.key,\n target: state.key,\n });\n }}\n onNativeDismissCancelled={(event) => {\n navigation.dispatch({\n ...StackActions.pop(event.nativeEvent.dismissCount),\n source: route.key,\n target: state.key,\n });\n }}\n onGestureCancel={() => {\n navigation.emit({\n type: 'gestureCancel',\n target: route.key,\n });\n }}\n onSheetDetentChanged={(event) => {\n navigation.emit({\n type: 'sheetDetentChange',\n target: route.key,\n data: {\n index: event.nativeEvent.index,\n stable: event.nativeEvent.isStable,\n },\n });\n }}\n />\n );\n })}\n \n \n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n header: {\n zIndex: 1,\n },\n absolute: {\n position: 'absolute',\n top: 0,\n start: 0,\n end: 0,\n },\n translucent: {\n position: 'absolute',\n top: 0,\n start: 0,\n end: 0,\n zIndex: 1,\n elevation: 1,\n },\n background: {\n overflow: 'hidden',\n },\n});\n"]} \ No newline at end of file +{"version":3,"file":"NativeStackView.native.js","sourceRoot":"","sources":["../../../../src/react-navigation/native-stack/views/NativeStackView.native.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0cb,0CA2HC;;AApkBD,6CAA+B;AAC/B,iCAA4B;AAC5B,+CAAiG;AACjG,mFAAmE;AACnE,+DAK8B;AAE9B,6CAQwB;AAMxB,iEAA8D;AAC9D,yCAQsB;AACtB,gDAA6C;AAC7C,oEAAgE;AAChE,8EAA+E;AAC/E,4EAAyE;AACzE,wFAAqF;AAErF,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAEzC,SAAS,QAAQ;IACf,OAAO,uBAAuB,IAAI,MAAM,CAAC;AAC3C,CAAC;AAsBD,MAAM,eAAe,GAAG,uBAAQ,CAAC,EAAE,KAAK,KAAK,CAAC;AAE9C,MAAM,SAAS,GAAG,CAAC,EACjB,KAAK,EACL,OAAO,EACP,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,WAAW,EACX,yBAAyB,EACzB,wBAAwB,EACxB,eAAe,EACf,oBAAoB,GACL,EAAE,EAAE;IACnB,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAE1D,IAAI,EACF,SAAS,EACT,uBAAuB,EACvB,YAAY,GAAG,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EACrD,wBAAwB,GACzB,GAAG,OAAO,CAAC;IAEZ,MAAM,EACJ,iBAAiB,EACjB,uBAAuB,GAAG,MAAM,EAChC,8BAA8B,GAAG,IAAI,EACrC,cAAc,EACd,gBAAgB,GAAG,YAAY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BACd,IAAI,EAAE,mBAAmB;4BACzB,MAAM,EAAE,KAAK,CAAC,GAAG;4BACjB,IAAI,EAAE;gCACJ,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,KAAK;gCAC9B,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,QAAQ;6BACnC;yBACF,CAAC,CAAC;oBACL,CAAC,IA3EI,KAAK,CAAC,GAAG,CA4Ed,CACH,CAAC;YACJ,CAAC,CAAC,GACU,GACS,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;KACR;IACD,MAAM,EAAE;QACN,MAAM,EAAE,CAAC;KACV;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;KACP;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,CAAC;QACT,SAAS,EAAE,CAAC;KACb;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,QAAQ;KACnB;CACF,CAAC,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { use } from 'react';\nimport { Animated, Platform, StatusBar, StyleSheet, useAnimatedValue, View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport {\n compatibilityFlags,\n type ScreenProps,\n ScreenStack,\n ScreenStackItem,\n} from 'react-native-screens';\n\nimport {\n getDefaultHeaderHeight,\n getHeaderTitle,\n HeaderBackContext,\n HeaderHeightContext,\n HeaderShownContext,\n SafeAreaProviderCompat,\n useFrameSize,\n} from '../../elements';\nimport type {\n NativeStackDescriptor,\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n} from '../types';\nimport { useHeaderConfigProps } from './useHeaderConfigProps';\nimport {\n NavigationProvider,\n type ParamListBase,\n type RouteProp,\n StackActions,\n type StackNavigationState,\n usePreventRemoveContext,\n useTheme,\n} from '../../native';\nimport { debounce } from '../utils/debounce';\nimport { getModalRouteKeys } from '../utils/getModalRoutesKeys';\nimport { AnimatedHeaderHeightContext } from '../utils/useAnimatedHeaderHeight';\nimport { useDismissedRouteError } from '../utils/useDismissedRouteError';\nimport { useInvalidPreventRemoveError } from '../utils/useInvalidPreventRemoveError';\n\nconst ANDROID_DEFAULT_HEADER_HEIGHT = 56;\n\nfunction isFabric() {\n return 'nativeFabricUIManager' in global;\n}\n\ntype SceneViewProps = {\n index: number;\n focused: boolean;\n shouldFreeze: boolean;\n descriptor: NativeStackDescriptor;\n previousDescriptor?: NativeStackDescriptor;\n nextDescriptor?: NativeStackDescriptor;\n isPresentationModal?: boolean;\n isPreloaded?: boolean;\n onWillDisappear: () => void;\n onWillAppear: () => void;\n onAppear: () => void;\n onDisappear: () => void;\n onDismissed: ScreenProps['onDismissed'];\n onHeaderBackButtonClicked: ScreenProps['onHeaderBackButtonClicked'];\n onNativeDismissCancelled: ScreenProps['onDismissed'];\n onGestureCancel: ScreenProps['onGestureCancel'];\n onSheetDetentChanged: ScreenProps['onSheetDetentChanged'];\n};\n\nconst useNativeDriver = Platform.OS !== 'web';\n\nconst SceneView = ({\n index,\n focused,\n shouldFreeze,\n descriptor,\n previousDescriptor,\n nextDescriptor,\n isPresentationModal,\n isPreloaded,\n onWillDisappear,\n onWillAppear,\n onAppear,\n onDisappear,\n onDismissed,\n onHeaderBackButtonClicked,\n onNativeDismissCancelled,\n onGestureCancel,\n onSheetDetentChanged,\n}: SceneViewProps) => {\n const { route, navigation, options, render } = descriptor;\n\n let {\n animation,\n animationMatchesGesture,\n presentation = isPresentationModal ? 'modal' : 'card',\n fullScreenGestureEnabled,\n } = options;\n\n const {\n animationDuration,\n animationTypeForReplace = 'push',\n fullScreenGestureShadowEnabled = true,\n gestureEnabled,\n gestureDirection = presentation === 'card' ? 'horizontal' : 'vertical',\n gestureResponseDistance,\n header,\n headerBackButtonMenuEnabled,\n headerShown,\n headerBackground,\n headerTransparent,\n autoHideHomeIndicator,\n keyboardHandlingEnabled,\n navigationBarColor,\n navigationBarTranslucent,\n navigationBarHidden,\n orientation,\n sheetAllowedDetents = [1.0],\n sheetLargestUndimmedDetentIndex = -1,\n sheetGrabberVisible = false,\n sheetCornerRadius = -1.0,\n sheetElevation = 24,\n sheetExpandsWhenScrolledToEdge = true,\n sheetInitialDetentIndex = 0,\n sheetShouldOverflowTopInset = false,\n sheetResizeAnimationEnabled = true,\n statusBarAnimation,\n statusBarHidden,\n statusBarStyle,\n statusBarTranslucent,\n statusBarBackgroundColor,\n unstable_sheetFooter,\n scrollEdgeEffects,\n freezeOnBlur,\n contentStyle,\n } = options;\n\n if (gestureDirection === 'vertical' && Platform.OS === 'ios') {\n // for `vertical` direction to work, we need to set `fullScreenGestureEnabled` to `true`\n // so the screen can be dismissed from any point on screen.\n // `animationMatchesGesture` needs to be set to `true` so the `animation` set by user can be used,\n // otherwise `simple_push` will be used.\n // Also, the default animation for this direction seems to be `slide_from_bottom`.\n if (fullScreenGestureEnabled === undefined) {\n fullScreenGestureEnabled = true;\n }\n\n if (animationMatchesGesture === undefined) {\n animationMatchesGesture = true;\n }\n\n if (animation === undefined) {\n animation = 'slide_from_bottom';\n }\n }\n\n // workaround for rn-screens where gestureDirection has to be set on both\n // current and previous screen - software-mansion/react-native-screens/pull/1509\n const nextGestureDirection = nextDescriptor?.options.gestureDirection;\n const gestureDirectionOverride =\n nextGestureDirection != null ? nextGestureDirection : gestureDirection;\n\n if (index === 0) {\n // first screen should always be treated as `card`, it resolves problems with no header animation\n // for navigator with first screen as `modal` and the next as `card`\n presentation = 'card';\n }\n\n const { colors } = useTheme();\n const insets = useSafeAreaInsets();\n\n // `modal`, `formSheet` and `pageSheet` presentations do not take whole screen, so should not take the inset.\n const isModal =\n presentation === 'modal' || presentation === 'formSheet' || presentation === 'pageSheet';\n\n // Modals are fullscreen in landscape only on iPhone\n const isIPhone = Platform.OS === 'ios' && !(Platform.isPad || Platform.isTV);\n\n const isParentHeaderShown = use(HeaderShownContext);\n const parentHeaderHeight = use(HeaderHeightContext);\n const parentHeaderBack = use(HeaderBackContext);\n\n const isLandscape = useFrameSize((frame) => frame.width > frame.height);\n\n const topInset =\n isParentHeaderShown || (Platform.OS === 'ios' && isModal) || (isIPhone && isLandscape)\n ? 0\n : insets.top;\n\n const defaultHeaderHeight = useFrameSize((frame) =>\n Platform.select({\n // FIXME: Currently screens isn't using Material 3\n // So our `getDefaultHeaderHeight` doesn't return the correct value\n // So we hardcode the value here for now until screens is updated\n android: ANDROID_DEFAULT_HEADER_HEIGHT + topInset,\n default: getDefaultHeaderHeight(frame, isModal, topInset),\n })\n );\n\n const { preventedRoutes } = usePreventRemoveContext();\n\n const [headerHeight, setHeaderHeight] = React.useState(defaultHeaderHeight);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const setHeaderHeightDebounced = React.useCallback(\n // Debounce the header height updates to avoid excessive re-renders\n debounce(setHeaderHeight, 100),\n []\n );\n\n const hasCustomHeader = header != null;\n\n const usesNewAndroidHeaderHeightImplementation =\n 'usesNewAndroidHeaderHeightImplementation' in compatibilityFlags &&\n compatibilityFlags['usesNewAndroidHeaderHeightImplementation'] === true;\n\n let headerHeightCorrectionOffset = 0;\n\n if (Platform.OS === 'android' && !hasCustomHeader && !usesNewAndroidHeaderHeightImplementation) {\n const statusBarHeight = StatusBar.currentHeight ?? 0;\n\n // On Android, the native header height is not correctly calculated\n // It includes status bar height even if statusbar is not translucent\n // And the statusbar value itself doesn't match the actual status bar height\n // So we subtract the bogus status bar height and add the actual top inset\n headerHeightCorrectionOffset = -statusBarHeight + topInset;\n }\n\n const rawAnimatedHeaderHeight = useAnimatedValue(defaultHeaderHeight);\n const animatedHeaderHeight = React.useMemo(\n () => Animated.add(rawAnimatedHeaderHeight, headerHeightCorrectionOffset),\n [headerHeightCorrectionOffset, rawAnimatedHeaderHeight]\n );\n\n // During the very first render topInset is > 0 when running\n // in non edge-to-edge mode on Android, while on every consecutive render\n // topInset === 0, causing header content to jump, as we add padding on the first frame,\n // just to remove it in next one. To prevent this, when statusBarTranslucent is set,\n // we apply additional padding in header only if its true.\n // For more details see: https://github.com/react-navigation/react-navigation/pull/12014\n const headerTopInsetEnabled =\n typeof statusBarTranslucent === 'boolean' ? statusBarTranslucent : topInset !== 0;\n\n const canGoBack = previousDescriptor != null || parentHeaderBack != null;\n const backTitle = previousDescriptor\n ? getHeaderTitle(previousDescriptor.options, previousDescriptor.route.name)\n : parentHeaderBack?.title;\n\n const headerBack = React.useMemo(() => {\n if (canGoBack) {\n return {\n href: undefined, // No href needed for native\n title: backTitle,\n };\n }\n\n return undefined;\n }, [canGoBack, backTitle]);\n\n const isRemovePrevented = preventedRoutes[route.key]?.preventRemove;\n\n const headerConfig = useHeaderConfigProps({\n ...options,\n route,\n headerBackButtonMenuEnabled:\n isRemovePrevented !== undefined ? !isRemovePrevented : headerBackButtonMenuEnabled,\n headerBackTitle: options.headerBackTitle !== undefined ? options.headerBackTitle : undefined,\n headerHeight,\n headerShown: header !== undefined ? false : headerShown,\n headerTopInsetEnabled,\n headerTransparent,\n headerBack,\n });\n\n const onHeaderHeightChange = hasCustomHeader\n ? // If we have a custom header, don't use native header height\n undefined\n : // On Fabric, there's a bug where native event drivers for Animated objects\n // are created after the first notifications about the header height\n // from the native side, `onHeaderHeightChange` event does not notify\n // `animatedHeaderHeight` about initial values on appearing screens at the moment.\n Animated.event(\n [\n {\n nativeEvent: {\n headerHeight: rawAnimatedHeaderHeight,\n },\n },\n ],\n {\n useNativeDriver,\n listener: (e) => {\n if (\n e.nativeEvent &&\n typeof e.nativeEvent === 'object' &&\n 'headerHeight' in e.nativeEvent &&\n typeof e.nativeEvent.headerHeight === 'number'\n ) {\n const headerHeight = e.nativeEvent.headerHeight;\n\n // Only debounce if header has large title or search bar\n // As it's the only case where the header height can change frequently\n const doesHeaderAnimate =\n Platform.OS === 'ios' &&\n (options.headerLargeTitleEnabled || options.headerSearchBarOptions);\n\n if (doesHeaderAnimate) {\n setHeaderHeightDebounced(headerHeight);\n } else {\n if (\n Platform.OS === 'android' &&\n headerHeight !== 0 &&\n // On some devices, height maybe slightly off (e.g. 56.17 instead of 56)\n Math.round(headerHeight) <= ANDROID_DEFAULT_HEADER_HEIGHT\n ) {\n // FIXME: On Android, events may get delivered out-of-order\n // https://github.com/facebook/react-native/issues/54636\n // We seem to get header height without status bar height first,\n // and then the correct height with status bar height included\n // But due to out-of-order delivery, we may get the correct height first\n // and then the one without status bar height\n // This is hack to include status bar height if it's not already included\n // It only works because header height doesn't change dynamically on Android\n setHeaderHeight(headerHeight + insets.top);\n } else {\n setHeaderHeight(headerHeight);\n }\n }\n }\n },\n }\n );\n\n return (\n \n \n \n \n {headerBackground != null ? (\n /**\n * To show a custom header background, we render it at the top of the screen below the header\n * The header also needs to be positioned absolutely (with `translucent` style)\n */\n \n {headerBackground()}\n \n ) : null}\n {header != null && headerShown !== false ? (\n {\n const headerHeight = e.nativeEvent.layout.height;\n\n setHeaderHeight(headerHeight);\n rawAnimatedHeaderHeight.setValue(headerHeight);\n }}\n style={[styles.header, headerTransparent ? styles.absolute : null]}>\n {header({\n back: headerBack,\n options,\n route,\n navigation,\n })}\n \n ) : null}\n \n {render()}\n \n \n \n \n \n );\n};\n\ntype Props = {\n state: StackNavigationState;\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n describe: (route: RouteProp, placeholder: boolean) => NativeStackDescriptor;\n};\n\nexport function NativeStackView({ state, navigation, descriptors, describe }: Props) {\n const { setNextDismissedKey } = useDismissedRouteError(state);\n\n useInvalidPreventRemoveError(descriptors);\n\n const modalRouteKeys = getModalRouteKeys(state.routes, descriptors);\n\n const preloadedDescriptors = state.preloadedRoutes.reduce(\n (acc, route) => {\n acc[route.key] = acc[route.key] || describe(route, true);\n return acc;\n },\n {}\n );\n\n return (\n \n \n {state.routes.concat(state.preloadedRoutes).map((route, index) => {\n const descriptor = (descriptors[route.key] ?? preloadedDescriptors[route.key])!;\n const isFocused = state.index === index;\n const isBelowFocused = state.index - 1 === index;\n const previousKey = state.routes[index - 1]?.key;\n const nextKey = state.routes[index + 1]?.key;\n const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;\n const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;\n\n const isModal = modalRouteKeys.includes(route.key);\n const isModalOnIos = isModal && Platform.OS === 'ios';\n\n const isPreloaded =\n preloadedDescriptors[route.key] !== undefined && descriptors[route.key] === undefined;\n\n // On Fabric, when screen is frozen, animated and reanimated values are not updated\n // due to component being unmounted. To avoid this, we don't freeze the previous screen there\n const shouldFreeze = isFabric()\n ? !isPreloaded && !isFocused && !isBelowFocused && !isModalOnIos\n : !isPreloaded && !isFocused && !isModalOnIos;\n\n return (\n {\n navigation.emit({\n type: 'transitionStart',\n data: { closing: true },\n target: route.key,\n });\n }}\n onWillAppear={() => {\n navigation.emit({\n type: 'transitionStart',\n data: { closing: false },\n target: route.key,\n });\n }}\n onAppear={() => {\n navigation.emit({\n type: 'transitionEnd',\n data: { closing: false },\n target: route.key,\n });\n }}\n onDisappear={() => {\n navigation.emit({\n type: 'transitionEnd',\n data: { closing: true },\n target: route.key,\n });\n }}\n onDismissed={(event) => {\n navigation.dispatch({\n ...StackActions.pop(event.nativeEvent.dismissCount),\n source: route.key,\n target: state.key,\n });\n\n setNextDismissedKey(route.key);\n }}\n onHeaderBackButtonClicked={() => {\n navigation.dispatch({\n ...StackActions.pop(),\n source: route.key,\n target: state.key,\n });\n }}\n onNativeDismissCancelled={(event) => {\n navigation.dispatch({\n ...StackActions.pop(event.nativeEvent.dismissCount),\n source: route.key,\n target: state.key,\n });\n }}\n onGestureCancel={() => {\n navigation.emit({\n type: 'gestureCancel',\n target: route.key,\n });\n }}\n onSheetDetentChanged={(event) => {\n navigation.emit({\n type: 'sheetDetentChange',\n target: route.key,\n data: {\n index: event.nativeEvent.index,\n stable: event.nativeEvent.isStable,\n },\n });\n }}\n />\n );\n })}\n \n \n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n header: {\n zIndex: 1,\n },\n absolute: {\n position: 'absolute',\n top: 0,\n start: 0,\n end: 0,\n },\n translucent: {\n position: 'absolute',\n top: 0,\n start: 0,\n end: 0,\n zIndex: 1,\n elevation: 1,\n },\n background: {\n overflow: 'hidden',\n },\n});\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/native/__stubs__/createStackNavigator.js.map b/packages/expo-router/build/react-navigation/native/__stubs__/createStackNavigator.js.map index 6805f725465443..a2760fcad91462 100644 --- a/packages/expo-router/build/react-navigation/native/__stubs__/createStackNavigator.js.map +++ b/packages/expo-router/build/react-navigation/native/__stubs__/createStackNavigator.js.map @@ -1 +1 @@ -{"version":3,"file":"createStackNavigator.js","sourceRoot":"","sources":["../../../../src/react-navigation/native/__stubs__/createStackNavigator.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AA8Bb,oDAYC;;AAzCD,qCAUoB;AAEpB,MAAM,cAAc,GAAG,CACrB,KAOC,EACD,EAAE;IACF,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,GAAG,IAAA,2BAAoB,EAAC,kBAAW,EAAE,KAAK,CAAC,CAAC;IAE3F,OAAO,CACL,uBAAC,iBAAiB,cAAE,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAqB,CAC7F,CAAC;AACJ,CAAC,CAAC;AAEF,SAAgB,oBAAoB;IAWlC,OAAO,IAAA,6BAAsB,EAAC,cAAc,CAAC,EAAE,CAAC;AAClD,CAAC","sourcesContent":["'use client';\nimport {\n createNavigatorFactory,\n type DefaultNavigatorOptions,\n type EventMapBase,\n type NavigationListBase,\n type ParamListBase,\n type StackNavigationState,\n StackRouter,\n type TypedNavigator,\n useNavigationBuilder,\n} from '../../core';\n\nconst StackNavigator = (\n props: DefaultNavigatorOptions<\n ParamListBase,\n string | undefined,\n StackNavigationState,\n object,\n EventMapBase,\n unknown\n >\n) => {\n const { state, descriptors, NavigationContent } = useNavigationBuilder(StackRouter, props);\n\n return (\n {descriptors[state.routes[state.index].key].render()}\n );\n};\n\nexport function createStackNavigator(): TypedNavigator<{\n ParamList: ParamList;\n NavigatorID: string | undefined;\n State: StackNavigationState;\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n ScreenOptions: {};\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n EventMap: {};\n NavigationList: NavigationListBase;\n Navigator: typeof StackNavigator;\n}> {\n return createNavigatorFactory(StackNavigator)();\n}\n"]} \ No newline at end of file +{"version":3,"file":"createStackNavigator.js","sourceRoot":"","sources":["../../../../src/react-navigation/native/__stubs__/createStackNavigator.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AA8Bb,oDAYC;;AAzCD,qCAUoB;AAEpB,MAAM,cAAc,GAAG,CACrB,KAOC,EACD,EAAE;IACF,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,GAAG,IAAA,2BAAoB,EAAC,kBAAW,EAAE,KAAK,CAAC,CAAC;IAE3F,OAAO,CACL,uBAAC,iBAAiB,cAAE,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAE,CAAC,GAAG,CAAE,CAAC,MAAM,EAAE,GAAqB,CAC/F,CAAC;AACJ,CAAC,CAAC;AAEF,SAAgB,oBAAoB;IAWlC,OAAO,IAAA,6BAAsB,EAAC,cAAc,CAAC,EAAE,CAAC;AAClD,CAAC","sourcesContent":["'use client';\nimport {\n createNavigatorFactory,\n type DefaultNavigatorOptions,\n type EventMapBase,\n type NavigationListBase,\n type ParamListBase,\n type StackNavigationState,\n StackRouter,\n type TypedNavigator,\n useNavigationBuilder,\n} from '../../core';\n\nconst StackNavigator = (\n props: DefaultNavigatorOptions<\n ParamListBase,\n string | undefined,\n StackNavigationState,\n object,\n EventMapBase,\n unknown\n >\n) => {\n const { state, descriptors, NavigationContent } = useNavigationBuilder(StackRouter, props);\n\n return (\n {descriptors[state.routes[state.index]!.key]!.render()}\n );\n};\n\nexport function createStackNavigator(): TypedNavigator<{\n ParamList: ParamList;\n NavigatorID: string | undefined;\n State: StackNavigationState;\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n ScreenOptions: {};\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n EventMap: {};\n NavigationList: NavigationListBase;\n Navigator: typeof StackNavigator;\n}> {\n return createNavigatorFactory(StackNavigator)();\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/native/__stubs__/window.js.map b/packages/expo-router/build/react-navigation/native/__stubs__/window.js.map index 1a40028c546da8..420278ef283780 100644 --- a/packages/expo-router/build/react-navigation/native/__stubs__/window.js.map +++ b/packages/expo-router/build/react-navigation/native/__stubs__/window.js.map @@ -1 +1 @@ -{"version":3,"file":"window.js","sourceRoot":"","sources":["../../../../src/react-navigation/native/__stubs__/window.tsx"],"names":[],"mappings":";;;AAAA,IAAI,QAAQ,GAAG,IAAI,GAAG,CAAC,EAAE,EAAE,oBAAoB,CAAC,CAAC;AAEjD,IAAI,SAAS,GAAmB,EAAE,CAAC;AACnC,IAAI,OAAO,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;AACrD,IAAI,KAAK,GAAG,CAAC,CAAC;AAEd,IAAI,YAAY,GAAQ,IAAI,CAAC;AAE7B,MAAM,OAAO,GAAG;IACd,IAAI,KAAK;QACP,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,SAAS,CAAC,KAAU,EAAE,CAAS,EAAE,IAAY;QAC3C,QAAQ,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE1C,YAAY,GAAG,KAAK,CAAC;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C,CAAC;IACb,CAAC;CACF,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,IAAgB,EAAE,QAAoB,EAAE,EAAE;IAClE,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;QACxB,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,IAAgB,EAAE,QAAoB,EAAE,EAAE;IACrE,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;QACxB,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;IACxD,CAAC;AACH,CAAC,CAAC;AAEW,QAAA,MAAM,GAAG;IACpB,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IACvB,IAAI,QAAQ;QACV,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO;IACP,gBAAgB;IAChB,mBAAmB;IACnB,IAAI,MAAM;QACR,OAAO,cAAM,CAAC;IAChB,CAAC;CACF,CAAC","sourcesContent":["let location = new URL('', 'http://example.com');\n\nlet listeners: (() => void)[] = [];\nlet entries = [{ state: null, href: location.href }];\nlet index = 0;\n\nlet currentState: any = null;\n\nconst history = {\n get state() {\n return currentState;\n },\n\n pushState(state: any, _: string, path: string) {\n location = new URL(path, location.origin);\n\n currentState = state;\n entries = entries.slice(0, index + 1);\n entries.push({ state, href: location.href });\n index = entries.length - 1;\n },\n\n replaceState(state: any, _: string, path: string) {\n location = new URL(path, location.origin);\n\n currentState = state;\n entries[index] = { state, href: location.href };\n },\n\n go(n: number) {\n setTimeout(() => {\n if ((n > 0 && n < entries.length - index) || (n < 0 && Math.abs(n) <= index)) {\n index += n;\n const entry = entries[index];\n location = new URL(entry.href);\n currentState = entry.state;\n listeners.forEach((cb) => cb());\n }\n }, 0);\n },\n\n back() {\n this.go(-1);\n },\n\n forward() {\n this.go(1);\n },\n};\n\nconst addEventListener = (type: 'popstate', listener: () => void) => {\n if (type === 'popstate') {\n listeners.push(listener);\n }\n};\n\nconst removeEventListener = (type: 'popstate', listener: () => void) => {\n if (type === 'popstate') {\n listeners = listeners.filter((cb) => cb !== listener);\n }\n};\n\nexport const window = {\n document: { title: '' },\n get location() {\n return location;\n },\n history,\n addEventListener,\n removeEventListener,\n get window() {\n return window;\n },\n};\n"]} \ No newline at end of file +{"version":3,"file":"window.js","sourceRoot":"","sources":["../../../../src/react-navigation/native/__stubs__/window.tsx"],"names":[],"mappings":";;;AAAA,IAAI,QAAQ,GAAG,IAAI,GAAG,CAAC,EAAE,EAAE,oBAAoB,CAAC,CAAC;AAEjD,IAAI,SAAS,GAAmB,EAAE,CAAC;AACnC,IAAI,OAAO,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;AACrD,IAAI,KAAK,GAAG,CAAC,CAAC;AAEd,IAAI,YAAY,GAAQ,IAAI,CAAC;AAE7B,MAAM,OAAO,GAAG;IACd,IAAI,KAAK;QACP,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,SAAS,CAAC,KAAU,EAAE,CAAS,EAAE,IAAY;QAC3C,QAAQ,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE1C,YAAY,GAAG,KAAK,CAAC;QACrB,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7C,KAAK,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,YAAY,CAAC,KAAU,EAAE,CAAS,EAAE,IAAY;QAC9C,QAAQ,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,QAAQ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MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;IACxD,CAAC;AACH,CAAC,CAAC;AAEW,QAAA,MAAM,GAAG;IACpB,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IACvB,IAAI,QAAQ;QACV,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO;IACP,gBAAgB;IAChB,mBAAmB;IACnB,IAAI,MAAM;QACR,OAAO,cAAM,CAAC;IAChB,CAAC;CACF,CAAC","sourcesContent":["let location = new URL('', 'http://example.com');\n\nlet listeners: (() => void)[] = [];\nlet entries = [{ state: null, href: location.href }];\nlet index = 0;\n\nlet currentState: any = null;\n\nconst history = {\n get state() {\n return currentState;\n },\n\n pushState(state: any, _: string, path: string) {\n location = new URL(path, location.origin);\n\n currentState = state;\n entries = entries.slice(0, index + 1);\n entries.push({ state, href: location.href });\n index = entries.length - 1;\n },\n\n replaceState(state: any, _: string, path: string) {\n location = new URL(path, location.origin);\n\n currentState = state;\n entries[index] = { state, href: location.href };\n },\n\n go(n: number) {\n setTimeout(() => {\n if ((n > 0 && n < entries.length - index) || (n < 0 && Math.abs(n) <= index)) {\n index += n;\n const entry = entries[index]!;\n location = new URL(entry.href);\n currentState = entry.state;\n listeners.forEach((cb) => cb());\n }\n }, 0);\n },\n\n back() {\n this.go(-1);\n },\n\n forward() {\n this.go(1);\n },\n};\n\nconst addEventListener = (type: 'popstate', listener: () => void) => {\n if (type === 'popstate') {\n listeners.push(listener);\n }\n};\n\nconst removeEventListener = (type: 'popstate', listener: () => void) => {\n if (type === 'popstate') {\n listeners = listeners.filter((cb) => cb !== listener);\n }\n};\n\nexport const window = {\n document: { title: '' },\n get location() {\n return location;\n },\n history,\n addEventListener,\n removeEventListener,\n get window() {\n return window;\n },\n};\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/native/extractPathFromURL.js.map b/packages/expo-router/build/react-navigation/native/extractPathFromURL.js.map index 543db20599a8f7..879199ce78e0a9 100644 --- a/packages/expo-router/build/react-navigation/native/extractPathFromURL.js.map +++ b/packages/expo-router/build/react-navigation/native/extractPathFromURL.js.map @@ -1 +1 @@ -{"version":3,"file":"extractPathFromURL.js","sourceRoot":"","sources":["../../../src/react-navigation/native/extractPathFromURL.tsx"],"names":[],"mappings":";;;;;AAEA,gDA0BC;AA5BD,gFAAsD;AAEtD,SAAgB,kBAAkB,CAAC,QAAkB,EAAE,GAAW;IAChE,KAAK,MAAM,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACpD,MAAM,IAAI,GAAG,MAAM;aAChB,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,IAAA,8BAAkB,EAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;aAC3D,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,+CAA+C;aACpE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,6BAA6B;QAEpD,MAAM,WAAW,GAAG,IAAI,MAAM,CAC5B,IAAI,IAAA,8BAAkB,EAAC,QAAQ,CAAC,OAAO,IAAI;aACxC,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,8BAAkB,EAAC,EAAE,CAAC,CAAC,CAAC;aAC5D,IAAI,CAAC,KAAK,CAAC,EAAE,CACjB,CAAC;QAEF,MAAM,CAAC,aAAa,EAAE,GAAG,YAAY,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxD,MAAM,aAAa,GAAG,aAAa;aAChC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;aACpB,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAEnE,IAAI,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;YACpC,OAAO,aAAa,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import escapeStringRegexp from 'escape-string-regexp';\n\nexport function extractPathFromURL(prefixes: string[], url: string) {\n for (const prefix of prefixes) {\n const protocol = prefix.match(/^[^:]+:/)?.[0] ?? '';\n const host = prefix\n .replace(new RegExp(`^${escapeStringRegexp(protocol)}`), '')\n .replace(/\\/+/g, '/') // Replace multiple slash (//) with single ones\n .replace(/^\\//, ''); // Remove extra leading slash\n\n const prefixRegex = new RegExp(\n `^${escapeStringRegexp(protocol)}(/)*${host\n .split('.')\n .map((it) => (it === '*' ? '[^/]+' : escapeStringRegexp(it)))\n .join('\\\\.')}`\n );\n\n const [originAndPath, ...searchParams] = url.split('?');\n const normalizedURL = originAndPath\n .replace(/\\/+/g, '/')\n .concat(searchParams.length ? `?${searchParams.join('?')}` : '');\n\n if (prefixRegex.test(normalizedURL)) {\n return normalizedURL.replace(prefixRegex, '');\n }\n }\n\n return undefined;\n}\n"]} \ No newline at end of file +{"version":3,"file":"extractPathFromURL.js","sourceRoot":"","sources":["../../../src/react-navigation/native/extractPathFromURL.tsx"],"names":[],"mappings":";;;;;AAEA,gDA0BC;AA5BD,gFAAsD;AAEtD,SAAgB,kBAAkB,CAAC,QAAkB,EAAE,GAAW;IAChE,KAAK,MAAM,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACpD,MAAM,IAAI,GAAG,MAAM;aAChB,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,IAAA,8BAAkB,EAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;aAC3D,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,+CAA+C;aACpE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,6BAA6B;QAEpD,MAAM,WAAW,GAAG,IAAI,MAAM,CAC5B,IAAI,IAAA,8BAAkB,EAAC,QAAQ,CAAC,OAAO,IAAI;aACxC,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,8BAAkB,EAAC,EAAE,CAAC,CAAC,CAAC;aAC5D,IAAI,CAAC,KAAK,CAAC,EAAE,CACjB,CAAC;QAEF,MAAM,CAAC,aAAa,EAAE,GAAG,YAAY,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxD,MAAM,aAAa,GAAG,aAAc;aACjC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;aACpB,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAEnE,IAAI,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;YACpC,OAAO,aAAa,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import escapeStringRegexp from 'escape-string-regexp';\n\nexport function extractPathFromURL(prefixes: string[], url: string) {\n for (const prefix of prefixes) {\n const protocol = prefix.match(/^[^:]+:/)?.[0] ?? '';\n const host = prefix\n .replace(new RegExp(`^${escapeStringRegexp(protocol)}`), '')\n .replace(/\\/+/g, '/') // Replace multiple slash (//) with single ones\n .replace(/^\\//, ''); // Remove extra leading slash\n\n const prefixRegex = new RegExp(\n `^${escapeStringRegexp(protocol)}(/)*${host\n .split('.')\n .map((it) => (it === '*' ? '[^/]+' : escapeStringRegexp(it)))\n .join('\\\\.')}`\n );\n\n const [originAndPath, ...searchParams] = url.split('?');\n const normalizedURL = originAndPath!\n .replace(/\\/+/g, '/')\n .concat(searchParams.length ? `?${searchParams.join('?')}` : '');\n\n if (prefixRegex.test(normalizedURL)) {\n return normalizedURL.replace(prefixRegex, '');\n }\n }\n\n return undefined;\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/native/useScrollToTop.js.map b/packages/expo-router/build/react-navigation/native/useScrollToTop.js.map index 7da010d2991e2b..535bbdb00af01b 100644 --- a/packages/expo-router/build/react-navigation/native/useScrollToTop.js.map +++ b/packages/expo-router/build/react-navigation/native/useScrollToTop.js.map @@ -1 +1 @@ -{"version":3,"file":"useScrollToTop.js","sourceRoot":"","sources":["../../../src/react-navigation/native/useScrollToTop.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDb,wCAoEC;AA1HD,6CAA+B;AAC/B,iCAA4B;AAG5B,kCAMiB;AAgBjB,SAAS,iBAAiB,CAAC,GAAuC;IAChE,IAAI,GAAG,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IACE,aAAa,IAAI,GAAG,CAAC,OAAO;QAC5B,UAAU,IAAI,GAAG,CAAC,OAAO;QACzB,gBAAgB,IAAI,GAAG,CAAC,OAAO;QAC/B,yBAAyB,IAAI,GAAG,CAAC,OAAO,EACxC,CAAC;QACD,qCAAqC;QACrC,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;SAAM,IAAI,oBAAoB,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QAC/C,2DAA2D;QAC3D,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,CAAC,CAAC;QACxD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { use } from 'react';\nimport type { ScrollView } from 'react-native';\n\nimport {\n type EventArg,\n NavigationContext,\n type NavigationProp,\n type ParamListBase,\n useRoute,\n} from '../core';\n\ntype ScrollOptions = { x?: number; y?: number; animated?: boolean };\n\ntype ScrollableView =\n | { scrollToTop(): void }\n | { scrollTo(options: ScrollOptions): void }\n | { scrollToOffset(options: { offset: number; animated?: boolean }): void }\n | { scrollResponderScrollTo(options: ScrollOptions): void };\n\ntype ScrollableWrapper =\n | { getScrollResponder(): React.ReactNode | ScrollView }\n | { getNode(): ScrollableView }\n | ScrollableView\n | null;\n\nfunction getScrollableNode(ref: React.RefObject) {\n if (ref.current == null) {\n return null;\n }\n\n if (\n 'scrollToTop' in ref.current ||\n 'scrollTo' in ref.current ||\n 'scrollToOffset' in ref.current ||\n 'scrollResponderScrollTo' in ref.current\n ) {\n // This is already a scrollable node.\n return ref.current;\n } else if ('getScrollResponder' in ref.current) {\n // If the view is a wrapper like FlatList, SectionList etc.\n // We need to use `getScrollResponder` to get access to the scroll responder\n return ref.current.getScrollResponder();\n } else if ('getNode' in ref.current) {\n // When a `ScrollView` is wrapped in `Animated.createAnimatedComponent`\n // we need to use `getNode` to get the ref to the actual scrollview.\n // Note that `getNode` is deprecated in newer versions of react-native\n // this is why we check if we already have a scrollable node above.\n return ref.current.getNode();\n } else {\n return ref.current;\n }\n}\n\nexport function useScrollToTop(ref: React.RefObject) {\n const navigation = use(NavigationContext);\n const route = useRoute();\n\n if (navigation === undefined) {\n throw new Error(\n \"Couldn't find a navigation object. Is your component inside NavigationContainer?\"\n );\n }\n\n React.useEffect(() => {\n const tabNavigations: NavigationProp[] = [];\n let currentNavigation = navigation;\n // If the screen is nested inside multiple tab navigators, we should scroll to top for any of them\n // So we need to find all the parent tab navigators and add the listeners there\n while (currentNavigation) {\n if (currentNavigation.getState().type === 'tab') {\n tabNavigations.push(currentNavigation);\n }\n\n currentNavigation = currentNavigation.getParent();\n }\n\n if (tabNavigations.length === 0) {\n return;\n }\n\n const unsubscribers = tabNavigations.map((tab) => {\n return tab.addListener(\n // We don't wanna import tab types here to avoid extra deps\n // in addition, there are multiple tab implementations\n // @ts-expect-error the `tabPress` event is only available when navigation type is tab\n 'tabPress',\n (e: EventArg<'tabPress', true>) => {\n // We should scroll to top only when the screen is focused\n const isFocused = navigation.isFocused();\n\n // In a nested stack navigator, tab press resets the stack to first screen\n // So we should scroll to top only when we are on first screen\n const isFirst =\n tabNavigations.includes(navigation) ||\n navigation.getState().routes[0].key === route.key;\n\n // Run the operation in the next frame so we're sure all listeners have been run\n // This is necessary to know if preventDefault() has been called\n requestAnimationFrame(() => {\n const scrollable = getScrollableNode(ref) as ScrollableWrapper;\n\n if (isFocused && isFirst && scrollable && !e.defaultPrevented) {\n if ('scrollToTop' in scrollable) {\n scrollable.scrollToTop();\n } else if ('scrollTo' in scrollable) {\n scrollable.scrollTo({ y: 0, animated: true });\n } else if ('scrollToOffset' in scrollable) {\n scrollable.scrollToOffset({ offset: 0, animated: true });\n } else if ('scrollResponderScrollTo' in scrollable) {\n scrollable.scrollResponderScrollTo({ y: 0, animated: true });\n }\n }\n });\n }\n );\n });\n\n return () => {\n unsubscribers.forEach((unsubscribe) => unsubscribe());\n };\n }, [navigation, ref, route.key]);\n}\n"]} \ No newline at end of file +{"version":3,"file":"useScrollToTop.js","sourceRoot":"","sources":["../../../src/react-navigation/native/useScrollToTop.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDb,wCAoEC;AA1HD,6CAA+B;AAC/B,iCAA4B;AAG5B,kCAMiB;AAgBjB,SAAS,iBAAiB,CAAC,GAAuC;IAChE,IAAI,GAAG,CAAC,OAAO,IAAI,IAA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AAC;wBAC3D,CAAC;6BAAM,IAAI,yBAAyB,IAAI,UAAU,EAAE,CAAC;4BACnD,UAAU,CAAC,uBAAuB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;wBAC/D,CAAC;oBACH,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,aAAa,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;QACxD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { use } from 'react';\nimport type { ScrollView } from 'react-native';\n\nimport {\n type EventArg,\n NavigationContext,\n type NavigationProp,\n type ParamListBase,\n useRoute,\n} from '../core';\n\ntype ScrollOptions = { x?: number; y?: number; animated?: boolean };\n\ntype ScrollableView =\n | { scrollToTop(): void }\n | { scrollTo(options: ScrollOptions): void }\n | { scrollToOffset(options: { offset: number; animated?: boolean }): void }\n | { scrollResponderScrollTo(options: ScrollOptions): void };\n\ntype ScrollableWrapper =\n | { getScrollResponder(): React.ReactNode | ScrollView }\n | { getNode(): ScrollableView }\n | ScrollableView\n | null;\n\nfunction getScrollableNode(ref: React.RefObject) {\n if (ref.current == null) {\n return null;\n }\n\n if (\n 'scrollToTop' in ref.current ||\n 'scrollTo' in ref.current ||\n 'scrollToOffset' in ref.current ||\n 'scrollResponderScrollTo' in ref.current\n ) {\n // This is already a scrollable node.\n return ref.current;\n } else if ('getScrollResponder' in ref.current) {\n // If the view is a wrapper like FlatList, SectionList etc.\n // We need to use `getScrollResponder` to get access to the scroll responder\n return ref.current.getScrollResponder();\n } else if ('getNode' in ref.current) {\n // When a `ScrollView` is wrapped in `Animated.createAnimatedComponent`\n // we need to use `getNode` to get the ref to the actual scrollview.\n // Note that `getNode` is deprecated in newer versions of react-native\n // this is why we check if we already have a scrollable node above.\n return ref.current.getNode();\n } else {\n return ref.current;\n }\n}\n\nexport function useScrollToTop(ref: React.RefObject) {\n const navigation = use(NavigationContext);\n const route = useRoute();\n\n if (navigation === undefined) {\n throw new Error(\n \"Couldn't find a navigation object. Is your component inside NavigationContainer?\"\n );\n }\n\n React.useEffect(() => {\n const tabNavigations: NavigationProp[] = [];\n let currentNavigation = navigation;\n // If the screen is nested inside multiple tab navigators, we should scroll to top for any of them\n // So we need to find all the parent tab navigators and add the listeners there\n while (currentNavigation) {\n if (currentNavigation.getState().type === 'tab') {\n tabNavigations.push(currentNavigation);\n }\n\n currentNavigation = currentNavigation.getParent();\n }\n\n if (tabNavigations.length === 0) {\n return;\n }\n\n const unsubscribers = tabNavigations.map((tab) => {\n return tab.addListener(\n // We don't wanna import tab types here to avoid extra deps\n // in addition, there are multiple tab implementations\n // @ts-expect-error the `tabPress` event is only available when navigation type is tab\n 'tabPress',\n (e: EventArg<'tabPress', true>) => {\n // We should scroll to top only when the screen is focused\n const isFocused = navigation.isFocused();\n\n // In a nested stack navigator, tab press resets the stack to first screen\n // So we should scroll to top only when we are on first screen\n const isFirst =\n tabNavigations.includes(navigation) ||\n navigation.getState().routes[0]!.key === route.key;\n\n // Run the operation in the next frame so we're sure all listeners have been run\n // This is necessary to know if preventDefault() has been called\n requestAnimationFrame(() => {\n const scrollable = getScrollableNode(ref) as ScrollableWrapper;\n\n if (isFocused && isFirst && scrollable && !e.defaultPrevented) {\n if ('scrollToTop' in scrollable) {\n scrollable.scrollToTop();\n } else if ('scrollTo' in scrollable) {\n scrollable.scrollTo({ y: 0, animated: true });\n } else if ('scrollToOffset' in scrollable) {\n scrollable.scrollToOffset({ offset: 0, animated: true });\n } else if ('scrollResponderScrollTo' in scrollable) {\n scrollable.scrollResponderScrollTo({ y: 0, animated: true });\n }\n }\n });\n }\n );\n });\n\n return () => {\n unsubscribers.forEach((unsubscribe) => unsubscribe());\n };\n }, [navigation, ref, route.key]);\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/routers/StackRouter.js.map b/packages/expo-router/build/react-navigation/routers/StackRouter.js.map index 15522a92852c37..79d618f4f2172d 100644 --- a/packages/expo-router/build/react-navigation/routers/StackRouter.js.map +++ b/packages/expo-router/build/react-navigation/routers/StackRouter.js.map @@ -1 +1 @@ -{"version":3,"file":"StackRouter.js","sourceRoot":"","sources":["../../../src/react-navigation/routers/StackRouter.tsx"],"names":[],"mappings":";;;AAkKA,kCAygBC;AA3qBD,kDAA2C;AAE3C,6CAA0C;AAC1C,qEAAkE;AAClE,mEAAgE;AAmHnD,QAAA,YAAY,GAAG;IAC1B,OAAO,CAAC,IAAY,EAAE,MAAe;QACnC,OAAO;YACL,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACS,CAAC;IACvC,CAAC;IACD,IAAI,CAAC,IAAY,EAAE,MAAe;QAChC,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACS,CAAC;IACvC,CAAC;IACD,GAAG,CAAC,QAAgB,CAAC;QACnB,OAAO;YACL,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,EAAE,KAAK,EAAE;SACgB,CAAC;IACvC,CAAC;IACD,QAAQ;QACN,OAAO,EAAE,IAAI,EAAE,YAAY,EAAqC,CAAC;IACnE,CAAC;IACD,KAAK,CAAC,IAAY,EAAE,MAAe,EAAE,OAA6B;QAChE,IAAI,OAAO,OAAO,KAAK,SAAS,EAAE,CAAC;YACjC,OAAO,CAAC,IAAI,CACV,mGAAmG,CACpG,CAAC;QACJ,CAAC;QAED,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,IAAI;gBACJ,MAAM;gBACN,KAAK,EAAE,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CA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AK,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CACjF,CAAC;oBACJ,CAAC;oBAED,IAAI,KAAK,EAAE,CAAC;wBACV,OAAO;4BACL,GAAG,KAAK;4BACR,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gCAC7B,IAAI,CAAC,CAAC,GAAG,KAAK,KAAK,EAAE,GAAG,EAAE,CAAC;oCACzB,OAAO,CAAC,CAAC;gCACX,CAAC;gCACD,OAAO;oCACL,GAAG,CAAC;oCACJ,MAAM,EAAE,IAAA,+CAAsB,EAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;iCAC3D,CAAC;4BACJ,CAAC,CAAC;yBACH,CAAC;oBACJ,CAAC;yBAAM,CAAC;wBACN,OAAO;4BACL,GAAG,KAAK;4BACR,eAAe,EAAE,KAAK,CAAC,eAAe;iCACnC,MAAM,CACL,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,KAAK,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAC9E;iCACA,MAAM,CAAC,IAAA,6CAAqB,EAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;yBAC7D,CAAC;oBACJ,CAAC;gBACH,CAAC;gBAED;oBACE,OAAO,uBAAU,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;QAED,cAAc,EAAE,oBAAY;KAC7B,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { nanoid } from 'nanoid/non-secure';\n\nimport { BaseRouter } from './BaseRouter';\nimport { createParamsFromAction } from './createParamsFromAction';\nimport { createRouteFromAction } from './createRouteFromAction';\nimport type {\n CommonNavigationAction,\n DefaultRouterOptions,\n NavigationRoute,\n NavigationState,\n ParamListBase,\n Route,\n Router,\n} from './types';\n\nexport type StackActionType =\n | {\n type: 'REPLACE';\n payload: { name: string; params?: object };\n source?: string;\n target?: string;\n }\n | {\n type: 'PUSH';\n payload: { name: string; params?: object };\n source?: string;\n target?: string;\n }\n | {\n type: 'POP';\n payload: { count: number };\n source?: string;\n target?: string;\n }\n | {\n type: 'POP_TO_TOP';\n source?: string;\n target?: string;\n }\n | {\n type: 'POP_TO';\n payload: {\n name: string;\n params?: object;\n merge?: boolean;\n };\n source?: string;\n target?: string;\n };\n\nexport type StackRouterOptions = DefaultRouterOptions;\n\nexport type StackNavigationState = NavigationState & {\n /**\n * Type of the router, in this case, it's stack.\n */\n type: 'stack';\n /**\n * List of routes, which are supposed to be preloaded before navigating to.\n */\n preloadedRoutes: NavigationRoute[];\n};\n\nexport type StackActionHelpers = {\n /**\n * Replace the current route with a new one.\n *\n * @param screen Name of the new route that will replace the current one.\n * @param [params] Params object for the new route.\n */\n replace(\n ...args: RouteName extends unknown\n ? undefined extends ParamList[RouteName]\n ? [screen: RouteName, params?: ParamList[RouteName]]\n : [screen: RouteName, params: ParamList[RouteName]]\n : never\n ): void;\n\n /**\n * Push a new screen onto the stack.\n *\n * @param screen Name of the route to push onto the stack.\n * @param [params] Params object for the route.\n */\n push(\n ...args: RouteName extends unknown\n ? undefined extends ParamList[RouteName]\n ? [screen: RouteName, params?: ParamList[RouteName]]\n : [screen: RouteName, params: ParamList[RouteName]]\n : never\n ): void;\n\n /**\n * Pop a screen from the stack.\n */\n pop(count?: number): void;\n\n /**\n * Pop to the first route in the stack, dismissing all other screens.\n */\n popToTop(): void;\n\n /**\n * Pop any screens to go back to the specified screen.\n * If the specified screen doesn't exist, it'll be added to the stack.\n *\n * @param screen Name of the route to pop to.\n * @param [params] Params object for the route.\n * @param [options.merge] Whether to merge the params onto the route. Defaults to `false`.\n */\n popTo(\n ...args: RouteName extends unknown\n ? undefined extends ParamList[RouteName]\n ? [screen: RouteName, params?: ParamList[RouteName], options?: { merge?: boolean }]\n : [screen: RouteName, params: ParamList[RouteName], options?: { merge?: boolean }]\n : never\n ): void;\n};\n\nexport const StackActions = {\n replace(name: string, params?: object) {\n return {\n type: 'REPLACE',\n payload: { name, params },\n } as const satisfies StackActionType;\n },\n push(name: string, params?: object) {\n return {\n type: 'PUSH',\n payload: { name, params },\n } as const satisfies StackActionType;\n },\n pop(count: number = 1) {\n return {\n type: 'POP',\n payload: { count },\n } as const satisfies StackActionType;\n },\n popToTop() {\n return { type: 'POP_TO_TOP' } as const satisfies StackActionType;\n },\n popTo(name: string, params?: object, options?: { merge?: boolean }) {\n if (typeof options === 'boolean') {\n console.warn(\n `Passing a boolean as the third argument to 'popTo' is deprecated. Pass '{ merge: true }' instead.`\n );\n }\n\n return {\n type: 'POP_TO',\n payload: {\n name,\n params,\n merge: typeof options === 'boolean' ? options : options?.merge,\n },\n } as const satisfies StackActionType;\n },\n};\n\n/**\n * StackRouter is considered an internal implementation and its behavior may change without a notice between expo-router's version\n */\nexport function StackRouter(options: StackRouterOptions) {\n const router: Router<\n StackNavigationState,\n CommonNavigationAction | StackActionType\n > = {\n ...BaseRouter,\n\n type: 'stack',\n\n getInitialState({ routeNames, routeParamList }) {\n const initialRouteName =\n options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName)\n ? options.initialRouteName\n : routeNames[0];\n\n return {\n stale: false,\n type: 'stack',\n key: `stack-${nanoid()}`,\n index: 0,\n routeNames,\n preloadedRoutes: [],\n routes: [\n {\n key: `${initialRouteName}-${nanoid()}`,\n name: initialRouteName,\n params: routeParamList[initialRouteName],\n },\n ],\n };\n },\n\n getRehydratedState(partialState, { routeNames, routeParamList }) {\n const state = partialState;\n\n if (state.stale === false) {\n return state;\n }\n\n const routes = state.routes\n .filter((route) => routeNames.includes(route.name))\n .map((route) => ({\n ...route,\n key: route.key || `${route.name}-${nanoid()}`,\n params:\n routeParamList[route.name] !== undefined\n ? {\n ...routeParamList[route.name],\n ...route.params,\n }\n : route.params,\n }));\n\n const preloadedRoutes =\n state.preloadedRoutes\n ?.filter((route) => routeNames.includes(route.name))\n .map(\n (route) =>\n ({\n ...route,\n key: route.key || `${route.name}-${nanoid()}`,\n params:\n routeParamList[route.name] !== undefined\n ? {\n ...routeParamList[route.name],\n ...route.params,\n }\n : route.params,\n }) as Route\n ) ?? [];\n\n if (routes.length === 0) {\n const initialRouteName =\n options.initialRouteName !== undefined ? options.initialRouteName : routeNames[0];\n\n routes.push({\n key: `${initialRouteName}-${nanoid()}`,\n name: initialRouteName,\n params: routeParamList[initialRouteName],\n });\n }\n\n return {\n stale: false,\n type: 'stack',\n key: `stack-${nanoid()}`,\n index: routes.length - 1,\n routeNames,\n routes,\n preloadedRoutes,\n };\n },\n\n getStateForRouteNamesChange(state, { routeNames, routeParamList, routeKeyChanges }) {\n const routes = state.routes.filter(\n (route) => routeNames.includes(route.name) && !routeKeyChanges.includes(route.name)\n );\n\n if (routes.length === 0) {\n const initialRouteName =\n options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName)\n ? options.initialRouteName\n : routeNames[0];\n\n routes.push({\n key: `${initialRouteName}-${nanoid()}`,\n name: initialRouteName,\n params: routeParamList[initialRouteName],\n });\n }\n\n return {\n ...state,\n routeNames,\n routes,\n index: Math.min(state.index, routes.length - 1),\n };\n },\n\n getStateForRouteFocus(state, key) {\n const index = state.routes.findIndex((r) => r.key === key);\n\n if (index === -1 || index === state.index) {\n return state;\n }\n\n return {\n ...state,\n index,\n routes: state.routes.slice(0, index + 1),\n };\n },\n\n getStateForAction(state, action, options) {\n const { routeParamList } = options;\n\n switch (action.type) {\n case 'REPLACE': {\n const currentIndex =\n action.target === state.key && action.source\n ? state.routes.findIndex((r) => r.key === action.source)\n : state.index;\n\n if (currentIndex === -1) {\n return null;\n }\n\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n\n const getId = options.routeGetIdList[action.payload.name];\n const id = getId?.({ params: action.payload.params });\n\n // Re-use preloaded route if available\n let route = state.preloadedRoutes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n\n if (!route) {\n route = createRouteFromAction({ action, routeParamList });\n }\n\n return {\n ...state,\n routes: state.routes.map((r, i) => (i === currentIndex ? route : r)),\n preloadedRoutes: state.preloadedRoutes.filter((r) => r.key !== route.key),\n };\n }\n\n case 'PUSH':\n case 'NAVIGATE': {\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n\n const getId = options.routeGetIdList[action.payload.name];\n const id = getId?.({ params: action.payload.params });\n\n let route: Route | undefined;\n\n if (id !== undefined) {\n route = state.routes.findLast(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n } else if (action.type === 'NAVIGATE') {\n const currentRoute = state.routes[state.index];\n\n // If the route matches the current one, then navigate to it\n if (action.payload.name === currentRoute.name) {\n route = currentRoute;\n } else if (action.payload.pop) {\n route = state.routes.findLast((route) => route.name === action.payload.name);\n }\n }\n\n if (!route) {\n route = state.preloadedRoutes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n }\n\n let params;\n\n if (action.type === 'NAVIGATE' && action.payload.merge && route) {\n params =\n action.payload.params !== undefined ||\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...route.params,\n ...action.payload.params,\n }\n : route.params;\n } else {\n params = createParamsFromAction({ action, routeParamList });\n }\n\n let routes: Route[];\n\n if (route) {\n if (action.type === 'NAVIGATE' && action.payload.pop) {\n routes = [];\n\n // Get all routes until the matching one\n for (const r of state.routes) {\n if (r.key === route.key) {\n routes.push({\n ...route,\n path: action.payload.path !== undefined ? action.payload.path : route.path,\n params,\n });\n break;\n }\n\n routes.push(r);\n }\n } else {\n routes = state.routes.filter((r) => r.key !== route.key);\n routes.push({\n ...route,\n path:\n action.type === 'NAVIGATE' && action.payload.path !== undefined\n ? action.payload.path\n : route.path,\n params,\n });\n }\n } else {\n routes = [\n ...state.routes,\n {\n key: `${action.payload.name}-${nanoid()}`,\n name: action.payload.name,\n path: action.type === 'NAVIGATE' ? action.payload.path : undefined,\n params,\n },\n ];\n }\n\n return {\n ...state,\n index: routes.length - 1,\n preloadedRoutes: state.preloadedRoutes.filter(\n (route) => routes[routes.length - 1].key !== route.key\n ),\n routes,\n };\n }\n\n case 'NAVIGATE_DEPRECATED': {\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n\n if (\n state.preloadedRoutes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n )\n ) {\n return null;\n }\n\n // If the route already exists, navigate to that\n let index = -1;\n\n const getId = options.routeGetIdList[action.payload.name];\n const id = getId?.({ params: action.payload.params });\n\n if (id !== undefined) {\n index = state.routes.findIndex(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n } else if (state.routes[state.index].name === action.payload.name) {\n index = state.index;\n } else {\n index = state.routes.findLastIndex((route) => route.name === action.payload.name);\n }\n\n if (index === -1) {\n const routes = [...state.routes, createRouteFromAction({ action, routeParamList })];\n\n return {\n ...state,\n routes,\n index: routes.length - 1,\n };\n }\n\n const route = state.routes[index];\n\n let params;\n\n if (action.payload.merge) {\n params =\n action.payload.params !== undefined || routeParamList[route.name] !== undefined\n ? {\n ...routeParamList[route.name],\n ...route.params,\n ...action.payload.params,\n }\n : route.params;\n } else {\n params = createParamsFromAction({ action, routeParamList });\n }\n\n return {\n ...state,\n index,\n routes: [\n ...state.routes.slice(0, index),\n params !== route.params ? { ...route, params } : state.routes[index],\n ],\n };\n }\n\n case 'POP': {\n const currentIndex =\n action.target === state.key && action.source\n ? state.routes.findIndex((r) => r.key === action.source)\n : state.index;\n\n if (currentIndex > 0) {\n const count = Math.max(currentIndex - action.payload.count + 1, 1);\n const routes = state.routes\n .slice(0, count)\n .concat(state.routes.slice(currentIndex + 1));\n\n return {\n ...state,\n index: routes.length - 1,\n routes,\n };\n }\n\n return null;\n }\n\n case 'POP_TO_TOP':\n return router.getStateForAction(\n state,\n {\n type: 'POP',\n payload: { count: state.routes.length - 1 },\n },\n options\n );\n\n case 'POP_TO': {\n const currentIndex =\n action.target === state.key && action.source\n ? state.routes.findLastIndex((r) => r.key === action.source)\n : state.index;\n\n if (currentIndex === -1) {\n return null;\n }\n\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n\n // If the route already exists, navigate to it\n let index = -1;\n\n const getId = options.routeGetIdList[action.payload.name];\n const id = getId?.({ params: action.payload.params });\n\n if (id !== undefined) {\n index = state.routes.findIndex(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n } else if (state.routes[currentIndex].name === action.payload.name) {\n index = currentIndex;\n } else {\n for (let i = currentIndex; i >= 0; i--) {\n if (state.routes[i].name === action.payload.name) {\n index = i;\n break;\n }\n }\n }\n\n // If the route doesn't exist, remove the current route and add the new one\n if (index === -1) {\n // Re-use preloaded route if available\n let route = state.preloadedRoutes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n\n if (!route) {\n route = createRouteFromAction({ action, routeParamList });\n }\n\n const routes = state.routes.slice(0, currentIndex).concat(route);\n\n return {\n ...state,\n index: routes.length - 1,\n routes,\n preloadedRoutes: state.preloadedRoutes.filter((r) => r.key !== route.key),\n };\n }\n\n const route = state.routes[index];\n\n let params;\n\n if (action.payload.merge) {\n params =\n action.payload.params !== undefined || routeParamList[route.name] !== undefined\n ? {\n ...routeParamList[route.name],\n ...route.params,\n ...action.payload.params,\n }\n : route.params;\n } else {\n params = createParamsFromAction({ action, routeParamList });\n }\n\n return {\n ...state,\n index,\n routes: [\n ...state.routes.slice(0, index),\n params !== route.params ? { ...route, params } : state.routes[index],\n ],\n };\n }\n\n case 'GO_BACK':\n if (state.index > 0) {\n return router.getStateForAction(\n state,\n {\n type: 'POP',\n payload: { count: 1 },\n target: action.target,\n source: action.source,\n },\n options\n );\n }\n\n return null;\n\n case 'PRELOAD': {\n const getId = options.routeGetIdList[action.payload.name];\n const id = getId?.({ params: action.payload.params });\n\n let route: Route | undefined;\n\n if (id !== undefined) {\n route = state.routes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n }\n\n if (route) {\n return {\n ...state,\n routes: state.routes.map((r) => {\n if (r.key !== route?.key) {\n return r;\n }\n return {\n ...r,\n params: createParamsFromAction({ action, routeParamList }),\n };\n }),\n };\n } else {\n return {\n ...state,\n preloadedRoutes: state.preloadedRoutes\n .filter(\n (r) => r.name !== action.payload.name || id !== getId?.({ params: r.params })\n )\n .concat(createRouteFromAction({ action, routeParamList })),\n };\n }\n }\n\n default:\n return BaseRouter.getStateForAction(state, action);\n }\n },\n\n actionCreators: StackActions,\n };\n\n return router;\n}\n"]} \ No newline at end of file +{"version":3,"file":"StackRouter.js","sourceRoot":"","sources":["../../../src/react-navigation/routers/StackRouter.tsx"],"names":[],"mappings":";;;AAkKA,kCAygBC;AA3qBD,kDAA2C;AAE3C,6CAA0C;AAC1C,qEAAkE;AAClE,mEAAgE;AAmHnD,QAAA,YAAY,GAAG;IAC1B,OAAO,CAAC,IAAY,EAAE,MAAe;QACnC,OAAO;YACL,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACS,CAAC;IACvC,CAAC;IACD,IAAI,CAAC,IAAY,EAAE,MAAe;QAChC,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACS,CAAC;IACvC,CAAC;IACD,GAAG,CAAC,QAAgB,CAAC;QACnB,OAAO;YACL,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,EAAE,KAAK,EAAE;SACgB,CAAC;IACvC,CAAC;IACD,QAAQ;QACN,OAAO,EAAE,IAAI,EAAE,YAAY,EAAqC,CAAC;IACnE,CAAC;IACD,KAAK,CAAC,IAAY,EAAE,MAAe,EAAE,OAA6B;QAChE,IAAI,OAAO,OAAO,KAAK,SAAS,EAAE,CAAC;YACjC,OAAO,CAAC,IAAI,CACV,mGAAmG,CACpG,CA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'nanoid/non-secure';\n\nimport { BaseRouter } from './BaseRouter';\nimport { createParamsFromAction } from './createParamsFromAction';\nimport { createRouteFromAction } from './createRouteFromAction';\nimport type {\n CommonNavigationAction,\n DefaultRouterOptions,\n NavigationRoute,\n NavigationState,\n ParamListBase,\n Route,\n Router,\n} from './types';\n\nexport type StackActionType =\n | {\n type: 'REPLACE';\n payload: { name: string; params?: object };\n source?: string;\n target?: string;\n }\n | {\n type: 'PUSH';\n payload: { name: string; params?: object };\n source?: string;\n target?: string;\n }\n | {\n type: 'POP';\n payload: { count: number };\n source?: string;\n target?: string;\n }\n | {\n type: 'POP_TO_TOP';\n source?: string;\n target?: string;\n }\n | {\n type: 'POP_TO';\n payload: {\n name: string;\n params?: object;\n merge?: boolean;\n };\n source?: string;\n target?: string;\n };\n\nexport type StackRouterOptions = DefaultRouterOptions;\n\nexport type StackNavigationState = NavigationState & {\n /**\n * Type of the router, in this case, it's stack.\n */\n type: 'stack';\n /**\n * List of routes, which are supposed to be preloaded before navigating to.\n */\n preloadedRoutes: NavigationRoute[];\n};\n\nexport type StackActionHelpers = {\n /**\n * Replace the current route with a new one.\n *\n * @param screen Name of the new route that will replace the current one.\n * @param [params] Params object for the new route.\n */\n replace(\n ...args: RouteName extends unknown\n ? undefined extends ParamList[RouteName]\n ? [screen: RouteName, params?: ParamList[RouteName]]\n : [screen: RouteName, params: ParamList[RouteName]]\n : never\n ): void;\n\n /**\n * Push a new screen onto the stack.\n *\n * @param screen Name of the route to push onto the stack.\n * @param [params] Params object for the route.\n */\n push(\n ...args: RouteName extends unknown\n ? undefined extends ParamList[RouteName]\n ? [screen: RouteName, params?: ParamList[RouteName]]\n : [screen: RouteName, params: ParamList[RouteName]]\n : never\n ): void;\n\n /**\n * Pop a screen from the stack.\n */\n pop(count?: number): void;\n\n /**\n * Pop to the first route in the stack, dismissing all other screens.\n */\n popToTop(): void;\n\n /**\n * Pop any screens to go back to the specified screen.\n * If the specified screen doesn't exist, it'll be added to the stack.\n *\n * @param screen Name of the route to pop to.\n * @param [params] Params object for the route.\n * @param [options.merge] Whether to merge the params onto the route. Defaults to `false`.\n */\n popTo(\n ...args: RouteName extends unknown\n ? undefined extends ParamList[RouteName]\n ? [screen: RouteName, params?: ParamList[RouteName], options?: { merge?: boolean }]\n : [screen: RouteName, params: ParamList[RouteName], options?: { merge?: boolean }]\n : never\n ): void;\n};\n\nexport const StackActions = {\n replace(name: string, params?: object) {\n return {\n type: 'REPLACE',\n payload: { name, params },\n } as const satisfies StackActionType;\n },\n push(name: string, params?: object) {\n return {\n type: 'PUSH',\n payload: { name, params },\n } as const satisfies StackActionType;\n },\n pop(count: number = 1) {\n return {\n type: 'POP',\n payload: { count },\n } as const satisfies StackActionType;\n },\n popToTop() {\n return { type: 'POP_TO_TOP' } as const satisfies StackActionType;\n },\n popTo(name: string, params?: object, options?: { merge?: boolean }) {\n if (typeof options === 'boolean') {\n console.warn(\n `Passing a boolean as the third argument to 'popTo' is deprecated. Pass '{ merge: true }' instead.`\n );\n }\n\n return {\n type: 'POP_TO',\n payload: {\n name,\n params,\n merge: typeof options === 'boolean' ? options : options?.merge,\n },\n } as const satisfies StackActionType;\n },\n};\n\n/**\n * StackRouter is considered an internal implementation and its behavior may change without a notice between expo-router's version\n */\nexport function StackRouter(options: StackRouterOptions) {\n const router: Router<\n StackNavigationState,\n CommonNavigationAction | StackActionType\n > = {\n ...BaseRouter,\n\n type: 'stack',\n\n getInitialState({ routeNames, routeParamList }) {\n const initialRouteName =\n options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName)\n ? options.initialRouteName\n : routeNames[0]!;\n\n return {\n stale: false,\n type: 'stack',\n key: `stack-${nanoid()}`,\n index: 0,\n routeNames,\n preloadedRoutes: [],\n routes: [\n {\n key: `${initialRouteName}-${nanoid()}`,\n name: initialRouteName,\n params: routeParamList[initialRouteName],\n },\n ],\n };\n },\n\n getRehydratedState(partialState, { routeNames, routeParamList }) {\n const state = partialState;\n\n if (state.stale === false) {\n return state;\n }\n\n const routes = state.routes\n .filter((route) => routeNames.includes(route.name))\n .map((route) => ({\n ...route,\n key: route.key || `${route.name}-${nanoid()}`,\n params:\n routeParamList[route.name] !== undefined\n ? {\n ...routeParamList[route.name],\n ...route.params,\n }\n : route.params,\n }));\n\n const preloadedRoutes =\n state.preloadedRoutes\n ?.filter((route) => routeNames.includes(route.name))\n .map(\n (route) =>\n ({\n ...route,\n key: route.key || `${route.name}-${nanoid()}`,\n params:\n routeParamList[route.name] !== undefined\n ? {\n ...routeParamList[route.name],\n ...route.params,\n }\n : route.params,\n }) as Route\n ) ?? [];\n\n if (routes.length === 0) {\n const initialRouteName =\n options.initialRouteName !== undefined ? options.initialRouteName : routeNames[0]!;\n\n routes.push({\n key: `${initialRouteName}-${nanoid()}`,\n name: initialRouteName,\n params: routeParamList[initialRouteName],\n });\n }\n\n return {\n stale: false,\n type: 'stack',\n key: `stack-${nanoid()}`,\n index: routes.length - 1,\n routeNames,\n routes,\n preloadedRoutes,\n };\n },\n\n getStateForRouteNamesChange(state, { routeNames, routeParamList, routeKeyChanges }) {\n const routes = state.routes.filter(\n (route) => routeNames.includes(route.name) && !routeKeyChanges.includes(route.name)\n );\n\n if (routes.length === 0) {\n const initialRouteName =\n options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName)\n ? options.initialRouteName\n : routeNames[0]!;\n\n routes.push({\n key: `${initialRouteName}-${nanoid()}`,\n name: initialRouteName,\n params: routeParamList[initialRouteName],\n });\n }\n\n return {\n ...state,\n routeNames,\n routes,\n index: Math.min(state.index, routes.length - 1),\n };\n },\n\n getStateForRouteFocus(state, key) {\n const index = state.routes.findIndex((r) => r.key === key);\n\n if (index === -1 || index === state.index) {\n return state;\n }\n\n return {\n ...state,\n index,\n routes: state.routes.slice(0, index + 1),\n };\n },\n\n getStateForAction(state, action, options) {\n const { routeParamList } = options;\n\n switch (action.type) {\n case 'REPLACE': {\n const currentIndex =\n action.target === state.key && action.source\n ? state.routes.findIndex((r) => r.key === action.source)\n : state.index;\n\n if (currentIndex === -1) {\n return null;\n }\n\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n\n const getId = options.routeGetIdList[action.payload.name];\n const id = getId?.({ params: action.payload.params });\n\n // Re-use preloaded route if available\n let route = state.preloadedRoutes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n\n if (!route) {\n route = createRouteFromAction({ action, routeParamList });\n }\n\n return {\n ...state,\n routes: state.routes.map((r, i) => (i === currentIndex ? route : r)),\n preloadedRoutes: state.preloadedRoutes.filter((r) => r.key !== route.key),\n };\n }\n\n case 'PUSH':\n case 'NAVIGATE': {\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n\n const getId = options.routeGetIdList[action.payload.name];\n const id = getId?.({ params: action.payload.params });\n\n let route: Route | undefined;\n\n if (id !== undefined) {\n route = state.routes.findLast(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n } else if (action.type === 'NAVIGATE') {\n const currentRoute = state.routes[state.index]!;\n\n // If the route matches the current one, then navigate to it\n if (action.payload.name === currentRoute.name) {\n route = currentRoute;\n } else if (action.payload.pop) {\n route = state.routes.findLast((route) => route.name === action.payload.name);\n }\n }\n\n if (!route) {\n route = state.preloadedRoutes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n }\n\n let params;\n\n if (action.type === 'NAVIGATE' && action.payload.merge && route) {\n params =\n action.payload.params !== undefined ||\n routeParamList[action.payload.name] !== undefined\n ? {\n ...routeParamList[action.payload.name],\n ...route.params,\n ...action.payload.params,\n }\n : route.params;\n } else {\n params = createParamsFromAction({ action, routeParamList });\n }\n\n let routes: Route[];\n\n if (route) {\n if (action.type === 'NAVIGATE' && action.payload.pop) {\n routes = [];\n\n // Get all routes until the matching one\n for (const r of state.routes) {\n if (r.key === route.key) {\n routes.push({\n ...route,\n path: action.payload.path !== undefined ? action.payload.path : route.path,\n params,\n });\n break;\n }\n\n routes.push(r);\n }\n } else {\n routes = state.routes.filter((r) => r.key !== route.key);\n routes.push({\n ...route,\n path:\n action.type === 'NAVIGATE' && action.payload.path !== undefined\n ? action.payload.path\n : route.path,\n params,\n });\n }\n } else {\n routes = [\n ...state.routes,\n {\n key: `${action.payload.name}-${nanoid()}`,\n name: action.payload.name,\n path: action.type === 'NAVIGATE' ? action.payload.path : undefined,\n params,\n },\n ];\n }\n\n return {\n ...state,\n index: routes.length - 1,\n preloadedRoutes: state.preloadedRoutes.filter(\n (route) => routes[routes.length - 1]!.key !== route.key\n ),\n routes,\n };\n }\n\n case 'NAVIGATE_DEPRECATED': {\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n\n if (\n state.preloadedRoutes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n )\n ) {\n return null;\n }\n\n // If the route already exists, navigate to that\n let index = -1;\n\n const getId = options.routeGetIdList[action.payload.name];\n const id = getId?.({ params: action.payload.params });\n\n if (id !== undefined) {\n index = state.routes.findIndex(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n } else if (state.routes[state.index]!.name === action.payload.name) {\n index = state.index;\n } else {\n index = state.routes.findLastIndex((route) => route.name === action.payload.name);\n }\n\n if (index === -1) {\n const routes = [...state.routes, createRouteFromAction({ action, routeParamList })];\n\n return {\n ...state,\n routes,\n index: routes.length - 1,\n };\n }\n\n const route = state.routes[index]!;\n\n let params;\n\n if (action.payload.merge) {\n params =\n action.payload.params !== undefined || routeParamList[route.name] !== undefined\n ? {\n ...routeParamList[route.name],\n ...route.params,\n ...action.payload.params,\n }\n : route.params;\n } else {\n params = createParamsFromAction({ action, routeParamList });\n }\n\n return {\n ...state,\n index,\n routes: [\n ...state.routes.slice(0, index),\n params !== route.params ? { ...route, params } : state.routes[index]!,\n ],\n };\n }\n\n case 'POP': {\n const currentIndex =\n action.target === state.key && action.source\n ? state.routes.findIndex((r) => r.key === action.source)\n : state.index;\n\n if (currentIndex > 0) {\n const count = Math.max(currentIndex - action.payload.count + 1, 1);\n const routes = state.routes\n .slice(0, count)\n .concat(state.routes.slice(currentIndex + 1));\n\n return {\n ...state,\n index: routes.length - 1,\n routes,\n };\n }\n\n return null;\n }\n\n case 'POP_TO_TOP':\n return router.getStateForAction(\n state,\n {\n type: 'POP',\n payload: { count: state.routes.length - 1 },\n },\n options\n );\n\n case 'POP_TO': {\n const currentIndex =\n action.target === state.key && action.source\n ? state.routes.findLastIndex((r) => r.key === action.source)\n : state.index;\n\n if (currentIndex === -1) {\n return null;\n }\n\n if (!state.routeNames.includes(action.payload.name)) {\n return null;\n }\n\n // If the route already exists, navigate to it\n let index = -1;\n\n const getId = options.routeGetIdList[action.payload.name];\n const id = getId?.({ params: action.payload.params });\n\n if (id !== undefined) {\n index = state.routes.findIndex(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n } else if (state.routes[currentIndex]!.name === action.payload.name) {\n index = currentIndex;\n } else {\n for (let i = currentIndex; i >= 0; i--) {\n if (state.routes[i]!.name === action.payload.name) {\n index = i;\n break;\n }\n }\n }\n\n // If the route doesn't exist, remove the current route and add the new one\n if (index === -1) {\n // Re-use preloaded route if available\n let route = state.preloadedRoutes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n\n if (!route) {\n route = createRouteFromAction({ action, routeParamList });\n }\n\n const routes = state.routes.slice(0, currentIndex).concat(route);\n\n return {\n ...state,\n index: routes.length - 1,\n routes,\n preloadedRoutes: state.preloadedRoutes.filter((r) => r.key !== route.key),\n };\n }\n\n const route = state.routes[index]!;\n\n let params;\n\n if (action.payload.merge) {\n params =\n action.payload.params !== undefined || routeParamList[route.name] !== undefined\n ? {\n ...routeParamList[route.name],\n ...route.params,\n ...action.payload.params,\n }\n : route.params;\n } else {\n params = createParamsFromAction({ action, routeParamList });\n }\n\n return {\n ...state,\n index,\n routes: [\n ...state.routes.slice(0, index),\n params !== route.params ? { ...route, params } : state.routes[index]!,\n ],\n };\n }\n\n case 'GO_BACK':\n if (state.index > 0) {\n return router.getStateForAction(\n state,\n {\n type: 'POP',\n payload: { count: 1 },\n target: action.target,\n source: action.source,\n },\n options\n );\n }\n\n return null;\n\n case 'PRELOAD': {\n const getId = options.routeGetIdList[action.payload.name];\n const id = getId?.({ params: action.payload.params });\n\n let route: Route | undefined;\n\n if (id !== undefined) {\n route = state.routes.find(\n (route) =>\n route.name === action.payload.name && id === getId?.({ params: route.params })\n );\n }\n\n if (route) {\n return {\n ...state,\n routes: state.routes.map((r) => {\n if (r.key !== route?.key) {\n return r;\n }\n return {\n ...r,\n params: createParamsFromAction({ action, routeParamList }),\n };\n }),\n };\n } else {\n return {\n ...state,\n preloadedRoutes: state.preloadedRoutes\n .filter(\n (r) => r.name !== action.payload.name || id !== getId?.({ params: r.params })\n )\n .concat(createRouteFromAction({ action, routeParamList })),\n };\n }\n }\n\n default:\n return BaseRouter.getStateForAction(state, action);\n }\n },\n\n actionCreators: StackActions,\n };\n\n return router;\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/routers/TabRouter.js.map b/packages/expo-router/build/react-navigation/routers/TabRouter.js.map index 50d4486e0550e6..7f1c90e3d5de9e 100644 --- a/packages/expo-router/build/react-navigation/routers/TabRouter.js.map +++ b/packages/expo-router/build/react-navigation/routers/TabRouter.js.map @@ -1 +1 @@ -{"version":3,"file":"TabRouter.js","sourceRoot":"","sources":["../../../src/react-navigation/routers/TabRouter.tsx"],"names":[],"mappings":";;;AAofA,8BAiDC;AAriBD,kDAA2C;AAE3C,6CAA0C;AAC1C,qEAAkE;AA0ElE,MAAM,UAAU,GAAG,OAAgB,CAAC;AAEvB,QAAA,UAAU,GAAG;IACxB,MAAM,CAAC,IAAY,EAAE,MAAe;QAClC,OAAO;YACL,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACO,CAAC;IACrC,CAAC;CACF,CAAC;AAEF,MAAM,eAAe,GAAG,CACtB,MAAuB,EACvB,KAAa,EACb,YAA0B,EAC1B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nimport { BaseRouter } from './BaseRouter';\nimport { createParamsFromAction } from './createParamsFromAction';\nimport type {\n CommonNavigationAction,\n DefaultRouterOptions,\n NavigationState,\n ParamListBase,\n PartialState,\n Route,\n Router,\n} from './types';\nimport type { StackActionType } from '../core';\n\nexport type TabActionType = {\n type: 'JUMP_TO';\n payload: { name: string; params?: object };\n source?: string;\n target?: string;\n};\n\nexport type BackBehavior =\n | 'firstRoute'\n | 'initialRoute'\n | 'order'\n | 'history'\n | 'fullHistory'\n | 'none';\n\nexport type TabRouterOptions = DefaultRouterOptions & {\n /**\n * Control how going back should behave\n * - `firstRoute` - return to the first defined route\n * - `initialRoute` - return to the route from `initialRouteName`\n * - `order` - return to the route defined before the focused route\n * - `history` - return to last visited route; if the same route is visited multiple times, the older entries are dropped from the history\n * - `fullHistory` - return to last visited route; doesn't drop duplicate entries unlike `history` - matches behavior of web pages\n * - `none` - do not handle going back\n */\n backBehavior?: BackBehavior;\n};\n\nexport type TabNavigationState = Omit<\n NavigationState,\n 'history'\n> & {\n /**\n * Type of the router, in this case, it's tab.\n */\n type: 'tab';\n /**\n * List of previously visited route keys.\n */\n history: { type: 'route'; key: string; params?: object | undefined }[];\n /**\n * List of routes' key, which are supposed to be preloaded before navigating to.\n */\n preloadedRouteKeys: string[];\n};\n\nexport type TabActionHelpers = {\n /**\n * Jump to an existing tab.\n *\n * @param screen Name of the route to jump to.\n * @param [params] Params object for the route.\n */\n jumpTo(\n ...args: RouteName extends unknown\n ? undefined extends ParamList[RouteName]\n ? [screen: RouteName, params?: ParamList[RouteName]]\n : [screen: RouteName, params: ParamList[RouteName]]\n : never\n ): void;\n};\n\nconst TYPE_ROUTE = 'route' as const;\n\nexport const TabActions = {\n jumpTo(name: string, params?: object) {\n return {\n type: 'JUMP_TO',\n payload: { name, params },\n } as const satisfies TabActionType;\n },\n};\n\nconst getRouteHistory = (\n routes: Route[],\n index: number,\n backBehavior: BackBehavior,\n initialRouteName: string | undefined\n) => {\n const history = [\n {\n type: TYPE_ROUTE,\n key: routes[index].key,\n },\n ];\n\n let initialRouteIndex;\n\n switch (backBehavior) {\n case 'order':\n for (let i = index; i > 0; i--) {\n history.unshift({\n type: TYPE_ROUTE,\n key: routes[i - 1].key,\n });\n }\n break;\n case 'firstRoute':\n if (index !== 0) {\n history.unshift({\n type: TYPE_ROUTE,\n key: routes[0].key,\n });\n }\n break;\n case 'initialRoute':\n initialRouteIndex = routes.findIndex((route) => route.name === initialRouteName);\n initialRouteIndex = initialRouteIndex === -1 ? 0 : initialRouteIndex;\n\n if (index !== initialRouteIndex) {\n history.unshift({\n type: TYPE_ROUTE,\n key: routes[initialRouteIndex].key,\n });\n }\n break;\n case 'history':\n case 'fullHistory':\n // The history will fill up on navigation\n break;\n }\n\n return history;\n};\n\nconst changeIndex = (\n state: TabNavigationState,\n index: number,\n backBehavior: BackBehavior,\n initialRouteName: string | undefined\n) => {\n let history = state.history;\n\n if (backBehavior === 'history' || backBehavior === 'fullHistory') {\n const currentRoute = state.routes[index];\n\n if (backBehavior === 'history') {\n // Remove the existing key from the history to de-duplicate it\n history = history.filter((it) => (it.type === 'route' ? it.key !== currentRoute.key : false));\n } else if (backBehavior === 'fullHistory') {\n const lastHistoryRouteItemIndex = history.findLastIndex((item) => item.type === 'route');\n\n if (currentRoute.key === history[lastHistoryRouteItemIndex]?.key) {\n // For full-history, only remove if it matches the last route\n // Useful for drawer, if current route was in history, then drawer state changed\n // Then we only need to move the route to the front\n history = [\n ...history.slice(0, lastHistoryRouteItemIndex),\n ...history.slice(lastHistoryRouteItemIndex + 1),\n ];\n }\n }\n\n history = history.concat({\n type: TYPE_ROUTE,\n key: currentRoute.key,\n params: backBehavior === 'fullHistory' ? currentRoute.params : undefined,\n });\n } else {\n history = getRouteHistory(state.routes, index, backBehavior, initialRouteName);\n }\n\n return {\n ...state,\n index,\n history,\n };\n};\n\n// TODO(@ubax): unify the logic into single router instead of BaseTabRouter and override\n// TODO(@ubax): add REPLACE action to CommonAction type and handle it in all routers\nfunction BaseTabRouter({ initialRouteName, backBehavior = 'firstRoute' }: TabRouterOptions) {\n const router: Router<\n TabNavigationState,\n TabActionType | CommonNavigationAction\n > = {\n ...BaseRouter,\n\n type: 'tab',\n\n getInitialState({ routeNames, routeParamList }) {\n const index =\n initialRouteName !== undefined && routeNames.includes(initialRouteName)\n ? routeNames.indexOf(initialRouteName)\n : 0;\n\n const routes = routeNames.map((name) => ({\n name,\n key: `${name}-${nanoid()}`,\n params: routeParamList[name],\n }));\n\n const history = getRouteHistory(routes, index, backBehavior, initialRouteName);\n\n return {\n stale: false,\n type: 'tab',\n key: `tab-${nanoid()}`,\n index,\n routeNames,\n history,\n routes,\n preloadedRouteKeys: [],\n };\n },\n\n getRehydratedState(partialState, { routeNames, routeParamList }) {\n const state = partialState;\n\n if (state.stale === false) {\n return state;\n }\n\n const routes = routeNames.map((name) => {\n const route = (state as PartialState>).routes.find(\n (r) => r.name === name\n );\n\n return {\n ...route,\n name,\n key: route && route.name === name && route.key ? route.key : `${name}-${nanoid()}`,\n params:\n routeParamList[name] !== undefined\n ? {\n ...routeParamList[name],\n ...(route ? route.params : undefined),\n }\n : route\n ? route.params\n : undefined,\n } as Route;\n });\n\n const index = Math.min(\n Math.max(routeNames.indexOf(state.routes[state?.index ?? 0]?.name), 0),\n routes.length - 1\n );\n\n const routeKeys = routes.map((route) => route.key);\n\n const history = state.history?.filter((it) => routeKeys.includes(it.key)) ?? [];\n\n return changeIndex(\n {\n stale: false,\n type: 'tab',\n key: `tab-${nanoid()}`,\n index,\n routeNames,\n history,\n routes,\n preloadedRouteKeys:\n state.preloadedRouteKeys?.filter((key) => routeKeys.includes(key)) ?? [],\n },\n index,\n backBehavior,\n initialRouteName\n );\n },\n\n getStateForRouteNamesChange(state, { routeNames, routeParamList, routeKeyChanges }) {\n const routes = routeNames.map(\n (name) =>\n state.routes.find((r) => r.name === name && !routeKeyChanges.includes(r.name)) || {\n name,\n key: `${name}-${nanoid()}`,\n params: routeParamList[name],\n }\n );\n\n const index = Math.max(0, routeNames.indexOf(state.routes[state.index].name));\n\n let history = state.history.filter(\n // Type will always be 'route' for tabs, but could be different in a router extending this (e.g. drawer)\n (it) => it.type !== 'route' || routes.find((r) => r.key === it.key)\n );\n\n if (!history.length) {\n history = getRouteHistory(routes, index, backBehavior, initialRouteName);\n }\n\n return {\n ...state,\n history,\n routeNames,\n routes,\n index,\n };\n },\n\n getStateForRouteFocus(state, key) {\n const index = state.routes.findIndex((r) => r.key === key);\n\n if (index === -1 || index === state.index) {\n return state;\n }\n\n return changeIndex(state, index, backBehavior, initialRouteName);\n },\n\n getStateForAction(state, action, { routeParamList, routeGetIdList }) {\n switch (action.type) {\n case 'JUMP_TO':\n case 'NAVIGATE':\n case 'NAVIGATE_DEPRECATED': {\n const index = state.routes.findIndex((route) => route.name === action.payload.name);\n\n if (index === -1) {\n return null;\n }\n\n const updatedState = changeIndex(\n {\n ...state,\n routes: state.routes.map((route) => {\n if (route.name !== action.payload.name) {\n return route;\n }\n\n const getId = routeGetIdList[route.name];\n\n const currentId = getId?.({ params: route.params });\n const nextId = getId?.({ params: action.payload.params });\n\n const key = currentId === nextId ? route.key : `${route.name}-${nanoid()}`;\n\n let params;\n\n if (\n (action.type === 'NAVIGATE' || action.type === 'NAVIGATE_DEPRECATED') &&\n action.payload.merge &&\n currentId === nextId\n ) {\n params =\n action.payload.params !== undefined || routeParamList[route.name] !== undefined\n ? {\n ...routeParamList[route.name],\n ...route.params,\n ...action.payload.params,\n }\n : route.params;\n } else {\n params = createParamsFromAction({ action, routeParamList });\n }\n\n const path =\n action.type === 'NAVIGATE' && action.payload.path != null\n ? action.payload.path\n : route.path;\n\n return params !== route.params || path !== route.path\n ? { ...route, key, path, params }\n : route;\n }),\n },\n index,\n backBehavior,\n initialRouteName\n );\n\n return {\n ...updatedState,\n preloadedRouteKeys: updatedState.preloadedRouteKeys.filter(\n (key) => key !== state.routes[updatedState.index].key\n ),\n };\n }\n\n case 'SET_PARAMS':\n case 'REPLACE_PARAMS': {\n const nextState = BaseRouter.getStateForAction(state, action);\n\n if (nextState !== null) {\n const index = nextState.index;\n\n if (index != null) {\n const focusedRoute = nextState.routes[index];\n const historyItemIndex = state.history.findLastIndex(\n (item) => item.key === focusedRoute.key\n );\n\n let updatedHistory = state.history;\n\n if (historyItemIndex !== -1) {\n updatedHistory = [...state.history];\n updatedHistory[historyItemIndex] = {\n ...updatedHistory[historyItemIndex],\n params: focusedRoute.params,\n };\n }\n\n return {\n ...nextState,\n history: updatedHistory,\n };\n }\n }\n\n return nextState;\n }\n\n case 'GO_BACK': {\n if (state.history.length === 1) {\n return null;\n }\n\n const previousHistoryItem = state.history[state.history.length - 2];\n const previousKey = previousHistoryItem?.key;\n const index = state.routes.findLastIndex((route) => route.key === previousKey);\n\n if (index === -1) {\n return null;\n }\n\n let routes = state.routes;\n\n if (\n backBehavior === 'fullHistory' &&\n routes[index].params !== previousHistoryItem.params\n ) {\n routes = [...state.routes];\n routes[index] = {\n ...routes[index],\n params: previousHistoryItem.params,\n };\n }\n\n return {\n ...state,\n routes,\n preloadedRouteKeys: state.preloadedRouteKeys.filter(\n (key) => key !== state.routes[index].key\n ),\n history: state.history.slice(0, -1),\n index,\n };\n }\n\n case 'PRELOAD': {\n const routeIndex = state.routes.findIndex((route) => route.name === action.payload.name);\n\n if (routeIndex === -1) {\n return null;\n }\n\n const route = state.routes[routeIndex];\n\n const getId = routeGetIdList[route.name];\n\n const currentId = getId?.({ params: route.params });\n const nextId = getId?.({ params: action.payload.params });\n\n const key = currentId === nextId ? route.key : `${route.name}-${nanoid()}`;\n\n const params = createParamsFromAction({ action, routeParamList });\n const newRoute = params !== route.params ? { ...route, key, params } : route;\n\n return {\n ...state,\n preloadedRouteKeys: state.preloadedRouteKeys\n .filter((key) => key !== route.key)\n .concat(newRoute.key),\n routes: state.routes.map((route, index) => (index === routeIndex ? newRoute : route)),\n history:\n key === route.key\n ? state.history\n : state.history.filter((record) => record.key !== route.key),\n };\n }\n\n default:\n return BaseRouter.getStateForAction(state, action);\n }\n },\n\n actionCreators: TabActions,\n };\n\n return router;\n}\n\n/**\n * TabRouter is considered an internal implementation and its behavior may change without a notice between expo-router's version\n */\nexport function TabRouter(\n args: TabRouterOptions\n): Router, TabActionType | CommonNavigationAction> {\n const base = BaseTabRouter(args);\n return {\n ...base,\n getStateForAction: (state, action, options) => {\n if (action.target && action.target !== state.key) {\n return null;\n }\n\n if ((action.type as string) === 'REPLACE') {\n const replaceAction = action as unknown as Extract;\n // Generate the state as if we were using JUMP_TO\n let nextState = base.getStateForAction(\n state,\n {\n ...replaceAction,\n type: 'JUMP_TO',\n },\n options\n );\n\n if (!nextState || nextState.index === undefined || !Array.isArray(nextState.history)) {\n return null;\n }\n\n // If the state is valid and we didn't JUMP_TO a single history state,\n // then remove the previous state.\n if (nextState.index !== 0) {\n const previousIndex = nextState.index - 1;\n\n nextState = {\n ...nextState,\n key: `${nextState.key}-replace`,\n // Omit the previous history entry that we are replacing\n history: [\n ...nextState.history.slice(0, previousIndex),\n ...nextState.history.splice(nextState.index),\n ],\n };\n }\n\n return nextState;\n }\n\n return base.getStateForAction(state, action, options);\n },\n };\n}\n"]} \ No newline at end of file +{"version":3,"file":"TabRouter.js","sourceRoot":"","sources":["../../../src/react-navigation/routers/TabRouter.tsx"],"names":[],"mappings":";;;AAofA,8BAiDC;AAriBD,kDAA2C;AAE3C,6CAA0C;AAC1C,qEAAkE;AA0ElE,MAAM,UAAU,GAAG,OAAgB,CAAC;AAEvB,QAAA,UAAU,GAAG;IACxB,MAAM,CAAC,IAAY,EAAE,MAAe;QAClC,OAAO;YACL,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACO,CAAC;IACrC,CAAC;CACF,CAAC;AAEF,MAAM,eAAe,GAAG,CACtB,MAAuB,EACvB,KAAa,EACb,YAA0B,EAC1B,gBAAoC,EACpC,EAAE;IACF,MAAM,OAAO,GAAG;QACd;YACE,IAAI,EAAE,UAAU;YAChB,GAA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IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,CAAC,GAAG,EAAE,CAAC;gBACjD,OAAO,IAAI,CAAC;YACd,CAAC;YAED,IAAK,MAAM,CAAC,IAAe,KAAK,SAAS,EAAE,CAAC;gBAC1C,MAAM,aAAa,GAAG,MAAkE,CAAC;gBACzF,iDAAiD;gBACjD,IAAI,SAAS,GAAG,IAAI,CAAC,iBAAiB,CACpC,KAAK,EACL;oBACE,GAAG,aAAa;oBAChB,IAAI,EAAE,SAAS;iBAChB,EACD,OAAO,CACR,CAAC;gBAEF,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;oBACrF,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,sEAAsE;gBACtE,kCAAkC;gBAClC,IAAI,SAAS,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;oBAC1B,MAAM,aAAa,GAAG,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC;oBAE1C,SAAS,GAAG;wBACV,GAAG,SAAS;wBACZ,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,UAAU;wBAC/B,wDAAwD;wBACxD,OAAO,EAAE;4BACP,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC;4BAC5C,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;yBAC7C;qBACF,CAAC;gBACJ,CAAC;gBAED,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { nanoid } from 'nanoid/non-secure';\n\nimport { BaseRouter } from './BaseRouter';\nimport { createParamsFromAction } from './createParamsFromAction';\nimport type {\n CommonNavigationAction,\n DefaultRouterOptions,\n NavigationState,\n ParamListBase,\n PartialState,\n Route,\n Router,\n} from './types';\nimport type { StackActionType } from '../core';\n\nexport type TabActionType = {\n type: 'JUMP_TO';\n payload: { name: string; params?: object };\n source?: string;\n target?: string;\n};\n\nexport type BackBehavior =\n | 'firstRoute'\n | 'initialRoute'\n | 'order'\n | 'history'\n | 'fullHistory'\n | 'none';\n\nexport type TabRouterOptions = DefaultRouterOptions & {\n /**\n * Control how going back should behave\n * - `firstRoute` - return to the first defined route\n * - `initialRoute` - return to the route from `initialRouteName`\n * - `order` - return to the route defined before the focused route\n * - `history` - return to last visited route; if the same route is visited multiple times, the older entries are dropped from the history\n * - `fullHistory` - return to last visited route; doesn't drop duplicate entries unlike `history` - matches behavior of web pages\n * - `none` - do not handle going back\n */\n backBehavior?: BackBehavior;\n};\n\nexport type TabNavigationState = Omit<\n NavigationState,\n 'history'\n> & {\n /**\n * Type of the router, in this case, it's tab.\n */\n type: 'tab';\n /**\n * List of previously visited route keys.\n */\n history: { type: 'route'; key: string; params?: object | undefined }[];\n /**\n * List of routes' key, which are supposed to be preloaded before navigating to.\n */\n preloadedRouteKeys: string[];\n};\n\nexport type TabActionHelpers = {\n /**\n * Jump to an existing tab.\n *\n * @param screen Name of the route to jump to.\n * @param [params] Params object for the route.\n */\n jumpTo(\n ...args: RouteName extends unknown\n ? undefined extends ParamList[RouteName]\n ? [screen: RouteName, params?: ParamList[RouteName]]\n : [screen: RouteName, params: ParamList[RouteName]]\n : never\n ): void;\n};\n\nconst TYPE_ROUTE = 'route' as const;\n\nexport const TabActions = {\n jumpTo(name: string, params?: object) {\n return {\n type: 'JUMP_TO',\n payload: { name, params },\n } as const satisfies TabActionType;\n },\n};\n\nconst getRouteHistory = (\n routes: Route[],\n index: number,\n backBehavior: BackBehavior,\n initialRouteName: string | undefined\n) => {\n const history = [\n {\n type: TYPE_ROUTE,\n key: routes[index]!.key,\n },\n ];\n\n let initialRouteIndex;\n\n switch (backBehavior) {\n case 'order':\n for (let i = index; i > 0; i--) {\n history.unshift({\n type: TYPE_ROUTE,\n key: routes[i - 1]!.key,\n });\n }\n break;\n case 'firstRoute':\n if (index !== 0) {\n history.unshift({\n type: TYPE_ROUTE,\n key: routes[0]!.key,\n });\n }\n break;\n case 'initialRoute':\n initialRouteIndex = routes.findIndex((route) => route.name === initialRouteName);\n initialRouteIndex = initialRouteIndex === -1 ? 0 : initialRouteIndex;\n\n if (index !== initialRouteIndex) {\n history.unshift({\n type: TYPE_ROUTE,\n key: routes[initialRouteIndex]!.key,\n });\n }\n break;\n case 'history':\n case 'fullHistory':\n // The history will fill up on navigation\n break;\n }\n\n return history;\n};\n\nconst changeIndex = (\n state: TabNavigationState,\n index: number,\n backBehavior: BackBehavior,\n initialRouteName: string | undefined\n) => {\n let history = state.history;\n\n if (backBehavior === 'history' || backBehavior === 'fullHistory') {\n const currentRoute = state.routes[index]!;\n\n if (backBehavior === 'history') {\n // Remove the existing key from the history to de-duplicate it\n history = history.filter((it) => (it.type === 'route' ? it.key !== currentRoute.key : false));\n } else if (backBehavior === 'fullHistory') {\n const lastHistoryRouteItemIndex = history.findLastIndex((item) => item.type === 'route');\n\n if (currentRoute.key === history[lastHistoryRouteItemIndex]?.key) {\n // For full-history, only remove if it matches the last route\n // Useful for drawer, if current route was in history, then drawer state changed\n // Then we only need to move the route to the front\n history = [\n ...history.slice(0, lastHistoryRouteItemIndex),\n ...history.slice(lastHistoryRouteItemIndex + 1),\n ];\n }\n }\n\n history = history.concat({\n type: TYPE_ROUTE,\n key: currentRoute.key,\n params: backBehavior === 'fullHistory' ? currentRoute.params : undefined,\n });\n } else {\n history = getRouteHistory(state.routes, index, backBehavior, initialRouteName);\n }\n\n return {\n ...state,\n index,\n history,\n };\n};\n\n// TODO(@ubax): unify the logic into single router instead of BaseTabRouter and override\n// TODO(@ubax): add REPLACE action to CommonAction type and handle it in all routers\nfunction BaseTabRouter({ initialRouteName, backBehavior = 'firstRoute' }: TabRouterOptions) {\n const router: Router<\n TabNavigationState,\n TabActionType | CommonNavigationAction\n > = {\n ...BaseRouter,\n\n type: 'tab',\n\n getInitialState({ routeNames, routeParamList }) {\n const index =\n initialRouteName !== undefined && routeNames.includes(initialRouteName)\n ? routeNames.indexOf(initialRouteName)\n : 0;\n\n const routes = routeNames.map((name) => ({\n name,\n key: `${name}-${nanoid()}`,\n params: routeParamList[name],\n }));\n\n const history = getRouteHistory(routes, index, backBehavior, initialRouteName);\n\n return {\n stale: false,\n type: 'tab',\n key: `tab-${nanoid()}`,\n index,\n routeNames,\n history,\n routes,\n preloadedRouteKeys: [],\n };\n },\n\n getRehydratedState(partialState, { routeNames, routeParamList }) {\n const state = partialState;\n\n if (state.stale === false) {\n return state;\n }\n\n const routes = routeNames.map((name) => {\n const route = (state as PartialState>).routes.find(\n (r) => r.name === name\n );\n\n return {\n ...route,\n name,\n key: route && route.name === name && route.key ? route.key : `${name}-${nanoid()}`,\n params:\n routeParamList[name] !== undefined\n ? {\n ...routeParamList[name],\n ...(route ? route.params : undefined),\n }\n : route\n ? route.params\n : undefined,\n } as Route;\n });\n\n const index = Math.min(\n Math.max(routeNames.indexOf(state.routes[state?.index ?? 0]?.name as string), 0),\n routes.length - 1\n );\n\n const routeKeys = routes.map((route) => route.key);\n\n const history = state.history?.filter((it) => routeKeys.includes(it.key)) ?? [];\n\n return changeIndex(\n {\n stale: false,\n type: 'tab',\n key: `tab-${nanoid()}`,\n index,\n routeNames,\n history,\n routes,\n preloadedRouteKeys:\n state.preloadedRouteKeys?.filter((key) => routeKeys.includes(key)) ?? [],\n },\n index,\n backBehavior,\n initialRouteName\n );\n },\n\n getStateForRouteNamesChange(state, { routeNames, routeParamList, routeKeyChanges }) {\n const routes = routeNames.map(\n (name) =>\n state.routes.find((r) => r.name === name && !routeKeyChanges.includes(r.name)) || {\n name,\n key: `${name}-${nanoid()}`,\n params: routeParamList[name],\n }\n );\n\n const index = Math.max(0, routeNames.indexOf(state.routes[state.index]!.name));\n\n let history = state.history.filter(\n // Type will always be 'route' for tabs, but could be different in a router extending this (e.g. drawer)\n (it) => it.type !== 'route' || routes.find((r) => r.key === it.key)\n );\n\n if (!history.length) {\n history = getRouteHistory(routes, index, backBehavior, initialRouteName);\n }\n\n return {\n ...state,\n history,\n routeNames,\n routes,\n index,\n };\n },\n\n getStateForRouteFocus(state, key) {\n const index = state.routes.findIndex((r) => r.key === key);\n\n if (index === -1 || index === state.index) {\n return state;\n }\n\n return changeIndex(state, index, backBehavior, initialRouteName);\n },\n\n getStateForAction(state, action, { routeParamList, routeGetIdList }) {\n switch (action.type) {\n case 'JUMP_TO':\n case 'NAVIGATE':\n case 'NAVIGATE_DEPRECATED': {\n const index = state.routes.findIndex((route) => route.name === action.payload.name);\n\n if (index === -1) {\n return null;\n }\n\n const updatedState = changeIndex(\n {\n ...state,\n routes: state.routes.map((route) => {\n if (route.name !== action.payload.name) {\n return route;\n }\n\n const getId = routeGetIdList[route.name];\n\n const currentId = getId?.({ params: route.params });\n const nextId = getId?.({ params: action.payload.params });\n\n const key = currentId === nextId ? route.key : `${route.name}-${nanoid()}`;\n\n let params;\n\n if (\n (action.type === 'NAVIGATE' || action.type === 'NAVIGATE_DEPRECATED') &&\n action.payload.merge &&\n currentId === nextId\n ) {\n params =\n action.payload.params !== undefined || routeParamList[route.name] !== undefined\n ? {\n ...routeParamList[route.name],\n ...route.params,\n ...action.payload.params,\n }\n : route.params;\n } else {\n params = createParamsFromAction({ action, routeParamList });\n }\n\n const path =\n action.type === 'NAVIGATE' && action.payload.path != null\n ? action.payload.path\n : route.path;\n\n return params !== route.params || path !== route.path\n ? { ...route, key, path, params }\n : route;\n }),\n },\n index,\n backBehavior,\n initialRouteName\n );\n\n return {\n ...updatedState,\n preloadedRouteKeys: updatedState.preloadedRouteKeys.filter(\n (key) => key !== state.routes[updatedState.index]!.key\n ),\n };\n }\n\n case 'SET_PARAMS':\n case 'REPLACE_PARAMS': {\n const nextState = BaseRouter.getStateForAction(state, action);\n\n if (nextState !== null) {\n const index = nextState.index;\n\n if (index != null) {\n const focusedRoute = nextState.routes[index]!;\n const historyItemIndex = state.history.findLastIndex(\n (item) => item.key === focusedRoute.key\n );\n\n let updatedHistory = state.history;\n\n if (historyItemIndex !== -1) {\n updatedHistory = [...state.history];\n updatedHistory[historyItemIndex] = {\n ...updatedHistory[historyItemIndex]!,\n params: focusedRoute.params,\n };\n }\n\n return {\n ...nextState,\n history: updatedHistory,\n };\n }\n }\n\n return nextState;\n }\n\n case 'GO_BACK': {\n if (state.history.length === 1) {\n return null;\n }\n\n const previousHistoryItem = state.history[state.history.length - 2];\n const previousKey = previousHistoryItem?.key;\n const index = state.routes.findLastIndex((route) => route.key === previousKey);\n\n if (index === -1) {\n return null;\n }\n\n let routes = state.routes;\n\n if (\n backBehavior === 'fullHistory' &&\n routes[index]!.params !== previousHistoryItem!.params\n ) {\n routes = [...state.routes];\n routes[index] = {\n ...routes[index]!,\n params: previousHistoryItem!.params,\n };\n }\n\n return {\n ...state,\n routes,\n preloadedRouteKeys: state.preloadedRouteKeys.filter(\n (key) => key !== state.routes[index]!.key\n ),\n history: state.history.slice(0, -1),\n index,\n };\n }\n\n case 'PRELOAD': {\n const routeIndex = state.routes.findIndex((route) => route.name === action.payload.name);\n\n if (routeIndex === -1) {\n return null;\n }\n\n const route = state.routes[routeIndex]!;\n\n const getId = routeGetIdList[route.name];\n\n const currentId = getId?.({ params: route.params });\n const nextId = getId?.({ params: action.payload.params });\n\n const key = currentId === nextId ? route.key : `${route.name}-${nanoid()}`;\n\n const params = createParamsFromAction({ action, routeParamList });\n const newRoute = params !== route.params ? { ...route, key, params } : route;\n\n return {\n ...state,\n preloadedRouteKeys: state.preloadedRouteKeys\n .filter((key) => key !== route.key)\n .concat(newRoute.key),\n routes: state.routes.map((route, index) => (index === routeIndex ? newRoute : route)),\n history:\n key === route.key\n ? state.history\n : state.history.filter((record) => record.key !== route.key),\n };\n }\n\n default:\n return BaseRouter.getStateForAction(state, action);\n }\n },\n\n actionCreators: TabActions,\n };\n\n return router;\n}\n\n/**\n * TabRouter is considered an internal implementation and its behavior may change without a notice between expo-router's version\n */\nexport function TabRouter(\n args: TabRouterOptions\n): Router, TabActionType | CommonNavigationAction> {\n const base = BaseTabRouter(args);\n return {\n ...base,\n getStateForAction: (state, action, options) => {\n if (action.target && action.target !== state.key) {\n return null;\n }\n\n if ((action.type as string) === 'REPLACE') {\n const replaceAction = action as unknown as Extract;\n // Generate the state as if we were using JUMP_TO\n let nextState = base.getStateForAction(\n state,\n {\n ...replaceAction,\n type: 'JUMP_TO',\n },\n options\n );\n\n if (!nextState || nextState.index === undefined || !Array.isArray(nextState.history)) {\n return null;\n }\n\n // If the state is valid and we didn't JUMP_TO a single history state,\n // then remove the previous state.\n if (nextState.index !== 0) {\n const previousIndex = nextState.index - 1;\n\n nextState = {\n ...nextState,\n key: `${nextState.key}-replace`,\n // Omit the previous history entry that we are replacing\n history: [\n ...nextState.history.slice(0, previousIndex),\n ...nextState.history.splice(nextState.index),\n ],\n };\n }\n\n return nextState;\n }\n\n return base.getStateForAction(state, action, options);\n },\n };\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/stack/utils/findLastIndex.js.map b/packages/expo-router/build/react-navigation/stack/utils/findLastIndex.js.map index de0703e37776b7..0ef913e79890f1 100644 --- a/packages/expo-router/build/react-navigation/stack/utils/findLastIndex.js.map +++ b/packages/expo-router/build/react-navigation/stack/utils/findLastIndex.js.map @@ -1 +1 @@ -{"version":3,"file":"findLastIndex.js","sourceRoot":"","sources":["../../../../src/react-navigation/stack/utils/findLastIndex.tsx"],"names":[],"mappings":";;AAAA,sCAQC;AARD,SAAgB,aAAa,CAAI,KAAU,EAAE,QAA+B;IAC1E,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IAED,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC","sourcesContent":["export function findLastIndex(array: T[], callback: (value: T) => boolean) {\n for (let i = array.length - 1; i >= 0; i--) {\n if (callback(array[i])) {\n return i;\n }\n }\n\n return -1;\n}\n"]} \ No newline at end of file +{"version":3,"file":"findLastIndex.js","sourceRoot":"","sources":["../../../../src/react-navigation/stack/utils/findLastIndex.tsx"],"names":[],"mappings":";;AAAA,sCAQC;AARD,SAAgB,aAAa,CAAI,KAAU,EAAE,QAA+B;IAC1E,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,EAAE,CAAC;YACxB,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IAED,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC","sourcesContent":["export function findLastIndex(array: T[], callback: (value: T) => boolean) {\n for (let i = array.length - 1; i >= 0; i--) {\n if (callback(array[i]!)) {\n return i;\n }\n }\n\n return -1;\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/stack/views/Stack/CardStack.js b/packages/expo-router/build/react-navigation/stack/views/Stack/CardStack.js index f807ea3fb89d75..122ca3838be930 100644 --- a/packages/expo-router/build/react-navigation/stack/views/Stack/CardStack.js +++ b/packages/expo-router/build/react-navigation/stack/views/Stack/CardStack.js @@ -439,7 +439,7 @@ class CardStack extends React.Component { const safeAreaInsetRight = insets.right; const safeAreaInsetBottom = insets.bottom; const safeAreaInsetLeft = insets.left; - const headerHeight = headerShown !== false ? headerHeights[route.key] : 0; + const headerHeight = headerShown !== false ? (headerHeights[route.key] ?? 0) : 0; // Start from current card and count backwards the number of cards with same interpolation const interpolationIndex = getInterpolationIndex(scenes, index); const isModal = getIsModal(scene, interpolationIndex, isParentModal); diff --git a/packages/expo-router/build/react-navigation/stack/views/Stack/CardStack.js.map b/packages/expo-router/build/react-navigation/stack/views/Stack/CardStack.js.map index aca188c1251719..77923e8aa84c30 100644 --- a/packages/expo-router/build/react-navigation/stack/views/Stack/CardStack.js.map +++ b/packages/expo-router/build/react-navigation/stack/views/Stack/CardStack.js.map @@ -1 +1 @@ -{"version":3,"file":"CardStack.js","sourceRoot":"","sources":["../../../../../src/react-navigation/stack/views/Stack/CardStack.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsOA,kDAEC;;AAxOD,6CAA+B;AAC/B,+CAA4F;AAG5F,gDAAmF;AAEnF,2FAGwD;AACxD,iFAYmD;AAWnD,6DAA0D;AAC1D,iFAA8E;AAC9E,uEAAmE;AAEnE,wCAA+D;AAC/D,mDAAgD;AAuChD,MAAM,yBAAyB,GAAG;IAChC,OAAO,EAAE,qCAAiB;IAC1B,IAAI,EAAE,uCAAmB;IACzB,gBAAgB,EAAE,yCAAqB;IACvC,eAAe,EAAE,wCAAoB;IACrC,IAAI,EAAE,qCAAiB;IACvB,kBAAkB,EAAE,2CAAuB;IAC3C,iBAAiB,EAAE,0CAAsB;IACzC,eAAe,EAAE,oCAAgB;IACjC,gBAAgB,EAAE,qCAAiB;IACnC,iBAAiB,EAAE,uBAAQ,CAAC,MAAM,CAAC;QACjC,GAAG,EAAE,2CAAuB;QAC5B,OAAO,EAAE,sCAAkB;KAC5B,CAAC;CAC6D,CAAC;AAElE,MAAM,OAAO,GAAG,IAAI,CAAC;AAErB,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAC3C,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;AAE3D,MAAM,qBAAqB,GAAG,CAAC,MAAe,EAAE,KAAa,EAAE,EAAE;I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BAAkB,EAAE,kBAAkB,EACtC,mBAAmB,EAAE,mBAAmB,EACxC,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE,mBAAmB,EACxC,oBAAoB,EAAE,IAAI,CAAC,kBAAkB,EAC7C,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EACvC,eAAe,EAAE,IAAI,CAAC,eAAe,EACrC,sBAAsB,EAAE,qBAAqB,IAAI,CAAC,iBAAiB,EACnE,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,iBAAiB,EAAE,iBAAiB,EACpC,eAAe,EAAE,eAAe,EAChC,uBAAuB,EAAE,uBAAuB,EAChD,mBAAmB,EAAE,mBAAmB,EACxC,SAAS,EAAE,WAAW,GACtB,IAxCG,KAAK,CAAC,GAAG,CAyCF,CACf,CAAC;oBACJ,CAAC,CAAC,GACmB,IAClB,CACR,CAAC;IACJ,CAAC;CACF;AAveD,8BAueC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;KACR;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;KACP;IACD,QAAQ,EAAE;QACR,MAAM,EAAE,CAAC;KACV;CACF,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { Animated, type LayoutChangeEvent, Platform, StyleSheet, View } from 'react-native';\nimport type { EdgeInsets } from 'react-native-safe-area-context';\n\nimport { getDefaultHeaderHeight, SafeAreaProviderCompat } from '../../../elements';\nimport type { LocaleDirection, ParamListBase, Route, StackNavigationState } from '../../../native';\nimport {\n forModalPresentationIOS,\n forNoAnimation as forNoAnimationCard,\n} from '../../TransitionConfigs/CardStyleInterpolators';\nimport {\n BottomSheetAndroid,\n DefaultTransition,\n FadeFromBottomAndroid,\n FadeFromRightAndroid,\n ModalFadeTransition,\n ModalSlideFromBottomIOS,\n ModalTransition,\n RevealFromBottomAndroid,\n ScaleFromCenterAndroid,\n SlideFromLeftIOS,\n SlideFromRightIOS,\n} from '../../TransitionConfigs/TransitionPresets';\nimport type {\n Layout,\n Scene,\n StackAnimationName,\n StackCardStyleInterpolator,\n StackDescriptorMap,\n StackHeaderMode,\n StackNavigationOptions,\n TransitionPreset,\n} from '../../types';\nimport { findLastIndex } from '../../utils/findLastIndex';\nimport { getDistanceForDirection } from '../../utils/getDistanceForDirection';\nimport { getModalRouteKeys } from '../../utils/getModalRoutesKeys';\nimport type { Props as HeaderContainerProps } from '../Header/HeaderContainer';\nimport { MaybeScreen, MaybeScreenContainer } from '../Screens';\nimport { CardContainer } from './CardContainer';\n\ntype GestureValues = {\n [key: string]: Animated.Value;\n};\n\ntype Props = {\n direction: LocaleDirection;\n insets: EdgeInsets;\n state: StackNavigationState;\n descriptors: StackDescriptorMap;\n preloadedDescriptors: StackDescriptorMap;\n routes: Route[];\n openingRouteKeys: string[];\n closingRouteKeys: string[];\n onOpenRoute: (props: { route: Route }) => void;\n onCloseRoute: (props: { route: Route }) => void;\n getPreviousRoute: (props: { route: Route }) => Route | undefined;\n renderHeader: (props: HeaderContainerProps) => React.ReactNode;\n isParentHeaderShown: boolean;\n isParentModal: boolean;\n onTransitionStart: (props: { route: Route }, closing: boolean) => void;\n onTransitionEnd: (props: { route: Route }, closing: boolean) => void;\n onGestureStart: (props: { route: Route }) => void;\n onGestureEnd: (props: { route: Route }) => void;\n onGestureCancel: (props: { route: Route }) => void;\n detachInactiveScreens?: boolean;\n};\n\ntype State = {\n routes: Route[];\n descriptors: StackDescriptorMap;\n scenes: Scene[];\n gestures: GestureValues;\n layout: Layout;\n activeStates: (0 | 1 | Animated.AnimatedInterpolation<0 | 1>)[];\n headerHeights: Record;\n};\n\nconst NAMED_TRANSITIONS_PRESETS = {\n default: DefaultTransition,\n fade: ModalFadeTransition,\n fade_from_bottom: FadeFromBottomAndroid,\n fade_from_right: FadeFromRightAndroid,\n none: DefaultTransition,\n reveal_from_bottom: RevealFromBottomAndroid,\n scale_from_center: ScaleFromCenterAndroid,\n slide_from_left: SlideFromLeftIOS,\n slide_from_right: SlideFromRightIOS,\n slide_from_bottom: Platform.select({\n ios: ModalSlideFromBottomIOS,\n default: BottomSheetAndroid,\n }),\n} as const satisfies Record;\n\nconst EPSILON = 1e-5;\n\nconst STATE_INACTIVE = 0;\nconst STATE_TRANSITIONING_OR_BELOW_TOP = 1;\nconst STATE_ON_TOP = 2;\n\nconst FALLBACK_DESCRIPTOR = Object.freeze({ options: {} });\n\nconst getInterpolationIndex = (scenes: Scene[], index: number) => {\n const { cardStyleInterpolator } = scenes[index].descriptor.options;\n\n // Start from current card and count backwards the number of cards with same interpolation\n let interpolationIndex = 0;\n\n for (let i = index - 1; i >= 0; i--) {\n const cardStyleInterpolatorCurrent = scenes[i]?.descriptor.options.cardStyleInterpolator;\n\n if (cardStyleInterpolatorCurrent !== cardStyleInterpolator) {\n break;\n }\n\n interpolationIndex++;\n }\n\n return interpolationIndex;\n};\n\nconst getIsModalPresentation = (cardStyleInterpolator: StackCardStyleInterpolator) => {\n return (\n cardStyleInterpolator === forModalPresentationIOS ||\n // Handle custom modal presentation interpolators as well\n cardStyleInterpolator.name === 'forModalPresentationIOS'\n );\n};\n\nconst getIsModal = (scene: Scene, interpolationIndex: number, isParentModal: boolean) => {\n if (isParentModal) {\n return true;\n }\n\n const { cardStyleInterpolator } = scene.descriptor.options;\n const isModalPresentation = getIsModalPresentation(cardStyleInterpolator);\n const isModal = isModalPresentation && interpolationIndex !== 0;\n\n return isModal;\n};\n\nconst getHeaderHeights = (\n scenes: Scene[],\n insets: EdgeInsets,\n isParentHeaderShown: boolean,\n isParentModal: boolean,\n layout: Layout,\n previous: Record\n) => {\n return scenes.reduce>((acc, curr, index) => {\n const { headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top, headerStyle } =\n curr.descriptor.options;\n\n const style = StyleSheet.flatten(headerStyle || {});\n\n const height =\n 'height' in style && typeof style.height === 'number'\n ? style.height\n : previous[curr.route.key];\n\n const interpolationIndex = getInterpolationIndex(scenes, index);\n const isModal = getIsModal(curr, interpolationIndex, isParentModal);\n\n acc[curr.route.key] =\n typeof height === 'number'\n ? height\n : getDefaultHeaderHeight(layout, isModal, headerStatusBarHeight);\n\n return acc;\n }, {});\n};\n\nconst getDistanceFromOptions = (\n layout: Layout,\n options: StackNavigationOptions | undefined,\n isRTL: boolean\n) => {\n if (options?.gestureDirection) {\n return getDistanceForDirection(layout, options.gestureDirection, isRTL);\n }\n\n const defaultGestureDirection =\n options?.presentation === 'modal'\n ? ModalTransition.gestureDirection\n : DefaultTransition.gestureDirection;\n\n const gestureDirection = options?.animation\n ? NAMED_TRANSITIONS_PRESETS[options?.animation]?.gestureDirection\n : defaultGestureDirection;\n\n return getDistanceForDirection(layout, gestureDirection, isRTL);\n};\n\nconst getProgressFromGesture = (\n gesture: Animated.Value,\n layout: Layout,\n options: StackNavigationOptions | undefined,\n isRTL: boolean\n) => {\n const distance = getDistanceFromOptions(\n {\n // Make sure that we have a non-zero distance, otherwise there will be incorrect progress\n // This causes blank screen on web if it was previously inside container with display: none\n width: Math.max(1, layout.width),\n height: Math.max(1, layout.height),\n },\n options,\n isRTL\n );\n\n if (distance > 0) {\n return gesture.interpolate({\n inputRange: [0, distance],\n outputRange: [1, 0],\n });\n }\n\n return gesture.interpolate({\n inputRange: [distance, 0],\n outputRange: [0, 1],\n });\n};\n\nfunction getDefaultAnimation(animation: StackAnimationName | undefined) {\n // Disable screen transition animation by default on web, windows and macos to match the native behavior\n const excludedPlatforms =\n Platform.OS !== 'web' && Platform.OS !== 'windows' && Platform.OS !== 'macos';\n\n return animation ?? (excludedPlatforms ? 'default' : 'none');\n}\n\nexport function getAnimationEnabled(animation: StackAnimationName | undefined) {\n return getDefaultAnimation(animation) !== 'none';\n}\n\nexport class CardStack extends React.Component {\n static getDerivedStateFromProps(props: Props, state: State): Partial | null {\n if (props.routes === state.routes && props.descriptors === state.descriptors) {\n return null;\n }\n\n const gestures = [...props.routes, ...props.state.preloadedRoutes].reduce(\n (acc, curr) => {\n const descriptor = props.descriptors[curr.key] || props.preloadedDescriptors[curr.key];\n const { animation } = descriptor?.options || {};\n\n acc[curr.key] =\n state.gestures[curr.key] ||\n new Animated.Value(\n (props.openingRouteKeys.includes(curr.key) && getAnimationEnabled(animation)) ||\n props.state.preloadedRoutes.includes(curr)\n ? getDistanceFromOptions(state.layout, descriptor?.options, props.direction === 'rtl')\n : 0\n );\n\n return acc;\n },\n {}\n );\n\n const modalRouteKeys = getModalRouteKeys([...props.routes, ...props.state.preloadedRoutes], {\n ...props.descriptors,\n ...props.preloadedDescriptors,\n });\n\n const scenes = [...props.routes, ...props.state.preloadedRoutes].map((route, index, self) => {\n // For preloaded screens, we don't care about the previous and the next screen\n const isPreloaded = props.state.preloadedRoutes.includes(route);\n const previousRoute = isPreloaded ? undefined : self[index - 1];\n const nextRoute = isPreloaded ? undefined : self[index + 1];\n\n const oldScene = state.scenes[index];\n\n const currentGesture = gestures[route.key];\n const previousGesture = previousRoute ? gestures[previousRoute.key] : undefined;\n const nextGesture = nextRoute ? gestures[nextRoute.key] : undefined;\n\n const descriptor =\n (isPreloaded ? props.preloadedDescriptors : props.descriptors)[route.key] ||\n state.descriptors[route.key] ||\n (oldScene ? oldScene.descriptor : FALLBACK_DESCRIPTOR);\n\n const nextOptions =\n nextRoute &&\n (props.descriptors[nextRoute?.key] || state.descriptors[nextRoute?.key])?.options;\n\n const previousOptions =\n previousRoute &&\n (props.descriptors[previousRoute?.key] || state.descriptors[previousRoute?.key])?.options;\n\n // When a screen is not the last, it should use next screen's transition config\n // Many transitions also animate the previous screen, so using 2 different transitions doesn't look right\n // For example combining a slide and a modal transition would look wrong otherwise\n // With this approach, combining different transition styles in the same navigator mostly looks right\n // This will still be broken when 2 transitions have different idle state (e.g. modal presentation),\n // but the majority of the transitions look alright\n const optionsForTransitionConfig =\n index !== self.length - 1 && nextOptions && nextOptions?.presentation !== 'transparentModal'\n ? nextOptions\n : descriptor.options;\n\n // Assume modal if there are already modal screens in the stack\n // or current screen is a modal when no presentation is specified\n const isModal = modalRouteKeys.includes(route.key);\n\n const animation = getDefaultAnimation(optionsForTransitionConfig.animation);\n\n const isAnimationEnabled = getAnimationEnabled(animation);\n\n const transitionPreset =\n animation !== 'default'\n ? NAMED_TRANSITIONS_PRESETS[animation]\n : optionsForTransitionConfig.presentation === 'transparentModal'\n ? ModalFadeTransition\n : optionsForTransitionConfig.presentation === 'modal' || isModal\n ? ModalTransition\n : DefaultTransition;\n\n const {\n gestureEnabled = Platform.OS === 'ios' && isAnimationEnabled,\n gestureDirection = transitionPreset.gestureDirection,\n transitionSpec = transitionPreset.transitionSpec,\n cardStyleInterpolator = isAnimationEnabled\n ? transitionPreset.cardStyleInterpolator\n : forNoAnimationCard,\n headerStyleInterpolator = transitionPreset.headerStyleInterpolator,\n cardOverlayEnabled = (Platform.OS !== 'ios' &&\n optionsForTransitionConfig.presentation !== 'transparentModal') ||\n getIsModalPresentation(cardStyleInterpolator),\n } = optionsForTransitionConfig;\n\n const headerMode: StackHeaderMode =\n descriptor.options.headerMode ??\n (!(\n optionsForTransitionConfig.presentation === 'modal' ||\n optionsForTransitionConfig.presentation === 'transparentModal' ||\n nextOptions?.presentation === 'modal' ||\n nextOptions?.presentation === 'transparentModal' ||\n getIsModalPresentation(cardStyleInterpolator)\n ) &&\n Platform.OS === 'ios' &&\n descriptor.options.header === undefined\n ? 'float'\n : 'screen');\n\n const isRTL = props.direction === 'rtl';\n\n const scene = {\n route,\n descriptor: {\n ...descriptor,\n options: {\n ...descriptor.options,\n animation,\n cardOverlayEnabled,\n cardStyleInterpolator,\n gestureDirection,\n gestureEnabled,\n headerStyleInterpolator,\n transitionSpec,\n headerMode,\n },\n },\n progress: {\n current: getProgressFromGesture(currentGesture, state.layout, descriptor.options, isRTL),\n next:\n nextGesture && nextOptions?.presentation !== 'transparentModal'\n ? getProgressFromGesture(nextGesture, state.layout, nextOptions, isRTL)\n : undefined,\n previous: previousGesture\n ? getProgressFromGesture(previousGesture, state.layout, previousOptions, isRTL)\n : undefined,\n },\n __memo: [\n state.layout,\n descriptor,\n nextOptions,\n previousOptions,\n currentGesture,\n nextGesture,\n previousGesture,\n ],\n };\n\n if (\n oldScene &&\n scene.__memo.every((it, i) => {\n // @ts-expect-error: we haven't added __memo to the annotation to prevent usage elsewhere\n return oldScene.__memo[i] === it;\n })\n ) {\n return oldScene;\n }\n\n return scene;\n });\n\n let activeStates = state.activeStates;\n\n if (props.routes.length !== state.routes.length) {\n let activeScreensLimit = 1;\n\n for (let i = props.routes.length - 1; i >= 0; i--) {\n const { options } = scenes[i].descriptor;\n\n const {\n // By default, we don't want to detach the previous screen of the active one for modals\n detachPreviousScreen = options.presentation === 'transparentModal'\n ? false\n : getIsModalPresentation(options.cardStyleInterpolator)\n ? i !==\n findLastIndex(scenes, (scene) => {\n const { cardStyleInterpolator } = scene.descriptor.options;\n\n return (\n cardStyleInterpolator === forModalPresentationIOS ||\n cardStyleInterpolator?.name === 'forModalPresentationIOS'\n );\n })\n : true,\n } = options;\n\n if (detachPreviousScreen === false) {\n activeScreensLimit++;\n } else {\n // Check at least last 2 screens before stopping\n // This will make sure that screen isn't detached when another screen is animating on top of the transparent one\n // e.g. opaque -> transparent -> opaque\n if (i <= props.routes.length - 2) {\n break;\n }\n }\n }\n\n activeStates = props.routes.map((_, index, self) => {\n // The activity state represents state of the screen:\n // 0 - inactive, the screen is detached\n // 1 - transitioning or below the top screen, the screen is mounted but interaction is disabled\n // 2 - on top of the stack, the screen is mounted and interaction is enabled\n let activityState: Animated.AnimatedInterpolation<0 | 1 | 2> | 0 | 1 | 2;\n\n const lastActiveState = state.activeStates[index];\n const activeAfterTransition = index >= self.length - activeScreensLimit;\n\n if (lastActiveState === STATE_INACTIVE && !activeAfterTransition) {\n // screen was inactive before and it will still be inactive after the transition\n activityState = STATE_INACTIVE;\n } else {\n const sceneForActivity = scenes[self.length - 1];\n const outputValue =\n index === self.length - 1\n ? STATE_ON_TOP // the screen is on top after the transition\n : activeAfterTransition\n ? STATE_TRANSITIONING_OR_BELOW_TOP // the screen should stay active after the transition, it is not on top but is in activeLimit\n : STATE_INACTIVE; // the screen should be active only during the transition, it is at the edge of activeLimit\n\n activityState = sceneForActivity\n ? sceneForActivity.progress.current.interpolate({\n inputRange: [0, 1 - EPSILON, 1],\n outputRange: [1, 1, outputValue],\n extrapolate: 'clamp',\n })\n : STATE_TRANSITIONING_OR_BELOW_TOP;\n }\n\n return activityState;\n });\n }\n\n return {\n routes: props.routes,\n scenes,\n gestures,\n descriptors: props.descriptors,\n activeStates,\n headerHeights: getHeaderHeights(\n scenes,\n props.insets,\n props.isParentHeaderShown,\n props.isParentModal,\n state.layout,\n state.headerHeights\n ),\n };\n }\n\n constructor(props: Props) {\n super(props);\n\n this.state = {\n routes: [],\n scenes: [],\n gestures: {},\n layout: SafeAreaProviderCompat.initialMetrics.frame,\n descriptors: this.props.descriptors,\n activeStates: [],\n // Used when card's header is null and mode is float to make transition\n // between screens with headers and those without headers smooth.\n // This is not a great heuristic here. We don't know synchronously\n // on mount what the header height is so we have just used the most\n // common cases here.\n headerHeights: {},\n };\n }\n\n private handleLayout = (e: LayoutChangeEvent) => {\n const { height, width } = e.nativeEvent.layout;\n\n const layout = { width, height };\n\n this.setState((state, props) => {\n if (height === state.layout.height && width === state.layout.width) {\n return null;\n }\n\n return {\n layout,\n headerHeights: getHeaderHeights(\n state.scenes,\n props.insets,\n props.isParentHeaderShown,\n props.isParentModal,\n layout,\n state.headerHeights\n ),\n };\n });\n };\n\n private handleHeaderLayout = ({ route, height }: { route: Route; height: number }) => {\n this.setState(({ headerHeights }) => {\n const previousHeight = headerHeights[route.key];\n\n if (previousHeight === height) {\n return null;\n }\n\n return {\n headerHeights: {\n ...headerHeights,\n [route.key]: height,\n },\n };\n });\n };\n\n private getFocusedRoute = () => {\n const { state } = this.props;\n\n return state.routes[state.index];\n };\n\n private getPreviousScene = ({ route }: { route: Route }) => {\n const { getPreviousRoute } = this.props;\n const { scenes } = this.state;\n\n const previousRoute = getPreviousRoute({ route });\n\n if (previousRoute) {\n const previousScene = scenes.find(\n (scene) => scene.descriptor.route.key === previousRoute.key\n );\n\n return previousScene;\n }\n\n return undefined;\n };\n\n render() {\n const {\n insets,\n state,\n routes,\n openingRouteKeys,\n closingRouteKeys,\n onOpenRoute,\n onCloseRoute,\n renderHeader,\n isParentHeaderShown,\n isParentModal,\n onTransitionStart,\n onTransitionEnd,\n onGestureStart,\n onGestureEnd,\n onGestureCancel,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n } = this.props;\n\n const { scenes, layout, gestures, activeStates, headerHeights } = this.state;\n\n const focusedRoute = state.routes[state.index];\n const focusedHeaderHeight = headerHeights[focusedRoute.key];\n\n const isFloatHeaderAbsolute = this.state.scenes.slice(-2).some((scene) => {\n const options = scene.descriptor.options ?? {};\n const { headerMode, headerTransparent, headerShown = true } = options;\n\n if (headerTransparent || headerShown === false || headerMode === 'screen') {\n return true;\n }\n\n return false;\n });\n\n return (\n \n {renderHeader({\n mode: 'float',\n layout,\n scenes,\n getPreviousScene: this.getPreviousScene,\n getFocusedRoute: this.getFocusedRoute,\n onContentHeightChange: this.handleHeaderLayout,\n style: [\n styles.floating,\n isFloatHeaderAbsolute && [\n // Without this, the header buttons won't be touchable on Android when headerTransparent: true\n { height: focusedHeaderHeight },\n styles.absolute,\n ],\n ],\n })}\n \n {[...routes, ...state.preloadedRoutes].map((route, index) => {\n const focused = focusedRoute.key === route.key;\n const gesture = gestures[route.key];\n const scene = scenes[index];\n // It is possible that for a short period the route appears in both arrays.\n // Particularly, if the screen is removed with `retain`, then it needs a moment to execute the animation.\n // However, due to the router action, it immediately populates the `preloadedRoutes` array.\n // Practically, the logic below takes care that it is rendered only once.\n const isPreloaded = state.preloadedRoutes.includes(route) && !routes.includes(route);\n if (\n state.preloadedRoutes.includes(route) &&\n routes.includes(route) &&\n index >= routes.length\n ) {\n return null;\n }\n\n const {\n headerShown = true,\n headerTransparent,\n freezeOnBlur,\n autoHideHomeIndicator,\n } = scene.descriptor.options;\n\n const safeAreaInsetTop = insets.top;\n const safeAreaInsetRight = insets.right;\n const safeAreaInsetBottom = insets.bottom;\n const safeAreaInsetLeft = insets.left;\n\n const headerHeight = headerShown !== false ? headerHeights[route.key] : 0;\n\n // Start from current card and count backwards the number of cards with same interpolation\n const interpolationIndex = getInterpolationIndex(scenes, index);\n const isModal = getIsModal(scene, interpolationIndex, isParentModal);\n\n const isNextScreenTransparent =\n scenes[index + 1]?.descriptor.options.presentation === 'transparentModal';\n\n const detachCurrentScreen =\n scenes[index + 1]?.descriptor.options.detachPreviousScreen !== false;\n\n const activityState = isPreloaded ? STATE_INACTIVE : activeStates[index];\n\n return (\n \n \n \n );\n })}\n \n \n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n absolute: {\n position: 'absolute',\n top: 0,\n start: 0,\n end: 0,\n },\n floating: {\n zIndex: 1,\n },\n});\n"]} \ No newline at end of file +{"version":3,"file":"CardStack.js","sourceRoot":"","sources":["../../../../../src/react-navigation/stack/views/Stack/CardStack.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsOA,kDAEC;;AAxOD,6CAA+B;AAC/B,+CAA4F;AAG5F,gDAAmF;AAEnF,2FAGwD;AACxD,iFAYmD;AAWnD,6DAA0D;AAC1D,iFAA8E;AAC9E,uEAAmE;AAEnE,wCAA+D;AAC/D,mDAAgD;AAuChD,MAAM,yBAAyB,GAAG;IAChC,OAAO,EAAE,qCAAiB;IAC1B,IAAI,EAAE,uCAAmB;IACzB,gBAAgB,EAAE,yCAAqB;IACvC,eAAe,E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yCF,CACf,CAAC;oBACJ,CAAC,CAAC,GACmB,IAClB,CACR,CAAC;IACJ,CAAC;CACF;AAveD,8BAueC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;KACR;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;KACP;IACD,QAAQ,EAAE;QACR,MAAM,EAAE,CAAC;KACV;CACF,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { Animated, type LayoutChangeEvent, Platform, StyleSheet, View } from 'react-native';\nimport type { EdgeInsets } from 'react-native-safe-area-context';\n\nimport { getDefaultHeaderHeight, SafeAreaProviderCompat } from '../../../elements';\nimport type { LocaleDirection, ParamListBase, Route, StackNavigationState } from '../../../native';\nimport {\n forModalPresentationIOS,\n forNoAnimation as forNoAnimationCard,\n} from '../../TransitionConfigs/CardStyleInterpolators';\nimport {\n BottomSheetAndroid,\n DefaultTransition,\n FadeFromBottomAndroid,\n FadeFromRightAndroid,\n ModalFadeTransition,\n ModalSlideFromBottomIOS,\n ModalTransition,\n RevealFromBottomAndroid,\n ScaleFromCenterAndroid,\n SlideFromLeftIOS,\n SlideFromRightIOS,\n} from '../../TransitionConfigs/TransitionPresets';\nimport type {\n Layout,\n Scene,\n StackAnimationName,\n StackCardStyleInterpolator,\n StackDescriptorMap,\n StackHeaderMode,\n StackNavigationOptions,\n TransitionPreset,\n} from '../../types';\nimport { findLastIndex } from '../../utils/findLastIndex';\nimport { getDistanceForDirection } from '../../utils/getDistanceForDirection';\nimport { getModalRouteKeys } from '../../utils/getModalRoutesKeys';\nimport type { Props as HeaderContainerProps } from '../Header/HeaderContainer';\nimport { MaybeScreen, MaybeScreenContainer } from '../Screens';\nimport { CardContainer } from './CardContainer';\n\ntype GestureValues = {\n [key: string]: Animated.Value;\n};\n\ntype Props = {\n direction: LocaleDirection;\n insets: EdgeInsets;\n state: StackNavigationState;\n descriptors: StackDescriptorMap;\n preloadedDescriptors: StackDescriptorMap;\n routes: Route[];\n openingRouteKeys: string[];\n closingRouteKeys: string[];\n onOpenRoute: (props: { route: Route }) => void;\n onCloseRoute: (props: { route: Route }) => void;\n getPreviousRoute: (props: { route: Route }) => Route | undefined;\n renderHeader: (props: HeaderContainerProps) => React.ReactNode;\n isParentHeaderShown: boolean;\n isParentModal: boolean;\n onTransitionStart: (props: { route: Route }, closing: boolean) => void;\n onTransitionEnd: (props: { route: Route }, closing: boolean) => void;\n onGestureStart: (props: { route: Route }) => void;\n onGestureEnd: (props: { route: Route }) => void;\n onGestureCancel: (props: { route: Route }) => void;\n detachInactiveScreens?: boolean;\n};\n\ntype State = {\n routes: Route[];\n descriptors: StackDescriptorMap;\n scenes: Scene[];\n gestures: GestureValues;\n layout: Layout;\n activeStates: (0 | 1 | Animated.AnimatedInterpolation<0 | 1>)[];\n headerHeights: Record;\n};\n\nconst NAMED_TRANSITIONS_PRESETS = {\n default: DefaultTransition,\n fade: ModalFadeTransition,\n fade_from_bottom: FadeFromBottomAndroid,\n fade_from_right: FadeFromRightAndroid,\n none: DefaultTransition,\n reveal_from_bottom: RevealFromBottomAndroid,\n scale_from_center: ScaleFromCenterAndroid,\n slide_from_left: SlideFromLeftIOS,\n slide_from_right: SlideFromRightIOS,\n slide_from_bottom: Platform.select({\n ios: ModalSlideFromBottomIOS,\n default: BottomSheetAndroid,\n }),\n} as const satisfies Record;\n\nconst EPSILON = 1e-5;\n\nconst STATE_INACTIVE = 0;\nconst STATE_TRANSITIONING_OR_BELOW_TOP = 1;\nconst STATE_ON_TOP = 2;\n\nconst FALLBACK_DESCRIPTOR = Object.freeze({ options: {} as StackNavigationOptions });\n\nconst getInterpolationIndex = (scenes: Scene[], index: number) => {\n const { cardStyleInterpolator } = scenes[index]!.descriptor.options;\n\n // Start from current card and count backwards the number of cards with same interpolation\n let interpolationIndex = 0;\n\n for (let i = index - 1; i >= 0; i--) {\n const cardStyleInterpolatorCurrent = scenes[i]?.descriptor.options.cardStyleInterpolator;\n\n if (cardStyleInterpolatorCurrent !== cardStyleInterpolator) {\n break;\n }\n\n interpolationIndex++;\n }\n\n return interpolationIndex;\n};\n\nconst getIsModalPresentation = (cardStyleInterpolator: StackCardStyleInterpolator) => {\n return (\n cardStyleInterpolator === forModalPresentationIOS ||\n // Handle custom modal presentation interpolators as well\n cardStyleInterpolator.name === 'forModalPresentationIOS'\n );\n};\n\nconst getIsModal = (scene: Scene, interpolationIndex: number, isParentModal: boolean) => {\n if (isParentModal) {\n return true;\n }\n\n const { cardStyleInterpolator } = scene.descriptor.options;\n const isModalPresentation = getIsModalPresentation(cardStyleInterpolator);\n const isModal = isModalPresentation && interpolationIndex !== 0;\n\n return isModal;\n};\n\nconst getHeaderHeights = (\n scenes: Scene[],\n insets: EdgeInsets,\n isParentHeaderShown: boolean,\n isParentModal: boolean,\n layout: Layout,\n previous: Record\n) => {\n return scenes.reduce>((acc, curr, index) => {\n const { headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top, headerStyle } =\n curr.descriptor.options;\n\n const style = StyleSheet.flatten(headerStyle || {});\n\n const height =\n 'height' in style && typeof style.height === 'number'\n ? style.height\n : previous[curr.route.key];\n\n const interpolationIndex = getInterpolationIndex(scenes, index);\n const isModal = getIsModal(curr, interpolationIndex, isParentModal);\n\n acc[curr.route.key] =\n typeof height === 'number'\n ? height\n : getDefaultHeaderHeight(layout, isModal, headerStatusBarHeight);\n\n return acc;\n }, {});\n};\n\nconst getDistanceFromOptions = (\n layout: Layout,\n options: StackNavigationOptions | undefined,\n isRTL: boolean\n) => {\n if (options?.gestureDirection) {\n return getDistanceForDirection(layout, options.gestureDirection, isRTL);\n }\n\n const defaultGestureDirection =\n options?.presentation === 'modal'\n ? ModalTransition.gestureDirection\n : DefaultTransition.gestureDirection;\n\n const gestureDirection = options?.animation\n ? NAMED_TRANSITIONS_PRESETS[options?.animation]?.gestureDirection\n : defaultGestureDirection;\n\n return getDistanceForDirection(layout, gestureDirection, isRTL);\n};\n\nconst getProgressFromGesture = (\n gesture: Animated.Value,\n layout: Layout,\n options: StackNavigationOptions | undefined,\n isRTL: boolean\n) => {\n const distance = getDistanceFromOptions(\n {\n // Make sure that we have a non-zero distance, otherwise there will be incorrect progress\n // This causes blank screen on web if it was previously inside container with display: none\n width: Math.max(1, layout.width),\n height: Math.max(1, layout.height),\n },\n options,\n isRTL\n );\n\n if (distance > 0) {\n return gesture.interpolate({\n inputRange: [0, distance],\n outputRange: [1, 0],\n });\n }\n\n return gesture.interpolate({\n inputRange: [distance, 0],\n outputRange: [0, 1],\n });\n};\n\nfunction getDefaultAnimation(animation: StackAnimationName | undefined) {\n // Disable screen transition animation by default on web, windows and macos to match the native behavior\n const excludedPlatforms =\n Platform.OS !== 'web' && Platform.OS !== 'windows' && Platform.OS !== 'macos';\n\n return animation ?? (excludedPlatforms ? 'default' : 'none');\n}\n\nexport function getAnimationEnabled(animation: StackAnimationName | undefined) {\n return getDefaultAnimation(animation) !== 'none';\n}\n\nexport class CardStack extends React.Component {\n static getDerivedStateFromProps(props: Props, state: State): Partial | null {\n if (props.routes === state.routes && props.descriptors === state.descriptors) {\n return null;\n }\n\n const gestures = [...props.routes, ...props.state.preloadedRoutes].reduce(\n (acc, curr) => {\n const descriptor = props.descriptors[curr.key] || props.preloadedDescriptors[curr.key];\n const { animation } = descriptor?.options || {};\n\n acc[curr.key] =\n state.gestures[curr.key] ||\n new Animated.Value(\n (props.openingRouteKeys.includes(curr.key) && getAnimationEnabled(animation)) ||\n props.state.preloadedRoutes.includes(curr)\n ? getDistanceFromOptions(state.layout, descriptor?.options, props.direction === 'rtl')\n : 0\n );\n\n return acc;\n },\n {}\n );\n\n const modalRouteKeys = getModalRouteKeys([...props.routes, ...props.state.preloadedRoutes], {\n ...props.descriptors,\n ...props.preloadedDescriptors,\n });\n\n const scenes = [...props.routes, ...props.state.preloadedRoutes].map((route, index, self) => {\n // For preloaded screens, we don't care about the previous and the next screen\n const isPreloaded = props.state.preloadedRoutes.includes(route);\n const previousRoute = isPreloaded ? undefined : self[index - 1];\n const nextRoute = isPreloaded ? undefined : self[index + 1];\n\n const oldScene = state.scenes[index];\n\n const currentGesture = gestures[route.key]!;\n const previousGesture = previousRoute ? gestures[previousRoute.key]! : undefined;\n const nextGesture = nextRoute ? gestures[nextRoute.key]! : undefined;\n\n const descriptor =\n (isPreloaded ? props.preloadedDescriptors : props.descriptors)[route.key] ||\n state.descriptors[route.key] ||\n (oldScene ? oldScene.descriptor : FALLBACK_DESCRIPTOR);\n\n const nextOptions =\n nextRoute &&\n (props.descriptors[nextRoute?.key] || state.descriptors[nextRoute?.key])?.options;\n\n const previousOptions =\n previousRoute &&\n (props.descriptors[previousRoute?.key] || state.descriptors[previousRoute?.key])?.options;\n\n // When a screen is not the last, it should use next screen's transition config\n // Many transitions also animate the previous screen, so using 2 different transitions doesn't look right\n // For example combining a slide and a modal transition would look wrong otherwise\n // With this approach, combining different transition styles in the same navigator mostly looks right\n // This will still be broken when 2 transitions have different idle state (e.g. modal presentation),\n // but the majority of the transitions look alright\n const optionsForTransitionConfig: StackNavigationOptions =\n index !== self.length - 1 && nextOptions && nextOptions?.presentation !== 'transparentModal'\n ? nextOptions\n : descriptor.options;\n\n // Assume modal if there are already modal screens in the stack\n // or current screen is a modal when no presentation is specified\n const isModal = modalRouteKeys.includes(route.key);\n\n const animation = getDefaultAnimation(optionsForTransitionConfig.animation);\n\n const isAnimationEnabled = getAnimationEnabled(animation);\n\n const transitionPreset =\n animation !== 'default'\n ? NAMED_TRANSITIONS_PRESETS[animation]!\n : optionsForTransitionConfig.presentation === 'transparentModal'\n ? ModalFadeTransition\n : optionsForTransitionConfig.presentation === 'modal' || isModal\n ? ModalTransition\n : DefaultTransition;\n\n const {\n gestureEnabled = Platform.OS === 'ios' && isAnimationEnabled,\n gestureDirection = transitionPreset.gestureDirection,\n transitionSpec = transitionPreset.transitionSpec,\n cardStyleInterpolator = isAnimationEnabled\n ? transitionPreset.cardStyleInterpolator\n : forNoAnimationCard,\n headerStyleInterpolator = transitionPreset.headerStyleInterpolator,\n cardOverlayEnabled = (Platform.OS !== 'ios' &&\n optionsForTransitionConfig.presentation !== 'transparentModal') ||\n getIsModalPresentation(cardStyleInterpolator),\n } = optionsForTransitionConfig;\n\n const headerMode: StackHeaderMode =\n descriptor.options.headerMode ??\n (!(\n optionsForTransitionConfig.presentation === 'modal' ||\n optionsForTransitionConfig.presentation === 'transparentModal' ||\n nextOptions?.presentation === 'modal' ||\n nextOptions?.presentation === 'transparentModal' ||\n getIsModalPresentation(cardStyleInterpolator)\n ) &&\n Platform.OS === 'ios' &&\n descriptor.options.header === undefined\n ? 'float'\n : 'screen');\n\n const isRTL = props.direction === 'rtl';\n\n const scene = {\n route,\n descriptor: {\n ...descriptor,\n options: {\n ...descriptor.options,\n animation,\n cardOverlayEnabled,\n cardStyleInterpolator,\n gestureDirection,\n gestureEnabled,\n headerStyleInterpolator,\n transitionSpec,\n headerMode,\n },\n },\n progress: {\n current: getProgressFromGesture(currentGesture, state.layout, descriptor.options, isRTL),\n next:\n nextGesture && nextOptions?.presentation !== 'transparentModal'\n ? getProgressFromGesture(nextGesture, state.layout, nextOptions, isRTL)\n : undefined,\n previous: previousGesture\n ? getProgressFromGesture(previousGesture, state.layout, previousOptions, isRTL)\n : undefined,\n },\n __memo: [\n state.layout,\n descriptor,\n nextOptions,\n previousOptions,\n currentGesture,\n nextGesture,\n previousGesture,\n ],\n };\n\n if (\n oldScene &&\n scene.__memo.every((it, i) => {\n // @ts-expect-error: we haven't added __memo to the annotation to prevent usage elsewhere\n return oldScene.__memo[i] === it;\n })\n ) {\n return oldScene;\n }\n\n return scene as unknown as Scene;\n });\n\n let activeStates = state.activeStates;\n\n if (props.routes.length !== state.routes.length) {\n let activeScreensLimit = 1;\n\n for (let i = props.routes.length - 1; i >= 0; i--) {\n const { options } = scenes[i]!.descriptor;\n\n const {\n // By default, we don't want to detach the previous screen of the active one for modals\n detachPreviousScreen = options.presentation === 'transparentModal'\n ? false\n : getIsModalPresentation(options.cardStyleInterpolator)\n ? i !==\n findLastIndex(scenes, (scene) => {\n const { cardStyleInterpolator } = scene.descriptor.options;\n\n return (\n cardStyleInterpolator === forModalPresentationIOS ||\n cardStyleInterpolator?.name === 'forModalPresentationIOS'\n );\n })\n : true,\n } = options;\n\n if (detachPreviousScreen === false) {\n activeScreensLimit++;\n } else {\n // Check at least last 2 screens before stopping\n // This will make sure that screen isn't detached when another screen is animating on top of the transparent one\n // e.g. opaque -> transparent -> opaque\n if (i <= props.routes.length - 2) {\n break;\n }\n }\n }\n\n activeStates = props.routes.map((_, index, self) => {\n // The activity state represents state of the screen:\n // 0 - inactive, the screen is detached\n // 1 - transitioning or below the top screen, the screen is mounted but interaction is disabled\n // 2 - on top of the stack, the screen is mounted and interaction is enabled\n let activityState: Animated.AnimatedInterpolation<0 | 1 | 2> | 0 | 1 | 2;\n\n const lastActiveState = state.activeStates[index];\n const activeAfterTransition = index >= self.length - activeScreensLimit;\n\n if (lastActiveState === STATE_INACTIVE && !activeAfterTransition) {\n // screen was inactive before and it will still be inactive after the transition\n activityState = STATE_INACTIVE;\n } else {\n const sceneForActivity = scenes[self.length - 1];\n const outputValue =\n index === self.length - 1\n ? STATE_ON_TOP // the screen is on top after the transition\n : activeAfterTransition\n ? STATE_TRANSITIONING_OR_BELOW_TOP // the screen should stay active after the transition, it is not on top but is in activeLimit\n : STATE_INACTIVE; // the screen should be active only during the transition, it is at the edge of activeLimit\n\n activityState = sceneForActivity\n ? sceneForActivity.progress.current.interpolate({\n inputRange: [0, 1 - EPSILON, 1],\n outputRange: [1, 1, outputValue],\n extrapolate: 'clamp',\n })\n : STATE_TRANSITIONING_OR_BELOW_TOP;\n }\n\n return activityState;\n });\n }\n\n return {\n routes: props.routes,\n scenes,\n gestures,\n descriptors: props.descriptors,\n activeStates,\n headerHeights: getHeaderHeights(\n scenes,\n props.insets,\n props.isParentHeaderShown,\n props.isParentModal,\n state.layout,\n state.headerHeights\n ),\n };\n }\n\n constructor(props: Props) {\n super(props);\n\n this.state = {\n routes: [],\n scenes: [],\n gestures: {},\n layout: SafeAreaProviderCompat.initialMetrics.frame,\n descriptors: this.props.descriptors,\n activeStates: [],\n // Used when card's header is null and mode is float to make transition\n // between screens with headers and those without headers smooth.\n // This is not a great heuristic here. We don't know synchronously\n // on mount what the header height is so we have just used the most\n // common cases here.\n headerHeights: {},\n };\n }\n\n private handleLayout = (e: LayoutChangeEvent) => {\n const { height, width } = e.nativeEvent.layout;\n\n const layout = { width, height };\n\n this.setState((state, props) => {\n if (height === state.layout.height && width === state.layout.width) {\n return null;\n }\n\n return {\n layout,\n headerHeights: getHeaderHeights(\n state.scenes,\n props.insets,\n props.isParentHeaderShown,\n props.isParentModal,\n layout,\n state.headerHeights\n ),\n };\n });\n };\n\n private handleHeaderLayout = ({ route, height }: { route: Route; height: number }) => {\n this.setState(({ headerHeights }) => {\n const previousHeight = headerHeights[route.key];\n\n if (previousHeight === height) {\n return null;\n }\n\n return {\n headerHeights: {\n ...headerHeights,\n [route.key]: height,\n },\n };\n });\n };\n\n private getFocusedRoute = () => {\n const { state } = this.props;\n\n return state.routes[state.index]!;\n };\n\n private getPreviousScene = ({ route }: { route: Route }) => {\n const { getPreviousRoute } = this.props;\n const { scenes } = this.state;\n\n const previousRoute = getPreviousRoute({ route });\n\n if (previousRoute) {\n const previousScene = scenes.find(\n (scene) => scene.descriptor.route.key === previousRoute.key\n );\n\n return previousScene;\n }\n\n return undefined;\n };\n\n render() {\n const {\n insets,\n state,\n routes,\n openingRouteKeys,\n closingRouteKeys,\n onOpenRoute,\n onCloseRoute,\n renderHeader,\n isParentHeaderShown,\n isParentModal,\n onTransitionStart,\n onTransitionEnd,\n onGestureStart,\n onGestureEnd,\n onGestureCancel,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n } = this.props;\n\n const { scenes, layout, gestures, activeStates, headerHeights } = this.state;\n\n const focusedRoute = state.routes[state.index]!;\n const focusedHeaderHeight = headerHeights[focusedRoute.key];\n\n const isFloatHeaderAbsolute = this.state.scenes.slice(-2).some((scene) => {\n const options = scene.descriptor.options ?? {};\n const { headerMode, headerTransparent, headerShown = true } = options;\n\n if (headerTransparent || headerShown === false || headerMode === 'screen') {\n return true;\n }\n\n return false;\n });\n\n return (\n \n {renderHeader({\n mode: 'float',\n layout,\n scenes,\n getPreviousScene: this.getPreviousScene,\n getFocusedRoute: this.getFocusedRoute,\n onContentHeightChange: this.handleHeaderLayout,\n style: [\n styles.floating,\n isFloatHeaderAbsolute && [\n // Without this, the header buttons won't be touchable on Android when headerTransparent: true\n { height: focusedHeaderHeight },\n styles.absolute,\n ],\n ],\n })}\n \n {[...routes, ...state.preloadedRoutes].map((route, index) => {\n const focused = focusedRoute.key === route.key;\n const gesture = gestures[route.key]!;\n const scene = scenes[index]!;\n // It is possible that for a short period the route appears in both arrays.\n // Particularly, if the screen is removed with `retain`, then it needs a moment to execute the animation.\n // However, due to the router action, it immediately populates the `preloadedRoutes` array.\n // Practically, the logic below takes care that it is rendered only once.\n const isPreloaded = state.preloadedRoutes.includes(route) && !routes.includes(route);\n if (\n state.preloadedRoutes.includes(route) &&\n routes.includes(route) &&\n index >= routes.length\n ) {\n return null;\n }\n\n const {\n headerShown = true,\n headerTransparent,\n freezeOnBlur,\n autoHideHomeIndicator,\n } = scene.descriptor.options;\n\n const safeAreaInsetTop = insets.top;\n const safeAreaInsetRight = insets.right;\n const safeAreaInsetBottom = insets.bottom;\n const safeAreaInsetLeft = insets.left;\n\n const headerHeight = headerShown !== false ? (headerHeights[route.key] ?? 0) : 0;\n\n // Start from current card and count backwards the number of cards with same interpolation\n const interpolationIndex = getInterpolationIndex(scenes, index);\n const isModal = getIsModal(scene, interpolationIndex, isParentModal);\n\n const isNextScreenTransparent =\n scenes[index + 1]?.descriptor.options.presentation === 'transparentModal';\n\n const detachCurrentScreen =\n scenes[index + 1]?.descriptor.options.detachPreviousScreen !== false;\n\n const activityState = isPreloaded ? STATE_INACTIVE : activeStates[index]!;\n\n return (\n \n \n \n );\n })}\n \n \n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n absolute: {\n position: 'absolute',\n top: 0,\n start: 0,\n end: 0,\n },\n floating: {\n zIndex: 1,\n },\n});\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/stack/views/Stack/StackView.d.ts.map b/packages/expo-router/build/react-navigation/stack/views/Stack/StackView.d.ts.map index ab76336d792add..450dae76c54dcf 100644 --- a/packages/expo-router/build/react-navigation/stack/views/Stack/StackView.d.ts.map +++ b/packages/expo-router/build/react-navigation/stack/views/Stack/StackView.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"StackView.d.ts","sourceRoot":"","sources":["../../../../../src/react-navigation/stack/views/Stack/StackView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,SAAS,EAEd,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAKrB,KAAK,KAAK,GAAG,qBAAqB,GAAG;IACnC,SAAS,EAAE,eAAe,CAAC;IAC3B,KAAK,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC3C,UAAU,EAAE,sBAAsB,CAAC;IACnC,WAAW,EAAE,kBAAkB,CAAC;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,aAAa,CAAC,EAAE,WAAW,EAAE,OAAO,KAAK,eAAe,CAAC;CACtF,CAAC;AAEF,KAAK,KAAK,GAAG;IAEX,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;IAExB,aAAa,EAAE,oBAAoB,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC;IAE/D,mBAAmB,EAAE,kBAAkB,CAAC;IAExC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAE3B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAE3B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAG7B,WAAW,EAAE,kBAAkB,CAAC;CACjC,CAAC;AAWF,qBAAa,SAAU,SAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IAC1D,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;IAqO9E,KAAK,EAAE,KAAK,CAQV;IAEF,OAAO,CAAC,gBAAgB,CAWtB;IAEF,OAAO,CAAC,YAAY,CAElB;IAEF,OAAO,CAAC,eAAe,CA8CrB;IAEF,OAAO,CAAC,gBAAgB,CAoBtB;IAEF,OAAO,CAAC,qBAAqB,CAKxB;IAEL,OAAO,CAAC,mBAAmB,CAKtB;IAEL,OAAO,CAAC,kBAAkB,CAKxB;IAEF,OAAO,CAAC,gBAAgB,CAKtB;IAEF,OAAO,CAAC,mBAAmB,CAKzB;IAEF,MAAM;CAuDP"} \ No newline at end of file +{"version":3,"file":"StackView.d.ts","sourceRoot":"","sources":["../../../../../src/react-navigation/stack/views/Stack/StackView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,SAAS,EAEd,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAKrB,KAAK,KAAK,GAAG,qBAAqB,GAAG;IACnC,SAAS,EAAE,eAAe,CAAC;IAC3B,KAAK,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC3C,UAAU,EAAE,sBAAsB,CAAC;IACnC,WAAW,EAAE,kBAAkB,CAAC;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,aAAa,CAAC,EAAE,WAAW,EAAE,OAAO,KAAK,eAAe,CAAC;CACtF,CAAC;AAEF,KAAK,KAAK,GAAG;IAEX,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;IAExB,aAAa,EAAE,oBAAoB,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC;IAE/D,mBAAmB,EAAE,kBAAkB,CAAC;IAExC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAE3B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAE3B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAG7B,WAAW,EAAE,kBAAkB,CAAC;CACjC,CAAC;AAWF,qBAAa,SAAU,SAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IAC1D,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;IAoO9E,KAAK,EAAE,KAAK,CAQV;IAEF,OAAO,CAAC,gBAAgB,CAWtB;IAEF,OAAO,CAAC,YAAY,CAElB;IAEF,OAAO,CAAC,eAAe,CA8CrB;IAEF,OAAO,CAAC,gBAAgB,CAoBtB;IAEF,OAAO,CAAC,qBAAqB,CAKxB;IAEL,OAAO,CAAC,mBAAmB,CAKtB;IAEL,OAAO,CAAC,kBAAkB,CAKxB;IAEF,OAAO,CAAC,gBAAgB,CAKtB;IAEF,OAAO,CAAC,mBAAmB,CAKzB;IAEF,MAAM;CAuDP"} \ No newline at end of file diff --git a/packages/expo-router/build/react-navigation/stack/views/Stack/StackView.js b/packages/expo-router/build/react-navigation/stack/views/Stack/StackView.js index dbede43bfb726a..14831f6f174acf 100644 --- a/packages/expo-router/build/react-navigation/stack/views/Stack/StackView.js +++ b/packages/expo-router/build/react-navigation/stack/views/Stack/StackView.js @@ -81,7 +81,7 @@ class StackView extends React.Component { let previousDescriptors = state.previousDescriptors; if (props.descriptors !== state.previousDescriptors) { descriptors = routes.reduce((acc, route) => { - acc[route.key] = props.descriptors[route.key] || state.descriptors[route.key]; + acc[route.key] = (props.descriptors[route.key] || state.descriptors[route.key]); return acc; }, {}); previousDescriptors = props.descriptors; @@ -199,7 +199,7 @@ class StackView extends React.Component { throw new Error('There should always be at least one route in the navigation state.'); } const descriptors = allRoutes.reduce((acc, route) => { - acc[route.key] = props.descriptors[route.key] || state.descriptors[route.key]; + acc[route.key] = (props.descriptors[route.key] || state.descriptors[route.key]); return acc; }, {}); return { diff --git a/packages/expo-router/build/react-navigation/stack/views/Stack/StackView.js.map b/packages/expo-router/build/react-navigation/stack/views/Stack/StackView.js.map index 48f2aa96e95166..32680a431a92ba 100644 --- a/packages/expo-router/build/react-navigation/stack/views/Stack/StackView.js.map +++ b/packages/expo-router/build/react-navigation/stack/views/Stack/StackView.js.map @@ -1 +1 @@ -{"version":3,"file":"StackView.js","sourceRoot":"","sources":["../../../../../src/react-navigation/stack/views/Stack/StackView.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,6CAA+B;AAC/B,+CAAgD;AAChD,mFAAuE;AAEvE,2CAA6D;AAC7D,gDAA+E;AAC/E,4CAQyB;AAOzB,mFAAgF;AAChF,sDAA2D;AAC3D,+DAAgG;AA4BhG,MAAM,qBAAqB,GAAG,uCAAsB,IAAI,mBAAI,CAAC;AAE7D;;;GAGG;AACH,MAAM,YAAY,GAAG,CAAC,CAAQ,EAAE,CAAQ,EAAE,EAAE,CAC1C,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,CA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sDAAqB,CAAC,QAAQ,cAC5B,CAAC,MAAM,EAAE,EAAE,CAAC,CACX,uBAAC,mDAAwB,CAAC,QAAQ,cAC/B,CAAC,aAAa,EAAE,EAAE,CAAC,CAClB,uBAAC,6BAAkB,CAAC,QAAQ,cACzB,CAAC,mBAAmB,EAAE,EAAE,CAAC,CACxB,uBAAC,qBAAS,IACR,MAAM,EAAE,MAAO,EACf,mBAAmB,EAAE,mBAAmB,EACxC,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EACvC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,IAAI,CAAC,eAAe,EACjC,YAAY,EAAE,IAAI,CAAC,gBAAgB,EACnC,iBAAiB,EAAE,IAAI,CAAC,qBAAqB,EAC7C,eAAe,EAAE,IAAI,CAAC,mBAAmB,EACzC,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,IAAI,CAAC,kBAAkB,EACvC,YAAY,EAAE,IAAI,CAAC,gBAAgB,EACnC,eAAe,EAAE,IAAI,CAAC,mBAAmB,EACzC,oBAAoB,EAAE,oBAAoB,KACtC,IAAI,GACR,CACH,GAC2B,CAC/B,GACiC,CACrC,GAC8B,GACV,GACH,CACzB,CAAC;IACJ,CAAC;CACF;AAjaD,8BAiaC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nimport { CardStack, getAnimationEnabled } from './CardStack';\nimport { HeaderShownContext, SafeAreaProviderCompat } from '../../../elements';\nimport {\n CommonActions,\n type LocaleDirection,\n type ParamListBase,\n type Route,\n type RouteProp,\n StackActions,\n type StackNavigationState,\n} from '../../../native';\nimport type {\n StackDescriptor,\n StackDescriptorMap,\n StackNavigationConfig,\n StackNavigationHelpers,\n} from '../../types';\nimport { ModalPresentationContext } from '../../utils/ModalPresentationContext';\nimport { GestureHandlerRootView } from '../GestureHandler';\nimport { HeaderContainer, type Props as HeaderContainerProps } from '../Header/HeaderContainer';\n\ntype Props = StackNavigationConfig & {\n direction: LocaleDirection;\n state: StackNavigationState;\n navigation: StackNavigationHelpers;\n descriptors: StackDescriptorMap;\n describe: (route: RouteProp, placeholder: boolean) => StackDescriptor;\n};\n\ntype State = {\n // Local copy of the routes which are actually rendered\n routes: Route[];\n // Previous navigation state for comparison\n previousState: StackNavigationState | undefined;\n // Previous descriptors, to compare whether descriptors have changed or not\n previousDescriptors: StackDescriptorMap;\n // List of routes being opened, we need to animate pushing of these new routes\n openingRouteKeys: string[];\n // List of routes being closed, we need to animate popping of these routes\n closingRouteKeys: string[];\n // List of routes being replaced, we need to keep a copy until the new route animates in\n replacingRouteKeys: string[];\n // Since the local routes can vary from the routes from props, we need to keep the descriptors for old routes\n // Otherwise we won't be able to access the options for routes that were removed\n descriptors: StackDescriptorMap;\n};\n\nconst GestureHandlerWrapper = GestureHandlerRootView ?? View;\n\n/**\n * Compare two arrays with primitive values as the content.\n * We need to make sure that both values and order match.\n */\nconst isArrayEqual = (a: any[], b: any[]) =>\n a.length === b.length && a.every((it, index) => Object.is(it, b[index]));\n\nexport class StackView extends React.Component {\n static getDerivedStateFromProps(props: Readonly, state: Readonly) {\n const allRoutes = [...props.state.routes, ...props.state.preloadedRoutes];\n const previousRoutes = state.previousState\n ? [...state.previousState.routes, ...state.previousState.preloadedRoutes]\n : [];\n\n // If there was no change in routes, we don't need to compute anything\n if (\n isArrayEqual(\n allRoutes.map((r) => r.key),\n previousRoutes.map((r) => r.key)\n ) &&\n state.routes.length\n ) {\n // If there were any routes being closed or replaced,\n // We need to make sure they are preserved in the new state from props.state\n // So first we get all such routes from the previous state (that included the animating routes)\n // Then we add them back to the new state if they don't already exist\n\n const closingRoutes = state.routes.filter(\n (r) =>\n state.closingRouteKeys.includes(r.key) &&\n !props.state.routes.some((pr) => pr.key === r.key)\n );\n\n const replacingRoutes = state.routes.filter(\n (r) =>\n state.replacingRouteKeys.includes(r.key) &&\n !props.state.routes.some((pr) => pr.key === r.key)\n );\n\n let routes: Route[] = props.state.routes.slice();\n\n // Replacing routes go before the focused route (they're being covered)\n if (replacingRoutes.length) {\n routes.splice(routes.length - 1, 0, ...replacingRoutes);\n }\n\n // Closing routes go at the end (they're animating out on top)\n if (closingRoutes.length) {\n routes.push(...closingRoutes);\n }\n\n let descriptors = props.descriptors;\n let previousDescriptors = state.previousDescriptors;\n\n if (props.descriptors !== state.previousDescriptors) {\n descriptors = routes.reduce((acc, route) => {\n acc[route.key] = props.descriptors[route.key] || state.descriptors[route.key];\n\n return acc;\n }, {});\n\n previousDescriptors = props.descriptors;\n }\n\n if (!isArrayEqual(allRoutes, previousRoutes)) {\n // if any route objects have changed, we should update them\n const map = allRoutes.reduce>>((acc, route) => {\n acc[route.key] = route;\n return acc;\n }, {});\n\n routes = routes.map((route) => map[route.key] || route);\n }\n\n return {\n routes,\n previousState: props.state,\n descriptors,\n previousDescriptors,\n };\n }\n\n // Here we determine which routes were added or removed to animate them\n // We keep a copy of the route being removed in local state to be able to animate it\n\n let routes =\n props.state.index < props.state.routes.length - 1\n ? // Remove any extra routes from the state\n // The last visible route should be the focused route, i.e. at current index\n props.state.routes.slice(0, props.state.index + 1)\n : props.state.routes;\n\n let { openingRouteKeys, closingRouteKeys, replacingRouteKeys } = state;\n\n // If a route that was closing or being replaced is now back in the routes,\n // it was added back before the animation finished, so stop tracking it\n closingRouteKeys = closingRouteKeys.filter((key) => !routes.some((r) => r.key === key));\n\n replacingRouteKeys = replacingRouteKeys.filter((key) => !routes.some((r) => r.key === key));\n\n // Get previous focused route from previousState (actual focused route, not last in previousRoutes\n // which can be a preloaded route that was never focused)\n const previousFocusedRoute = state.previousState\n ? state.previousState.routes[state.previousState.index]\n : undefined;\n\n const nextFocusedRoute = routes[routes.length - 1];\n\n const isAnimationEnabled = (key: string) => {\n const descriptor = props.descriptors[key] || state.descriptors[key];\n\n return getAnimationEnabled(descriptor?.options.animation);\n };\n\n const getAnimationTypeForReplace = (key: string) => {\n const descriptor = props.descriptors[key] || state.descriptors[key];\n\n return descriptor.options.animationTypeForReplace ?? 'push';\n };\n\n if (previousFocusedRoute && previousFocusedRoute.key !== nextFocusedRoute.key) {\n // We only need to animate routes if the focused route changed\n // Animating previous routes won't be visible coz the focused route is on top of everything\n\n if (\n previousRoutes.some((r) => r.key === nextFocusedRoute.key) &&\n !routes.some((r) => r.key === previousFocusedRoute.key)\n ) {\n // The previously focused route was removed, and the new focused route was already present\n // We treat this as a pop\n\n if (\n isAnimationEnabled(previousFocusedRoute.key) &&\n !closingRouteKeys.includes(previousFocusedRoute.key)\n ) {\n closingRouteKeys = [...closingRouteKeys, previousFocusedRoute.key];\n\n // Sometimes a route can be closed before the opening animation finishes\n // So we also need to remove it from the opening list\n openingRouteKeys = openingRouteKeys.filter((key) => key !== previousFocusedRoute.key);\n replacingRouteKeys = replacingRouteKeys.filter((key) => key !== previousFocusedRoute.key);\n\n // Keep a copy of route being removed in the state to be able to animate it\n routes = [...routes, previousFocusedRoute];\n }\n } else {\n // A route has come to the focus, we treat this as a push\n // A replace or rearranging can also trigger this\n // The animation should look like push\n\n if (\n isAnimationEnabled(nextFocusedRoute.key) &&\n !openingRouteKeys.includes(nextFocusedRoute.key)\n ) {\n // In this case, we need to animate pushing the focused route\n // We don't care about animating any other added routes because they won't be visible\n openingRouteKeys = [...openingRouteKeys, nextFocusedRoute.key];\n\n closingRouteKeys = closingRouteKeys.filter((key) => key !== nextFocusedRoute.key);\n replacingRouteKeys = replacingRouteKeys.filter((key) => key !== nextFocusedRoute.key);\n\n if (!routes.some((r) => r.key === previousFocusedRoute.key)) {\n // The previous focused route isn't present in state, we treat this as a replace\n\n openingRouteKeys = openingRouteKeys.filter((key) => key !== previousFocusedRoute.key);\n\n if (getAnimationTypeForReplace(nextFocusedRoute.key) === 'pop') {\n closingRouteKeys = [...closingRouteKeys, previousFocusedRoute.key];\n\n // By default, new routes have a push animation, so we add it to `openingRouteKeys` before\n // But since user configured it to animate the old screen like a pop, we need to add this without animation\n // So remove it from `openingRouteKeys` which will remove the animation\n openingRouteKeys = openingRouteKeys.filter((key) => key !== nextFocusedRoute.key);\n\n // Keep the route being removed at the end to animate it out\n routes = [...routes, previousFocusedRoute];\n } else {\n replacingRouteKeys = [...replacingRouteKeys, previousFocusedRoute.key];\n\n closingRouteKeys = closingRouteKeys.filter((key) => key !== previousFocusedRoute.key);\n\n // Keep the old route in the state because it's visible under the new route, and removing it will feel abrupt\n // We need to insert it just before the focused one (the route being pushed)\n // After the push animation is completed, routes being replaced will be removed completely\n routes = routes.slice();\n routes.splice(routes.length - 1, 0, previousFocusedRoute);\n\n // Preserve any other routes still being replaced from previous transitions\n const previousReplacingRoutes = state.routes.filter(\n (r) =>\n replacingRouteKeys.includes(r.key) &&\n !routes.some((existing) => existing.key === r.key)\n );\n\n if (previousReplacingRoutes.length) {\n // Insert before the route we just added (previousFocusedRoute)\n routes.splice(routes.length - 2, 0, ...previousReplacingRoutes);\n }\n }\n }\n }\n }\n } else if (replacingRouteKeys.length || closingRouteKeys.length) {\n // Keep the routes we are closing or replacing if animation is enabled for them\n routes = routes.slice();\n routes.splice(\n routes.length - 1,\n 0,\n ...state.routes.filter(({ key }) =>\n isAnimationEnabled(key)\n ? replacingRouteKeys.includes(key) || closingRouteKeys.includes(key)\n : false\n )\n );\n }\n\n if (!routes.length) {\n throw new Error('There should always be at least one route in the navigation state.');\n }\n\n const descriptors = allRoutes.reduce((acc, route) => {\n acc[route.key] = props.descriptors[route.key] || state.descriptors[route.key];\n\n return acc;\n }, {});\n\n return {\n routes,\n previousState: props.state,\n previousDescriptors: props.descriptors,\n openingRouteKeys,\n closingRouteKeys,\n replacingRouteKeys,\n descriptors,\n };\n }\n\n state: State = {\n routes: [],\n previousState: undefined,\n previousDescriptors: {},\n openingRouteKeys: [],\n closingRouteKeys: [],\n replacingRouteKeys: [],\n descriptors: {},\n };\n\n private getPreviousRoute = ({ route }: { route: Route }) => {\n const { closingRouteKeys, replacingRouteKeys } = this.state;\n const routes = this.state.routes.filter(\n (r) =>\n r.key === route.key ||\n (!closingRouteKeys.includes(r.key) && !replacingRouteKeys.includes(r.key))\n );\n\n const index = routes.findIndex((r) => r.key === route.key);\n\n return routes[index - 1];\n };\n\n private renderHeader = (props: HeaderContainerProps) => {\n return ;\n };\n\n private handleOpenRoute = ({ route }: { route: Route }) => {\n const { state, navigation } = this.props;\n const { closingRouteKeys, replacingRouteKeys } = this.state;\n\n if (\n closingRouteKeys.some((key) => key === route.key) &&\n replacingRouteKeys.every((key) => key !== route.key) &&\n state.routeNames.includes(route.name) &&\n !state.routes.some((r) => r.key === route.key)\n ) {\n // If route isn't present in current state, but was closing, assume that a close animation was cancelled\n // So we need to add this route back to the state\n navigation.dispatch((state) => {\n const routes = [...state.routes.filter((r) => r.key !== route.key), route];\n\n return CommonActions.reset({\n ...state,\n routes,\n index: routes.length - 1,\n });\n });\n } else {\n this.setState((state) => {\n const routeIndex = state.routes.findIndex((r) => r.key === route.key);\n\n // Remove replacing routes that were before the route that just opened\n // Those were replaced by this or earlier routes and should be cleaned up\n const replacingRoutesToRemove = new Set(\n state.routes\n .slice(0, routeIndex)\n .filter((r) => state.replacingRouteKeys.includes(r.key))\n .map((r) => r.key)\n );\n\n const newRoutes = state.routes.filter((r) => !replacingRoutesToRemove.has(r.key));\n\n return {\n routes: newRoutes,\n openingRouteKeys: state.openingRouteKeys.filter((key) => key !== route.key),\n closingRouteKeys: state.closingRouteKeys.filter((key) => key !== route.key),\n replacingRouteKeys: state.replacingRouteKeys.filter(\n (key) => !replacingRoutesToRemove.has(key)\n ),\n };\n });\n }\n };\n\n private handleCloseRoute = ({ route }: { route: Route }) => {\n const { state, navigation } = this.props;\n\n if (state.routes.some((r) => r.key === route.key)) {\n // If a route exists in state, trigger a pop\n // This will happen in when the route was closed from the card component\n // e.g. When the close animation triggered from a gesture ends\n navigation.dispatch({\n ...StackActions.pop(),\n source: route.key,\n target: state.key,\n });\n } else {\n // We need to clean up any state tracking the route and pop it immediately\n this.setState((state) => ({\n routes: state.routes.filter((r) => r.key !== route.key),\n openingRouteKeys: state.openingRouteKeys.filter((key) => key !== route.key),\n closingRouteKeys: state.closingRouteKeys.filter((key) => key !== route.key),\n }));\n }\n };\n\n private handleTransitionStart = ({ route }: { route: Route }, closing: boolean) =>\n this.props.navigation.emit({\n type: 'transitionStart',\n data: { closing },\n target: route.key,\n });\n\n private handleTransitionEnd = ({ route }: { route: Route }, closing: boolean) =>\n this.props.navigation.emit({\n type: 'transitionEnd',\n data: { closing },\n target: route.key,\n });\n\n private handleGestureStart = ({ route }: { route: Route }) => {\n this.props.navigation.emit({\n type: 'gestureStart',\n target: route.key,\n });\n };\n\n private handleGestureEnd = ({ route }: { route: Route }) => {\n this.props.navigation.emit({\n type: 'gestureEnd',\n target: route.key,\n });\n };\n\n private handleGestureCancel = ({ route }: { route: Route }) => {\n this.props.navigation.emit({\n type: 'gestureCancel',\n target: route.key,\n });\n };\n\n render() {\n const {\n state,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n descriptors: _,\n ...rest\n } = this.props;\n\n const { routes, descriptors, openingRouteKeys, closingRouteKeys } = this.state;\n\n const preloadedDescriptors = state.preloadedRoutes.reduce((acc, route) => {\n acc[route.key] = acc[route.key] || this.props.describe(route, true);\n return acc;\n }, {});\n\n return (\n \n \n \n {(insets) => (\n \n {(isParentModal) => (\n \n {(isParentHeaderShown) => (\n \n )}\n \n )}\n \n )}\n \n \n \n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"]} \ No newline at end of file +{"version":3,"file":"StackView.js","sourceRoot":"","sources":["../../../../../src/react-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CAAC,mBAAmB,EACzC,oBAAoB,EAAE,oBAAoB,KACtC,IAAI,GACR,CACH,GAC2B,CAC/B,GACiC,CACrC,GAC8B,GACV,GACH,CACzB,CAAC;IACJ,CAAC;CACF;AAhaD,8BAgaC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nimport { CardStack, getAnimationEnabled } from './CardStack';\nimport { HeaderShownContext, SafeAreaProviderCompat } from '../../../elements';\nimport {\n CommonActions,\n type LocaleDirection,\n type ParamListBase,\n type Route,\n type RouteProp,\n StackActions,\n type StackNavigationState,\n} from '../../../native';\nimport type {\n StackDescriptor,\n StackDescriptorMap,\n StackNavigationConfig,\n StackNavigationHelpers,\n} from '../../types';\nimport { ModalPresentationContext } from '../../utils/ModalPresentationContext';\nimport { GestureHandlerRootView } from '../GestureHandler';\nimport { HeaderContainer, type Props as HeaderContainerProps } from '../Header/HeaderContainer';\n\ntype Props = StackNavigationConfig & {\n direction: LocaleDirection;\n state: StackNavigationState;\n navigation: StackNavigationHelpers;\n descriptors: StackDescriptorMap;\n describe: (route: RouteProp, placeholder: boolean) => StackDescriptor;\n};\n\ntype State = {\n // Local copy of the routes which are actually rendered\n routes: Route[];\n // Previous navigation state for comparison\n previousState: StackNavigationState | undefined;\n // Previous descriptors, to compare whether descriptors have changed or not\n previousDescriptors: StackDescriptorMap;\n // List of routes being opened, we need to animate pushing of these new routes\n openingRouteKeys: string[];\n // List of routes being closed, we need to animate popping of these routes\n closingRouteKeys: string[];\n // List of routes being replaced, we need to keep a copy until the new route animates in\n replacingRouteKeys: string[];\n // Since the local routes can vary from the routes from props, we need to keep the descriptors for old routes\n // Otherwise we won't be able to access the options for routes that were removed\n descriptors: StackDescriptorMap;\n};\n\nconst GestureHandlerWrapper = GestureHandlerRootView ?? View;\n\n/**\n * Compare two arrays with primitive values as the content.\n * We need to make sure that both values and order match.\n */\nconst isArrayEqual = (a: any[], b: any[]) =>\n a.length === b.length && a.every((it, index) => Object.is(it, b[index]));\n\nexport class StackView extends React.Component {\n static getDerivedStateFromProps(props: Readonly, state: Readonly) {\n const allRoutes = [...props.state.routes, ...props.state.preloadedRoutes];\n const previousRoutes = state.previousState\n ? [...state.previousState.routes, ...state.previousState.preloadedRoutes]\n : [];\n\n // If there was no change in routes, we don't need to compute anything\n if (\n isArrayEqual(\n allRoutes.map((r) => r.key),\n previousRoutes.map((r) => r.key)\n ) &&\n state.routes.length\n ) {\n // If there were any routes being closed or replaced,\n // We need to make sure they are preserved in the new state from props.state\n // So first we get all such routes from the previous state (that included the animating routes)\n // Then we add them back to the new state if they don't already exist\n\n const closingRoutes = state.routes.filter(\n (r) =>\n state.closingRouteKeys.includes(r.key) &&\n !props.state.routes.some((pr) => pr.key === r.key)\n );\n\n const replacingRoutes = state.routes.filter(\n (r) =>\n state.replacingRouteKeys.includes(r.key) &&\n !props.state.routes.some((pr) => pr.key === r.key)\n );\n\n let routes: Route[] = props.state.routes.slice();\n\n // Replacing routes go before the focused route (they're being covered)\n if (replacingRoutes.length) {\n routes.splice(routes.length - 1, 0, ...replacingRoutes);\n }\n\n // Closing routes go at the end (they're animating out on top)\n if (closingRoutes.length) {\n routes.push(...closingRoutes);\n }\n\n let descriptors = props.descriptors;\n let previousDescriptors = state.previousDescriptors;\n\n if (props.descriptors !== state.previousDescriptors) {\n descriptors = routes.reduce((acc, route) => {\n acc[route.key] = (props.descriptors[route.key] || state.descriptors[route.key])!;\n\n return acc;\n }, {});\n\n previousDescriptors = props.descriptors;\n }\n\n if (!isArrayEqual(allRoutes, previousRoutes)) {\n // if any route objects have changed, we should update them\n const map = allRoutes.reduce>>((acc, route) => {\n acc[route.key] = route;\n return acc;\n }, {});\n\n routes = routes.map((route) => map[route.key] || route);\n }\n\n return {\n routes,\n previousState: props.state,\n descriptors,\n previousDescriptors,\n };\n }\n\n // Here we determine which routes were added or removed to animate them\n // We keep a copy of the route being removed in local state to be able to animate it\n\n let routes =\n props.state.index < props.state.routes.length - 1\n ? // Remove any extra routes from the state\n // The last visible route should be the focused route, i.e. at current index\n props.state.routes.slice(0, props.state.index + 1)\n : props.state.routes;\n\n let { openingRouteKeys, closingRouteKeys, replacingRouteKeys } = state;\n\n // If a route that was closing or being replaced is now back in the routes,\n // it was added back before the animation finished, so stop tracking it\n closingRouteKeys = closingRouteKeys.filter((key) => !routes.some((r) => r.key === key));\n\n replacingRouteKeys = replacingRouteKeys.filter((key) => !routes.some((r) => r.key === key));\n\n // Get previous focused route from previousState (actual focused route, not last in previousRoutes\n // which can be a preloaded route that was never focused)\n const previousFocusedRoute = state.previousState\n ? state.previousState.routes[state.previousState.index]!\n : undefined;\n\n const nextFocusedRoute = routes[routes.length - 1]!;\n\n const isAnimationEnabled = (key: string) => {\n const descriptor = props.descriptors[key] || state.descriptors[key];\n\n return getAnimationEnabled(descriptor?.options.animation);\n };\n\n const getAnimationTypeForReplace = (key: string) => {\n const descriptor = props.descriptors[key] || state.descriptors[key]!;\n return descriptor.options.animationTypeForReplace ?? 'push';\n };\n\n if (previousFocusedRoute && previousFocusedRoute.key !== nextFocusedRoute.key) {\n // We only need to animate routes if the focused route changed\n // Animating previous routes won't be visible coz the focused route is on top of everything\n\n if (\n previousRoutes.some((r) => r.key === nextFocusedRoute.key) &&\n !routes.some((r) => r.key === previousFocusedRoute.key)\n ) {\n // The previously focused route was removed, and the new focused route was already present\n // We treat this as a pop\n\n if (\n isAnimationEnabled(previousFocusedRoute.key) &&\n !closingRouteKeys.includes(previousFocusedRoute.key)\n ) {\n closingRouteKeys = [...closingRouteKeys, previousFocusedRoute.key];\n\n // Sometimes a route can be closed before the opening animation finishes\n // So we also need to remove it from the opening list\n openingRouteKeys = openingRouteKeys.filter((key) => key !== previousFocusedRoute.key);\n replacingRouteKeys = replacingRouteKeys.filter((key) => key !== previousFocusedRoute.key);\n\n // Keep a copy of route being removed in the state to be able to animate it\n routes = [...routes, previousFocusedRoute];\n }\n } else {\n // A route has come to the focus, we treat this as a push\n // A replace or rearranging can also trigger this\n // The animation should look like push\n\n if (\n isAnimationEnabled(nextFocusedRoute.key) &&\n !openingRouteKeys.includes(nextFocusedRoute.key)\n ) {\n // In this case, we need to animate pushing the focused route\n // We don't care about animating any other added routes because they won't be visible\n openingRouteKeys = [...openingRouteKeys, nextFocusedRoute.key];\n\n closingRouteKeys = closingRouteKeys.filter((key) => key !== nextFocusedRoute.key);\n replacingRouteKeys = replacingRouteKeys.filter((key) => key !== nextFocusedRoute.key);\n\n if (!routes.some((r) => r.key === previousFocusedRoute.key)) {\n // The previous focused route isn't present in state, we treat this as a replace\n\n openingRouteKeys = openingRouteKeys.filter((key) => key !== previousFocusedRoute.key);\n\n if (getAnimationTypeForReplace(nextFocusedRoute.key) === 'pop') {\n closingRouteKeys = [...closingRouteKeys, previousFocusedRoute.key];\n\n // By default, new routes have a push animation, so we add it to `openingRouteKeys` before\n // But since user configured it to animate the old screen like a pop, we need to add this without animation\n // So remove it from `openingRouteKeys` which will remove the animation\n openingRouteKeys = openingRouteKeys.filter((key) => key !== nextFocusedRoute.key);\n\n // Keep the route being removed at the end to animate it out\n routes = [...routes, previousFocusedRoute];\n } else {\n replacingRouteKeys = [...replacingRouteKeys, previousFocusedRoute.key];\n\n closingRouteKeys = closingRouteKeys.filter((key) => key !== previousFocusedRoute.key);\n\n // Keep the old route in the state because it's visible under the new route, and removing it will feel abrupt\n // We need to insert it just before the focused one (the route being pushed)\n // After the push animation is completed, routes being replaced will be removed completely\n routes = routes.slice();\n routes.splice(routes.length - 1, 0, previousFocusedRoute);\n\n // Preserve any other routes still being replaced from previous transitions\n const previousReplacingRoutes = state.routes.filter(\n (r) =>\n replacingRouteKeys.includes(r.key) &&\n !routes.some((existing) => existing.key === r.key)\n );\n\n if (previousReplacingRoutes.length) {\n // Insert before the route we just added (previousFocusedRoute)\n routes.splice(routes.length - 2, 0, ...previousReplacingRoutes);\n }\n }\n }\n }\n }\n } else if (replacingRouteKeys.length || closingRouteKeys.length) {\n // Keep the routes we are closing or replacing if animation is enabled for them\n routes = routes.slice();\n routes.splice(\n routes.length - 1,\n 0,\n ...state.routes.filter(({ key }) =>\n isAnimationEnabled(key)\n ? replacingRouteKeys.includes(key) || closingRouteKeys.includes(key)\n : false\n )\n );\n }\n\n if (!routes.length) {\n throw new Error('There should always be at least one route in the navigation state.');\n }\n\n const descriptors = allRoutes.reduce((acc, route) => {\n acc[route.key] = (props.descriptors[route.key] || state.descriptors[route.key])!;\n\n return acc;\n }, {});\n\n return {\n routes,\n previousState: props.state,\n previousDescriptors: props.descriptors,\n openingRouteKeys,\n closingRouteKeys,\n replacingRouteKeys,\n descriptors,\n };\n }\n\n state: State = {\n routes: [],\n previousState: undefined,\n previousDescriptors: {},\n openingRouteKeys: [],\n closingRouteKeys: [],\n replacingRouteKeys: [],\n descriptors: {},\n };\n\n private getPreviousRoute = ({ route }: { route: Route }) => {\n const { closingRouteKeys, replacingRouteKeys } = this.state;\n const routes = this.state.routes.filter(\n (r) =>\n r.key === route.key ||\n (!closingRouteKeys.includes(r.key) && !replacingRouteKeys.includes(r.key))\n );\n\n const index = routes.findIndex((r) => r.key === route.key);\n\n return routes[index - 1];\n };\n\n private renderHeader = (props: HeaderContainerProps) => {\n return ;\n };\n\n private handleOpenRoute = ({ route }: { route: Route }) => {\n const { state, navigation } = this.props;\n const { closingRouteKeys, replacingRouteKeys } = this.state;\n\n if (\n closingRouteKeys.some((key) => key === route.key) &&\n replacingRouteKeys.every((key) => key !== route.key) &&\n state.routeNames.includes(route.name) &&\n !state.routes.some((r) => r.key === route.key)\n ) {\n // If route isn't present in current state, but was closing, assume that a close animation was cancelled\n // So we need to add this route back to the state\n navigation.dispatch((state) => {\n const routes = [...state.routes.filter((r) => r.key !== route.key), route];\n\n return CommonActions.reset({\n ...state,\n routes,\n index: routes.length - 1,\n });\n });\n } else {\n this.setState((state) => {\n const routeIndex = state.routes.findIndex((r) => r.key === route.key);\n\n // Remove replacing routes that were before the route that just opened\n // Those were replaced by this or earlier routes and should be cleaned up\n const replacingRoutesToRemove = new Set(\n state.routes\n .slice(0, routeIndex)\n .filter((r) => state.replacingRouteKeys.includes(r.key))\n .map((r) => r.key)\n );\n\n const newRoutes = state.routes.filter((r) => !replacingRoutesToRemove.has(r.key));\n\n return {\n routes: newRoutes,\n openingRouteKeys: state.openingRouteKeys.filter((key) => key !== route.key),\n closingRouteKeys: state.closingRouteKeys.filter((key) => key !== route.key),\n replacingRouteKeys: state.replacingRouteKeys.filter(\n (key) => !replacingRoutesToRemove.has(key)\n ),\n };\n });\n }\n };\n\n private handleCloseRoute = ({ route }: { route: Route }) => {\n const { state, navigation } = this.props;\n\n if (state.routes.some((r) => r.key === route.key)) {\n // If a route exists in state, trigger a pop\n // This will happen in when the route was closed from the card component\n // e.g. When the close animation triggered from a gesture ends\n navigation.dispatch({\n ...StackActions.pop(),\n source: route.key,\n target: state.key,\n });\n } else {\n // We need to clean up any state tracking the route and pop it immediately\n this.setState((state) => ({\n routes: state.routes.filter((r) => r.key !== route.key),\n openingRouteKeys: state.openingRouteKeys.filter((key) => key !== route.key),\n closingRouteKeys: state.closingRouteKeys.filter((key) => key !== route.key),\n }));\n }\n };\n\n private handleTransitionStart = ({ route }: { route: Route }, closing: boolean) =>\n this.props.navigation.emit({\n type: 'transitionStart',\n data: { closing },\n target: route.key,\n });\n\n private handleTransitionEnd = ({ route }: { route: Route }, closing: boolean) =>\n this.props.navigation.emit({\n type: 'transitionEnd',\n data: { closing },\n target: route.key,\n });\n\n private handleGestureStart = ({ route }: { route: Route }) => {\n this.props.navigation.emit({\n type: 'gestureStart',\n target: route.key,\n });\n };\n\n private handleGestureEnd = ({ route }: { route: Route }) => {\n this.props.navigation.emit({\n type: 'gestureEnd',\n target: route.key,\n });\n };\n\n private handleGestureCancel = ({ route }: { route: Route }) => {\n this.props.navigation.emit({\n type: 'gestureCancel',\n target: route.key,\n });\n };\n\n render() {\n const {\n state,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n descriptors: _,\n ...rest\n } = this.props;\n\n const { routes, descriptors, openingRouteKeys, closingRouteKeys } = this.state;\n\n const preloadedDescriptors = state.preloadedRoutes.reduce((acc, route) => {\n acc[route.key] = acc[route.key] || this.props.describe(route, true);\n return acc;\n }, {});\n\n return (\n \n \n \n {(insets) => (\n \n {(isParentModal) => (\n \n {(isParentHeaderShown) => (\n \n )}\n \n )}\n \n )}\n \n \n \n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/sortRoutes.js.map b/packages/expo-router/build/sortRoutes.js.map index fd958a7d9b18e6..5287defa520333 100644 --- a/packages/expo-router/build/sortRoutes.js.map +++ b/packages/expo-router/build/sortRoutes.js.map @@ -1 +1 @@ -{"version":3,"file":"sortRoutes.js","sourceRoot":"","sources":["../src/sortRoutes.ts"],"names":[],"mappings":";;AAaA,gCAgDC;AAED,sDAYC;AA1ED,yCAA4C;AAE5C,SAAS,qBAAqB,CAAC,CAAoB,EAAE,CAAoB;IACvE,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACtB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QACtB,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAgB,UAAU,CAAC,CAAY,EAAE,CAAY;IACnD,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAC5B,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;QAC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O,IAAI,IAAA,yBAAc,EAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;IACtE,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,KAAK,OAAO,IAAI,IAAA,yBAAc,EAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;IAEtE,IAAI,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;QACtB,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IACD,IAAI,CAAC,MAAM,IAAI,MAAM,EAAE,CAAC;QACtB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;AACzC,CAAC;AAED,SAAgB,qBAAqB,CAAC,gBAAyB;IAC7D,OAAO,CAAC,CAAY,EAAE,CAAY,EAAU,EAAE;QAC5C,IAAI,gBAAgB,EAAE,CAAC;YACrB,IAAI,CAAC,CAAC,KAAK,KAAK,gBAAgB,EAAE,CAAC;gBACjC,OAAO,CAAC,CAAC,CAAC;YACZ,CAAC;YACD,IAAI,CAAC,CAAC,KAAK,KAAK,gBAAgB,EAAE,CAAC;gBACjC,OAAO,CAAC,CAAC;YACX,CAAC;QACH,CAAC;QACD,OAAO,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { DynamicConvention, RouteNode } from './Route';\nimport { matchGroupName } from './matchers';\n\nfunction sortDynamicConvention(a: DynamicConvention, b: DynamicConvention) {\n if (a.deep && !b.deep) {\n return 1;\n }\n if (!a.deep && b.deep) {\n return -1;\n }\n return 0;\n}\n\nexport function sortRoutes(a: RouteNode, b: RouteNode): number {\n if (a.dynamic && !b.dynamic) {\n return 1;\n }\n if (!a.dynamic && b.dynamic) {\n return -1;\n }\n if (a.dynamic && b.dynamic) {\n if (a.dynamic.length !== b.dynamic.length) {\n return b.dynamic.length - a.dynamic.length;\n }\n\n for (let i = 0; i < a.dynamic.length; i++) {\n const aDynamic = a.dynamic[i];\n const bDynamic = b.dynamic[i];\n\n if (aDynamic.notFound && bDynamic.notFound) {\n const s = sortDynamicConvention(aDynamic, bDynamic);\n if (s) {\n return s;\n }\n }\n if (aDynamic.notFound && !bDynamic.notFound) {\n return 1;\n }\n if (!aDynamic.notFound && bDynamic.notFound) {\n return -1;\n }\n\n const s = sortDynamicConvention(aDynamic, bDynamic);\n if (s) {\n return s;\n }\n }\n return 0;\n }\n\n const aIndex = a.route === 'index' || matchGroupName(a.route) != null;\n const bIndex = b.route === 'index' || matchGroupName(b.route) != null;\n\n if (aIndex && !bIndex) {\n return -1;\n }\n if (!aIndex && bIndex) {\n return 1;\n }\n\n return a.route.length - b.route.length;\n}\n\nexport function sortRoutesWithInitial(initialRouteName?: string) {\n return (a: RouteNode, b: RouteNode): number => {\n if (initialRouteName) {\n if (a.route === initialRouteName) {\n return -1;\n }\n if (b.route === initialRouteName) {\n return 1;\n }\n }\n return sortRoutes(a, b);\n };\n}\n"]} \ No newline at end of file +{"version":3,"file":"sortRoutes.js","sourceRoot":"","sources":["../src/sortRoutes.ts"],"names":[],"mappings":";;AAaA,gCAgDC;AAED,sDAYC;AA1ED,yCAA4C;AAE5C,SAAS,qBAAqB,CAAC,CAAoB,EAAE,CAAoB;IACvE,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACtB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QACtB,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAgB,UAAU,CAAC,CAAY,EAAE,CAAY;IACnD,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAC5B,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,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C;IACX,CAAC;IAED,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,KAAK,OAAO,IAAI,IAAA,yBAAc,EAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;IACtE,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,KAAK,OAAO,IAAI,IAAA,yBAAc,EAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;IAEtE,IAAI,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;QACtB,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IACD,IAAI,CAAC,MAAM,IAAI,MAAM,EAAE,CAAC;QACtB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;AACzC,CAAC;AAED,SAAgB,qBAAqB,CAAC,gBAAyB;IAC7D,OAAO,CAAC,CAAY,EAAE,CAAY,EAAU,EAAE;QAC5C,IAAI,gBAAgB,EAAE,CAAC;YACrB,IAAI,CAAC,CAAC,KAAK,KAAK,gBAAgB,EAAE,CAAC;gBACjC,OAAO,CAAC,CAAC,CAAC;YACZ,CAAC;YACD,IAAI,CAAC,CAAC,KAAK,KAAK,gBAAgB,EAAE,CAAC;gBACjC,OAAO,CAAC,CAAC;YACX,CAAC;QACH,CAAC;QACD,OAAO,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { DynamicConvention, RouteNode } from './Route';\nimport { matchGroupName } from './matchers';\n\nfunction sortDynamicConvention(a: DynamicConvention, b: DynamicConvention) {\n if (a.deep && !b.deep) {\n return 1;\n }\n if (!a.deep && b.deep) {\n return -1;\n }\n return 0;\n}\n\nexport function sortRoutes(a: RouteNode, b: RouteNode): number {\n if (a.dynamic && !b.dynamic) {\n return 1;\n }\n if (!a.dynamic && b.dynamic) {\n return -1;\n }\n if (a.dynamic && b.dynamic) {\n if (a.dynamic.length !== b.dynamic.length) {\n return b.dynamic.length - a.dynamic.length;\n }\n\n for (let i = 0; i < a.dynamic.length; i++) {\n const aDynamic = a.dynamic[i]!;\n const bDynamic = b.dynamic[i]!;\n\n if (aDynamic.notFound && bDynamic.notFound) {\n const s = sortDynamicConvention(aDynamic, bDynamic);\n if (s) {\n return s;\n }\n }\n if (aDynamic.notFound && !bDynamic.notFound) {\n return 1;\n }\n if (!aDynamic.notFound && bDynamic.notFound) {\n return -1;\n }\n\n const s = sortDynamicConvention(aDynamic, bDynamic);\n if (s) {\n return s;\n }\n }\n return 0;\n }\n\n const aIndex = a.route === 'index' || matchGroupName(a.route) != null;\n const bIndex = b.route === 'index' || matchGroupName(b.route) != null;\n\n if (aIndex && !bIndex) {\n return -1;\n }\n if (!aIndex && bIndex) {\n return 1;\n }\n\n return a.route.length - b.route.length;\n}\n\nexport function sortRoutesWithInitial(initialRouteName?: string) {\n return (a: RouteNode, b: RouteNode): number => {\n if (initialRouteName) {\n if (a.route === initialRouteName) {\n return -1;\n }\n if (b.route === initialRouteName) {\n return 1;\n }\n }\n return sortRoutes(a, b);\n };\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/testing-library/context-stubs.d.ts b/packages/expo-router/build/testing-library/context-stubs.d.ts index 23678ef9839679..441ffda28559eb 100644 --- a/packages/expo-router/build/testing-library/context-stubs.d.ts +++ b/packages/expo-router/build/testing-library/context-stubs.d.ts @@ -17,8 +17,8 @@ export declare function inMemoryContext(context: MemoryContext): ((id: string) = unstable_settings?: Record; loader?: LoaderFunction; }) | { - default: NativeIntent | FileStub; -}) & { + default: NativeIntent | FileStub | undefined; +} | undefined) & { resolve: (key: string) => string; id: string; keys: () => string[]; diff --git a/packages/expo-router/build/ui/TabRouter.js.map b/packages/expo-router/build/ui/TabRouter.js.map index e0b0cc813df0a5..b7c84201b0ea4c 100644 --- a/packages/expo-router/build/ui/TabRouter.js.map +++ b/packages/expo-router/build/ui/TabRouter.js.map @@ -1 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E,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;oBACpC,CAAC,CAAC;iBACH,CAAC;gBACF,OAAO,WAAW,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YAC/D,CAAC;iBAAM,CAAC;gBACN,OAAO,WAAW,CAAC,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;KACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,eAAe,CAAC,MAAwB;IAC/C,OAAO,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC;AACnC,CAAC","sourcesContent":["import type { TriggerMap } from './common';\nimport {\n type CommonNavigationAction,\n type ParamListBase,\n type Router,\n type TabActionType as RNTabActionType,\n type TabNavigationState,\n type TabRouterOptions as RNTabRouterOptions,\n type StackActionType,\n type NavigationAction,\n TabRouter as RNTabRouter,\n} from '../react-navigation/native';\n\nexport type ExpoTabRouterOptions = RNTabRouterOptions & {\n triggerMap: TriggerMap;\n};\n\ntype ReplaceAction = Extract;\n\nexport type ExpoTabActionType =\n | RNTabActionType\n | CommonNavigationAction\n | ReplaceAction\n | {\n type: 'JUMP_TO';\n source?: string;\n target?: string;\n payload: {\n name: string;\n resetOnFocus?: boolean;\n params?: object;\n };\n };\n\nexport function ExpoTabRouter(options: ExpoTabRouterOptions) {\n const rnTabRouter = RNTabRouter(options);\n\n const router: Router<\n TabNavigationState,\n ExpoTabActionType | CommonNavigationAction\n > = {\n ...rnTabRouter,\n getStateForAction(state, action, options) {\n if (isReplaceAction(action)) {\n action = {\n ...action,\n type: 'JUMP_TO',\n };\n // Generate the state as if we were using JUMP_TO\n const nextState = rnTabRouter.getStateForAction(state, action, options);\n\n if (!nextState || nextState.index === undefined || !Array.isArray(nextState.history)) {\n return null;\n }\n\n // We can assert that nextState is TabNavigationState here, because we checked for index and history above\n state = nextState as TabNavigationState;\n\n // If the state is valid and we didn't JUMP_TO a single history state,\n // then remove the previous state.\n if (state.index !== 0) {\n const previousIndex = state.index - 1;\n\n state = {\n ...state,\n key: `${state.key}-replace`,\n // Omit the previous history entry that we are replacing\n history: [\n ...state.history.slice(0, previousIndex),\n ...state.history.splice(state.index),\n ],\n };\n }\n } else if (action.type !== 'JUMP_TO') {\n return rnTabRouter.getStateForAction(state, action, options);\n }\n\n const route = state.routes.find((route) => route.name === action.payload.name);\n\n if (!route || !state) {\n // This shouldn't occur, but lets just hand it off to the next navigator in case.\n return null;\n }\n\n // We should reset if this is the first time visiting the route\n let shouldReset = !state.history?.some((item) => item.key === route?.key) && !route.state;\n\n if (!shouldReset && 'resetOnFocus' in action.payload && action.payload.resetOnFocus) {\n shouldReset = state.routes[state.index ?? 0].key !== route.key;\n }\n\n if (shouldReset) {\n options.routeParamList[route.name] = {\n ...options.routeParamList[route.name],\n };\n state = {\n ...state,\n routes: state.routes.map((r) => {\n if (r.key !== route.key) {\n return r;\n }\n return { ...r, state: undefined };\n }),\n };\n return rnTabRouter.getStateForAction(state, action, options);\n } else {\n return rnTabRouter.getStateForRouteFocus(state, route.key);\n }\n },\n };\n\n return router;\n}\n\nfunction isReplaceAction(action: NavigationAction): action is ReplaceAction {\n return action.type === 'REPLACE';\n}\n"]} \ No newline at end of file +{"version":3,"file":"TabRouter.js","sourceRoot":"","sources":["../../src/ui/TabRouter.tsx"],"names":[],"mappings":";;AAkCA,sCA8EC;AA/GD,uDAUoC;AAuBpC,SAAgB,aAAa,CAAC,OAA6B;IACzD,MAAM,WAAW,GAAG,IAAA,kBAAW,EAAC,OAAO,CAAC,CAAC;IAEzC,MAAM,MAAM,GAGR;QACF,GAAG,WAAW;QACd,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO;YACtC,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC5B,MAAM,GAAG;oBACP,GAAG,MAAM;oBACT,IAAI,EAAE,SAAS;iBAChB,CAAC;gBACF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C","sourcesContent":["import type { TriggerMap } from './common';\nimport {\n type CommonNavigationAction,\n type ParamListBase,\n type Router,\n type TabActionType as RNTabActionType,\n type TabNavigationState,\n type TabRouterOptions as RNTabRouterOptions,\n type StackActionType,\n type NavigationAction,\n TabRouter as RNTabRouter,\n} from '../react-navigation/native';\n\nexport type ExpoTabRouterOptions = RNTabRouterOptions & {\n triggerMap: TriggerMap;\n};\n\ntype ReplaceAction = Extract;\n\nexport type ExpoTabActionType =\n | RNTabActionType\n | CommonNavigationAction\n | ReplaceAction\n | {\n type: 'JUMP_TO';\n source?: string;\n target?: string;\n payload: {\n name: string;\n resetOnFocus?: boolean;\n params?: object;\n };\n };\n\nexport function ExpoTabRouter(options: ExpoTabRouterOptions) {\n const rnTabRouter = RNTabRouter(options);\n\n const router: Router<\n TabNavigationState,\n ExpoTabActionType | CommonNavigationAction\n > = {\n ...rnTabRouter,\n getStateForAction(state, action, options) {\n if (isReplaceAction(action)) {\n action = {\n ...action,\n type: 'JUMP_TO',\n };\n // Generate the state as if we were using JUMP_TO\n const nextState = rnTabRouter.getStateForAction(state, action, options);\n\n if (!nextState || nextState.index === undefined || !Array.isArray(nextState.history)) {\n return null;\n }\n\n // We can assert that nextState is TabNavigationState here, because we checked for index and history above\n state = nextState as TabNavigationState;\n\n // If the state is valid and we didn't JUMP_TO a single history state,\n // then remove the previous state.\n if (state.index !== 0) {\n const previousIndex = state.index - 1;\n\n state = {\n ...state,\n key: `${state.key}-replace`,\n // Omit the previous history entry that we are replacing\n history: [\n ...state.history.slice(0, previousIndex),\n ...state.history.splice(state.index),\n ],\n };\n }\n } else if (action.type !== 'JUMP_TO') {\n return rnTabRouter.getStateForAction(state, action, options);\n }\n\n const route = state.routes.find((route) => route.name === action.payload.name);\n\n if (!route || !state) {\n // This shouldn't occur, but lets just hand it off to the next navigator in case.\n return null;\n }\n\n // We should reset if this is the first time visiting the route\n let shouldReset = !state.history?.some((item) => item.key === route?.key) && !route.state;\n\n if (!shouldReset && 'resetOnFocus' in action.payload && action.payload.resetOnFocus) {\n shouldReset = state.routes[state.index ?? 0]!.key !== route.key;\n }\n\n if (shouldReset) {\n options.routeParamList[route.name] = {\n ...options.routeParamList[route.name],\n };\n state = {\n ...state,\n routes: state.routes.map((r) => {\n if (r.key !== route.key) {\n return r;\n }\n return { ...r, state: undefined };\n }),\n };\n return rnTabRouter.getStateForAction(state, action, options);\n } else {\n return rnTabRouter.getStateForRouteFocus(state, route.key);\n }\n },\n };\n\n return router;\n}\n\nfunction isReplaceAction(action: NavigationAction): action is ReplaceAction {\n return action.type === 'REPLACE';\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/ui/TabSlot.js.map b/packages/expo-router/build/ui/TabSlot.js.map index 64c6e73cfd6f92..02db8eb8e7a632 100644 --- a/packages/expo-router/build/ui/TabSlot.js.map +++ b/packages/expo-router/build/ui/TabSlot.js.map @@ -1 +1 @@ -{"version":3,"file":"TabSlot.js","sourceRoot":"","sources":["../../src/ui/TabSlot.tsx"],"names":[],"mappings":";;AAuDA,gCAkCC;AAiBD,0BAEC;AAKD,sDAyBC;AAKD,8BAEC;;AAhJD,iCAAiC;AACjC,+CAAoD;AACpD,+DAA+D;AAG/D,6CAA0C;AAE1C,kDAAyD;AAmCzD;;;;;;;;;;;GAWG;AACH,SAAgB,UAAU,CAAC,EACzB,qBAAqB,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,uBAAQ,CAAC,EAAE,CAAC,EACvE,KAAK,EACL,QAAQ,GAAG,qBAAqB,MAChB,EAAE;IAClB,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,IAAA,+BAAmB,GAAE,CAAC;IACrD,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;IACtD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,eAAe,CAAC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I,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QAClC,4DAA4D;QAC5D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,uBAAC,6BAAM,IAEL,OAAO,EAAE,qBAAqB,EAC9B,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAChC,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,YACpE,UAAU,CAAC,MAAM,EAAE,IALf,UAAU,CAAC,KAAK,CAAC,GAAG,CAMlB,CACV,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAC,KAAwB;IAChD,OAAO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC;AAChC,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE;QACN,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,MAAM;KACf;IACD,eAAe,EAAE;QACf,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;KACZ;IACD,OAAO,EAAE;QACP,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;KACZ;IACD,SAAS,EAAE;QACT,MAAM,EAAE,CAAC,CAAC;QACV,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;KACZ;CACF,CAAC,CAAC","sourcesContent":["import type { ComponentProps, ReactElement } from 'react';\nimport { useState } from 'react';\nimport { Platform, StyleSheet } from 'react-native';\nimport { ScreenContainer, Screen } from 'react-native-screens';\n\nimport type { TabsDescriptor } from './TabContext';\nimport { TabContext } from './TabContext';\nimport type { TabListProps } from './TabList';\nimport { useNavigatorContext } from '../views/Navigator';\n\nexport type TabSlotProps = ComponentProps & {\n /**\n * Remove inactive screens.\n */\n detachInactiveScreens?: boolean;\n /**\n * Override how the `Screen` component is rendered.\n */\n renderFn?: typeof defaultTabsSlotRender;\n};\n\n/**\n * Options provided to the `UseTabSlotOptions`.\n */\nexport type TabsSlotRenderOptions = {\n /**\n * Index of screen.\n */\n index: number;\n /**\n * Whether the screen is focused.\n */\n isFocused: boolean;\n /**\n * Whether the screen has been loaded.\n */\n loaded: boolean;\n /**\n * Should the screen be unloaded when inactive.\n */\n detachInactiveScreens: boolean;\n};\n\n/**\n * Returns a `ReactElement` of the current tab.\n *\n * @example\n * ```tsx\n * function MyTabSlot() {\n * const slot = useTabSlot();\n *\n * return slot;\n * }\n * ```\n */\nexport function useTabSlot({\n detachInactiveScreens = ['android', 'ios', 'web'].includes(Platform.OS),\n style,\n renderFn = defaultTabsSlotRender,\n}: TabSlotProps = {}) {\n const { state, descriptors } = useNavigatorContext();\n const focusedRouteKey = state.routes[state.index].key;\n const [loaded, setLoaded] = useState({ [focusedRouteKey]: true });\n\n if (!loaded[focusedRouteKey]) {\n setLoaded({ ...loaded, [focusedRouteKey]: true });\n }\n\n return (\n \n {state.routes.map((route, index) => {\n const descriptor = descriptors[route.key] as unknown as TabsDescriptor;\n\n return (\n \n {renderFn(descriptor, {\n index,\n isFocused: state.index === index,\n loaded: loaded[route.key],\n detachInactiveScreens,\n })}\n \n );\n })}\n \n );\n}\n\n/**\n * Renders the current tab.\n *\n * @see [`useTabSlot`](#usetabslot) for a hook version of this component.\n *\n * @example\n * ```tsx\n * \n * \n * \n * \n * \n * \n * ```\n */\nexport function TabSlot(props: TabSlotProps) {\n return useTabSlot(props);\n}\n\n/**\n * @hidden\n */\nexport function defaultTabsSlotRender(\n descriptor: TabsDescriptor,\n { isFocused, loaded, detachInactiveScreens }: TabsSlotRenderOptions\n) {\n const { lazy = true, unmountOnBlur, freezeOnBlur } = descriptor.options;\n\n if (unmountOnBlur && !isFocused) {\n return null;\n }\n\n if (lazy && !loaded && !isFocused) {\n // Don't render a lazy screen if we've never navigated to it\n return null;\n }\n\n return (\n \n {descriptor.render()}\n \n );\n}\n\n/**\n * @hidden\n */\nexport function isTabSlot(child: ReactElement): child is ReactElement {\n return child.type === TabSlot;\n}\n\nconst styles = StyleSheet.create({\n screen: {\n flex: 1,\n position: 'relative',\n height: '100%',\n },\n screenContainer: {\n flexShrink: 0,\n flexGrow: 1,\n },\n focused: {\n zIndex: 1,\n display: 'flex',\n flexShrink: 0,\n flexGrow: 1,\n },\n unfocused: {\n zIndex: -1,\n display: 'none',\n flexShrink: 1,\n flexGrow: 0,\n },\n});\n"]} \ No newline at end of file +{"version":3,"file":"TabSlot.js","sourceRoot":"","sources":["../../src/ui/TabSlot.tsx"],"names":[],"mappings":";;AAuDA,gCAkCC;AAiBD,0BAEC;AAKD,sDAyBC;AAKD,8BAEC;;AAhJD,iCAAiC;AACjC,+CAAoD;AACpD,+DAA+D;AAG/D,6CAA0C;AAE1C,kDAAyD;AAmCzD;;;;;;;;;;;GAWG;AACH,SAAgB,UAAU,CAAC,EACzB,qBAAqB,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,uBAAQ,CAAC,EAAE,CAAC,EACvE,KAAK,EACL,QAAQ,GAAG,qBAAqB,MAChB,EAAE;IAClB,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,IAAA,+BAAmB,GAAE,CAAC;IACrD,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAE,CAAC,GAAG,CAAC;IACvD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAElE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC;QAC7B,SAAS,CAAC,EAAE,GAAG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L,uBAAC,6BAAM,IAEL,OAAO,EAAE,qBAAqB,EAC9B,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAChC,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,YACpE,UAAU,CAAC,MAAM,EAAE,IALf,UAAU,CAAC,KAAK,CAAC,GAAG,CAMlB,CACV,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAC,KAAwB;IAChD,OAAO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC;AAChC,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE;QACN,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,MAAM;KACf;IACD,eAAe,EAAE;QACf,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;KACZ;IACD,OAAO,EAAE;QACP,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;KACZ;IACD,SAAS,EAAE;QACT,MAAM,EAAE,CAAC,CAAC;QACV,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;KACZ;CACF,CAAC,CAAC","sourcesContent":["import type { ComponentProps, ReactElement } from 'react';\nimport { useState } from 'react';\nimport { Platform, StyleSheet } from 'react-native';\nimport { ScreenContainer, Screen } from 'react-native-screens';\n\nimport type { TabsDescriptor } from './TabContext';\nimport { TabContext } from './TabContext';\nimport type { TabListProps } from './TabList';\nimport { useNavigatorContext } from '../views/Navigator';\n\nexport type TabSlotProps = ComponentProps & {\n /**\n * Remove inactive screens.\n */\n detachInactiveScreens?: boolean;\n /**\n * Override how the `Screen` component is rendered.\n */\n renderFn?: typeof defaultTabsSlotRender;\n};\n\n/**\n * Options provided to the `UseTabSlotOptions`.\n */\nexport type TabsSlotRenderOptions = {\n /**\n * Index of screen.\n */\n index: number;\n /**\n * Whether the screen is focused.\n */\n isFocused: boolean;\n /**\n * Whether the screen has been loaded.\n */\n loaded: boolean;\n /**\n * Should the screen be unloaded when inactive.\n */\n detachInactiveScreens: boolean;\n};\n\n/**\n * Returns a `ReactElement` of the current tab.\n *\n * @example\n * ```tsx\n * function MyTabSlot() {\n * const slot = useTabSlot();\n *\n * return slot;\n * }\n * ```\n */\nexport function useTabSlot({\n detachInactiveScreens = ['android', 'ios', 'web'].includes(Platform.OS),\n style,\n renderFn = defaultTabsSlotRender,\n}: TabSlotProps = {}) {\n const { state, descriptors } = useNavigatorContext();\n const focusedRouteKey = state.routes[state.index]!.key;\n const [loaded, setLoaded] = useState({ [focusedRouteKey]: true });\n\n if (!loaded[focusedRouteKey]) {\n setLoaded({ ...loaded, [focusedRouteKey]: true });\n }\n\n return (\n \n {state.routes.map((route, index) => {\n const descriptor = descriptors[route.key] as unknown as TabsDescriptor;\n\n return (\n \n {renderFn(descriptor, {\n index,\n isFocused: state.index === index,\n loaded: loaded[route.key]!,\n detachInactiveScreens,\n })}\n \n );\n })}\n \n );\n}\n\n/**\n * Renders the current tab.\n *\n * @see [`useTabSlot`](#usetabslot) for a hook version of this component.\n *\n * @example\n * ```tsx\n * \n * \n * \n * \n * \n * \n * ```\n */\nexport function TabSlot(props: TabSlotProps) {\n return useTabSlot(props);\n}\n\n/**\n * @hidden\n */\nexport function defaultTabsSlotRender(\n descriptor: TabsDescriptor,\n { isFocused, loaded, detachInactiveScreens }: TabsSlotRenderOptions\n) {\n const { lazy = true, unmountOnBlur, freezeOnBlur } = descriptor.options;\n\n if (unmountOnBlur && !isFocused) {\n return null;\n }\n\n if (lazy && !loaded && !isFocused) {\n // Don't render a lazy screen if we've never navigated to it\n return null;\n }\n\n return (\n \n {descriptor.render()}\n \n );\n}\n\n/**\n * @hidden\n */\nexport function isTabSlot(child: ReactElement): child is ReactElement {\n return child.type === TabSlot;\n}\n\nconst styles = StyleSheet.create({\n screen: {\n flex: 1,\n position: 'relative',\n height: '100%',\n },\n screenContainer: {\n flexShrink: 0,\n flexGrow: 1,\n },\n focused: {\n zIndex: 1,\n display: 'flex',\n flexShrink: 0,\n flexGrow: 1,\n },\n unfocused: {\n zIndex: -1,\n display: 'none',\n flexShrink: 1,\n flexGrow: 0,\n },\n});\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/ui/TabTrigger.js.map b/packages/expo-router/build/ui/TabTrigger.js.map index 2c9e8aac3c7351..598ef180654973 100644 --- a/packages/expo-router/build/ui/TabTrigger.js.map +++ b/packages/expo-router/build/ui/TabTrigger.js.map @@ -1 +1 @@ -{"version":3,"file":"TabTrigger.js","sourceRoot":"","sources":["../../src/ui/TabTrigger.tsx"],"names":[],"mappings":";;AAsEA,gCA4BC;AAKD,oCAIC;AAkCD,sCA6GC;;AA1PD,qDAA4C;AAE5C,iCAAyC;AAEzC,+CAAqD;AAErD,6CAAoD;AAEpD,+DAAyD;AACzD,sDAA2C;AAC3C,mEAAoE;AACpE,0CAAyD;AAGzD,kDAAyD;AAqCzD,MAAM,cAAc,GAAG,iBAA4D,CAAC;AAEpF;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,KAAK,EAAmB;IACzF,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,aAAa,CAAC;QAC9C,IAAI;QACJ,YAAY;QACZ,GAAG,KAAK;KACT,CAAC,CAAC;IAEH,sFAAsF;IACtF,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CACL,uBAAC,cAAc,IACb,KAAK,EAAE,MAAM,CAAC,UAAU,KACpB,KAAK,KACL,YAAY,EAChB,IAAI,EAAE,OAAO,EAAE,YAAY,YAC1B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cAAc,EAAE,eAAe;KAChC;CACF,CAAC,CAAC","sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport type { ReactNode, ReactElement, ComponentProps } from 'react';\nimport { use, useCallback } from 'react';\nimport type { View, PressableProps } from 'react-native';\nimport { StyleSheet, Pressable } from 'react-native';\n\nimport { TabTriggerMapContext } from './TabContext';\nimport type { TriggerMap } from './common';\nimport { appendBaseUrl } from '../fork/getPathFromState';\nimport { router } from '../imperative-api';\nimport { shouldHandleMouseEvent } from '../link/useLinkToPathProps';\nimport { stripGroupSegmentsFromPath } from '../matchers';\nimport type { TabNavigationState } from '../react-navigation/native';\nimport type { Href } from '../types';\nimport { useNavigatorContext } from '../views/Navigator';\n\ntype PressablePropsWithoutFunctionChildren = Omit & {\n children?: ReactNode | undefined;\n};\n\nexport type TabTriggerProps = PressablePropsWithoutFunctionChildren & {\n /**\n * Name of tab. When used within a `TabList` this sets the name of the tab.\n * Otherwise, this references the name.\n */\n name: string;\n /**\n * Name of tab. Required when used within a `TabList`.\n */\n href?: Href;\n /**\n * Forward props to child component. Useful for custom wrappers.\n */\n asChild?: boolean;\n /**\n * Resets the route when switching to a tab.\n */\n resetOnFocus?: boolean;\n};\n\nexport type TabTriggerOptions = {\n name: string;\n href: Href;\n};\n\nexport type TabTriggerSlotProps = PressablePropsWithoutFunctionChildren &\n React.RefAttributes & {\n isFocused?: boolean;\n href?: string;\n };\n\nconst TabTriggerSlot = Slot as React.ForwardRefExoticComponent;\n\n/**\n * Creates a trigger to navigate to a tab. When used as child of `TabList`, its\n * functionality slightly changes since the `href` prop is required,\n * and the trigger also defines what routes are present in the `Tabs`.\n *\n * When used outside of `TabList`, this component no longer requires an `href`.\n *\n * @example\n * ```tsx\n * \n * \n * \n * \n * \n * \n * ```\n */\nexport function TabTrigger({ asChild, name, href, resetOnFocus, ...props }: TabTriggerProps) {\n const { trigger, triggerProps } = useTabTrigger({\n name,\n resetOnFocus,\n ...props,\n });\n\n // Pressable doesn't accept the extra props, so only pass them if we are using asChild\n if (asChild) {\n return (\n \n {props.children}\n \n );\n } else {\n // These props are not typed, but are allowed by React Native Web\n const reactNativeWebProps = { href: trigger?.resolvedHref };\n\n return (\n \n {props.children}\n \n );\n }\n}\n\n/**\n * @hidden\n */\nexport function isTabTrigger(\n child: ReactElement\n): child is ReactElement> {\n return child.type === TabTrigger;\n}\n\n/**\n * Options for `switchTab` function.\n */\nexport type SwitchToOptions = {\n /**\n * Navigate and reset the history on route focus.\n */\n resetOnFocus?: boolean;\n};\n\nexport type Trigger = TriggerMap[string] & {\n isFocused: boolean;\n resolvedHref: string;\n route: TabNavigationState['routes'][number];\n};\n\nexport type UseTabTriggerResult = {\n switchTab: (name: string, options: SwitchToOptions) => void;\n getTrigger: (name: string) => Trigger | undefined;\n trigger?: Trigger;\n triggerProps: TriggerProps;\n};\n\nexport type TriggerProps = {\n isFocused: boolean;\n onPress: PressableProps['onPress'];\n onLongPress: PressableProps['onLongPress'];\n};\n\n/**\n * Utility hook creating custom `TabTrigger`.\n */\nexport function useTabTrigger(options: TabTriggerProps): UseTabTriggerResult {\n const { state, navigation } = useNavigatorContext();\n const { name, resetOnFocus, onPress, onLongPress } = options;\n const triggerMap = use(TabTriggerMapContext);\n\n const getTrigger = useCallback(\n (name: string) => {\n const config = triggerMap[name];\n\n if (!config) {\n return;\n }\n\n return {\n isFocused: state.index === config.index,\n route: state.routes[config.index],\n resolvedHref: stripGroupSegmentsFromPath(appendBaseUrl(config.href)),\n ...config,\n };\n },\n [triggerMap]\n );\n\n const trigger = name !== undefined ? getTrigger(name) : undefined;\n\n const switchTab = useCallback(\n (name: string, options?: SwitchToOptions) => {\n const config = triggerMap[name];\n\n if (config) {\n if (config.type === 'external') {\n return router.navigate(config.href);\n } else {\n return navigation?.dispatch({\n ...config.action,\n type: 'JUMP_TO',\n payload: {\n ...config.action.payload,\n ...options,\n },\n });\n }\n } else {\n return navigation?.dispatch({\n type: 'JUMP_TO',\n payload: {\n name,\n },\n });\n }\n },\n [navigation, triggerMap]\n );\n\n const handleOnPress = useCallback>(\n (event) => {\n onPress?.(event);\n if (!trigger) return;\n if (event?.isDefaultPrevented()) return;\n\n navigation?.emit({\n type: 'tabPress',\n target: trigger.type === 'internal' ? trigger.route.key : trigger?.href,\n canPreventDefault: true,\n });\n\n if (!shouldHandleMouseEvent(event)) return;\n\n if (!trigger.isFocused) {\n switchTab(name, { resetOnFocus });\n }\n },\n [onPress, name, resetOnFocus, trigger]\n );\n\n const handleOnLongPress = useCallback>(\n (event) => {\n onLongPress?.(event);\n if (!trigger) return;\n if (event?.isDefaultPrevented()) return;\n\n navigation?.emit({\n type: 'tabLongPress',\n target: trigger.type === 'internal' ? trigger.route.key : trigger?.href,\n });\n\n if (!shouldHandleMouseEvent(event)) return;\n\n if (!trigger.isFocused) {\n switchTab(name, {\n resetOnFocus,\n });\n }\n },\n [onLongPress, name, resetOnFocus, trigger]\n );\n\n const triggerProps = {\n isFocused: Boolean(trigger?.isFocused),\n onPress: handleOnPress,\n onLongPress: handleOnLongPress,\n };\n\n return {\n switchTab,\n getTrigger,\n trigger,\n triggerProps,\n };\n}\n\nconst styles = StyleSheet.create({\n tabTrigger: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n});\n"]} \ No newline at end of file +{"version":3,"file":"TabTrigger.js","sourceRoot":"","sources":["../../src/ui/TabTrigger.tsx"],"names":[],"mappings":";;AAsEA,gCA4BC;AAKD,oCAIC;AAkCD,sCA6GC;;AA1PD,qDAA4C;AAE5C,iCAAyC;AAEzC,+CAAqD;AAErD,6CAAoD;AAEpD,+DAAyD;AACzD,sDAA2C;AAC3C,mEAAoE;AACpE,0CAAyD;AAGzD,kDAAyD;AAqCzD,MAAM,cAAc,GAAG,iBAA4D,CAAC;AAEpF;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,KAAK,EAAmB;IACzF,MAAM,EAAE,OAAO,E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,CAAC,OAAO,EAAE,SAAS,CAAC;QACtC,OAAO,EAAE,aAAa;QACtB,WAAW,EAAE,iBAAiB;KAC/B,CAAC;IAEF,OAAO;QACL,SAAS;QACT,UAAU;QACV,OAAO;QACP,YAAY;KACb,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,UAAU,EAAE;QACV,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,eAAe;KAChC;CACF,CAAC,CAAC","sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport type { ReactNode, ReactElement, ComponentProps } from 'react';\nimport { use, useCallback } from 'react';\nimport type { View, PressableProps } from 'react-native';\nimport { StyleSheet, Pressable } from 'react-native';\n\nimport { TabTriggerMapContext } from './TabContext';\nimport type { TriggerMap } from './common';\nimport { appendBaseUrl } from '../fork/getPathFromState';\nimport { router } from '../imperative-api';\nimport { shouldHandleMouseEvent } from '../link/useLinkToPathProps';\nimport { stripGroupSegmentsFromPath } from '../matchers';\nimport type { TabNavigationState } from '../react-navigation/native';\nimport type { Href } from '../types';\nimport { useNavigatorContext } from '../views/Navigator';\n\ntype PressablePropsWithoutFunctionChildren = Omit & {\n children?: ReactNode | undefined;\n};\n\nexport type TabTriggerProps = PressablePropsWithoutFunctionChildren & {\n /**\n * Name of tab. When used within a `TabList` this sets the name of the tab.\n * Otherwise, this references the name.\n */\n name: string;\n /**\n * Name of tab. Required when used within a `TabList`.\n */\n href?: Href;\n /**\n * Forward props to child component. Useful for custom wrappers.\n */\n asChild?: boolean;\n /**\n * Resets the route when switching to a tab.\n */\n resetOnFocus?: boolean;\n};\n\nexport type TabTriggerOptions = {\n name: string;\n href: Href;\n};\n\nexport type TabTriggerSlotProps = PressablePropsWithoutFunctionChildren &\n React.RefAttributes & {\n isFocused?: boolean;\n href?: string;\n };\n\nconst TabTriggerSlot = Slot as React.ForwardRefExoticComponent;\n\n/**\n * Creates a trigger to navigate to a tab. When used as child of `TabList`, its\n * functionality slightly changes since the `href` prop is required,\n * and the trigger also defines what routes are present in the `Tabs`.\n *\n * When used outside of `TabList`, this component no longer requires an `href`.\n *\n * @example\n * ```tsx\n * \n * \n * \n * \n * \n * \n * ```\n */\nexport function TabTrigger({ asChild, name, href, resetOnFocus, ...props }: TabTriggerProps) {\n const { trigger, triggerProps } = useTabTrigger({\n name,\n resetOnFocus,\n ...props,\n });\n\n // Pressable doesn't accept the extra props, so only pass them if we are using asChild\n if (asChild) {\n return (\n \n {props.children}\n \n );\n } else {\n // These props are not typed, but are allowed by React Native Web\n const reactNativeWebProps = { href: trigger?.resolvedHref };\n\n return (\n \n {props.children}\n \n );\n }\n}\n\n/**\n * @hidden\n */\nexport function isTabTrigger(\n child: ReactElement\n): child is ReactElement> {\n return child.type === TabTrigger;\n}\n\n/**\n * Options for `switchTab` function.\n */\nexport type SwitchToOptions = {\n /**\n * Navigate and reset the history on route focus.\n */\n resetOnFocus?: boolean;\n};\n\nexport type Trigger = TriggerMap[string] & {\n isFocused: boolean;\n resolvedHref: string;\n route: TabNavigationState['routes'][number];\n};\n\nexport type UseTabTriggerResult = {\n switchTab: (name: string, options: SwitchToOptions) => void;\n getTrigger: (name: string) => Trigger | undefined;\n trigger?: Trigger;\n triggerProps: TriggerProps;\n};\n\nexport type TriggerProps = {\n isFocused: boolean;\n onPress: PressableProps['onPress'];\n onLongPress: PressableProps['onLongPress'];\n};\n\n/**\n * Utility hook creating custom `TabTrigger`.\n */\nexport function useTabTrigger(options: TabTriggerProps): UseTabTriggerResult {\n const { state, navigation } = useNavigatorContext();\n const { name, resetOnFocus, onPress, onLongPress } = options;\n const triggerMap = use(TabTriggerMapContext);\n\n const getTrigger = useCallback(\n (name: string) => {\n const config = triggerMap[name];\n\n if (!config) {\n return;\n }\n\n return {\n isFocused: state.index === config.index,\n route: state.routes[config.index]!,\n resolvedHref: stripGroupSegmentsFromPath(appendBaseUrl(config.href)),\n ...config,\n };\n },\n [triggerMap]\n );\n\n const trigger = name !== undefined ? getTrigger(name) : undefined;\n\n const switchTab = useCallback(\n (name: string, options?: SwitchToOptions) => {\n const config = triggerMap[name];\n\n if (config) {\n if (config.type === 'external') {\n return router.navigate(config.href);\n } else {\n return navigation?.dispatch({\n ...config.action,\n type: 'JUMP_TO',\n payload: {\n ...config.action.payload,\n ...options,\n },\n });\n }\n } else {\n return navigation?.dispatch({\n type: 'JUMP_TO',\n payload: {\n name,\n },\n });\n }\n },\n [navigation, triggerMap]\n );\n\n const handleOnPress = useCallback>(\n (event) => {\n onPress?.(event);\n if (!trigger) return;\n if (event?.isDefaultPrevented()) return;\n\n navigation?.emit({\n type: 'tabPress',\n target: trigger.type === 'internal' ? trigger.route.key : trigger?.href,\n canPreventDefault: true,\n });\n\n if (!shouldHandleMouseEvent(event)) return;\n\n if (!trigger.isFocused) {\n switchTab(name, { resetOnFocus });\n }\n },\n [onPress, name, resetOnFocus, trigger]\n );\n\n const handleOnLongPress = useCallback>(\n (event) => {\n onLongPress?.(event);\n if (!trigger) return;\n if (event?.isDefaultPrevented()) return;\n\n navigation?.emit({\n type: 'tabLongPress',\n target: trigger.type === 'internal' ? trigger.route.key : trigger?.href,\n });\n\n if (!shouldHandleMouseEvent(event)) return;\n\n if (!trigger.isFocused) {\n switchTab(name, {\n resetOnFocus,\n });\n }\n },\n [onLongPress, name, resetOnFocus, trigger]\n );\n\n const triggerProps = {\n isFocused: Boolean(trigger?.isFocused),\n onPress: handleOnPress,\n onLongPress: handleOnLongPress,\n };\n\n return {\n switchTab,\n getTrigger,\n trigger,\n triggerProps,\n };\n}\n\nconst styles = StyleSheet.create({\n tabTrigger: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n});\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/ui/common.d.ts.map b/packages/expo-router/build/ui/common.d.ts.map index e3dacbdb313674..1745ae47bba0d5 100644 --- a/packages/expo-router/build/ui/common.d.ts.map +++ b/packages/expo-router/build/ui/common.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"common.d.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IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,sBAAsB,CAAC;CAChC,GACD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE3E,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,aAAa,EAAE,EACzB,eAAe,EAAE,SAAS,EAC1B,OAAO,EAAE,cAAc,CAAC,aAAa,CAAC,EACtC,gBAAgB,EAAE,SAAS,GAAG,MAAM,EACpC,gBAAgB,EAAE,UAAU,EAC5B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,MAAM;;;EA0InB;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAAG,SAAS,EAClE,YAAY,CAAC,EAAE,MAAM,GACpB,sBAAsB,CAsCxB"} \ No newline at end of file diff --git a/packages/expo-router/build/ui/common.js b/packages/expo-router/build/ui/common.js index 94d510d129d6b4..bdbbc8d33174c8 100644 --- a/packages/expo-router/build/ui/common.js +++ b/packages/expo-router/build/ui/common.js @@ -58,7 +58,8 @@ function triggersToScreens(triggers, layoutRouteNode, linking, initialRouteName, break; state = state.state.routes[state.state.index ?? state.state.routes.length - 1]; } - routeState = state.state?.routes[state.state.index ?? state.state.routes.length - 1] || state; + routeState = + state.state?.routes[state.state.index ?? state.state.routes.length - 1] || state; const routeNode = layoutRouteNode.children.find((child) => child.route === routeState?.name); if (!routeNode) { console.warn(`Unable to find routeNode for trigger ${JSON.stringify(trigger)}. This might be a bug with Expo Router`); diff --git a/packages/expo-router/build/ui/common.js.map b/packages/expo-router/build/ui/common.js.map index 4445ae86641cbc..fdfb493a2dd535 100644 --- a/packages/expo-router/build/ui/common.js.map +++ b/packages/expo-router/build/ui/common.js.map @@ -1 +1 @@ -{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/ui/common.tsx"],"names":[],"mappings":";;;AA2CA,8CAgJC;AAED,sCAyCC;AAnOD,uCAA0E;AAC1E,8CAAsD;AAEtD,8CAA8C;AAC9C,iCAA8B;AAC9B,4CAAoD;AAQvC,QAAA,QAAQ,GAAG,WAAI,CAAC;AA2B7B,SAAgB,iBAAiB,CAC/B,QAAyB,EACzB,eAA0B,EAC1B,OAAsC,EACtC,gBAAoC,EACpC,gBAA4B,EAC5B,SAAoB,EACpB,UAAkB;IAElB,MAAM,OAAO,GAAoB,EAAE,CAAC;IAEpC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,CAAC,IAAI,IAAI,gBAAgB,EAAE,CAAC;YACrC,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACrD,MAAM,IAAI,KAAK,CACb,WAAW,IAAI,CAAC,SAAS,CAAC;gBACxB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB,CAAC,wCAAwC,IAAI,CAAC,SAAS,CAAC;gBACvD,IAAI,EAAE,aAAa,CAAC,IAAI;gBACxB,IAAI,EAAE,aAAa,CAAC,IAAI;aACzB,CAAC,oCAAoC,CACvC,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAChC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtB,SAAS;QACX,CAAC;QAED,IAAI,YAAY,GAAG,IAAA,kBAAW,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAE7C,IAAI,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACnC,MAAM,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AE,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACtE,IAAI,SAAS,EAAE,CAAC;gBACd,KAAK,GAAG,SAAS,CAAC;YACpB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,WAAW;KACrB,CAAC;AACJ,CAAC","sourcesContent":["import type { ExpoTabActionType } from './TabRouter';\nimport type { UrlObject } from '../LocationProvider';\nimport type { RouteNode } from '../Route';\nimport { resolveHref, resolveHrefStringWithSegments } from '../link/href';\nimport { sortRoutesWithInitial } from '../sortRoutes';\nimport type { Href } from '../types';\nimport { routeToScreen } from '../useScreens';\nimport { Slot } from './Slot';\nimport { NOT_FOUND_ROUTE_NAME } from '../constants';\nimport type {\n LinkingOptions,\n ParamListBase,\n PartialRoute,\n Route,\n} from '../react-navigation/native';\n\nexport const ViewSlot = Slot;\n\nexport type ScreenTrigger =\n | {\n type: 'internal';\n href: Href;\n name: string;\n }\n | {\n type: 'external';\n name: string;\n href: string;\n };\n\ntype JumpToNavigationAction = Extract;\ntype TriggerConfig =\n | {\n type: 'internal';\n name: string;\n href: string;\n routeNode: RouteNode;\n action: JumpToNavigationAction;\n }\n | { type: 'external'; name: string; href: string };\n\nexport type TriggerMap = Record;\n\nexport function triggersToScreens(\n triggers: ScreenTrigger[],\n layoutRouteNode: RouteNode,\n linking: LinkingOptions,\n initialRouteName: undefined | string,\n parentTriggerMap: TriggerMap,\n routeInfo: UrlObject,\n contextKey: string\n) {\n const configs: TriggerConfig[] = [];\n\n for (const trigger of triggers) {\n if (trigger.name in parentTriggerMap) {\n const parentTrigger = parentTriggerMap[trigger.name];\n throw new Error(\n `Trigger ${JSON.stringify({\n name: trigger.name,\n href: trigger.href,\n })} has the same name as parent trigger ${JSON.stringify({\n name: parentTrigger.name,\n href: parentTrigger.href,\n })}. Triggers must have unique names.`\n );\n }\n\n if (trigger.type === 'external') {\n configs.push(trigger);\n continue;\n }\n\n let resolvedHref = resolveHref(trigger.href);\n\n if (resolvedHref.startsWith('../')) {\n throw new Error('Trigger href cannot link to a parent directory');\n }\n\n const segmentsWithoutGroups = contextKey.split('/').filter((segment) => {\n return !(segment.startsWith('(') && segment.endsWith(')'));\n });\n\n resolvedHref = resolveHrefStringWithSegments(\n resolvedHref,\n {\n ...routeInfo,\n segments: segmentsWithoutGroups,\n },\n { relativeToDirectory: true }\n );\n\n let state = linking.getStateFromPath?.(resolvedHref, linking.config)?.routes[0];\n\n if (!state) {\n // This shouldn't occur, as you should get the global +not-found\n console.warn(\n `Unable to find screen for trigger ${JSON.stringify(trigger)}. Does this point to a valid screen?`\n );\n continue;\n }\n\n let routeState = state;\n\n if (routeState.name === NOT_FOUND_ROUTE_NAME) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Tab trigger '${trigger.name}' has the href '${trigger.href}' which points to a +not-found route.`\n );\n }\n continue;\n }\n\n const targetStateName = layoutRouteNode.route || '__root';\n\n // The state object is the current state from the rootNavigator\n // We need to work out the state for just this trigger\n while (state?.state) {\n if (state.name === targetStateName) break;\n state = state.state.routes[state.state.index ?? state.state.routes.length - 1];\n }\n routeState = state.state?.routes[state.state.index ?? state.state.routes.length - 1] || state;\n\n const routeNode = layoutRouteNode.children.find((child) => child.route === routeState?.name);\n\n if (!routeNode) {\n console.warn(\n `Unable to find routeNode for trigger ${JSON.stringify(trigger)}. This might be a bug with Expo Router`\n );\n continue;\n }\n\n const duplicateTrigger =\n trigger.type === 'internal' &&\n configs.find((config): config is Extract => {\n if (config.type === 'external') {\n return false;\n }\n\n return config.routeNode.route === routeNode.route;\n });\n\n if (duplicateTrigger) {\n const duplicateTriggerText = `${JSON.stringify({ name: duplicateTrigger.name, href: duplicateTrigger.href })} and ${JSON.stringify({ name: trigger.name, href: trigger.href })}`;\n\n throw new Error(\n `A navigator cannot contain multiple trigger components that map to the same sub-segment. Consider adding a shared group and assigning a group to each trigger. Conflicting triggers:\\n\\t${duplicateTriggerText}.\\nBoth triggers map to route ${routeNode.route}.`\n );\n }\n\n configs.push({\n ...trigger,\n href: resolvedHref,\n routeNode,\n action: stateToAction(state, layoutRouteNode.route),\n });\n }\n\n const sortFn = sortRoutesWithInitial(initialRouteName);\n\n const sortedConfigs = configs.sort((a, b) => {\n // External routes should be last. They will eventually be dropped\n if (a.type === 'external' && b.type === 'external') {\n return 0;\n } else if (a.type === 'external') {\n return 1;\n } else if (b.type === 'external') {\n return -1;\n }\n\n return sortFn(a.routeNode, b.routeNode);\n });\n\n const children: React.JSX.Element[] = [];\n const triggerMap: TriggerMap = { ...parentTriggerMap };\n\n for (const [index, config] of sortedConfigs.entries()) {\n triggerMap[config.name] = { ...config, index };\n\n if (config.type === 'internal') {\n children.push(routeToScreen(config.routeNode));\n }\n }\n return {\n children,\n triggerMap,\n };\n}\n\nexport function stateToAction(\n state: PartialRoute> | undefined,\n startAtRoute?: string\n): JumpToNavigationAction {\n const rootPayload: any = {};\n let payload = rootPayload;\n\n startAtRoute = startAtRoute === '' ? '__root' : startAtRoute;\n\n let foundStartingPoint = startAtRoute === undefined || !state?.state;\n\n while (state) {\n if (foundStartingPoint) {\n if (payload === rootPayload) {\n payload.name = state.name;\n } else {\n payload.screen = state.name;\n }\n payload.params = state.params ? { ...state.params } : {};\n\n state = state.state?.routes[state.state?.routes.length - 1];\n\n if (state) {\n payload.params ??= {};\n payload = payload.params;\n }\n } else {\n if (state.name === startAtRoute) {\n foundStartingPoint = true;\n }\n const nextState = state.state?.routes[state.state?.routes.length - 1];\n if (nextState) {\n state = nextState;\n }\n }\n }\n\n return {\n type: 'JUMP_TO',\n payload: rootPayload,\n };\n}\n"]} \ No newline at end of file +{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/ui/common.tsx"],"names":[],"mappings":";;;AA2CA,8CAiJC;AAED,sCAyCC;AApOD,uCAA0E;AAC1E,8CAAsD;AAEtD,8CAA8C;AAC9C,iCAA8B;AAC9B,4CAAoD;AA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import type { UrlObject } from '../LocationProvider';\nimport type { RouteNode } from '../Route';\nimport { resolveHref, resolveHrefStringWithSegments } from '../link/href';\nimport { sortRoutesWithInitial } from '../sortRoutes';\nimport type { Href } from '../types';\nimport { routeToScreen } from '../useScreens';\nimport { Slot } from './Slot';\nimport { NOT_FOUND_ROUTE_NAME } from '../constants';\nimport type {\n LinkingOptions,\n ParamListBase,\n PartialRoute,\n Route,\n} from '../react-navigation/native';\n\nexport const ViewSlot = Slot;\n\nexport type ScreenTrigger =\n | {\n type: 'internal';\n href: Href;\n name: string;\n }\n | {\n type: 'external';\n name: string;\n href: string;\n };\n\ntype JumpToNavigationAction = Extract;\ntype TriggerConfig =\n | {\n type: 'internal';\n name: string;\n href: string;\n routeNode: RouteNode;\n action: JumpToNavigationAction;\n }\n | { type: 'external'; name: string; href: string };\n\nexport type TriggerMap = Record;\n\nexport function triggersToScreens(\n triggers: ScreenTrigger[],\n layoutRouteNode: RouteNode,\n linking: LinkingOptions,\n initialRouteName: undefined | string,\n parentTriggerMap: TriggerMap,\n routeInfo: UrlObject,\n contextKey: string\n) {\n const configs: TriggerConfig[] = [];\n\n for (const trigger of triggers) {\n if (trigger.name in parentTriggerMap) {\n const parentTrigger = parentTriggerMap[trigger.name]!;\n throw new Error(\n `Trigger ${JSON.stringify({\n name: trigger.name,\n href: trigger.href,\n })} has the same name as parent trigger ${JSON.stringify({\n name: parentTrigger.name,\n href: parentTrigger.href,\n })}. Triggers must have unique names.`\n );\n }\n\n if (trigger.type === 'external') {\n configs.push(trigger);\n continue;\n }\n\n let resolvedHref = resolveHref(trigger.href);\n\n if (resolvedHref.startsWith('../')) {\n throw new Error('Trigger href cannot link to a parent directory');\n }\n\n const segmentsWithoutGroups = contextKey.split('/').filter((segment) => {\n return !(segment.startsWith('(') && segment.endsWith(')'));\n });\n\n resolvedHref = resolveHrefStringWithSegments(\n resolvedHref,\n {\n ...routeInfo,\n segments: segmentsWithoutGroups,\n },\n { relativeToDirectory: true }\n );\n\n let state = linking.getStateFromPath?.(resolvedHref, linking.config)?.routes[0];\n\n if (!state) {\n // This shouldn't occur, as you should get the global +not-found\n console.warn(\n `Unable to find screen for trigger ${JSON.stringify(trigger)}. Does this point to a valid screen?`\n );\n continue;\n }\n\n let routeState = state;\n\n if (routeState.name === NOT_FOUND_ROUTE_NAME) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Tab trigger '${trigger.name}' has the href '${trigger.href}' which points to a +not-found route.`\n );\n }\n continue;\n }\n\n const targetStateName = layoutRouteNode.route || '__root';\n\n // The state object is the current state from the rootNavigator\n // We need to work out the state for just this trigger\n while (state?.state) {\n if (state.name === targetStateName) break;\n state = state.state.routes[state.state.index ?? state.state.routes.length - 1]!;\n }\n routeState =\n state!.state?.routes[state!.state.index ?? state!.state.routes.length - 1] || state;\n\n const routeNode = layoutRouteNode.children.find((child) => child.route === routeState?.name);\n\n if (!routeNode) {\n console.warn(\n `Unable to find routeNode for trigger ${JSON.stringify(trigger)}. This might be a bug with Expo Router`\n );\n continue;\n }\n\n const duplicateTrigger =\n trigger.type === 'internal' &&\n configs.find((config): config is Extract => {\n if (config.type === 'external') {\n return false;\n }\n\n return config.routeNode.route === routeNode.route;\n });\n\n if (duplicateTrigger) {\n const duplicateTriggerText = `${JSON.stringify({ name: duplicateTrigger.name, href: duplicateTrigger.href })} and ${JSON.stringify({ name: trigger.name, href: trigger.href })}`;\n\n throw new Error(\n `A navigator cannot contain multiple trigger components that map to the same sub-segment. Consider adding a shared group and assigning a group to each trigger. Conflicting triggers:\\n\\t${duplicateTriggerText}.\\nBoth triggers map to route ${routeNode.route}.`\n );\n }\n\n configs.push({\n ...trigger,\n href: resolvedHref,\n routeNode,\n action: stateToAction(state, layoutRouteNode.route),\n });\n }\n\n const sortFn = sortRoutesWithInitial(initialRouteName);\n\n const sortedConfigs = configs.sort((a, b) => {\n // External routes should be last. They will eventually be dropped\n if (a.type === 'external' && b.type === 'external') {\n return 0;\n } else if (a.type === 'external') {\n return 1;\n } else if (b.type === 'external') {\n return -1;\n }\n\n return sortFn(a.routeNode, b.routeNode);\n });\n\n const children: React.JSX.Element[] = [];\n const triggerMap: TriggerMap = { ...parentTriggerMap };\n\n for (const [index, config] of sortedConfigs.entries()) {\n triggerMap[config.name] = { ...config, index };\n\n if (config.type === 'internal') {\n children.push(routeToScreen(config.routeNode));\n }\n }\n return {\n children,\n triggerMap,\n };\n}\n\nexport function stateToAction(\n state: PartialRoute> | undefined,\n startAtRoute?: string\n): JumpToNavigationAction {\n const rootPayload: any = {};\n let payload = rootPayload;\n\n startAtRoute = startAtRoute === '' ? '__root' : startAtRoute;\n\n let foundStartingPoint = startAtRoute === undefined || !state?.state;\n\n while (state) {\n if (foundStartingPoint) {\n if (payload === rootPayload) {\n payload.name = state.name;\n } else {\n payload.screen = state.name;\n }\n payload.params = state.params ? { ...state.params } : {};\n\n state = state.state?.routes[state.state?.routes.length - 1];\n\n if (state) {\n payload.params ??= {};\n payload = payload.params;\n }\n } else {\n if (state.name === startAtRoute) {\n foundStartingPoint = true;\n }\n const nextState = state.state?.routes[state.state?.routes.length - 1];\n if (nextState) {\n state = nextState;\n }\n }\n }\n\n return {\n type: 'JUMP_TO',\n payload: rootPayload,\n };\n}\n"]} \ No newline at end of file diff --git a/packages/expo-router/build/useScreens.js.map b/packages/expo-router/build/useScreens.js.map index a2ea4eb5705309..3ffe1b7c4ba8ef 100644 --- a/packages/expo-router/build/useScreens.js.map +++ b/packages/expo-router/build/useScreens.js.map @@ -1 +1 @@ -{"version":3,"file":"useScreens.js","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsKb,4CAiCC;AAuDD,gEA8IC;AA+ED,oDAwBC;AAED,sCAcC;AAED,sCAaC;;;AAhhBD,+CAAuD;AAGvD,mCAA8F;AAC9F,8DAAiE;AACjE,gDAAqE;AACrE,gEAAoD;AACpD,6EAA0E;AAC1E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AAC,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, useMemo } 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';\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 { generateStringUrlForState, getPathAndParamsFromStringUrl } from './navigationEvents/utils';\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 = Record,\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;\n options?:\n | TOptions\n | ((prop: { route: RouteProp; navigation: any }) => TOptions);\n\n listeners?:\n | ScreenListeners\n | ((prop: {\n route: RouteProp;\n navigation: any;\n }) => ScreenListeners);\n\n getId?: ({ params }: { params?: Record }) => 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 }[] {\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;\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,\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 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 {children};\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>();\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>\n | React.ComponentType<{ segment?: string }>;\n\n let LayoutSuspenseFallback: React.ComponentType | 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;\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 ;\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;\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 \n \n {unstable_navigationEvents.isEnabled() && isRouteType && hasRouteKey && (\n \n )}\n \n \n \n }>\n \n \n \n \n \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 & {\n isFocused(): boolean;\n };\n screenId: string;\n}) {\n const stateForPath = useStateForPath();\n const isFirstRenderRef = React.useRef(true);\n const hasBlurredRef = React.useRef(true);\n const stringUrl = useMemo(() => generateStringUrlForState(stateForPath), [stateForPath]);\n\n if (isFirstRenderRef.current) {\n isFirstRenderRef.current = false;\n if (stringUrl) {\n unstable_navigationEvents.emit('pageWillRender', {\n ...getPathAndParamsFromStringUrl(stringUrl),\n screenId,\n });\n }\n }\n\n useEffect(() => {\n if (stringUrl) {\n return () => {\n unstable_navigationEvents.emit('pageRemoved', {\n ...getPathAndParamsFromStringUrl(stringUrl),\n screenId,\n });\n };\n }\n return () => {};\n }, [stringUrl, screenId]);\n\n const isFocused = navigation.isFocused();\n\n if (isFocused && stringUrl) {\n unstable_navigationEvents.emit('pageFocused', {\n ...getPathAndParamsFromStringUrl(stringUrl),\n screenId,\n });\n hasBlurredRef.current = false;\n }\n\n useEffect(() => {\n if (stringUrl) {\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 ...getPathAndParamsFromStringUrl(stringUrl),\n screenId,\n });\n hasBlurredRef.current = false;\n }\n });\n const cleanBlur = navigation.addListener('blur', () => {\n unstable_navigationEvents.emit('pageBlurred', {\n ...getPathAndParamsFromStringUrl(stringUrl),\n screenId,\n });\n hasBlurredRef.current = true;\n });\n return () => {\n cleanFocus();\n cleanBlur();\n };\n }\n return () => {};\n }, [navigation, stringUrl, 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 = {}\n) {\n return (\n getQualifiedRouteComponent(route)}\n />\n );\n}\n\nexport function getSingularId(name: string, options: Record = {}) {\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"]} \ No newline at end of file +{"version":3,"file":"useScreens.js","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsKb,4CAiCC;AAuDD,gEA8IC;AA+ED,oDAwBC;AAED,sCAcC;AAED,sCAaC;;;AAhhBD,+CAAuD;AAGvD,mCAA8F;AAC9F,8DAAiE;AACjE,gDAAqE;AACrE,gEAAoD;AACpD,6EAA0E;AAC1E,qGAAoG;AACpG,yDAA+D;AAC/D,oDAAoG;AACpG,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,mB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AK,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, useMemo } 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';\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 { generateStringUrlForState, getPathAndParamsFromStringUrl } from './navigationEvents/utils';\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 = Record,\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;\n options?:\n | TOptions\n | ((prop: { route: RouteProp; navigation: any }) => TOptions);\n\n listeners?:\n | ScreenListeners\n | ((prop: {\n route: RouteProp;\n navigation: any;\n }) => ScreenListeners);\n\n getId?: ({ params }: { params?: Record }) => 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 }[] {\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;\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,\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 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 {children};\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>();\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>\n | React.ComponentType<{ segment?: string }>;\n\n let LayoutSuspenseFallback: React.ComponentType | 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;\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 ;\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;\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 \n \n {unstable_navigationEvents.isEnabled() && isRouteType && hasRouteKey && (\n \n )}\n \n \n \n }>\n \n \n \n \n \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 & {\n isFocused(): boolean;\n };\n screenId: string;\n}) {\n const stateForPath = useStateForPath();\n const isFirstRenderRef = React.useRef(true);\n const hasBlurredRef = React.useRef(true);\n const stringUrl = useMemo(() => generateStringUrlForState(stateForPath), [stateForPath]);\n\n if (isFirstRenderRef.current) {\n isFirstRenderRef.current = false;\n if (stringUrl) {\n unstable_navigationEvents.emit('pageWillRender', {\n ...getPathAndParamsFromStringUrl(stringUrl),\n screenId,\n });\n }\n }\n\n useEffect(() => {\n if (stringUrl) {\n return () => {\n unstable_navigationEvents.emit('pageRemoved', {\n ...getPathAndParamsFromStringUrl(stringUrl),\n screenId,\n });\n };\n }\n return () => {};\n }, [stringUrl, screenId]);\n\n const isFocused = navigation.isFocused();\n\n if (isFocused && stringUrl) {\n unstable_navigationEvents.emit('pageFocused', {\n ...getPathAndParamsFromStringUrl(stringUrl),\n screenId,\n });\n hasBlurredRef.current = false;\n }\n\n useEffect(() => {\n if (stringUrl) {\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 ...getPathAndParamsFromStringUrl(stringUrl),\n screenId,\n });\n hasBlurredRef.current = false;\n }\n });\n const cleanBlur = navigation.addListener('blur', () => {\n unstable_navigationEvents.emit('pageBlurred', {\n ...getPathAndParamsFromStringUrl(stringUrl),\n screenId,\n });\n hasBlurredRef.current = true;\n });\n return () => {\n cleanFocus();\n cleanBlur();\n };\n }\n return () => {};\n }, [navigation, stringUrl, 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 = {}\n) {\n return (\n getQualifiedRouteComponent(route)}\n />\n );\n}\n\nexport function getSingularId(name: string, options: Record = {}) {\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"]} \ No newline at end of file diff --git a/packages/expo-router/build/views/Navigator.d.ts b/packages/expo-router/build/views/Navigator.d.ts index ea4e05eb91cc71..bab7cf826adfb8 100644 --- a/packages/expo-router/build/views/Navigator.d.ts +++ b/packages/expo-router/build/views/Navigator.d.ts @@ -46,7 +46,7 @@ export declare function Slot(props: Omit, 'children'>): impo /** * Render the current navigator content. */ -declare function NavigatorSlot(): React.JSX.Element; +declare function NavigatorSlot(): React.JSX.Element | null; /** * The default navigator for the app when no root _layout is provided. */ diff --git a/packages/expo-router/build/views/Navigator.d.ts.map b/packages/expo-router/build/views/Navigator.d.ts.map index 62dc06e4b9dcc6..7f675a485fdd8c 100644 --- a/packages/expo-router/build/views/Navigator.d.ts.map +++ b/packages/expo-router/build/views/Navigator.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Navigator.d.ts","sourceRoot":"","sources":["../../src/views/Navigator.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGlE,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,GAAG;IAC5E,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,gBAAgB,6CAA0D,CAAC;AAMxF,KAAK,0BAA0B,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7E,KAAK,2BAA2B,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9E,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,0BAA0B,IAAI;IACjE,gBAAgB,CAAC,EAAE,2BAA2B,CAAC,kBAAkB,CAAC,CAAC;IACnE,aAAa,CAAC,EAAE,2BAA2B,CAAC,eAAe,CAAC,CAAC;IAC7D,QAAQ,CAAC,EAAE,2BAA2B,CAAC,UAAU,CAAC,CAAC;IACnD,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,aAAa,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;CAC5D,CAAC;AAEF;;;;GAIG;AACH,wBAAg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AAC;IACnE,aAAa,CAAC,EAAE,2BAA2B,CAAC,eAAe,CAAC,CAAC;IAC7D,QAAQ,CAAC,EAAE,2BAA2B,CAAC,UAAU,CAAC,CAAC;IACnD,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,aAAa,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;CAC5D,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,0BAA0B,GAAG,OAAO,WAAW,EAAE,EACnF,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,MAAM,EACN,aAAa,GACd,EAAE,cAAc,CAAC,CAAC,CAAC,kDA0CnB;yBAhDe,SAAS;;;;;AAkDzB;;GAEG;AACH,wBAAgB,mBAAmB,0BAMlC;AAqBD;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,2CAchE;AAED;;GAEG;AACH,iBAAS,aAAa,6BAMrB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,4CAS/B"} \ No newline at end of file diff --git a/packages/expo-router/build/views/Navigator.js.map b/packages/expo-router/build/views/Navigator.js.map index 8e417af2b20a08..b68c9d54cd6a51 100644 --- a/packages/expo-router/build/views/Navigator.js.map +++ b/packages/expo-router/build/views/Navigator.js.map @@ -1 +1 @@ -{"version":3,"file":"Navigator.js","sourceRoot":"","sources":["../../src/views/Navigator.tsx"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCb,8BAgDC;AAKD,kDAMC;AAgCD,oBAcC;AAgBD,4CASC;;AAxKD,6CAA+B;AAC/B,mFAA8D;AAE9D,qCAAkC;AAClC,oCAAyC;AACzC,wDAAqD;AACrD,oEAAuE;AAEvE,uDAAkE;AAClE,8CAAiD;AA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GAAG,mBAAmB,EAAE,CAAC;IAEtC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAEvC,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,IAAI,CAAC;AACtE,CAAC;AAED;;GAEG;AACH,SAAgB,gBAAgB;IAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,uBAAC,aAAa,KAAG,CAAC;IAC3B,CAAC;IACD,OAAO,CACL,uBAAC,6CAAY,IAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,YAC9B,uBAAC,aAAa,KAAG,GACJ,CAChB,CAAC;AACJ,CAAC;AAED,SAAS,CAAC,IAAI,GAAG,aAAa,CAAC;AAC/B,SAAS,CAAC,UAAU,GAAG,mBAAmB,CAAC;AAE3C,wCAAwC;AACxC,SAAS,CAAC,MAAM,GAAG,eAAM,CAAC","sourcesContent":["// Copyright © 2024 650 Industries.\n'use client';\n\nimport * as React from 'react';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\nimport { Screen } from './Screen';\nimport { useContextKey } from '../Route';\nimport { StackRouter } from '../layouts/StackClient';\nimport { useFilterScreenChildren } from '../layouts/withLayoutContext';\nimport type { RouterFactory } from '../react-navigation/native';\nimport { useNavigationBuilder } from '../react-navigation/native';\nimport { useSortedScreens } from '../useScreens';\n\nexport type NavigatorContextValue = ReturnType & {\n contextKey: string;\n router: RouterFactory;\n};\n\nexport const NavigatorContext = React.createContext(null);\n\nif (process.env.NODE_ENV !== 'production') {\n NavigatorContext.displayName = 'NavigatorContext';\n}\n\ntype UseNavigationBuilderRouter = Parameters[0];\ntype UseNavigationBuilderOptions = Parameters[1];\n\nexport type NavigatorProps = {\n initialRouteName?: UseNavigationBuilderOptions['initialRouteName'];\n screenOptions?: UseNavigationBuilderOptions['screenOptions'];\n children?: UseNavigationBuilderOptions['children'];\n router?: T;\n routerOptions?: Omit[0], 'initialRouteName'>;\n};\n\n/**\n * An unstyled custom navigator. Good for basic web layouts.\n *\n * @hidden\n */\nexport function Navigator({\n initialRouteName,\n screenOptions,\n children,\n router,\n routerOptions,\n}: NavigatorProps) {\n const contextKey = useContextKey();\n\n // A custom navigator can have a mix of Screen and other components (like a Slot inside a View)\n const {\n screens,\n children: nonScreenChildren,\n protectedScreens,\n } = useFilterScreenChildren(children, {\n isCustomNavigator: true,\n contextKey,\n });\n\n const sortedScreens = useSortedScreens(screens ?? [], protectedScreens);\n\n router ||= StackRouter as unknown as T;\n\n const navigation = useNavigationBuilder(router, {\n // Used for getting the parent with navigation.getParent('/normalized/path')\n ...routerOptions,\n id: contextKey,\n children: sortedScreens || [],\n screenOptions,\n initialRouteName,\n });\n\n // useNavigationBuilder requires at least one screen to be defined otherwise it will throw.\n if (!sortedScreens.length) {\n console.warn(`Navigator at \"${contextKey}\" has no children.`);\n return null;\n }\n\n return (\n \n {nonScreenChildren}\n \n );\n}\n\n/**\n * @hidden\n */\nexport function useNavigatorContext() {\n const context = React.use(NavigatorContext);\n if (!context) {\n throw new Error('useNavigatorContext must be used within a ');\n }\n return context;\n}\n\nfunction SlotNavigator(props: NavigatorProps) {\n const contextKey = useContextKey();\n\n // Allows adding Screen components as children to configure routes.\n const { screens, protectedScreens } = useFilterScreenChildren([], {\n contextKey,\n });\n\n const { state, descriptors, NavigationContent } = useNavigationBuilder(StackRouter, {\n ...props,\n id: contextKey,\n children: useSortedScreens(screens ?? [], protectedScreens),\n });\n\n return (\n {descriptors[state.routes[state.index].key].render()}\n );\n}\n\n/**\n * Renders the currently selected content.\n *\n * There are actually two different implementations of ``:\n * - Used inside a `_layout` as the `Navigator`\n * - Used inside a `Navigator` as the content\n *\n * Since a custom `Navigator` will set the `NavigatorContext.contextKey` to\n * the current `_layout`, you can use this to determine if you are inside\n * a custom navigator or not.\n */\nexport function Slot(props: Omit, 'children'>) {\n const contextKey = useContextKey();\n const context = React.use(NavigatorContext);\n\n if (context?.contextKey !== contextKey) {\n // The _layout has changed since the last navigator\n return ;\n }\n\n /*\n * The user has defined a custom navigator\n * \n */\n return ;\n}\n\n/**\n * Render the current navigator content.\n */\nfunction NavigatorSlot() {\n const context = useNavigatorContext();\n\n const { state, descriptors } = context;\n\n return descriptors[state.routes[state.index].key]?.render() ?? null;\n}\n\n/**\n * The default navigator for the app when no root _layout is provided.\n */\nexport function DefaultNavigator() {\n if (process.env.EXPO_OS === 'android') {\n return ;\n }\n return (\n \n \n \n );\n}\n\nNavigator.Slot = NavigatorSlot;\nNavigator.useContext = useNavigatorContext;\n\n/** Used to configure route settings. */\nNavigator.Screen = Screen;\n"]} \ No newline at end of file +{"version":3,"file":"Navigator.js","sourceRoot":"","sources":["../../src/views/Navigator.tsx"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCb,8BAgDC;AAKD,kDAMC;AAgCD,oBAcC;AAgBD,4CASC;;AAxKD,6CAA+B;AAC/B,mFAA8D;AAE9D,qCAAkC;AAClC,oCAAyC;AACzC,wDAAqD;AACrD,oEAAuE;AAEvE,uDAAkE;AAClE,8CAAiD;AAOpC,QAAA,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAA+B,IAAI,CAAC,CAAC;AAExF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;IAC1C,wBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC;AACpD,CAAC;AAaD;;;;GAIG;AACH,SAAgB,SAAS,CAA4D,EACnF,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,MAAM,EACN,aAAa,GACK;IAClB,MAAM,UAAU,GAAG,IAAA,qBAAa,GAAE,CAAC;IAEnC,+FAA+F;IAC/F,MAAM,EACJ,OAAO,EACP,QAAQ,EAAE,iBAAiB,EAC3B,gBAAgB,GACj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EAAE,CAAC,EAAE,YAC9B,uBAAC,aAAa,KAAG,GACJ,CAChB,CAAC;AACJ,CAAC;AAED,SAAS,CAAC,IAAI,GAAG,aAAa,CAAC;AAC/B,SAAS,CAAC,UAAU,GAAG,mBAAmB,CAAC;AAE3C,wCAAwC;AACxC,SAAS,CAAC,MAAM,GAAG,eAAM,CAAC","sourcesContent":["// Copyright © 2024 650 Industries.\n'use client';\n\nimport * as React from 'react';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\nimport { Screen } from './Screen';\nimport { useContextKey } from '../Route';\nimport { StackRouter } from '../layouts/StackClient';\nimport { useFilterScreenChildren } from '../layouts/withLayoutContext';\nimport type { RouterFactory } from '../react-navigation/native';\nimport { useNavigationBuilder } from '../react-navigation/native';\nimport { useSortedScreens } from '../useScreens';\n\nexport type NavigatorContextValue = ReturnType & {\n contextKey: string;\n router: RouterFactory;\n};\n\nexport const NavigatorContext = React.createContext(null);\n\nif (process.env.NODE_ENV !== 'production') {\n NavigatorContext.displayName = 'NavigatorContext';\n}\n\ntype UseNavigationBuilderRouter = Parameters[0];\ntype UseNavigationBuilderOptions = Parameters[1];\n\nexport type NavigatorProps = {\n initialRouteName?: UseNavigationBuilderOptions['initialRouteName'];\n screenOptions?: UseNavigationBuilderOptions['screenOptions'];\n children?: UseNavigationBuilderOptions['children'];\n router?: T;\n routerOptions?: Omit[0], 'initialRouteName'>;\n};\n\n/**\n * An unstyled custom navigator. Good for basic web layouts.\n *\n * @hidden\n */\nexport function Navigator({\n initialRouteName,\n screenOptions,\n children,\n router,\n routerOptions,\n}: NavigatorProps) {\n const contextKey = useContextKey();\n\n // A custom navigator can have a mix of Screen and other components (like a Slot inside a View)\n const {\n screens,\n children: nonScreenChildren,\n protectedScreens,\n } = useFilterScreenChildren(children, {\n isCustomNavigator: true,\n contextKey,\n });\n\n const sortedScreens = useSortedScreens(screens ?? [], protectedScreens);\n\n router ||= StackRouter as unknown as T;\n\n const navigation = useNavigationBuilder(router, {\n // Used for getting the parent with navigation.getParent('/normalized/path')\n ...routerOptions,\n id: contextKey,\n children: sortedScreens || [],\n screenOptions,\n initialRouteName,\n });\n\n // useNavigationBuilder requires at least one screen to be defined otherwise it will throw.\n if (!sortedScreens.length) {\n console.warn(`Navigator at \"${contextKey}\" has no children.`);\n return null;\n }\n\n return (\n \n {nonScreenChildren}\n \n );\n}\n\n/**\n * @hidden\n */\nexport function useNavigatorContext() {\n const context = React.use(NavigatorContext);\n if (!context) {\n throw new Error('useNavigatorContext must be used within a ');\n }\n return context;\n}\n\nfunction SlotNavigator(props: NavigatorProps) {\n const contextKey = useContextKey();\n\n // Allows adding Screen components as children to configure routes.\n const { screens, protectedScreens } = useFilterScreenChildren([], {\n contextKey,\n });\n\n const { state, descriptors, NavigationContent } = useNavigationBuilder(StackRouter, {\n ...props,\n id: contextKey,\n children: useSortedScreens(screens ?? [], protectedScreens),\n });\n\n return (\n {descriptors[state.routes[state.index]!.key]!.render()}\n );\n}\n\n/**\n * Renders the currently selected content.\n *\n * There are actually two different implementations of ``:\n * - Used inside a `_layout` as the `Navigator`\n * - Used inside a `Navigator` as the content\n *\n * Since a custom `Navigator` will set the `NavigatorContext.contextKey` to\n * the current `_layout`, you can use this to determine if you are inside\n * a custom navigator or not.\n */\nexport function Slot(props: Omit, 'children'>) {\n const contextKey = useContextKey();\n const context = React.use(NavigatorContext);\n\n if (context?.contextKey !== contextKey) {\n // The _layout has changed since the last navigator\n return ;\n }\n\n /*\n * The user has defined a custom navigator\n * \n */\n return ;\n}\n\n/**\n * Render the current navigator content.\n */\nfunction NavigatorSlot() {\n const context = useNavigatorContext();\n\n const { state, descriptors } = context;\n\n return descriptors[state.routes[state.index]!.key]?.render() ?? null;\n}\n\n/**\n * The default navigator for the app when no root _layout is provided.\n */\nexport function DefaultNavigator() {\n if (process.env.EXPO_OS === 'android') {\n return ;\n }\n return (\n \n \n \n );\n}\n\nNavigator.Slot = NavigatorSlot;\nNavigator.useContext = useNavigatorContext;\n\n/** Used to configure route settings. */\nNavigator.Screen = Screen;\n"]} \ No newline at end of file diff --git a/packages/expo-router/src/ExpoRoot.tsx b/packages/expo-router/src/ExpoRoot.tsx index 93472e7979393c..0d72b805684340 100644 --- a/packages/expo-router/src/ExpoRoot.tsx +++ b/packages/expo-router/src/ExpoRoot.tsx @@ -179,7 +179,7 @@ function Content() { }); return ( - {descriptors[state.routes[state.index].key].render()} + {descriptors[state.routes[state.index]!.key]!.render()} ); } diff --git a/packages/expo-router/src/LocationProvider.tsx b/packages/expo-router/src/LocationProvider.tsx index d396d45ddca80e..38d335309b601b 100644 --- a/packages/expo-router/src/LocationProvider.tsx +++ b/packages/expo-router/src/LocationProvider.tsx @@ -22,7 +22,7 @@ export function getRouteInfoFromState( return { // TODO: This may have a predefined origin attached in the future. unstable_globalHref: path, - pathname: stripBaseUrl(path, baseUrl).split('?')['0'], + pathname: stripBaseUrl(path, baseUrl).split('?')[0]!, isIndex: isIndexPath(state), ...getNormalizedStatePath(qualified, baseUrl), }; @@ -30,7 +30,9 @@ export function getRouteInfoFromState( function isIndexPath(state: State) { const route = state.routes[state.index ?? state.routes.length - 1]; - if (route.state) { + if (!route) { + return false; + } else if (route.state) { return isIndexPath(route.state); } @@ -65,7 +67,10 @@ export function getNormalizedStatePath( const [pathname] = statePath.split('?'); return { // Strip empty path at the start - segments: stripBaseUrl(pathname, baseUrl).split('/').filter(Boolean).map(decodeURIComponent), + segments: stripBaseUrl(pathname!, baseUrl) + .split('/') + .filter((x) => !!x) + .map(decodeURIComponent), // TODO: This is not efficient, we should generate based on the state instead // of converting to string then back to object params: decodeParams(params), diff --git a/packages/expo-router/src/__tests__/experimentalModalStack.test.web.tsx b/packages/expo-router/src/__tests__/experimentalModalStack.test.web.tsx index eac69350730269..fdc9da64590bf2 100644 --- a/packages/expo-router/src/__tests__/experimentalModalStack.test.web.tsx +++ b/packages/expo-router/src/__tests__/experimentalModalStack.test.web.tsx @@ -33,7 +33,7 @@ describe('ExperimentalModalStack', () => { expect(mockRouterModal).toHaveBeenCalledTimes(1); - const passedChildren = mockRouterModal.mock.calls[0][0].children; + const passedChildren = mockRouterModal.mock.calls[0]![0].children; const childArray = React.Children.toArray(passedChildren); expect(childArray).toHaveLength(2); @@ -52,7 +52,7 @@ describe('ExperimentalModalStack', () => { expect(mockRouterModal).toHaveBeenCalledTimes(1); - const passedChildren = mockRouterModal.mock.calls[0][0].children; + const passedChildren = mockRouterModal.mock.calls[0]![0].children; const childArray = React.Children.toArray(passedChildren); expect(childArray).toHaveLength(1); @@ -69,6 +69,6 @@ describe('ExperimentalModalStack', () => { ); expect(mockRouterModal).toHaveBeenCalledTimes(1); - expect(mockRouterModal.mock.calls[0][0].screenOptions).toEqual({ headerShown: false }); + expect(mockRouterModal.mock.calls[0]![0].screenOptions).toEqual({ headerShown: false }); }); }); diff --git a/packages/expo-router/src/__tests__/headless-tabs.test.ios.tsx b/packages/expo-router/src/__tests__/headless-tabs.test.ios.tsx index 73e887157cc18f..410dfe977e6c8c 100644 --- a/packages/expo-router/src/__tests__/headless-tabs.test.ios.tsx +++ b/packages/expo-router/src/__tests__/headless-tabs.test.ios.tsx @@ -263,7 +263,7 @@ it('does works with shared groups', () => { ), '(one,two)/[fruit]': function Fruit() { - const fruit = useLocalSearchParams().fruit.toString(); + const fruit = useLocalSearchParams().fruit!.toString(); return Fruit: {fruit}; }, }, diff --git a/packages/expo-router/src/__tests__/hooks.test.ios.tsx b/packages/expo-router/src/__tests__/hooks.test.ios.tsx index c746286219e8e9..8df67711689214 100644 --- a/packages/expo-router/src/__tests__/hooks.test.ios.tsx +++ b/packages/expo-router/src/__tests__/hooks.test.ios.tsx @@ -826,7 +826,7 @@ describe(useLoaderData, () => { expect(fetchLoaderMock).toHaveBeenCalledWith('/users/123'); await act(async () => { - await fetchLoaderMock.mock.results[0].value; + await fetchLoaderMock.mock.results[0]!.value; }); expect(cache.getData('/users/123')).toEqual({ fromFetch: true }); diff --git a/packages/expo-router/src/__tests__/navigation.test.ios.tsx b/packages/expo-router/src/__tests__/navigation.test.ios.tsx index d5a32a0a62bfbb..571f7acf354e8a 100644 --- a/packages/expo-router/src/__tests__/navigation.test.ios.tsx +++ b/packages/expo-router/src/__tests__/navigation.test.ios.tsx @@ -1770,18 +1770,18 @@ it('multiple pushes to different stack are executed in order and added separatel expect(store.state!.index).toBe(0); expect(store.state!.routes).toHaveLength(1); - expect(store.state!.routes[0].name).toBe('__root'); + expect(store.state!.routes[0]!.name).toBe('__root'); // Both pushes from 'c' will create new routes in root layout. This is because both pushes are happening on the same state, where there is no 'b' stack yet. - expect(store.state!.routes[0].state!.routes).toHaveLength(3); - expect(store.state!.routes[0].state!.routes[0].name).toBe('a'); - expect(store.state!.routes[0].state!.routes[0].state!.routes).toHaveLength(1); - expect(store.state!.routes[0].state!.routes[0].state!.routes[0].name).toBe('c'); - expect(store.state!.routes[0].state!.routes[1].name).toBe('b'); - expect(store.state!.routes[0].state!.routes[1].state!.routes).toHaveLength(1); - expect(store.state!.routes[0].state!.routes[1].state!.routes[0].name).toBe('d'); - expect(store.state!.routes[0].state!.routes[2].name).toBe('b'); - expect(store.state!.routes[0].state!.routes[2].state!.routes).toHaveLength(1); - expect(store.state!.routes[0].state!.routes[2].state!.routes[0].name).toBe('e'); + expect(store.state!.routes[0]!.state!.routes).toHaveLength(3); + expect(store.state!.routes[0]!.state!.routes[0]!.name).toBe('a'); + expect(store.state!.routes[0]!.state!.routes[0]!.state!.routes).toHaveLength(1); + expect(store.state!.routes[0]!.state!.routes[0]!.state!.routes[0]!.name).toBe('c'); + expect(store.state!.routes[0]!.state!.routes[1]!.name).toBe('b'); + expect(store.state!.routes[0]!.state!.routes[1]!.state!.routes).toHaveLength(1); + expect(store.state!.routes[0]!.state!.routes[1]!.state!.routes[0]!.name).toBe('d'); + expect(store.state!.routes[0]!.state!.routes[2]!.name).toBe('b'); + expect(store.state!.routes[0]!.state!.routes[2]!.state!.routes).toHaveLength(1); + expect(store.state!.routes[0]!.state!.routes[2]!.state!.routes[0]!.name).toBe('e'); act(() => router.back()); expect(screen.getByTestId('d')).toBeVisible(); diff --git a/packages/expo-router/src/__tests__/prefetch.test.ios.tsx b/packages/expo-router/src/__tests__/prefetch.test.ios.tsx index 5b41607e171079..4a4a6252a9a463 100644 --- a/packages/expo-router/src/__tests__/prefetch.test.ios.tsx +++ b/packages/expo-router/src/__tests__/prefetch.test.ios.tsx @@ -813,12 +813,12 @@ it('stamps zoom transition screen ID on preloaded route', () => { }); const state = (screen as ReturnType).getRouterState(); - const innerState = state?.routes[0].state; + const innerState = state?.routes[0]!.state; if (innerState?.type !== 'stack') { throw new Error('Expected a stack navigator'); } // eslint-disable-next-line @typescript-eslint/no-empty-object-type - const preloadedRoute = (innerState as StackNavigationState<{}>).preloadedRoutes[0]; + const preloadedRoute = (innerState as StackNavigationState<{}>).preloadedRoutes[0]!; expect(preloadedRoute.name).toBe('target'); expect(preloadedRoute.params).toHaveProperty( @@ -839,12 +839,12 @@ it('does not stamp zoom transition screen ID without zoom source param', () => { }); const state = (screen as ReturnType).getRouterState(); - const innerState = state?.routes[0].state; + const innerState = state?.routes[0]!.state; if (innerState?.type !== 'stack') { throw new Error('Expected a stack navigator'); } // eslint-disable-next-line @typescript-eslint/no-empty-object-type - const preloadedRoute = (innerState as StackNavigationState<{}>).preloadedRoutes[0]; + const preloadedRoute = (innerState as StackNavigationState<{}>).preloadedRoutes[0]!; expect(preloadedRoute.name).toBe('target'); expect(preloadedRoute.params).not.toHaveProperty( @@ -879,11 +879,11 @@ it('stamps zoom transition screen ID on preloaded route that is navigated to', ( }); const state = (screen as ReturnType).getRouterState(); - const innerState = state?.routes[0].state; + const innerState = state?.routes[0]!.state; if (innerState?.type !== 'stack') { throw new Error('Expected a stack navigator'); } - const navigatedRoute = innerState.routes[innerState.routes.length - 1]; + const navigatedRoute = innerState.routes[innerState.routes.length - 1]!; expect(navigatedRoute.name).toBe('target'); expect(navigatedRoute.params).toHaveProperty( diff --git a/packages/expo-router/src/__tests__/protected.test.ios.tsx b/packages/expo-router/src/__tests__/protected.test.ios.tsx index 781d36a0321616..8a38b4f75e1535 100644 --- a/packages/expo-router/src/__tests__/protected.test.ios.tsx +++ b/packages/expo-router/src/__tests__/protected.test.ios.tsx @@ -165,8 +165,8 @@ it('should protect nested protected routes', () => { expect(screen).toHavePathname('/a'); expect(store.state!.index).toBe(0); - expect(store.state!.routes[0].name).toBe('__root'); - expect(store.state!.routes[0].state!.routeNames).toStrictEqual(['a', 'index']); + expect(store.state!.routes[0]!.name).toBe('__root'); + expect(store.state!.routes[0]!.state!.routeNames).toStrictEqual(['a', 'index']); // change the guard for route B to true: should make B available and also C // should be available now as all its parents guards are true @@ -187,8 +187,8 @@ it('should protect nested protected routes', () => { expect(screen).toHavePathname('/c'); expect(store.state!.index).toBe(0); - expect(store.state!.routes[0].name).toBe('__root'); - expect(store.state!.routes[0].state!.routeNames).toStrictEqual(['a', 'b', 'c', 'index']); + expect(store.state!.routes[0]!.name).toBe('__root'); + expect(store.state!.routes[0]!.state!.routeNames).toStrictEqual(['a', 'b', 'c', 'index']); }); it('should default to anchor during initial load', () => { diff --git a/packages/expo-router/src/__tests__/sitemap.test.ios.tsx b/packages/expo-router/src/__tests__/sitemap.test.ios.tsx index d9668af62f54ee..3fb93c6fec013a 100644 --- a/packages/expo-router/src/__tests__/sitemap.test.ios.tsx +++ b/packages/expo-router/src/__tests__/sitemap.test.ios.tsx @@ -123,7 +123,7 @@ test('expands nested route when the layout header is pressed', async () => { act(() => router.replace('/_sitemap')); const containers = screen.getAllByTestId('sitemap-item-container'); - const nestedContainer = containers[2]; + const nestedContainer = containers[2]!; const layoutHeader = within(nestedContainer).getByTestId('sitemap-item'); act(() => fireEvent.press(layoutHeader)); await waitFor(() => { @@ -153,7 +153,7 @@ test('renders and expands all levels of a deeply nested route on presses on head const containers = screen.getAllByTestId('sitemap-item-container'); expect(containers).toHaveLength(3); - const nestedContainer = containers[2]; + const nestedContainer = containers[2]!; const layoutHeader = within(nestedContainer).getByTestId('sitemap-item'); act(() => fireEvent.press(layoutHeader)); await waitFor(() => { @@ -161,7 +161,7 @@ test('renders and expands all levels of a deeply nested route on presses on head }); let nestedItems = within(nestedContainer).getAllByTestId('sitemap-item'); - const deepLayoutHeader = nestedItems[2]; + const deepLayoutHeader = nestedItems[2]!; act(() => fireEvent.press(deepLayoutHeader)); await waitFor(() => { @@ -211,19 +211,19 @@ describe('links', () => { expect(containers).toHaveLength(3); }); test('clicking the first sitemap item navigates to the index page', () => { - const link = within(containers[0]).getByRole('link'); + const link = within(containers[0]!).getByRole('link'); act(() => fireEvent.press(link)); expect(screen).toHavePathname('/'); }); test('clicking the second sitemap item navigates to the about page', () => { - const link = within(containers[1]).getByRole('link'); + const link = within(containers[1]!).getByRole('link'); act(() => fireEvent.press(link)); expect(screen).toHavePathname('/about'); }); describe('nested links', () => { let nestedContainer: ReturnType; beforeEach(async () => { - nestedContainer = containers[2]; + nestedContainer = containers[2]!; const layoutHeader = within(nestedContainer).getByTestId('sitemap-item'); act(() => fireEvent.press(layoutHeader)); await waitFor(() => { diff --git a/packages/expo-router/src/__tests__/stacks.test.ios.tsx b/packages/expo-router/src/__tests__/stacks.test.ios.tsx index e2d12bc6c59ae8..f5a893e40b39dd 100644 --- a/packages/expo-router/src/__tests__/stacks.test.ios.tsx +++ b/packages/expo-router/src/__tests__/stacks.test.ios.tsx @@ -784,7 +784,7 @@ describe('function-form options', () => { }); expect(screen.getByTestId('index')).toBeVisible(); - expect(MockedScreenStackItem.mock.calls[0][0].headerConfig?.title).toBe('Page: index'); + expect(MockedScreenStackItem.mock.calls[0]![0].headerConfig?.title).toBe('Page: index'); }); it('calls function-form options with route and navigation', () => { @@ -800,7 +800,7 @@ describe('function-form options', () => { }); expect(optionsFn).toHaveBeenCalled(); - const arg = optionsFn.mock.calls[0][0]; + const arg = optionsFn.mock.calls[0]![0]; expect(arg).toHaveProperty('route'); expect(arg).toHaveProperty('navigation'); expect(arg.route).toHaveProperty('name', 'index'); @@ -825,7 +825,7 @@ describe('function-form options', () => { expect(screen.getByTestId('profile')).toBeVisible(); - expect(MockedScreenStackItem.mock.calls[2][0].headerConfig?.title).toBe('Page: profile'); + expect(MockedScreenStackItem.mock.calls[2]![0].headerConfig?.title).toBe('Page: profile'); }); it('warns when function-form options are used in page context', () => { @@ -871,7 +871,7 @@ describe('Screen options with /index suffix normalization', () => { expect(screen).toHavePathname('/settings/general'); // Verify the title option is actually applied - expect(MockedScreenStackItem.mock.calls[0][0].headerConfig?.title).toBe('General Settings'); + expect(MockedScreenStackItem.mock.calls[0]![0].headerConfig?.title).toBe('General Settings'); expect(spy).not.toHaveBeenCalledWith( expect.stringContaining('[Layout children]'), @@ -903,7 +903,7 @@ describe('Screen options with /index suffix normalization', () => { expect(screen).toHavePathname('/otp/signin'); // Verify the title option is actually applied - expect(MockedScreenStackItem.mock.calls[0][0].headerConfig?.title).toBe('OTP Flow'); + expect(MockedScreenStackItem.mock.calls[0]![0].headerConfig?.title).toBe('OTP Flow'); expect(spy).not.toHaveBeenCalledWith( expect.stringContaining('[Layout children]'), @@ -935,7 +935,7 @@ describe('Screen options with /index suffix normalization', () => { expect(screen).toHavePathname('/otp/signin/step1'); // Verify the title option is actually applied - expect(MockedScreenStackItem.mock.calls[0][0].headerConfig?.title).toBe('OTP Flow'); + expect(MockedScreenStackItem.mock.calls[0]![0].headerConfig?.title).toBe('OTP Flow'); expect(spy).not.toHaveBeenCalledWith( expect.stringContaining('[Layout children]'), diff --git a/packages/expo-router/src/fork/__tests__/getPathFromState.test.web.ts b/packages/expo-router/src/fork/__tests__/getPathFromState.test.web.ts index 159d25018a1b7d..3f44a97b4a9be5 100644 --- a/packages/expo-router/src/fork/__tests__/getPathFromState.test.web.ts +++ b/packages/expo-router/src/fork/__tests__/getPathFromState.test.web.ts @@ -157,9 +157,9 @@ describe('state mutation safety', () => { }, }; - const paramsBefore = { ...state.routes[0].params }; + const paramsBefore = { ...state.routes[0]!.params }; getPathDataFromState(state, config); // The original params on the route should not have been mutated - expect(state.routes[0].params).toEqual(paramsBefore); + expect(state.routes[0]!.params).toEqual(paramsBefore); }); }); diff --git a/packages/expo-router/src/fork/__tests__/getStateFromPath.test.web.ts b/packages/expo-router/src/fork/__tests__/getStateFromPath.test.web.ts index 6c2819ae70b523..9723b2950c7ed3 100644 --- a/packages/expo-router/src/fork/__tests__/getStateFromPath.test.web.ts +++ b/packages/expo-router/src/fork/__tests__/getStateFromPath.test.web.ts @@ -12,22 +12,24 @@ afterAll(() => { }); describe(stripBaseUrl, () => { - [ + ( [ - // Input - '/', - // Base Path - '', - // Result - '/', - ], - ['/one/two', '/one', '/two'], - ['/one/two', '/one/two', ''], - ['/one/two/', '/one/two', '/'], - ['///one/', '/one', '/'], - ['one/', '/one', 'one/'], - ['/a/b', '/one', '/a/b'], - ].forEach(([path, baseUrl, result]) => { + [ + // Input + '/', + // Base Path + '', + // Result + '/', + ], + ['/one/two', '/one', '/two'], + ['/one/two', '/one/two', ''], + ['/one/two/', '/one/two', '/'], + ['///one/', '/one', '/'], + ['one/', '/one', 'one/'], + ['/a/b', '/one', '/a/b'], + ] as const + ).forEach(([path, baseUrl, result]) => { it(`strips baseUrl "${path}"`, () => { expect(stripBaseUrl(path, baseUrl)).toBe(result); }); @@ -101,11 +103,13 @@ describe(getUrlWithReactNavigationConcessions, () => { }); }); - [ - ['', '/'], - ['https://acme.com/hello/world?foo=bar#123', 'hello/world/'], - ['https://acme.com/hello/world/?foo=bar#123', 'hello/world/'], - ].forEach(([url, expected]) => { + ( + [ + ['', '/'], + ['https://acme.com/hello/world?foo=bar#123', 'hello/world/'], + ['https://acme.com/hello/world/?foo=bar#123', 'hello/world/'], + ] as const + ).forEach(([url, expected]) => { it(`returns the pathname for ${url}`, () => { expect(getUrlWithReactNavigationConcessions(url).nonstandardPathname).toBe(expected); }); @@ -117,7 +121,7 @@ describe(getUrlWithReactNavigationConcessions, () => { ['https://acme.com/gh-pages/hello/world/?foo=bar#123', 'hello/world/'], ].forEach(([url, expected]) => { it(`returns the pathname for ${url}`, () => { - expect(getUrlWithReactNavigationConcessions(url, 'gh-pages').nonstandardPathname).toBe( + expect(getUrlWithReactNavigationConcessions(url!, 'gh-pages').nonstandardPathname).toBe( expected ); }); diff --git a/packages/expo-router/src/fork/createMemoryHistory.ts b/packages/expo-router/src/fork/createMemoryHistory.ts index aa2150871f2bbe..d84a924eeab316 100644 --- a/packages/expo-router/src/fork/createMemoryHistory.ts +++ b/packages/expo-router/src/fork/createMemoryHistory.ts @@ -55,8 +55,7 @@ export function createMemoryHistory() { backIndex({ path }: { path: string }) { // We need to find the index from the element before current to get closest path to go back to for (let i = index - 1; i >= 0; i--) { - const item = items[i]; - + const item = items[i]!; if (item.path === path) { return i; } @@ -106,7 +105,7 @@ export function createMemoryHistory() { items = [{ path: pathWithHash, state, id }]; index = 0; } else { - if (items[index].path === path) { + if (items[index]!.path === path) { pathWithHash = pathWithHash + hash; } items[index] = { path, state, id }; @@ -184,7 +183,7 @@ export function createMemoryHistory() { const index = pending.findIndex((it) => it.ref === done); if (index > -1) { - pending[index].cb(); + pending[index]!.cb(); pending.splice(index, 1); } }, 100); diff --git a/packages/expo-router/src/fork/findFocusedRoute.tsx b/packages/expo-router/src/fork/findFocusedRoute.tsx index 96ef638f14646e..9b3b09adc574e8 100644 --- a/packages/expo-router/src/fork/findFocusedRoute.tsx +++ b/packages/expo-router/src/fork/findFocusedRoute.tsx @@ -5,11 +5,10 @@ import type { InitialState } from '../react-navigation/routers'; export function findFocusedRoute(state: InitialState) { let current: InitialState | undefined = state; - while (current?.routes[current.index ?? 0].state != null) { - current = current.routes[current.index ?? 0].state; + while (current?.routes[current.index ?? 0]?.state != null) { + current = current.routes[current.index ?? 0]!.state; } const route = current?.routes[current?.index ?? 0]; - return route; } diff --git a/packages/expo-router/src/fork/getPathFromState.ts b/packages/expo-router/src/fork/getPathFromState.ts index e3aa25234b544a..5f0a32ee16ef23 100644 --- a/packages/expo-router/src/fork/getPathFromState.ts +++ b/packages/expo-router/src/fork/getPathFromState.ts @@ -28,9 +28,7 @@ type ConfigItem = ExpoConfigItem & { const getActiveRoute = (state: State): { name: string; params?: object } => { const route = - typeof state.index === 'number' - ? state.routes[state.index] - : state.routes[state.routes.length - 1]; + state.index != null ? state.routes[state.index]! : state.routes[state.routes.length - 1]!; if (route.state) { return getActiveRoute(route.state); @@ -127,7 +125,7 @@ export function getPathDataFromState( let hasNext = true; while (route.name in currentOptions && hasNext) { - pattern = currentOptions[route.name].pattern; + pattern = currentOptions[route.name]!.pattern; nestedRouteNames.push(route.name); @@ -172,7 +170,7 @@ export function getPathDataFromState( } // If there is no `screens` property or no nested state, we return pattern - if (!currentOptions[route.name].screens || route.state === undefined) { + if (!currentOptions[route.name]!.screens || route.state === undefined) { // START FORK // Expo Router allows you to navigate to a (group) and not specify a target screen // This is different from React Navigation, which requires a target screen @@ -190,7 +188,7 @@ export function getPathDataFromState( // // route.push('/home/(a)') --> This should navigate to /home/(a)/index // route.push('/home/(profile)') --> This should navigate to /home/(profile)/me - const screens = currentOptions[route.name].screens; + const screens = currentOptions[route.name]!.screens; // Determine what screen the user wants to navigate to. If no screen is specified, assume there is an index screen // In the examples above, this ensures that /home/(a) navigates to /home/(a)/index @@ -209,7 +207,7 @@ export function getPathDataFromState( : Object.keys(screens)[0] : undefined; - if (screen && screens && currentOptions[route.name].screens?.[screen]) { + if (screen && screens && currentOptions[route.name]!.screens?.[screen]) { const nestedParams = (route.params as { params?: object } | undefined)?.params; route = { ...screens[screen], name: screen, key: screen, params: nestedParams }; currentOptions = screens; @@ -219,14 +217,13 @@ export function getPathDataFromState( // hasNext = false; // END FORK } else { - index = - typeof route.state.index === 'number' ? route.state.index : route.state.routes.length - 1; + index = route.state.index != null ? route.state.index : route.state.routes.length - 1; - const nextRoute = route.state.routes[index]; - const nestedConfig = currentOptions[route.name].screens; + const nextRoute = route.state.routes[index]!; + const nestedConfig = currentOptions[route.name]!.screens; // if there is config for next route name, we go deeper - if (nestedConfig && nextRoute.name in nestedConfig) { + if (nestedConfig && nextRoute!.name in nestedConfig) { route = nextRoute as Route & { state?: State }; currentOptions = nestedConfig; } else { diff --git a/packages/expo-router/src/fork/getStateFromPath-forks.ts b/packages/expo-router/src/fork/getStateFromPath-forks.ts index a3e839319895b9..2cb7d3a0cd3963 100644 --- a/packages/expo-router/src/fork/getStateFromPath-forks.ts +++ b/packages/expo-router/src/fork/getStateFromPath-forks.ts @@ -206,8 +206,9 @@ export function handleUrlParams(route: ParsedRoute, params?: queryString.ParsedQ export function spreadParamsAcrossAllStates(state: InitialState, params?: Record) { while (state) { - const route = state.routes[0]; - (route as any).params = Object.assign({}, route.params, params); + // TODO(@kitten): Investigate why this is read-only or whether this function cal is used / is this dead code? + const route: any = state.routes[0]!; + route.params = Object.assign({}, route.params, params); } } @@ -348,6 +349,8 @@ export function getRouteConfigSorter(previousSegments: string[] = []) { * If there is not difference in similarity, then each non-group segment is compared against each other */ for (let i = 0; i < Math.max(a.parts.length, b.parts.length); i++) { + const aParts = a.parts[i]!; + const bParts = b.parts[i]!; // if b is longer, b get higher priority if (a.parts[i] == null) { return 1; @@ -357,12 +360,12 @@ export function getRouteConfigSorter(previousSegments: string[] = []) { return -1; } - const aWildCard = a.parts[i].startsWith('*'); - const bWildCard = b.parts[i].startsWith('*'); + const aWildCard = aParts.startsWith('*'); + const bWildCard = bParts.startsWith('*'); // if both are wildcard we compare next component if (aWildCard && bWildCard) { - const aNotFound = a.parts[i].match(/^[*]not-found$/); - const bNotFound = b.parts[i].match(/^[*]not-found$/); + const aNotFound = aParts.match(/^[*]not-found$/); + const bNotFound = bParts.match(/^[*]not-found$/); if (aNotFound && bNotFound) { continue; @@ -382,12 +385,12 @@ export function getRouteConfigSorter(previousSegments: string[] = []) { return -1; } - const aSlug = a.parts[i].startsWith(':'); - const bSlug = b.parts[i].startsWith(':'); + const aSlug = aParts.startsWith(':'); + const bSlug = bParts.startsWith(':'); // if both are wildcard we compare next component if (aSlug && bSlug) { - const aNotFound = a.parts[i].match(/^[*]not-found$/); - const bNotFound = b.parts[i].match(/^[*]not-found$/); + const aNotFound = aParts.match(/^[*]not-found$/); + const bNotFound = bParts.match(/^[*]not-found$/); if (aNotFound && bNotFound) { continue; @@ -456,7 +459,7 @@ export function parseQueryParams( } } else { const values = parseConfig?.hasOwnProperty(name) - ? searchParams.getAll(name).map((value) => parseConfig[name](value)) + ? searchParams.getAll(name).map((value) => parseConfig[name]!(value)) : searchParams.getAll(name); // searchParams.getAll returns an array. diff --git a/packages/expo-router/src/fork/getStateFromPath.ts b/packages/expo-router/src/fork/getStateFromPath.ts index a7991ff608e7d9..0a1738be500bf9 100644 --- a/packages/expo-router/src/fork/getStateFromPath.ts +++ b/packages/expo-router/src/fork/getStateFromPath.ts @@ -307,7 +307,7 @@ function checkForDuplicatedConfigs(configs: RouteConfig[]) { // Check for duplicate patterns in the config configs.reduce>((acc, config) => { if (acc[config.pattern]) { - const a = acc[config.pattern].routeNames; + const a = acc[config.pattern]!.routeNames; const b = config.routeNames; // It's not a problem if the path string omitted from a inner most screen @@ -382,8 +382,7 @@ const matchAgainstConfigs = (remaining: string, configs: RouteConfig[]) => { const decodedParamSegment = expo.safelyDecodeURIComponent( // const decodedParamSegment = decodeURIComponent( // The param segments appear every second item starting from 2 in the regex match result - match![(acc.pos + 1) * 2] - // Remove trailing slash + match[(acc.pos + 1) * 2]! // Remove trailing slash .replace(/\/$/, '') ); // END FORK @@ -428,7 +427,8 @@ const matchAgainstConfigs = (remaining: string, configs: RouteConfig[]) => { const offset = numInitialSegments ? numInitialSegments - 1 : 0; // START FORK // const value = matchedParams[p]?.[index + offset]; - const value = expo.getParamValue(p, matchedParams[p]?.[index + offset]); + // TODO(@kitten): Assess which is intended, non-optional or getParamValue accepting undefined + const value = expo.getParamValue(p, matchedParams[p]?.[index + offset]!); // END FORK if (value) { @@ -450,7 +450,7 @@ const matchAgainstConfigs = (remaining: string, configs: RouteConfig[]) => { return { name }; }); - remainingPath = remainingPath.replace(match[1], ''); + remainingPath = remainingPath.replace(match[1]!, ''); break; } @@ -605,7 +605,7 @@ const findInitialRoute = ( if (parentScreens.length === config.parentScreens.length) { let sameParents = true; for (let i = 0; i < parentScreens.length; i++) { - if (parentScreens[i].localeCompare(config.parentScreens[i]) !== 0) { + if (parentScreens[i]!.localeCompare(config.parentScreens[i]!) !== 0) { sameParents = false; break; } @@ -677,14 +677,14 @@ const createNestedStateObject = ( const nestedStateIndex = nestedState.index || nestedState.routes.length - 1; - nestedState.routes[nestedStateIndex].state = createStateObject( + nestedState.routes[nestedStateIndex]!.state = createStateObject( initialRoute, route, routes.length === 0 ); if (routes.length > 0) { - nestedState = nestedState.routes[nestedStateIndex].state as InitialState; + nestedState = nestedState.routes[nestedStateIndex]!.state as InitialState; } parentScreens.push(route.name); diff --git a/packages/expo-router/src/fork/native-stack/__tests__/usePreviewTransition.test.ios.tsx b/packages/expo-router/src/fork/native-stack/__tests__/usePreviewTransition.test.ios.tsx index 9107db13471dce..2ea10a08568914 100644 --- a/packages/expo-router/src/fork/native-stack/__tests__/usePreviewTransition.test.ios.tsx +++ b/packages/expo-router/src/fork/native-stack/__tests__/usePreviewTransition.test.ios.tsx @@ -139,7 +139,7 @@ describe('usePreviewTransition', () => { // After transitionStart, the hook should synthesize state with the preloaded route expect(result.current.computedState.routes).toHaveLength(2); - expect(result.current.computedState.routes[1].key).toBe('preview-key'); + expect(result.current.computedState.routes[1]!.key).toBe('preview-key'); expect(result.current.computedState.index).toBe(1); expect(result.current.computedState.preloadedRoutes).toHaveLength(0); diff --git a/packages/expo-router/src/fork/native-stack/composition-options/CompositionOptionsContext.tsx b/packages/expo-router/src/fork/native-stack/composition-options/CompositionOptionsContext.tsx index 5aa6a21ac96d98..2a1d10ec450106 100644 --- a/packages/expo-router/src/fork/native-stack/composition-options/CompositionOptionsContext.tsx +++ b/packages/expo-router/src/fork/native-stack/composition-options/CompositionOptionsContext.tsx @@ -38,7 +38,7 @@ export function registryReducer( if (!existing || filtered?.length === existing.length) { return state; } - if (filtered.length === 0) { + if (!filtered?.length) { const { [routeKey]: _, ...newState } = state; return newState; } diff --git a/packages/expo-router/src/fork/native-stack/composition-options/__tests__/mergeOptions.test.ts b/packages/expo-router/src/fork/native-stack/composition-options/__tests__/mergeOptions.test.ts index 221138544a341c..ad09da9997da6b 100644 --- a/packages/expo-router/src/fork/native-stack/composition-options/__tests__/mergeOptions.test.ts +++ b/packages/expo-router/src/fork/native-stack/composition-options/__tests__/mergeOptions.test.ts @@ -38,7 +38,7 @@ describe('mergeOptions', () => { const result = mergeOptions(descriptors, registry, state); - expect(result['route-1'].options).toEqual({ title: 'Original' }); + expect(result['route-1']!.options).toEqual({ title: 'Original' }); // Should return same reference when no composition options expect(result['route-1']).toBe(descriptors['route-1']); }); @@ -54,7 +54,7 @@ describe('mergeOptions', () => { const result = mergeOptions(descriptors, registry, state); - expect(result['route-1'].options).toEqual({ + expect(result['route-1']!.options).toEqual({ title: 'Composed Title', headerShown: true, }); @@ -72,8 +72,8 @@ describe('mergeOptions', () => { const result = mergeOptions(descriptors, registry, state); - expect(result['route-1'].options.title).toBe('Dynamic'); - expect(result['route-1'].options.headerShown).toBe(true); + expect(result['route-1']!.options.title).toBe('Dynamic'); + expect(result['route-1']!.options.headerShown).toBe(true); expect(result['route-1']).not.toBe(descriptors['route-1']); }); @@ -89,8 +89,8 @@ describe('mergeOptions', () => { const result = mergeOptions(descriptors, registry, state); // Last title entry wins - expect(result['route-1'].options.title).toBe('Second Title'); - expect(result['route-1'].options.headerShown).toBe(false); + expect(result['route-1']!.options.title).toBe('Second Title'); + expect(result['route-1']!.options.headerShown).toBe(false); expect(result['route-1']).not.toBe(descriptors['route-1']); }); @@ -112,9 +112,9 @@ describe('mergeOptions', () => { const result = mergeOptions(descriptors, registry, state); // Focused route gets composition options - expect(result['route-1'].options.title).toBe('Composed Focused'); + expect(result['route-1']!.options.title).toBe('Composed Focused'); // Preloaded unfocused route keeps original options - expect(result['route-preloaded'].options.title).toBe('Preloaded Static'); + expect(result['route-preloaded']!.options.title).toBe('Preloaded Static'); expect(result['route-preloaded']).toBe(descriptors['route-preloaded']); }); @@ -138,7 +138,7 @@ describe('mergeOptions', () => { const result = mergeOptions(descriptors, registry, state); - expect(result['route-preloaded'].options.title).toBe('Preloaded Composed'); + expect(result['route-preloaded']!.options.title).toBe('Preloaded Composed'); }); it('does not mutate input descriptors', () => { @@ -154,12 +154,12 @@ describe('mergeOptions', () => { const result = mergeOptions(descriptors, registry, state); // Original descriptor options unchanged - expect(descriptors['route-1'].options.title).toBe('Original'); + expect(descriptors['route-1']!.options.title).toBe('Original'); // New result has merged options - expect(result['route-1'].options.title).toBe('Modified'); + expect(result['route-1']!.options.title).toBe('Modified'); // Different object reference expect(result['route-1']).not.toBe(descriptors['route-1']); - expect(result['route-1'].options).not.toBe(descriptors['route-1'].options); + expect(result['route-1']!.options).not.toBe(descriptors['route-1']!.options); }); it('handles routes with no matching registry entries', () => { @@ -180,8 +180,8 @@ describe('mergeOptions', () => { const result = mergeOptions(descriptors, registry, state); - expect(result['route-1'].options.title).toBe('Modified One'); - expect(result['route-2'].options.title).toBe('Two'); + expect(result['route-1']!.options.title).toBe('Modified One'); + expect(result['route-2']!.options.title).toBe('Two'); expect(result['route-2']).toBe(descriptors['route-2']); }); @@ -194,7 +194,7 @@ describe('mergeOptions', () => { const result = mergeOptions(descriptors, registry, state); - expect(result['route-1'].options).toEqual({ title: 'Original' }); + expect(result['route-1']!.options).toEqual({ title: 'Original' }); expect(result['route-1']).toBe(descriptors['route-1']); }); @@ -217,8 +217,8 @@ describe('mergeOptions', () => { const result = mergeOptions(descriptor, registry, state); - expect(result['route-1'].render).toBe(mockRender); - expect(result['route-1'].navigation).toBe(mockNavigation); - expect(result['route-1'].route).toBe(mockRoute); + expect(result['route-1']!.render).toBe(mockRender); + expect(result['route-1']!.navigation).toBe(mockNavigation); + expect(result['route-1']!.route).toBe(mockRoute); }); }); diff --git a/packages/expo-router/src/fork/native-stack/composition-options/__tests__/registryReducer.test.ts b/packages/expo-router/src/fork/native-stack/composition-options/__tests__/registryReducer.test.ts index 690878008788cf..aa727c528103be 100644 --- a/packages/expo-router/src/fork/native-stack/composition-options/__tests__/registryReducer.test.ts +++ b/packages/expo-router/src/fork/native-stack/composition-options/__tests__/registryReducer.test.ts @@ -15,7 +15,7 @@ describe('registryReducer', () => { expect(result).not.toBe(state); expect(result['route-1']).toEqual([{ title: 'Hello' }]); - expect(result['route-1'][0]).toBe(options); + expect(result['route-1']![0]).toBe(options); }); it('appends options to existing route entry', () => { @@ -34,8 +34,8 @@ describe('registryReducer', () => { expect(result).not.toBe(state); expect(result['route-1']).toHaveLength(2); expect(result['route-1']).not.toBe(state['route-1']); // New array - expect(result['route-1'][0]).toBe(first); - expect(result['route-1'][1]).toBe(second); + expect(result['route-1']![0]).toBe(first); + expect(result['route-1']![1]).toBe(second); }); it('returns same state reference when options reference is already in array', () => { @@ -79,7 +79,7 @@ describe('registryReducer', () => { expect(Object.keys(result)).toHaveLength(1); expect(result['route-new']).toHaveLength(1); - expect(result['route-new'][0]).toEqual({ title: 'Brand New' }); + expect(result['route-new']![0]).toEqual({ title: 'Brand New' }); }); }); @@ -100,7 +100,7 @@ describe('registryReducer', () => { expect(result).not.toBe(state); expect(result['route-1']).toHaveLength(1); expect(result['route-1']).not.toBe(state['route-1']); // New array - expect(result['route-1'][0]).toBe(second); + expect(result['route-1']![0]).toBe(second); }); it('deletes entire route entry when last options is removed', () => { diff --git a/packages/expo-router/src/fork/native-stack/composition-options/mergeOptions.ts b/packages/expo-router/src/fork/native-stack/composition-options/mergeOptions.ts index 162f75d5d30bf3..628afa5f194979 100644 --- a/packages/expo-router/src/fork/native-stack/composition-options/mergeOptions.ts +++ b/packages/expo-router/src/fork/native-stack/composition-options/mergeOptions.ts @@ -19,7 +19,7 @@ export function mergeOptions( const focusedKey = state.routes[state.index]?.key; for (const key in descriptors) { - const descriptor = descriptors[key]; + const descriptor = descriptors[key]!; const routeOptions = registry[key]; // No composition options or empty array → pass through diff --git a/packages/expo-router/src/fork/native-stack/createNativeStackNavigator.tsx b/packages/expo-router/src/fork/native-stack/createNativeStackNavigator.tsx index 4e92ce6281eba5..77b91fd6eef81e 100644 --- a/packages/expo-router/src/fork/native-stack/createNativeStackNavigator.tsx +++ b/packages/expo-router/src/fork/native-stack/createNativeStackNavigator.tsx @@ -108,7 +108,7 @@ function NativeStackNavigator({ let needsNewMap = false; const result: typeof computedDescriptors = {}; for (const key of Object.keys(computedDescriptors)) { - const descriptor = computedDescriptors[key]; + const descriptor = computedDescriptors[key]!; const options = descriptor.options as NativeStackNavigationOptionsWithInternal; const internalGestureEnabled = options?.[INTERNAL_EXPO_ROUTER_GESTURE_ENABLED_OPTION_NAME]; const needsGestureFix = internalGestureEnabled !== undefined; diff --git a/packages/expo-router/src/fork/useLinking.ts b/packages/expo-router/src/fork/useLinking.ts index 9cf9658747089b..0b2ce52a0b7fc3 100644 --- a/packages/expo-router/src/fork/useLinking.ts +++ b/packages/expo-router/src/fork/useLinking.ts @@ -36,8 +36,8 @@ const findMatchingState = ( const aHistoryLength = a.history ? a.history.length : a.routes.length; const bHistoryLength = b.history ? b.history.length : b.routes.length; - const aRoute = a.routes[a.index]; - const bRoute = b.routes[b.index]; + const aRoute = a.routes[a.index]!; + const bRoute = b.routes[b.index]!; const aChildState = aRoute.state as T | undefined; const bChildState = bRoute.state as T | undefined; diff --git a/packages/expo-router/src/getRoutesCore.ts b/packages/expo-router/src/getRoutesCore.ts index 89b5649098a24e..4cd51a254826b8 100644 --- a/packages/expo-router/src/getRoutesCore.ts +++ b/packages/expo-router/src/getRoutesCore.ts @@ -156,7 +156,7 @@ function getMiddleware(contextModule: RequireContext, options: Options): Middlew } } - const middlewareFilePath = rootMiddlewareFiles[0]; + const middlewareFilePath = rootMiddlewareFiles[0]!; const middleware: MiddlewareNode = { loadRoute() { @@ -406,7 +406,7 @@ function getDirectoryTree(contextModule: RequireContext, options: Options) { continue; } - const redirect = redirects[meta.route]; + const redirect = redirects[meta.route]!; node.destinationContextKey = redirect.destinationContextKey; node.permanent = redirect.permanent; node.generated = true; @@ -418,7 +418,7 @@ function getDirectoryTree(contextModule: RequireContext, options: Options) { redirectConfig: redirect, }); } - if (redirect.methods) { + if (redirect!.methods) { node.methods = redirect.methods; } node.type = 'redirect'; @@ -430,7 +430,7 @@ function getDirectoryTree(contextModule: RequireContext, options: Options) { continue; } - const rewrite = rewrites[meta.route]; + const rewrite = rewrites[meta.route]!; node.destinationContextKey = rewrite.destinationContextKey; node.generated = true; if (node.type === 'route') { @@ -688,9 +688,10 @@ function getFileMeta( let route = key; const parts = removeFileSystemDots(originalKey).split('/'); - const filename = parts[parts.length - 1]; - const [filenameWithoutExtensions, platformExtension] = - removeSupportedExtensions(filename).split('.'); + const filename = parts[parts.length - 1]!; + const filenameParts = removeSupportedExtensions(filename).split('.'); + const filenameWithoutExtensions = filenameParts[0]!; + const platformExtension = filenameParts[1]; const isLayout = filenameWithoutExtensions === '_layout'; const isApi = originalKey.match(/\+api\.(\w+\.)?[jt]sx?$/); @@ -708,7 +709,7 @@ function getFileMeta( } let specificity = 0; - const hasPlatformExtension = validPlatforms.has(platformExtension); + const hasPlatformExtension = validPlatforms.has(platformExtension!); const usePlatformRoutes = options.platformRoutes ?? true; if (hasPlatformExtension) { @@ -950,7 +951,7 @@ function crawlAndAppendInitialRoutesAndEntryFiles( } function getMostSpecific(routes: RouteNode[]) { - const route = routes[routes.length - 1]; + const route = routes[routes.length - 1]!; if (!routes[0]) { throw new Error( @@ -960,5 +961,5 @@ function getMostSpecific(routes: RouteNode[]) { // This works even tho routes is holey array (e.g it might have index 0 and 2 but not 1) // `.length` includes the holes in its count - return routes[routes.length - 1]; + return route; } diff --git a/packages/expo-router/src/getRoutesRedirects.tsx b/packages/expo-router/src/getRoutesRedirects.tsx index b6ee7e31e101ed..9f0ef38a247e66 100644 --- a/packages/expo-router/src/getRoutesRedirects.tsx +++ b/packages/expo-router/src/getRoutesRedirects.tsx @@ -79,7 +79,7 @@ export function convertRedirect(path: string, config: RedirectConfig) { if (!dynamicName) { continue; } else if (!dynamicName.deep) { - params[dynamicName.name] = parts[index]; + params[dynamicName.name] = parts[index]!; continue; } else { params[dynamicName.name] = parts.slice(index); diff --git a/packages/expo-router/src/global-state/__tests__/stateUtils.test.ios.ts b/packages/expo-router/src/global-state/__tests__/stateUtils.test.ios.ts index b82a438cb3c18a..03a35138f63bf6 100644 --- a/packages/expo-router/src/global-state/__tests__/stateUtils.test.ios.ts +++ b/packages/expo-router/src/global-state/__tests__/stateUtils.test.ios.ts @@ -184,7 +184,7 @@ describe('findDivergentState', () => { expect(result.actionStateRoute?.name).toBe('settings'); expect(result.navigationState).toBeDefined(); expect(result.navigationRoutes).toHaveLength(1); - expect(result.navigationRoutes[0].name).toBe('root'); + expect(result.navigationRoutes[0]!.name).toBe('root'); }); it('returns the full path when routes are the same (no child state divergence)', () => { @@ -229,7 +229,7 @@ describe('findDivergentState', () => { expect(result.actionStateRoute?.name).toBe('home'); // navigationRoutes should include 'root' since that matched expect(result.navigationRoutes).toHaveLength(1); - expect(result.navigationRoutes[0].name).toBe('root'); + expect(result.navigationRoutes[0]!.name).toBe('root'); }); it('detects divergence on dynamic segments with different param values', () => { @@ -317,7 +317,7 @@ describe('findDivergentState', () => { // Should NOT diverge at [id] since params match, should proceed to details expect(result.actionStateRoute?.name).toBe('details'); expect(result.navigationRoutes).toHaveLength(1); - expect(result.navigationRoutes[0].name).toBe('[id]'); + expect(result.navigationRoutes[0]!.name).toBe('[id]'); }); it('diverges at intermediate route when names differ mid-tree', () => { @@ -380,7 +380,7 @@ describe('findDivergentState', () => { expect(result.actionStateRoute?.name).toBe('branch-a'); // Only root matched before divergence expect(result.navigationRoutes).toHaveLength(1); - expect(result.navigationRoutes[0].name).toBe('root'); + expect(result.navigationRoutes[0]!.name).toBe('root'); }); describe('lookThroughAllTabs', () => { @@ -427,7 +427,7 @@ describe('findDivergentState', () => { // Should find 'settings' tab even though current index points to 'home' expect(result.actionStateRoute?.name).toBe('page'); expect(result.navigationRoutes).toHaveLength(1); - expect(result.navigationRoutes[0].name).toBe('settings'); + expect(result.navigationRoutes[0]!.name).toBe('settings'); }); it('falls back to current index when tab name not found and lookThroughAllTabs is true', () => { @@ -512,7 +512,7 @@ describe('findDivergentState', () => { // The tab route should be added to navigationRoutes. expect(result.actionStateRoute?.name).toBe('settings'); expect(result.navigationRoutes).toHaveLength(1); - expect(result.navigationRoutes[0].name).toBe('settings'); + expect(result.navigationRoutes[0]!.name).toBe('settings'); }); }); }); diff --git a/packages/expo-router/src/global-state/getRouteInfoFromState.ts b/packages/expo-router/src/global-state/getRouteInfoFromState.ts index 1f78eb7c83cd6e..21c1297d5bde33 100644 --- a/packages/expo-router/src/global-state/getRouteInfoFromState.ts +++ b/packages/expo-router/src/global-state/getRouteInfoFromState.ts @@ -47,8 +47,9 @@ type StrictFocusedRouteParams = export function getRouteInfoFromState(state?: StrictState): UrlObject { if (!state) return defaultRouteInfo; + // TODO(@kitten): Review edge-case type safety const index = 'index' in state ? (state.index ?? 0) : 0; - let route = state.routes[index]; + let route = state.routes[index]!; if (route.name === NOT_FOUND_ROUTE_NAME || route.name === SITEMAP_ROUTE_NAME) { const path = route.path || (route.name === NOT_FOUND_ROUTE_NAME ? '/' : `/${route.name}`); @@ -71,7 +72,7 @@ export function getRouteInfoFromState(state?: StrictState): UrlObject { let params: UrlObject['params'] = Object.create(null); while (state) { - route = state.routes['index' in state && state.index ? state.index : 0]; + route = state.routes['index' in state && state.index ? state.index : 0]!; Object.assign(params, route.params); diff --git a/packages/expo-router/src/global-state/stateUtils.ts b/packages/expo-router/src/global-state/stateUtils.ts index 54efd0d68d4a01..6c044aa2614274 100644 --- a/packages/expo-router/src/global-state/stateUtils.ts +++ b/packages/expo-router/src/global-state/stateUtils.ts @@ -54,29 +54,30 @@ export function findDivergentState( let actionStateRoute: PartialRoute | undefined; const navigationRoutes = []; while (actionState && navigationState) { - actionStateRoute = actionState.routes[actionState.routes.length - 1]; + // TODO(@kitten): Review invalid indexed access into undefined + actionStateRoute = actionState.routes[actionState.routes.length - 1]!; const stateRoute = (() => { if (navigationState.type === 'tab' && lookThroughAllTabs) { return ( navigationState.routes.find((route) => route.name === actionStateRoute?.name) || - navigationState.routes[navigationState.index ?? 0] + navigationState.routes[navigationState.index ?? 0]! ); } - return navigationState.routes[navigationState.index ?? 0]; + return navigationState.routes[navigationState.index ?? 0]!; })(); const childState: PartialState | undefined = actionStateRoute.state; const nextNavigationState = stateRoute.state; - const dynamicName = matchDynamicName(actionStateRoute.name); + const dynamicName = matchDynamicName(actionStateRoute!.name); const didActionAndCurrentStateDiverge = actionStateRoute.name !== stateRoute.name || !childState || !nextNavigationState || (dynamicName && - // @ts-expect-error: TODO(@kitten): This isn't properly typed, so the index access fails - actionStateRoute.params?.[dynamicName.name] !== stateRoute.params?.[dynamicName.name]); + actionStateRoute.params?.[dynamicName.name] !== + (stateRoute.params as Record | undefined)?.[dynamicName.name]); if (didActionAndCurrentStateDiverge) { // If we are looking through all tabs, we need to add new tab id if this is the last route diff --git a/packages/expo-router/src/head/ExpoHead.ios.tsx b/packages/expo-router/src/head/ExpoHead.ios.tsx index 92e1bd045ecebf..335ee3b4639881 100644 --- a/packages/expo-router/src/head/ExpoHead.ios.tsx +++ b/packages/expo-router/src/head/ExpoHead.ios.tsx @@ -14,7 +14,7 @@ function urlToId(url: string) { function getLastSegment(path: string) { // Remove the extension const lastSegment = path.split('/').pop() ?? ''; - return lastSegment.replace(/\.[^/.]+$/, '').split('?')[0]; + return lastSegment.replace(/\.[^/.]+$/, '').split('?')[0]!; } // TODO: Use Head Provider to collect all props so only one Head is rendered for a given route. diff --git a/packages/expo-router/src/layouts/StackClient.tsx b/packages/expo-router/src/layouts/StackClient.tsx index 0c88815b59e284..7cd4238685b246 100644 --- a/packages/expo-router/src/layouts/StackClient.tsx +++ b/packages/expo-router/src/layouts/StackClient.tsx @@ -216,7 +216,7 @@ export const stackRouterOverride: NonNullable['UN route.name === action.payload.name && id === getId?.({ params: route.params }) ); } else if (action.type === 'NAVIGATE') { - const currentRoute = state.routes[state.index]; + const currentRoute = state.routes[state.index]!; // If the route matches the current one, then navigate to it if (action.payload.name === currentRoute.name && !isPreviewAction(action)) { @@ -295,7 +295,7 @@ export const stackRouterOverride: NonNullable['UN routes = state.routes.filter((r) => r.key !== route.key); } else if (action.type === 'NAVIGATE' && state.routes.length > 0) { // The navigation action should only replace the last route if it has the same name and path params. - const lastRoute = state.routes[state.routes.length - 1]; + const lastRoute = state.routes[state.routes.length - 1]!; if ( getSingularId(lastRoute.name, { params: lastRoute.params }) === getSingularId(route.name, { params }) @@ -355,7 +355,7 @@ export const stackRouterOverride: NonNullable['UN ...state, index: routes.length - 1, preloadedRoutes: state.preloadedRoutes.filter( - (route) => routes[routes.length - 1].key !== route.key + (route) => routes[routes.length - 1]!.key !== route.key ), routes, }; @@ -366,7 +366,7 @@ export const stackRouterOverride: NonNullable['UN const zoomTransitionId = getZoomTransitionIdFromAction(action); if (zoomTransitionId) { - const lastRoute = result.routes[result.routes.length - 1]; + const lastRoute = result.routes[result.routes.length - 1]!; const key = lastRoute.key; const modifiedLastRoute: typeof lastRoute = { ...lastRoute, @@ -532,8 +532,9 @@ function filterSingular< return state; } + // TODO(@kitten): This looks wrong as it's defaulting `index === 0` const currentIndex = state.index || state.routes.length - 1; - const current = state.routes[currentIndex]; + const current = state.routes[currentIndex]!; const name = current.name; const id = getId?.({ params: current.params }); diff --git a/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.renderCount.test.android.tsx b/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.renderCount.test.android.tsx index 1eec824d0a7410..79fc0b98201acc 100644 --- a/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.renderCount.test.android.tsx +++ b/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.renderCount.test.android.tsx @@ -55,7 +55,7 @@ describe('Stack composition components render count', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(2); // Final call should have merged composition options - const finalProps = ScreenStackItem.mock.calls[1][0]; + const finalProps = ScreenStackItem.mock.calls[1]![0]; expect(finalProps.headerConfig?.title).toBe('Home'); expect(finalProps.headerConfig?.backButtonInCustomView).toBe(false); expect(finalProps.headerConfig?.backgroundColor).toBe('blue'); @@ -93,7 +93,7 @@ describe('Stack composition components render count', () => { // layout render + index composition registration expect(ScreenStackItem).toHaveBeenCalledTimes(2); - expect(ScreenStackItem.mock.calls[1][0].headerConfig?.title).toBe('Home'); + expect(ScreenStackItem.mock.calls[1]![0].headerConfig?.title).toBe('Home'); jest.clearAllMocks(); @@ -115,7 +115,7 @@ describe('Stack composition components render count', () => { // but we can optimize this in the future expect(ScreenStackItem).toHaveBeenCalledTimes(4); // Last call should have detail's composition options - expect(ScreenStackItem.mock.calls[3][0].headerConfig?.title).toBe('Detail'); + expect(ScreenStackItem.mock.calls[3]![0].headerConfig?.title).toBe('Detail'); jest.clearAllMocks(); @@ -164,7 +164,7 @@ describe('Stack composition components render count', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(2); // Final call should have ALL four components' options merged - const finalProps = ScreenStackItem.mock.calls[1][0]; + const finalProps = ScreenStackItem.mock.calls[1]![0]; expect(finalProps.headerConfig?.title).toBe('Home'); expect(finalProps.headerConfig?.backButtonInCustomView).toBe(false); expect(finalProps.headerConfig?.backgroundColor).toBe('blue'); @@ -216,8 +216,8 @@ describe('Stack composition components render count', () => { // ScreenStackItem calls after A -> B: // [0] screen A (nav state), [1] screen B (initial), [2] screen A (rerender), [3] screen B (composition) expect(ScreenStackItem).toHaveBeenCalledTimes(4); - expect(ScreenStackItem.mock.calls[3][0].headerConfig?.title).toBe('Screen B'); - expect(ScreenStackItem.mock.calls[3][0].headerConfig?.backTitle).toBe('Back to A'); + expect(ScreenStackItem.mock.calls[3]![0].headerConfig?.title).toBe('Screen B'); + expect(ScreenStackItem.mock.calls[3]![0].headerConfig?.backTitle).toBe('Back to A'); // Navigate B -> C jest.clearAllMocks(); @@ -303,7 +303,7 @@ describe('Stack composition components render count', () => { expect(screen.getByTestId('title')).toHaveTextContent('Initial'); // Verify initial title propagated - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.title).toBe('Initial'); // Clear after initial settle @@ -320,7 +320,7 @@ describe('Stack composition components render count', () => { // ScreenStackItem SHOULD be called — composition options changed expect(ScreenStackItem).toHaveBeenCalledTimes(1); - expect(ScreenStackItem.mock.calls[0][0].headerConfig?.title).toBe('Updated'); + expect(ScreenStackItem.mock.calls[0]![0].headerConfig?.title).toBe('Updated'); }); it('conditionally removed composition component clears its options', () => { @@ -348,7 +348,7 @@ describe('Stack composition components render count', () => { expect(screen.getByTestId('content')).toBeVisible(); // Verify initial state has back button options - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.title).toBe('Home'); expect(initialProps.headerConfig?.backTitle).toBe('Go Back'); @@ -363,7 +363,7 @@ describe('Stack composition components render count', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(1); // The back button options should be cleared (unregistered from composition registry) - const finalProps = ScreenStackItem.mock.calls[0][0]; + const finalProps = ScreenStackItem.mock.calls[0]![0]; // Title still present (its composition component is still mounted) expect(finalProps.headerConfig?.title).toBe('Home'); // Back button title should be gone (component unmounted, unregistered) @@ -414,7 +414,7 @@ describe('Stack composition components render count', () => { // Initial render + suite 0 registration (batched) expect(ScreenStackItem).toHaveBeenCalledTimes(2); - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.title).toBe('Home'); expect(initialProps.headerConfig?.backButtonInCustomView).toBe(false); expect(initialProps.headerConfig?.backgroundColor).toBe('blue'); @@ -429,7 +429,7 @@ describe('Stack composition components render count', () => { expect(indexRender).toHaveBeenCalledTimes(1); expect(ScreenStackItem).toHaveBeenCalledTimes(1); - const suite1Props = ScreenStackItem.mock.calls[0][0]; + const suite1Props = ScreenStackItem.mock.calls[0]![0]; expect(suite1Props.headerConfig?.title).toBe('Browse'); expect(suite1Props.headerConfig?.backgroundColor).toBe('green'); // BackButton unmounted — its options should be cleared @@ -444,7 +444,7 @@ describe('Stack composition components render count', () => { expect(indexRender).toHaveBeenCalledTimes(1); expect(ScreenStackItem).toHaveBeenCalledTimes(1); - const suite2Props = ScreenStackItem.mock.calls[0][0]; + const suite2Props = ScreenStackItem.mock.calls[0]![0]; expect(suite2Props.headerConfig?.title).toBe('Search'); expect(suite2Props.headerConfig?.backButtonInCustomView).toBe(false); // Header unmounted — backgroundColor reverts to React Navigation's default theme card color diff --git a/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.renderCount.test.ios.tsx b/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.renderCount.test.ios.tsx index 57d07acf92312e..a7d2d30f6d05a2 100644 --- a/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.renderCount.test.ios.tsx +++ b/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.renderCount.test.ios.tsx @@ -46,7 +46,7 @@ describe('Stack composition components render count', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(2); // Final call should have merged composition options - const finalProps = ScreenStackItem.mock.calls[1][0]; + const finalProps = ScreenStackItem.mock.calls[1]![0]; expect(finalProps.headerConfig?.title).toBe('Home'); expect(finalProps.headerConfig?.backButtonInCustomView).toBe(false); expect(finalProps.headerConfig?.blurEffect).toBe('regular'); @@ -84,7 +84,7 @@ describe('Stack composition components render count', () => { // layout render + index composition registration expect(ScreenStackItem).toHaveBeenCalledTimes(2); - expect(ScreenStackItem.mock.calls[1][0].headerConfig?.title).toBe('Home'); + expect(ScreenStackItem.mock.calls[1]![0].headerConfig?.title).toBe('Home'); jest.clearAllMocks(); @@ -106,7 +106,7 @@ describe('Stack composition components render count', () => { // but we can optimize this in the future expect(ScreenStackItem).toHaveBeenCalledTimes(4); // Last call should have detail's composition options - expect(ScreenStackItem.mock.calls[3][0].headerConfig?.title).toBe('Detail'); + expect(ScreenStackItem.mock.calls[3]![0].headerConfig?.title).toBe('Detail'); jest.clearAllMocks(); @@ -157,7 +157,7 @@ describe('Stack composition components render count', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(2); // Final call should have ALL four components' options merged - const finalProps = ScreenStackItem.mock.calls[1][0]; + const finalProps = ScreenStackItem.mock.calls[1]![0]; expect(finalProps.headerConfig?.title).toBe('Home'); expect(finalProps.headerConfig?.backButtonInCustomView).toBe(false); expect(finalProps.headerConfig?.blurEffect).toBe('regular'); @@ -209,8 +209,8 @@ describe('Stack composition components render count', () => { // ScreenStackItem calls after A -> B: // [0] screen A (nav state), [1] screen B (initial), [2] screen A (rerender), [3] screen B (composition) expect(ScreenStackItem).toHaveBeenCalledTimes(4); - expect(ScreenStackItem.mock.calls[3][0].headerConfig?.title).toBe('Screen B'); - expect(ScreenStackItem.mock.calls[3][0].headerConfig?.backTitle).toBe('Back to A'); + expect(ScreenStackItem.mock.calls[3]![0].headerConfig?.title).toBe('Screen B'); + expect(ScreenStackItem.mock.calls[3]![0].headerConfig?.backTitle).toBe('Back to A'); // Navigate B -> C jest.clearAllMocks(); @@ -296,7 +296,7 @@ describe('Stack composition components render count', () => { expect(screen.getByTestId('title')).toHaveTextContent('Initial'); // Verify initial title propagated - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.title).toBe('Initial'); // Clear after initial settle @@ -313,7 +313,7 @@ describe('Stack composition components render count', () => { // ScreenStackItem SHOULD be called — composition options changed expect(ScreenStackItem).toHaveBeenCalledTimes(1); - expect(ScreenStackItem.mock.calls[0][0].headerConfig?.title).toBe('Updated'); + expect(ScreenStackItem.mock.calls[0]![0].headerConfig?.title).toBe('Updated'); }); it('conditionally removed composition component clears its options', () => { @@ -341,7 +341,7 @@ describe('Stack composition components render count', () => { expect(screen.getByTestId('content')).toBeVisible(); // Verify initial state has back button options - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.title).toBe('Home'); expect(initialProps.headerConfig?.backTitle).toBe('Go Back'); @@ -356,7 +356,7 @@ describe('Stack composition components render count', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(1); // The back button options should be cleared (unregistered from composition registry) - const finalProps = ScreenStackItem.mock.calls[0][0]; + const finalProps = ScreenStackItem.mock.calls[0]![0]; // Title still present (its composition component is still mounted) expect(finalProps.headerConfig?.title).toBe('Home'); // Back button title should be gone (component unmounted, unregistered) @@ -407,7 +407,7 @@ describe('Stack composition components render count', () => { // Initial render + suite 0 registration (batched) expect(ScreenStackItem).toHaveBeenCalledTimes(2); - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.title).toBe('Home'); expect(initialProps.headerConfig?.backButtonInCustomView).toBe(false); expect(initialProps.headerConfig?.blurEffect).toBe('regular'); @@ -422,7 +422,7 @@ describe('Stack composition components render count', () => { expect(indexRender).toHaveBeenCalledTimes(1); expect(ScreenStackItem).toHaveBeenCalledTimes(1); - const suite1Props = ScreenStackItem.mock.calls[0][0]; + const suite1Props = ScreenStackItem.mock.calls[0]![0]; expect(suite1Props.headerConfig?.title).toBe('Browse'); expect(suite1Props.headerConfig?.blurEffect).toBe('prominent'); // BackButton unmounted — its options should be cleared @@ -437,7 +437,7 @@ describe('Stack composition components render count', () => { expect(indexRender).toHaveBeenCalledTimes(1); expect(ScreenStackItem).toHaveBeenCalledTimes(1); - const suite2Props = ScreenStackItem.mock.calls[0][0]; + const suite2Props = ScreenStackItem.mock.calls[0]![0]; expect(suite2Props.headerConfig?.title).toBe('Search'); expect(suite2Props.headerConfig?.backButtonInCustomView).toBe(false); // Header unmounted — blurEffect should be cleared diff --git a/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.unmount.test.android.tsx b/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.unmount.test.android.tsx index 7b03810b0f3ce8..868515969313c4 100644 --- a/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.unmount.test.android.tsx +++ b/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.unmount.test.android.tsx @@ -44,7 +44,7 @@ describe('Stack composition component unmount resets options', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(2); // [0] is initial layout render, [1] is composition registration - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.title).toBe('Custom'); jest.clearAllMocks(); @@ -55,7 +55,7 @@ describe('Stack composition component unmount resets options', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(1); - const finalProps = ScreenStackItem.mock.calls[0][0]; + const finalProps = ScreenStackItem.mock.calls[0]![0]; expect(finalProps.headerConfig?.title).toBe('index'); }); @@ -75,7 +75,7 @@ describe('Stack composition component unmount resets options', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(2); // [0] is initial layout render, [1] is composition registration - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.backTitle).toBe('Go Back'); jest.clearAllMocks(); @@ -86,7 +86,7 @@ describe('Stack composition component unmount resets options', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(1); - const finalProps = ScreenStackItem.mock.calls[0][0]; + const finalProps = ScreenStackItem.mock.calls[0]![0]; expect(finalProps.headerConfig?.backTitle).toBeUndefined(); }); @@ -107,7 +107,7 @@ describe('Stack composition component unmount resets options', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(2); // [0] is initial layout render, [1] is composition registration - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.backgroundColor).toBe('red'); expect(initialProps.headerConfig?.hidden).toBe(false); @@ -119,7 +119,7 @@ describe('Stack composition component unmount resets options', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(1); - const finalProps = ScreenStackItem.mock.calls[0][0]; + const finalProps = ScreenStackItem.mock.calls[0]![0]; // backgroundColor reverts to React Navigation's default theme card color expect(finalProps.headerConfig?.backgroundColor).toBe('rgb(255, 255, 255)'); expect(finalProps.headerConfig?.hidden).toBe(true); @@ -144,7 +144,7 @@ describe('Stack composition component unmount resets options', () => { // headerSearchBarOptions is rendered as a SearchBar child inside ScreenStackHeaderSearchBarView expect(ScreenStackHeaderSearchBarView).toHaveBeenCalled(); // [0] is initial layout render, [1] is composition registration - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.hidden).toBe(false); jest.clearAllMocks(); @@ -156,7 +156,7 @@ describe('Stack composition component unmount resets options', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(1); // SearchBar view is no longer rendered after composition option is cleared expect(ScreenStackHeaderSearchBarView).not.toHaveBeenCalled(); - const finalProps = ScreenStackItem.mock.calls[0][0]; + const finalProps = ScreenStackItem.mock.calls[0]![0]; expect(finalProps.headerConfig?.hidden).toBe(true); }); }); diff --git a/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.unmount.test.ios.tsx b/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.unmount.test.ios.tsx index 92f57957e60e42..9dec429a0a517e 100644 --- a/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.unmount.test.ios.tsx +++ b/packages/expo-router/src/layouts/stack-utils/__tests__/StackComposition.unmount.test.ios.tsx @@ -43,7 +43,7 @@ describe('Stack composition component unmount resets options', () => { renderRouter({ _layout: () => , index: Index }); // [0] is initial layout render, [1] is composition registration - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.title).toBe('Custom'); jest.clearAllMocks(); @@ -54,7 +54,7 @@ describe('Stack composition component unmount resets options', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(1); - const finalProps = ScreenStackItem.mock.calls[0][0]; + const finalProps = ScreenStackItem.mock.calls[0]![0]; expect(finalProps.headerConfig?.title).toBe('index'); }); @@ -73,7 +73,7 @@ describe('Stack composition component unmount resets options', () => { renderRouter({ _layout: () => , index: Index }); // [0] is initial layout render, [1] is composition registration - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.backTitle).toBe('Go Back'); jest.clearAllMocks(); @@ -84,7 +84,7 @@ describe('Stack composition component unmount resets options', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(1); - const finalProps = ScreenStackItem.mock.calls[0][0]; + const finalProps = ScreenStackItem.mock.calls[0]![0]; expect(finalProps.headerConfig?.backTitle).toBeUndefined(); }); @@ -104,7 +104,7 @@ describe('Stack composition component unmount resets options', () => { renderRouter({ _layout: () => , index: Index }); // [0] is initial layout render, [1] is composition registration - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.blurEffect).toBe('regular'); expect(initialProps.headerConfig?.hidden).toBe(false); @@ -116,7 +116,7 @@ describe('Stack composition component unmount resets options', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(1); - const finalProps = ScreenStackItem.mock.calls[0][0]; + const finalProps = ScreenStackItem.mock.calls[0]![0]; expect(finalProps.headerConfig?.blurEffect).toBeUndefined(); expect(finalProps.headerConfig?.hidden).toBe(true); }); @@ -139,7 +139,7 @@ describe('Stack composition component unmount resets options', () => { // headerSearchBarOptions is rendered as a SearchBar child inside ScreenStackHeaderSearchBarView expect(ScreenStackHeaderSearchBarView).toHaveBeenCalled(); // [0] is initial layout render, [1] is composition registration - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.hidden).toBe(false); jest.clearAllMocks(); @@ -151,7 +151,7 @@ describe('Stack composition component unmount resets options', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(1); // SearchBar view is no longer rendered after composition option is cleared expect(ScreenStackHeaderSearchBarView).not.toHaveBeenCalled(); - const finalProps = ScreenStackItem.mock.calls[0][0]; + const finalProps = ScreenStackItem.mock.calls[0]![0]; expect(finalProps.headerConfig?.hidden).toBe(true); }); @@ -174,7 +174,7 @@ describe('Stack composition component unmount resets options', () => { renderRouter({ _layout: () => , index: Index }); // [0] is initial layout render, [1] is composition registration - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.headerLeftBarButtonItems).toBeDefined(); jest.clearAllMocks(); @@ -185,7 +185,7 @@ describe('Stack composition component unmount resets options', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(1); - const finalProps = ScreenStackItem.mock.calls[0][0]; + const finalProps = ScreenStackItem.mock.calls[0]![0]; expect(finalProps.headerConfig?.headerLeftBarButtonItems).toBeUndefined(); }); @@ -208,7 +208,7 @@ describe('Stack composition component unmount resets options', () => { renderRouter({ _layout: () => , index: Index }); // [0] is initial layout render, [1] is composition registration - const initialProps = ScreenStackItem.mock.calls[1][0]; + const initialProps = ScreenStackItem.mock.calls[1]![0]; expect(initialProps.headerConfig?.headerRightBarButtonItems).toBeDefined(); jest.clearAllMocks(); @@ -219,7 +219,7 @@ describe('Stack composition component unmount resets options', () => { expect(ScreenStackItem).toHaveBeenCalledTimes(1); - const finalProps = ScreenStackItem.mock.calls[0][0]; + const finalProps = ScreenStackItem.mock.calls[0]![0]; expect(finalProps.headerConfig?.headerRightBarButtonItems).toBeUndefined(); }); }); diff --git a/packages/expo-router/src/layouts/stack-utils/__tests__/StackScreen.test.ios.tsx b/packages/expo-router/src/layouts/stack-utils/__tests__/StackScreen.test.ios.tsx index c77a9d2a700502..d6e4f4650b81e2 100644 --- a/packages/expo-router/src/layouts/stack-utils/__tests__/StackScreen.test.ios.tsx +++ b/packages/expo-router/src/layouts/stack-utils/__tests__/StackScreen.test.ios.tsx @@ -230,8 +230,8 @@ describe(appendScreenStackPropsToOptions, () => { expect(typeof result[itemsKey]).toBe('function'); const items = result[itemsKey]?.({}); expect(items).toHaveLength(2); - expect(items?.[0].type).toBe('button'); - expect(items?.[1].type).toBe('button'); + expect(items?.[0]!.type).toBe('button'); + expect(items?.[1]!.type).toBe('button'); expect(result[otherKey]).toBeUndefined(); } ); diff --git a/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbar.integration.test.android.tsx b/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbar.integration.test.android.tsx index b1b511f48a93d0..5810456f2de454 100644 --- a/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbar.integration.test.android.tsx +++ b/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbar.integration.test.android.tsx @@ -168,7 +168,7 @@ describe('Stack.Toolbar Android integration tests', () => { // Android uses headerLeft/headerRight (ScreenStackHeaderLeftView/RightView), // NOT headerLeftBarButtonItems/headerRightBarButtonItems (iOS-only) - const headerConfig = MockedScreenStackItem.mock.calls[0][0].headerConfig; + const headerConfig = MockedScreenStackItem.mock.calls[0]![0].headerConfig; expect(headerConfig?.headerLeftBarButtonItems).toBeUndefined(); expect(headerConfig?.headerRightBarButtonItems).toBeUndefined(); @@ -206,7 +206,7 @@ describe('Stack.Toolbar Android integration tests', () => { expect(screen.getAllByTestId('IconButton')).toHaveLength(2); // Android uses headerLeft/headerRight, not iOS bar button items - const headerConfig = MockedScreenStackItem.mock.calls[0][0].headerConfig; + const headerConfig = MockedScreenStackItem.mock.calls[0]![0].headerConfig; expect(headerConfig?.headerLeftBarButtonItems).toBeUndefined(); expect(headerConfig?.headerRightBarButtonItems).toBeUndefined(); @@ -233,7 +233,7 @@ describe('Stack.Toolbar Android integration tests', () => { expect(screen.getByTestId('index')).toBeVisible(); expect(screen.getByTestId(`custom-${placement}`)).toBeVisible(); - const headerConfig = MockedScreenStackItem.mock.calls[0][0].headerConfig; + const headerConfig = MockedScreenStackItem.mock.calls[0]![0].headerConfig; expect(headerConfig?.headerLeftBarButtonItems).toBeUndefined(); expect(headerConfig?.headerRightBarButtonItems).toBeUndefined(); diff --git a/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbar.integration.test.ios.tsx b/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbar.integration.test.ios.tsx index 5f3880be5e0606..9f2d8f3a02fde1 100644 --- a/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbar.integration.test.ios.tsx +++ b/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbar.integration.test.ios.tsx @@ -187,7 +187,7 @@ describe('Stack.Toolbar integration tests', () => { expect(screen.getByTestId('index')).toBeVisible(); - const items = MockedScreenStackItem.mock.calls[0][0].headerConfig?.headerLeftBarButtonItems; + const items = MockedScreenStackItem.mock.calls[0]![0].headerConfig?.headerLeftBarButtonItems; expect(items).toHaveLength(1); expect(items?.[0]).toMatchObject({ type: 'button', @@ -211,7 +211,7 @@ describe('Stack.Toolbar integration tests', () => { expect(screen.getByTestId('index')).toBeVisible(); - const items = MockedScreenStackItem.mock.calls[0][0].headerConfig?.headerRightBarButtonItems; + const items = MockedScreenStackItem.mock.calls[0]![0].headerConfig?.headerRightBarButtonItems; expect(items).toHaveLength(1); expect(items?.[0]).toMatchObject({ type: 'button', @@ -238,7 +238,7 @@ describe('Stack.Toolbar integration tests', () => { expect(screen.getByTestId('index')).toBeVisible(); - const headerConfig = MockedScreenStackItem.mock.calls[0][0].headerConfig; + const headerConfig = MockedScreenStackItem.mock.calls[0]![0].headerConfig; const leftItems = headerConfig?.headerLeftBarButtonItems; const rightItems = headerConfig?.headerRightBarButtonItems; @@ -371,7 +371,7 @@ describe('Stack.Toolbar integration tests', () => { expect(screen.getByTestId('index')).toBeVisible(); - const headerConfig = MockedScreenStackItem.mock.calls[0][0].headerConfig; + const headerConfig = MockedScreenStackItem.mock.calls[0]![0].headerConfig; expect(headerConfig?.title).toBe('Page Title 1'); const rightItems = headerConfig?.headerRightBarButtonItems; @@ -399,7 +399,7 @@ describe('Stack.Toolbar integration tests', () => { expect(screen.getByTestId('index')).toBeVisible(); - const headerConfig = MockedScreenStackItem.mock.calls[0][0].headerConfig; + const headerConfig = MockedScreenStackItem.mock.calls[0]![0].headerConfig; expect(headerConfig?.backTitleFontSize).toBe(18); const rightItems = headerConfig?.headerRightBarButtonItems; diff --git a/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbar.placement-changes.test.ios.tsx b/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbar.placement-changes.test.ios.tsx index a47ab9fd10ef4f..a9df883507bddb 100644 --- a/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbar.placement-changes.test.ios.tsx +++ b/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbar.placement-changes.test.ios.tsx @@ -71,7 +71,7 @@ describe('Stack.Toolbar dynamic placement changes', () => { // [0] Initial layout render (no toolbar options yet) // [1] Screen component renders, toolbar sets left items via composition registry expect(ScreenStackItem).toHaveBeenCalledTimes(2); - const headerConfig = ScreenStackItem.mock.calls[1][0].headerConfig; + const headerConfig = ScreenStackItem.mock.calls[1]![0].headerConfig; expect(headerConfig?.headerLeftBarButtonItems).toHaveLength(1); expect( (headerConfig?.headerLeftBarButtonItems?.[0] as HeaderBarButtonItemWithAction).icon @@ -88,7 +88,7 @@ describe('Stack.Toolbar dynamic placement changes', () => { // Composition cleanup removes left items, right toolbar registers new items expect(ScreenStackItem).toHaveBeenCalledTimes(1); - const headerConfigAfter = ScreenStackItem.mock.calls[0][0].headerConfig; + const headerConfigAfter = ScreenStackItem.mock.calls[0]![0].headerConfig; expect(headerConfigAfter?.headerLeftBarButtonItems).toBeUndefined(); expect(headerConfigAfter?.headerRightBarButtonItems).toHaveLength(1); expect( @@ -126,7 +126,9 @@ describe('Stack.Toolbar dynamic placement changes', () => { // [0] Initial layout render // [1] Screen component renders with left toolbar options expect(ScreenStackItem).toHaveBeenCalledTimes(2); - expect(ScreenStackItem.mock.calls[1][0].headerConfig?.headerLeftBarButtonItems).toHaveLength(1); + expect(ScreenStackItem.mock.calls[1]![0].headerConfig?.headerLeftBarButtonItems).toHaveLength( + 1 + ); // Bottom toolbar uses RouterToolbarHost, not called yet expect(MockedRouterToolbarHost).not.toHaveBeenCalled(); @@ -140,12 +142,14 @@ describe('Stack.Toolbar dynamic placement changes', () => { // RouterToolbarItem is called with correct icon (systemImageName for SF Symbol) expect(MockedRouterToolbarItem).toHaveBeenCalledTimes(1); - expect(MockedRouterToolbarItem.mock.calls[0][0].systemImageName).toBe('star'); + expect(MockedRouterToolbarItem.mock.calls[0]![0].systemImageName).toBe('star'); // Render sequence after placement change: // Composition cleanup removes headerLeftBarButtonItems expect(ScreenStackItem).toHaveBeenCalledTimes(1); - expect(ScreenStackItem.mock.calls[0][0].headerConfig?.headerLeftBarButtonItems).toBeUndefined(); + expect( + ScreenStackItem.mock.calls[0]![0].headerConfig?.headerLeftBarButtonItems + ).toBeUndefined(); }); it('bottom to right: stops using RouterToolbarHost and populates headerRightBarButtonItems', () => { @@ -176,15 +180,15 @@ describe('Stack.Toolbar dynamic placement changes', () => { // RouterToolbarItem is called with correct icon (systemImageName for SF Symbol) expect(MockedRouterToolbarItem).toHaveBeenCalledTimes(1); - expect(MockedRouterToolbarItem.mock.calls[0][0].systemImageName).toBe('star'); + expect(MockedRouterToolbarItem.mock.calls[0]![0].systemImageName).toBe('star'); // No header bar button items should be set (bottom doesn't use them) // All initial calls should have no right bar button items expect( ScreenStackItem.mock.calls.every( (call) => - !call[0].headerConfig?.headerRightBarButtonItems || - call[0].headerConfig.headerRightBarButtonItems.length === 0 + !call[0]!.headerConfig?.headerRightBarButtonItems || + call[0]!.headerConfig.headerRightBarButtonItems.length === 0 ) ).toBe(true); @@ -195,7 +199,7 @@ describe('Stack.Toolbar dynamic placement changes', () => { // Render sequence after placement change: // [0] Right toolbar sets headerRightBarButtonItems expect(ScreenStackItem).toHaveBeenCalledTimes(1); - const headerConfigAfter = ScreenStackItem.mock.calls[0][0].headerConfig; + const headerConfigAfter = ScreenStackItem.mock.calls[0]![0].headerConfig; expect(headerConfigAfter?.headerRightBarButtonItems).toHaveLength(1); expect( (headerConfigAfter!.headerRightBarButtonItems![0] as HeaderBarButtonItemWithAction).icon @@ -234,7 +238,9 @@ describe('Stack.Toolbar dynamic placement changes', () => { // Initial: left placement // [0] Layout render, [1] Screen with left toolbar expect(ScreenStackItem).toHaveBeenCalledTimes(2); - expect(ScreenStackItem.mock.calls[1][0].headerConfig?.headerLeftBarButtonItems).toHaveLength(1); + expect(ScreenStackItem.mock.calls[1]![0].headerConfig?.headerLeftBarButtonItems).toHaveLength( + 1 + ); expect(MockedRouterToolbarHost).not.toHaveBeenCalled(); // Change to right @@ -243,8 +249,10 @@ describe('Stack.Toolbar dynamic placement changes', () => { // Composition cleanup clears left + right toolbar sets items expect(ScreenStackItem).toHaveBeenCalledTimes(1); - expect(ScreenStackItem.mock.calls[0][0].headerConfig?.headerLeftBarButtonItems).toBeUndefined(); - expect(ScreenStackItem.mock.calls[0][0].headerConfig?.headerRightBarButtonItems).toHaveLength( + expect( + ScreenStackItem.mock.calls[0]![0].headerConfig?.headerLeftBarButtonItems + ).toBeUndefined(); + expect(ScreenStackItem.mock.calls[0]![0].headerConfig?.headerRightBarButtonItems).toHaveLength( 1 ); expect(MockedRouterToolbarHost).not.toHaveBeenCalled(); @@ -256,13 +264,13 @@ describe('Stack.Toolbar dynamic placement changes', () => { // Composition cleanup removes right items expect(ScreenStackItem).toHaveBeenCalledTimes(1); expect( - ScreenStackItem.mock.calls[0][0].headerConfig?.headerRightBarButtonItems + ScreenStackItem.mock.calls[0]![0].headerConfig?.headerRightBarButtonItems ).toBeUndefined(); expect(MockedRouterToolbarHost).toHaveBeenCalledTimes(1); // RouterToolbarItem is called with correct icon for bottom placement expect(MockedRouterToolbarItem).toHaveBeenCalledTimes(1); - expect(MockedRouterToolbarItem.mock.calls[0][0].systemImageName).toBe('star'); + expect(MockedRouterToolbarItem.mock.calls[0]![0].systemImageName).toBe('star'); // Change back to left jest.clearAllMocks(); @@ -270,7 +278,9 @@ describe('Stack.Toolbar dynamic placement changes', () => { // [0] Left toolbar sets items (no cleanup needed from bottom) expect(ScreenStackItem).toHaveBeenCalledTimes(1); - expect(ScreenStackItem.mock.calls[0][0].headerConfig?.headerLeftBarButtonItems).toHaveLength(1); + expect(ScreenStackItem.mock.calls[0]![0].headerConfig?.headerLeftBarButtonItems).toHaveLength( + 1 + ); expect(MockedRouterToolbarHost).not.toHaveBeenCalled(); }); }); @@ -314,7 +324,7 @@ describe('Stack.Toolbar with navigation', () => { // Last call should have the toolbar options for the detail screen const lastCallIndex = ScreenStackItem.mock.calls.length - 1; - const headerConfig = ScreenStackItem.mock.calls[lastCallIndex][0].headerConfig; + const headerConfig = ScreenStackItem.mock.calls[lastCallIndex]![0].headerConfig; expect(headerConfig?.headerRightBarButtonItems).toHaveLength(1); expect( (headerConfig!.headerRightBarButtonItems![0] as HeaderBarButtonItemWithAction).icon @@ -358,7 +368,7 @@ describe('Stack.Toolbar with navigation', () => { // After navigation, last call should have left toolbar items const lastCallBeforePlacementChange = ScreenStackItem.mock.calls.length - 1; expect( - ScreenStackItem.mock.calls[lastCallBeforePlacementChange][0].headerConfig + ScreenStackItem.mock.calls[lastCallBeforePlacementChange]![0].headerConfig ?.headerLeftBarButtonItems ).toHaveLength(1); @@ -370,11 +380,13 @@ describe('Stack.Toolbar with navigation', () => { // [0] For index // [1] For detail with updated placement expect(ScreenStackItem.mock.calls.length).toBe(2); - expect(ScreenStackItem.mock.calls[0][0].headerConfig?.title).toBe('index'); - expect(ScreenStackItem.mock.calls[1][0].headerConfig?.title).toBe('detail'); + expect(ScreenStackItem.mock.calls[0]![0].headerConfig?.title).toBe('index'); + expect(ScreenStackItem.mock.calls[1]![0].headerConfig?.title).toBe('detail'); - expect(ScreenStackItem.mock.calls[1][0].headerConfig?.headerLeftBarButtonItems).toBeUndefined(); - expect(ScreenStackItem.mock.calls[1][0].headerConfig?.headerRightBarButtonItems).toHaveLength( + expect( + ScreenStackItem.mock.calls[1]![0].headerConfig?.headerLeftBarButtonItems + ).toBeUndefined(); + expect(ScreenStackItem.mock.calls[1]![0].headerConfig?.headerRightBarButtonItems).toHaveLength( 1 ); }); @@ -415,7 +427,7 @@ it('updates multiple toolbars correctly when one changes placement', () => { expect( ( - ScreenStackItem.mock.calls[1][0].headerConfig + ScreenStackItem.mock.calls[1]![0].headerConfig ?.headerLeftBarButtonItems?.[0] as HeaderBarButtonItemWithAction ).icon ).toEqual({ @@ -424,7 +436,7 @@ it('updates multiple toolbars correctly when one changes placement', () => { }); expect( ( - ScreenStackItem.mock.calls[1][0].headerConfig! + ScreenStackItem.mock.calls[1]![0].headerConfig! .headerRightBarButtonItems![0] as HeaderBarButtonItemWithAction ).icon ).toEqual({ @@ -441,18 +453,18 @@ it('updates multiple toolbars correctly when one changes placement', () => { // RouterToolbarItem is called with correct icon for the bottom toolbar expect(MockedRouterToolbarItem).toHaveBeenCalledTimes(1); - expect(MockedRouterToolbarItem.mock.calls[0][0].systemImageName).toBe('ellipsis.circle'); + expect(MockedRouterToolbarItem.mock.calls[0]![0].systemImageName).toBe('ellipsis.circle'); // Render sequence after changing right to bottom: // Composition cleanup removes right items (left toolbar stays) expect(ScreenStackItem.mock.calls.length).toBeGreaterThanOrEqual(1); // Right items cleared via composition cleanup, left items remain - expect(ScreenStackItem.mock.calls[0][0].headerConfig?.headerRightBarButtonItems).toBeUndefined(); - expect(ScreenStackItem.mock.calls[0][0].headerConfig?.headerLeftBarButtonItems).toHaveLength(1); + expect(ScreenStackItem.mock.calls[0]![0].headerConfig?.headerRightBarButtonItems).toBeUndefined(); + expect(ScreenStackItem.mock.calls[0]![0].headerConfig?.headerLeftBarButtonItems).toHaveLength(1); expect( ( - ScreenStackItem.mock.calls[0][0].headerConfig + ScreenStackItem.mock.calls[0]![0].headerConfig ?.headerLeftBarButtonItems?.[0] as HeaderBarButtonItemWithAction ).icon ).toEqual({ @@ -498,11 +510,11 @@ it('batched placement changes: ends up in correct final state', () => { const lastCall = ScreenStackItem.mock.calls.length - 1; expect(lastCall).toBeGreaterThanOrEqual(0); expect( - ScreenStackItem.mock.calls[lastCall][0].headerConfig!.headerRightBarButtonItems + ScreenStackItem.mock.calls[lastCall]![0].headerConfig!.headerRightBarButtonItems ).toHaveLength(1); expect( ( - ScreenStackItem.mock.calls[lastCall][0].headerConfig! + ScreenStackItem.mock.calls[lastCall]![0].headerConfig! .headerRightBarButtonItems![0] as HeaderBarButtonItemWithAction ).icon ).toEqual({ type: 'sfSymbol', name: 'star' }); diff --git a/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbarButton.test.android.tsx b/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbarButton.test.android.tsx index ff11d10aec1029..f13eea867b76ff 100644 --- a/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbarButton.test.android.tsx +++ b/packages/expo-router/src/layouts/stack-utils/__tests__/StackToolbarButton.test.android.tsx @@ -55,7 +55,7 @@ describe('NativeToolbarButton', () => { it('sets tintColor to undefined when imageRenderingMode is original', () => { render(); - expect(MockedIcon.mock.calls[0][0]).toMatchObject({ + expect(MockedIcon.mock.calls[0]![0]).toMatchObject({ tint: undefined, }); }); @@ -65,7 +65,7 @@ describe('NativeToolbarButton', () => { ); - expect(MockedIcon.mock.calls[0][0]).toMatchObject({ + expect(MockedIcon.mock.calls[0]![0]).toMatchObject({ tint: undefined, }); }); @@ -75,7 +75,7 @@ describe('NativeToolbarButton', () => { ); - expect(MockedIcon.mock.calls[0][0]).toMatchObject({ + expect(MockedIcon.mock.calls[0]![0]).toMatchObject({ tint: 'red', }); }); @@ -83,7 +83,7 @@ describe('NativeToolbarButton', () => { it('falls back to dynamic onSurface when imageRenderingMode is template and no tintColor', () => { render(); - expect(MockedIcon.mock.calls[0][0]).toMatchObject({ + expect(MockedIcon.mock.calls[0]![0]).toMatchObject({ tint: 'dynamic:onSurface', }); }); @@ -91,7 +91,7 @@ describe('NativeToolbarButton', () => { it('uses provided tintColor when imageRenderingMode is undefined', () => { render(); - expect(MockedIcon.mock.calls[0][0]).toMatchObject({ + expect(MockedIcon.mock.calls[0]![0]).toMatchObject({ tint: 'red', }); }); @@ -99,7 +99,7 @@ describe('NativeToolbarButton', () => { it('falls back to dynamic onSurface when both imageRenderingMode and tintColor are undefined', () => { render(); - expect(MockedIcon.mock.calls[0][0]).toMatchObject({ + expect(MockedIcon.mock.calls[0]![0]).toMatchObject({ tint: 'dynamic:onSurface', }); }); @@ -117,7 +117,7 @@ describe('NativeToolbarButton', () => { it('uses context tintColor when no prop tintColor', () => { renderWithColors(defaultProps, { tintColor: 'context-tint' }); - expect(MockedIcon.mock.calls[0][0]).toMatchObject({ + expect(MockedIcon.mock.calls[0]![0]).toMatchObject({ tint: 'context-tint', }); }); @@ -125,7 +125,7 @@ describe('NativeToolbarButton', () => { it('prop tintColor takes precedence over context tintColor', () => { renderWithColors({ ...defaultProps, tintColor: 'prop-tint' }, { tintColor: 'context-tint' }); - expect(MockedIcon.mock.calls[0][0]).toMatchObject({ + expect(MockedIcon.mock.calls[0]![0]).toMatchObject({ tint: 'prop-tint', }); }); @@ -133,7 +133,7 @@ describe('NativeToolbarButton', () => { it('falls back to default when no prop or context tintColor', () => { renderWithColors(defaultProps, {}); - expect(MockedIcon.mock.calls[0][0]).toMatchObject({ + expect(MockedIcon.mock.calls[0]![0]).toMatchObject({ tint: 'dynamic:onSurface', }); }); @@ -144,7 +144,7 @@ describe('NativeToolbarButton', () => { { tintColor: 'context-tint' } ); - expect(MockedIcon.mock.calls[0][0]).toMatchObject({ + expect(MockedIcon.mock.calls[0]![0]).toMatchObject({ tint: undefined, }); }); @@ -190,7 +190,7 @@ describe('NativeToolbarButton', () => { (hidden) => { render(