From de7d02780f2cd8b63f423c44acffc91a0856f4a1 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 21 Jan 2026 21:57:28 -0600 Subject: [PATCH] Fix navigation context --- src/Navigation.tsx | 12 +---- .../createNativeStackNavigatorWithAuth.tsx | 48 ++++++++++++------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/Navigation.tsx b/src/Navigation.tsx index 817d69e332..f354ecbe7a 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -136,7 +136,7 @@ import { EmailDialogScreenID, useEmailDialogControl, } from '#/components/dialogs/EmailDialog' -import {AnalyticsContext, useAnalytics, utils} from '#/analytics' +import {useAnalytics} from '#/analytics' import {IS_NATIVE, IS_WEB} from '#/env' import {router} from '#/routes' import {Referrer} from '../modules/expo-bluesky-swiss-army' @@ -1065,15 +1065,7 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) { // We will need to confirm we handle nested navigators correctly by the time we migrate to React Navigation 8.x // -sfn navigationInChildEnabled> - - {children} - + {children} ) } diff --git a/src/view/shell/createNativeStackNavigatorWithAuth.tsx b/src/view/shell/createNativeStackNavigatorWithAuth.tsx index 76f4f19ac0..6ce2dd3eef 100644 --- a/src/view/shell/createNativeStackNavigatorWithAuth.tsx +++ b/src/view/shell/createNativeStackNavigatorWithAuth.tsx @@ -37,6 +37,7 @@ import {Onboarding} from '#/screens/Onboarding' import {SignupQueued} from '#/screens/SignupQueued' import {atoms as a, useLayoutBreakpoints} from '#/alf' import {PolicyUpdateOverlay} from '#/components/PolicyUpdateOverlay' +import {AnalyticsContext, utils} from '#/analytics' import {IS_NATIVE, IS_WEB} from '#/env' import {BottomBarWeb} from './bottom-bar/BottomBarWeb' import {DesktopLeftNav} from './desktop/LeftNav' @@ -114,6 +115,11 @@ function NativeStackNavigator({ const {setShowLoggedOut} = useLoggedOutViewControls() const {isMobile} = useWebMediaQueries() const {leftNavMinimal} = useLayoutBreakpoints() + const prevActiveRouteName = React.useRef(undefined) + React.useEffect(() => { + prevActiveRouteName.current = activeRoute.name + }, [activeRoute.name]) + if (!hasSession && (activeRouteRequiresAuth || IS_NATIVE)) { return } @@ -148,24 +154,32 @@ function NativeStackNavigator({ return ( - - - - {IS_WEB && ( - <> - {showBottomBar ? : } - {!isMobile && } - - )} + + + + + {IS_WEB && ( + <> + {showBottomBar ? : } + {!isMobile && } + + )} - {/* Only shown after logged in and onboaring etc are complete */} - {hasSession && } + {/* Only shown after logged in and onboaring etc are complete */} + {hasSession && } + ) }