How to set the initial route in Expo Router
Originally written for Expo Router v1 in April 2023. The API has since moved — what's below is the current pattern as of Expo Router v3+ (Expo SDK 50+), still shipping behind the unstable_ prefix as of SDK 52.
initialRouteName is no longer a prop on <Slot /> / <Stack />. Set it via the unstable_settings export from your layout file (app/_layout.tsx, or any group's _layout.tsx):
1export const unstable_settings = {
2 initialRouteName: 'home',
3}
4
5export default function Layout() {
6 return <Stack />
7}Two things to keep in mind:
- Use the route name (
'home'), not a path ('/home'). - It only kicks in on cold start when nothing else dictates the initial route. A deep link that targets a specific screen wins, and once the navigation history is non-empty the setting is ignored.
For a group like app/(tabs)/_layout.tsx, set unstable_settings per layout — each group has its own initial route.