expo / router

[ARCHIVE]: Expo Router has moved to expo/expo -- The File-based router for universal React Native apps
https://docs.expo.dev/routing/introduction/
1.36k stars 113 forks source link

Bad start-up navigation with expo prebuild #845

Closed Scr3nt closed 1 year ago

Scr3nt commented 1 year ago

Which package manager are you using? (Yarn is recommended)

yarn

Summary

I use the authentication flow : https://docs.expo.dev/router/reference/authentication/

When I'm with Expo Go I don't have any problems browsing, if I'm logged in I go straight to the home page and if not I go to the login page.

But if I do npx expo prebuild then I have a problem If I'm logged in I go straight to the home page (no problems there) But if I'm not logged in, I'll first briefly see the home page and then be redirected to the login page (see video to understand).

https://github.com/expo/router/assets/56580186/7928c21f-4d63-4ba7-970a-68ba63a8a36f

Minimal reproducible example

To reproduce you can run npx create-expo-app@latest --template tabs@49 then integrate the authentication system and then do an npx expo prebuild.

ombogdanJoinToIt commented 1 year ago

nothing works for me either with expo prebuild

Noitham commented 1 year ago

From what I have been discovering, it seems to first show your app/index.tsx page before the page you want to show.

Scr3nt commented 1 year ago

From what I have been discovering, it seems to first show your app/index.tsx page before the page you want to show.

Yes, that's it

Scr3nt commented 1 year ago

The only solution I've found so far is to use a 1500ms setTimeout before masking the splashscreen to allow time for the redirection to take place The problem is that this adds 1500ms to the app's startup time.