Question
I’m using Expo Router in a React Native app and ran into an issue with stack navigation.
Structure
app/
├── _layout.tsx // Tabs
├── index.tsx // Home tab
└── profile/
├── _layout.tsx // Stack
├── index.tsx
└── detail/[id].tsx
Issue
Navigating from profile/index → profile/detail/[id] works fine — back button appears.
I also have a quick action on the Home tab that goes directly to /profile/detail/123.
If the Profile tab hasn’t been opened yet, going directly to the detail page shows no back button, and I can’t return to profile/index.
It looks like Expo Router treats the detail page as the root of the stack when accessed directly.
Tried
initialRouteName="index" in profile/_layout.tsx
Nested <Stack> and <Tabs>
Pushing twice (/profile, then /profile/detail/[id]) — works but briefly flashes the index page.
Question
How can I make the stack always treat profile/index as its root — so the back button works — even when opening /profile/detail/[id] directly from another tab (like via a quick action or deep link)?
Env
Expo SDK: 54
React Native: 0.81
Expo Router: latest
Code base github link : https://github.com/abbassi-ahmed/expo-problem