Commit 37ff001
fix(expo-router): pickDefaultScreen prefers a group with an index leaf
When the user-driven redirect after sign-in landed on the root with
href '/', our Stack matched the empty segment, fell back to
\`screens[0]\` — which is the FIRST <Stack.Screen> declared in
akari's root layout: '(auth)'. Effect: every successful login
bounced the user right back to the auth choice screen.
Real expo-router treats group segments \`(name)\` as URL-transparent:
'/' resolves through whatever group has an 'index' leaf. For akari
that's '(tabs)' (\`app/(tabs)/index/index.tsx\`), not '(auth)'
(which only has signin/oauth/password siblings, no index).
Add pickDefaultScreen(screens, base): walks the screens, picks the
first group whose corresponding file-system route table entry has
an index child (\`<group>/index\`, \`<group>/index/_layout\`, or
\`<group>/index/index\`). Falls back to \`screens[0]\` when no group
match — keeps existing apps (smoke-demo, expo-router-tabs.tsx, etc.)
unchanged, since they have no route table registered.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 9952b50 commit 37ff001
1 file changed
Lines changed: 29 additions & 2 deletions
Lines changed: 29 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
212 | 239 | | |
213 | 240 | | |
214 | 241 | | |
| |||
222 | 249 | | |
223 | 250 | | |
224 | 251 | | |
225 | | - | |
| 252 | + | |
226 | 253 | | |
227 | 254 | | |
228 | 255 | | |
| |||
264 | 291 | | |
265 | 292 | | |
266 | 293 | | |
267 | | - | |
| 294 | + | |
268 | 295 | | |
269 | 296 | | |
270 | 297 | | |
| |||
0 commit comments