Closed NiksCode closed 1 year ago
Hi @NiksCode, hopefully this explanation helps you understand the setting
initialRouteName
will not cause the (tabs)
screen to render, it is expected that (bugtest)
will render (as they both as /index
and (bugtest)
is higher in alphabetical order.
Without initialRouteName
: Your navigation stack is: (bugtest)
. If the user presses back
on their device it will close the app.
With initialRouteName
: Your navigation stack is (tabs)->(bugtest)
. If the users presses back
, they will be taken to the (tabs)
screen.
initialRouteName
adds an additional "route" to the navigation stack, even if the user hasn't been there. A popular usecase for this is social medial apps, where a user open a post by clicking on a link. When they press back, it takes them back to their feed (instead of closing the app).
These settings are still unstable and their names come from React Navigation (they are the navigator options). As they stabilise we're doing to revisits the documentation/naming convention.
Not sure what happened with all the description i wrote.
I cloned the sample Expo Navigation example project: https://github.com/expo/expo/tree/main/templates/expo-template-tabs
Added another folder/navigation route and in the parent _layout and attempted to set initialRouteName to be (tabs).
However, the app keeps rendering the screen from (bugtest) router group.
Link to github: https://github.com/NiksCode/expo-router-issue