Skip to content

Commit e4c17f2

Browse files
fix(mobile): Settings headers match the page instead of a white band
UIKit's scroll-edge material under the header takes the scroll view's own color. Settings pages colored only their outer view, so on the folded Duo the header showed the system's near-white bar over the page's surface. Settings pages now give their scroll view the page's surface, and the Settings list uses the workspace surface when it isn't in a sidebar. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 3f7588e commit e4c17f2

3 files changed

Lines changed: 26 additions & 12 deletions

File tree

‎apps/mobile/src/components/ui/ScreenScrollView.tsx‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
import { createContext, use, type ComponentProps } from "react";
22
import { Platform } from "react-native";
3+
import { cn } from "../../lib/cn";
34
import { NativeScrollView as ScrollView } from "../../native/NativeScrollViewMarker";
45

56
export const ScreenScrollViewBottomInset = createContext(0);
7+
/**
8+
* The screen's surface class. UIKit's scroll-edge material under the header takes the scroll
9+
* view's own color; a clear scroll view gets the system's near-white bar over the screen's surface.
10+
*/
11+
export const ScreenScrollViewSurface = createContext<string | undefined>(undefined);
612

713
export function ScreenScrollView(props: ComponentProps<typeof ScrollView>) {
814
const bottomInset = use(ScreenScrollViewBottomInset);
15+
const surface = use(ScreenScrollViewSurface);
916
return (
1017
<ScrollView
1118
{...props}
19+
className={Platform.OS === "ios" && surface ? cn(surface, props.className) : props.className}
1220
contentInset={
1321
Platform.OS === "ios" && bottomInset > 0
1422
? { ...props.contentInset, bottom: (props.contentInset?.bottom ?? 0) + bottomInset }

‎apps/mobile/src/features/settings/SettingsRouteScreen.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ export function SettingsRouteScreen() {
8181
function ConfiguredSettingsRouteScreen() {
8282
// UIKit's scroll-edge material takes the scroll view's own color; like the chat list, match
8383
// the sidebar's surface so the bar doesn't darken over content at rest.
84-
const listSurface = use(NativePrimaryColumnContext) ? "bg-drawer" : "bg-screen";
84+
const surface = useWorkspaceSurface();
85+
const listSurface = use(NativePrimaryColumnContext) ? "bg-drawer" : surface.className;
8586
const insets = useSafeAreaInsets();
8687
const navigation = useNavigation();
8788
const { isLoaded, isSignedIn } = useAuth({ treatPendingAsSignedOut: false });
@@ -130,7 +131,8 @@ function ConfiguredSettingsRouteScreen() {
130131
function LocalSettingsRouteScreen() {
131132
// UIKit's scroll-edge material takes the scroll view's own color; like the chat list, match
132133
// the sidebar's surface so the bar doesn't darken over content at rest.
133-
const listSurface = use(NativePrimaryColumnContext) ? "bg-drawer" : "bg-screen";
134+
const surface = useWorkspaceSurface();
135+
const listSurface = use(NativePrimaryColumnContext) ? "bg-drawer" : surface.className;
134136
const insets = useSafeAreaInsets();
135137
const { savedConnectionsById } = useSavedRemoteConnections();
136138
const environmentCount = Object.keys(savedConnectionsById).length;

‎apps/mobile/src/features/settings/components/SettingsScreen.tsx‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { useWorkspaceTabs } from "../../workspace/WorkspaceTabsContext";
99
import { useWorkspaceSurface } from "../../workspace/useWorkspaceSurface";
1010
import { useDeviceType } from "../../../native/native-layout-metrics";
1111
import { useCompactWorkspaceTabs } from "../../workspace/useSystemWorkspaceTabBar";
12-
import { ScreenScrollViewBottomInset } from "../../../components/ui/ScreenScrollView";
12+
import {
13+
ScreenScrollViewBottomInset,
14+
ScreenScrollViewSurface,
15+
} from "../../../components/ui/ScreenScrollView";
1316

1417
export { SettingsScreenContent };
1518

@@ -32,11 +35,10 @@ export function SettingsScreen(
3235
props.workspaceRoot ||
3336
(Platform.OS === "android" && workspace !== null && route.name === "Settings");
3437

38+
const surfaceClassName = workspaceRoot || cover ? surface.className : "bg-sheet";
39+
3540
return (
36-
<View
37-
collapsable={false}
38-
className={`flex-1 ${workspaceRoot || cover ? surface.className : "bg-sheet"}`}
39-
>
41+
<View collapsable={false} className={`flex-1 ${surfaceClassName}`}>
4042
<AppBar
4143
title={props.title}
4244
actions={props.actions}
@@ -46,11 +48,13 @@ export function SettingsScreen(
4648
hideBottomBorder={!props.formSheet}
4749
/>
4850
<ScreenScrollViewBottomInset value={deviceType === "pad" || compactTabs ? 80 : 0}>
49-
{props.formSheet ? (
50-
props.children
51-
) : (
52-
<SettingsScreenContent>{props.children}</SettingsScreenContent>
53-
)}
51+
<ScreenScrollViewSurface value={surfaceClassName}>
52+
{props.formSheet ? (
53+
props.children
54+
) : (
55+
<SettingsScreenContent>{props.children}</SettingsScreenContent>
56+
)}
57+
</ScreenScrollViewSurface>
5458
</ScreenScrollViewBottomInset>
5559
</View>
5660
);

0 commit comments

Comments
 (0)