88 useNavigationTabOrder ,
99 useHiddenNavigationTabs ,
1010} from "../workspace/navigation-tabs" ;
11+ import { currentWorkspaceSelections } from "../workspace/workspace-selection-store" ;
12+ import { rememberedSettingsPage } from "../workspace/workspace-tab-navigation" ;
1113import { useSelectWorkspaceTab } from "../workspace/useSelectWorkspaceTab" ;
1214import {
1315 ScreenScrollView as ScrollView ,
@@ -42,10 +44,14 @@ export function SettingsRouteScreen() {
4244 const compactTabs = useCompactWorkspaceTabs ( ) ;
4345 const { layout } = useAdaptiveWorkspaceLayout ( ) ;
4446 const inSidebar = use ( NativePrimaryColumnContext ) !== null && layout . usesSplitView ;
45- // The page open beside the list: the route right above the Settings tab's route.
47+ // The page open beside the list: the route right above the Settings tab's route. While
48+ // another tab is open this list stays mounted, hidden, and must keep showing the page Settings
49+ // reopens on; otherwise returning shows it unselected for a frame before the page arrives.
4650 const selected = useNavigationState ( ( state ) => {
4751 const list = state . routes . findIndex ( ( route ) => route . name === "Settings" ) ;
48- return list < 0 ? null : ( state . routes [ list + 1 ] ?. name ?? null ) ;
52+ return list < 0
53+ ? rememberedSettingsPage ( currentWorkspaceSelections ( ) )
54+ : ( state . routes [ list + 1 ] ?. name ?? null ) ;
4955 } ) ;
5056 const sidebar = useMemo ( ( ) => ( inSidebar ? { selected } : null ) , [ inSidebar , selected ] ) ;
5157 const content = hasCloudPublicConfig ( ) ? (
@@ -56,7 +62,7 @@ export function SettingsRouteScreen() {
5662
5763 return (
5864 < SettingsSidebarContext value = { sidebar } >
59- < View className = { `flex-1 ${ surface . className } ` } >
65+ < View className = { `flex-1 ${ inSidebar ? surface . className : "bg-screen" } ` } >
6066 < SettingsEnvironmentFilterHeader />
6167 < ScreenScrollViewBottomInset value = { deviceType === "pad" || compactTabs ? 80 : 0 } >
6268 { Platform . OS === "android" ? (
@@ -75,7 +81,8 @@ export function SettingsRouteScreen() {
7581function ConfiguredSettingsRouteScreen ( ) {
7682 // UIKit's scroll-edge material takes the scroll view's own color; like the chat list, match
7783 // the sidebar's surface so the bar doesn't darken over content at rest.
78- const listSurface = use ( NativePrimaryColumnContext ) ? "bg-drawer" : "bg-screen" ;
84+ // Grouped cards only lift off the screen surface; the drawer is as dark as they are.
85+ const listSurface = use ( SettingsSidebarContext ) ? "bg-drawer" : "bg-screen" ;
7986 const insets = useSafeAreaInsets ( ) ;
8087 const navigation = useNavigation ( ) ;
8188 const { isLoaded, isSignedIn } = useAuth ( { treatPendingAsSignedOut : false } ) ;
@@ -124,7 +131,8 @@ function ConfiguredSettingsRouteScreen() {
124131function LocalSettingsRouteScreen ( ) {
125132 // UIKit's scroll-edge material takes the scroll view's own color; like the chat list, match
126133 // the sidebar's surface so the bar doesn't darken over content at rest.
127- const listSurface = use ( NativePrimaryColumnContext ) ? "bg-drawer" : "bg-screen" ;
134+ // Grouped cards only lift off the screen surface; the drawer is as dark as they are.
135+ const listSurface = use ( SettingsSidebarContext ) ? "bg-drawer" : "bg-screen" ;
128136 const insets = useSafeAreaInsets ( ) ;
129137 const { savedConnectionsById } = useSavedRemoteConnections ( ) ;
130138 const environmentCount = Object . keys ( savedConnectionsById ) . length ;
0 commit comments