# Migrate an Expo App from React Navigation to Expo Router

Yes. An agent turns your React Navigation stack and tabs into Expo Router layout files, moves fonts and theme into the root layout, type-checks it and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/migrate-to-expo-router/expo/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent clones the app and maps the navigation tree before writing a file. In an app like `with-react-navigation` in expo/examples, `package.json` points `main` at `index.tsx`, which calls `registerRootComponent(App)`, and depends on `expo` 57, `@react-navigation/native` 7.1, `@react-navigation/native-stack` 7.3 and `@react-navigation/bottom-tabs` 7.4. `src/navigation/index.tsx` builds the tree with the static API: `createBottomTabNavigator` with `Home` and `Explore` screens, each with a `tabBarIcon` from `IconSymbol`, `HapticTab` as the tab button and `TabBarBackground`, nested as `HomeTabs` inside a `createNativeStackNavigator` beside a `NotFound` screen whose `linking.path` is `*`; `createStaticNavigation` turns that into the `Navigation` component. `src/App.tsx` loads the SpaceMono font with `useFonts`, returns `null` until it loads, builds a theme from `DarkTheme` or `DefaultTheme` with the tint from `constants/Colors.ts`, and passes a `linking` config with the `helloworld://` prefix that `app.json` also sets as `scheme`. `tsconfig.json` extends `expo/tsconfig.base` with an `@/*` alias to `src/*`.

It then expresses the same tree as files. `src/app/_layout.tsx` becomes the root: it calls `useFonts`, wraps the app in `ThemeProvider` from Expo Router's React Navigation entry point with the same tint logic, and renders a `Stack` with the `(tabs)` group and `headerShown: false`. `src/app/(tabs)/_layout.tsx` renders `Tabs` with the existing `HapticTab`, `TabBarBackground` and `tabBarStyle` from the old `screenOptions`, and one `Tabs.Screen` each for `index` and `explore` with their `IconSymbol` icons. `Home.tsx` becomes `src/app/(tabs)/index.tsx` and `Explore.tsx` becomes `src/app/(tabs)/explore.tsx`, each now a default export, and `NotFound.tsx` becomes `src/app/+not-found.tsx` with a `Link` to `/` in place of the `Button screen="HomeTabs"`. The `linking` prop goes away, because Expo Router derives links from the file tree, and the `initialState` and `linking.path: '*'` cases it replaced are covered by the not-found route. The agent fixes the `possition` typo in the iOS `tabBarStyle` while moving it, and says so.

The wiring changes are small and listed. `package.json` gets `"main": "expo-router/entry"` and `expo-router` installed with `npx expo install` so the version matches SDK 57, and `index.tsx` and `src/App.tsx` are deleted. `app.json` adds `expo-router` to `plugins`, keeps `scheme: helloworld`, and turns on `experiments.typedRoutes` so `Link` and `router.push` are checked against real routes. `gesture-handler.native.tsx` stays, imported from the root layout instead of the deleted entry file, since Expo Router does not install the gesture handler for you. The `reset-project` script in `src/scripts/`, which writes a `src/navigation` tree, is updated to write a minimal `src/app` instead. The `@react-navigation/*` packages stay because Expo Router depends on them and `HapticTab` still imports `BottomTabBarButtonProps`.

It proves the result compiles and resolves. It runs `npx expo install --check`, `npx tsc --noEmit` with the generated typed routes, `npx expo lint`, and `npx expo export --platform web`, which walks every route and fails on a route file without a default export. The exported route list goes into the pull request as the new navigation tree, next to the old one from `src/navigation/index.tsx`.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Migrate this Expo app from React Navigation to Expo Router. Read package.json, app.json, tsconfig.json, the entry file, the App component and every file under src/navigation first, and write down the navigator tree with its screen options, linking config and deep link scheme. Recreate it as Expo Router files under src/app: a root _layout.tsx that loads fonts and provides the theme, a (tabs) group with its own _layout.tsx keeping the tab buttons, icons and styles, one file per screen as a default export, and a +not-found.tsx with a link home. Set main to expo-router/entry, add the expo-router plugin, turn on typed routes, install expo-router at the SDK's version, delete the old entry and App files and update any script that regenerates the navigation tree. Run expo install --check, tsc, expo lint and a web export, and open a pull request with the old and new route trees side by side and the command output.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request that adds `src/app/_layout.tsx`, `src/app/(tabs)/_layout.tsx`, `index.tsx`, `explore.tsx` and `+not-found.tsx`, deletes `index.tsx`, `src/App.tsx` and `src/navigation/`, and changes `package.json`, `app.json` and the reset script. The description shows the React Navigation tree and the file tree that replaced it, screen by screen, with the options that moved and the one typo fixed.

The run's record keeps the `expo install --check` result, the `tsc` pass with typed routes on, the lint output and the web export's route list, so a reviewer can see every screen the router found without starting a simulator.

Before merging, a reviewer runs the app in a development build on one platform, opens a `helloworld://` link to a tab and to a path that does not exist, and confirms the font loads before the first screen rather than after.

## Run it on every Expo app still on React Navigation

A mobile engineer hands this off from the terminal once per app: one `POST /o/{org}/sessions` with this body and the repository in `resources`. A team with several apps sends one request each, with a `request_id` that is a UUID v5 of the repository name so a retried request returns the run already started, and reads each finished run from the key's `webhook_url`.

Each run reads its own app's navigator tree and reproduces that tree, so an app with a drawer or a nested stack inside a tab gets the matching layout files, not the two-tab template.

## Why run it on Rush?

A navigation migration touches the entry point, the config, every screen file and the links users already have, and the only honest check is building the app and walking its routes. The agent does that in its own sandbox: it exports the app, reads the route list the router produced, and compares it to the tree it set out to reproduce before a person reviews a line.

On Rush the comparison is in the run's record next to the pull request, and a follow-up can be sent to the same run, for example to move one more screen or change a route name, without starting over. The same body works for every Expo app a team maintains.

## Frequently asked questions

### Will existing deep links keep working?

Links to the tabs keep working because the scheme in `app.json` is unchanged and the routes are `/` and `/explore`. If your React Navigation linking config mapped a screen to a custom path, the agent names the file to match that path or adds a redirect, and lists each mapping in the pull request.

### Do I have to move the screens into src/app?

Only the route files. Expo Router treats `src/app` as the route root automatically, and a screen file there can stay a thin default export that renders a component from `src/components` or `src/screens` if you prefer to keep the implementation where it was.

### What happens to the font loading and the splash screen?

They move into the root layout. Expo Router hides the splash screen once navigation mounts, and returning `null` from the root while fonts load is not supported, so the layout keeps rendering and the screens hide text that needs the font until it is ready.

### Can I keep React Navigation installed?

Yes, and you should: Expo Router is built on it and your tab button type comes from `@react-navigation/bottom-tabs`. What goes away is the hand-written navigator and the `linking` prop, not the packages.

## More Expo jobs

- [Write Component Tests for an Expo App](https://getrush.ai/run/write-component-tests/expo/)
- [Add Accessibility Labels to an Expo App's Screens and Components](https://getrush.ai/run/add-accessibility-labels/expo/)
- [Add Analytics to an Expo App](https://getrush.ai/run/add-analytics/expo/)

## More jobs like this: Hand off a long task

- [Migrate an Ansible Role to Fully Qualified Collection Names](https://getrush.ai/run/migrate-to-fqcn/ansible/)
- [Migrate an Echo App From GORM v1 to GORM v2](https://getrush.ai/run/migrate-to-gorm-v2/echo/)
- [Migrate a Gradle Build to the Kotlin DSL](https://getrush.ai/run/migrate-to-kotlin-dsl/gradle/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
