diff --git a/native/navigation/app-navigator.react.js b/native/navigation/app-navigator.react.js --- a/native/navigation/app-navigator.react.js +++ b/native/navigation/app-navigator.react.js @@ -11,6 +11,7 @@ import HomeTabTip from './home-tab-tip.react.js'; import IntroTip from './intro-tip.react.js'; import MutedTabTip from './muted-tab-tip.react.js'; +import { NavContext } from './navigation-context.js'; import NUXTipOverlayBackdrop from './nux-tip-overlay-backdrop.react.js'; import { createOverlayNavigator } from './overlay-navigator.react.js'; import type { @@ -80,6 +81,8 @@ function AppNavigator(props: AppNavigatorProps): React.Node { const { navigation } = props; + const navContext = React.useContext(NavContext); + const fontsLoaded = useLoadCommFonts(); const rootContext = React.useContext(RootContext); @@ -96,7 +99,11 @@ React.useState(splashScreenHasHidden); React.useEffect(() => { - if (localSplashScreenHasHidden || !fontsLoaded) { + if ( + localSplashScreenHasHidden || + !fontsLoaded || + !navContext?.hasNavigatedToInitialState + ) { return; } splashScreenHasHidden = true; @@ -108,7 +115,11 @@ setLocalSplashScreenHasHidden(true); } })(); - }, [localSplashScreenHasHidden, fontsLoaded]); + }, [ + localSplashScreenHasHidden, + fontsLoaded, + navContext?.hasNavigatedToInitialState, + ]); let pushHandler; if (localSplashScreenHasHidden) { diff --git a/native/navigation/navigation-context.js b/native/navigation/navigation-context.js --- a/native/navigation/navigation-context.js +++ b/native/navigation/navigation-context.js @@ -18,6 +18,7 @@ export type NavContextType = { +state: PossiblyStaleNavigationState, +dispatch: (action: NavAction) => void, + +hasNavigatedToInitialState: boolean, }; const NavContext: React.Context = diff --git a/native/root.react.js b/native/root.react.js --- a/native/root.react.js +++ b/native/root.react.js @@ -135,6 +135,7 @@ | (PossiblyStaleNavigationState => GenericNavigationAction), ) => void>(); const navStateInitializedRef = React.useRef(false); + const hasNavigatedToInitialState = React.useRef(false); // We call this here to start the loading process // We gate the UI on the fonts loading in AppNavigator @@ -152,6 +153,7 @@ const updatedNavContext = { state: navStateRef.current, dispatch: navDispatchRef.current, + hasNavigatedToInitialState: hasNavigatedToInitialState.current, }; setNavContext(updatedNavContext); setGlobalNavContext(updatedNavContext); @@ -166,6 +168,7 @@ void (async () => { let loadedState = initialState; if (__DEV__) { + hasNavigatedToInitialState.current = true; try { const navStateString = await AsyncStorage.getItem( navStateAsyncStorageKey, @@ -217,6 +220,7 @@ invariant(state, 'nav state should be non-null'); const prevState = navStateRef.current; navStateRef.current = state; + hasNavigatedToInitialState.current = true; updateNavContext(); const queuedActions = queuedActionsRef.current;