Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Official Expo team skills for building, deploying, and debugging Expo apps — fine-tuned for Claude Code.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/react-navigation-to-expo-router.md
1# Migrating from react-navigation to expo-router23In SDK 56+, application code must not import from `@react-navigation/*` directly. Repoint those imports to the matching `expo-router` entry points. Runtime API is unchanged — only the module specifiers move.45## Steps671. Prefer the automated codemod (see below). If it is not viable, fall back to the manual mapping.82. Replace imports using the table. Use the entry point that matches the `@react-navigation/*` source.93. After rewriting, check whether any of the rewritten imports are deprecated in `expo-router` (see [Check for deprecated imports](#check-for-deprecated-imports)). If so, surface the deprecation reason and the suggested replacement to the user before continuing.104. Validate: search for remaining `@react-navigation/` references in source files, then run typecheck/build/start.115. Remove `@react-navigation/*` packages that are no longer imported from `package.json` and reinstall (delete `node_modules` if needed).1213## Automated migration (preferred)1415Run from the project root over your application code (replace `src` with the actual directory or glob):1617```sh18npx expo-codemod sdk-56-expo-router-react-navigation-replace src19```2021```sh22npx expo-codemod sdk-56-expo-router-react-navigation-replace '**/*.{ts,tsx,js,jsx}'23```2425## Manual API mapping2627| React Navigation source | Expo Router target |28| ------------------------------------- | ------------------------------------------------------------------------ |29| `@react-navigation/native` | `expo-router/react-navigation` |30| `@react-navigation/core` | `expo-router/react-navigation` |31| `@react-navigation/elements` | `expo-router/react-navigation` |32| `@react-navigation/routers` | `expo-router/react-navigation` |33| `@react-navigation/stack` | `expo-router/js-stack` |34| `@react-navigation/bottom-tabs` | `expo-router/js-tabs` |35| `@react-navigation/material-top-tabs` | `expo-router/js-top-tabs` |36| `@react-navigation/native-stack` | No direct equivalent. Use the `Stack` layout from `expo-router` instead. |3738**Stack caveat:** Do NOT rewrite `import { Stack } from "expo-router"` to `expo-router/js-stack`. The root `Stack` is the Expo Router layout component used in route files; only use `expo-router/js-stack` when replacing a `@react-navigation/stack` JS stack navigator.3940If you encounter a symbol that has no replacement, ask the user to file an issue in the `expo/expo` repository describing what is needed and why.4142## Check for deprecated imports4344A successful rewrite to `expo-router/*` does not guarantee the new import is the recommended one. Some symbols are re-exported as deprecated shims and the project may need to migrate further (for example, to a different `expo-router` API or to a first-party Expo package).4546For each symbol rewritten in step 2:47481. Resolve the rewritten module to its source in `node_modules` (e.g., `node_modules/expo-router/build/react-navigation.d.ts`, `js-stack`, `js-tabs`, `js-top-tabs`).492. Look for a `@deprecated` JSDoc tag on the named export, or a runtime deprecation warning in the implementation file.503. If deprecated, capture both the reason and the recommended replacement from the JSDoc/comment.514. Report each deprecated symbol to the user with: the import path, the symbol, the deprecation reason, and the suggested replacement. Wait for the user to confirm before mass-applying further changes.5253## Done when54551. No `@react-navigation/*` imports remain in source files.562. No unused `@react-navigation/*` entries remain in `package.json`.573. Typecheck and bundler start without `@react-navigation/*` errors.5859## Reference6061- Official Expo Router SDK 55 → 56 migration guide: https://docs.expo.dev/router/migrate/sdk-55-to-5662