The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): the drawer surface is only for a sidebar beside a page (#27289)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 3, 2026 at 16:53 UTC
9aa80a0dc412eeee80d12a53d077c2e1cd8939e7
12 files changed
+125
-38
apps/mobile/src/features/home/HomeScreen.tsx
+11
-8
@@ -1,3 +1,4 @@
1
+import { usePaneRole } from "../../components/ui/Pane";
2
import { useActiveNewTask } from "../../state/active-new-task";
3
import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
4
import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
@@ -215,6 +216,7 @@ function HomeTopContentSpacer() {
216
217
function HomeScrollView(props: ComponentProps<typeof ScrollView>) {
218
const primaryColumn = use(NativePrimaryColumnContext);
219
+ const sidebarSurface = usePaneRole() === "sidebar" && primaryColumn !== null;
220
if (Platform.OS !== "ios") return <ScrollView {...props} />;
221
222
// Register the scroll view explicitly; layout and header siblings hide it from UIKit.
@@ -229,7 +231,7 @@ function HomeScrollView(props: ComponentProps<typeof ScrollView>) {
231
<ScrollView
232
{...props}
233
// UIKit's scroll-edge material needs the scroll view's own surface color.
232
- className={cn(props.className, primaryColumn ? "bg-drawer" : "bg-screen")}
234
+ className={cn(props.className, sidebarSurface ? "bg-drawer" : "bg-screen")}
235
/>
236
</ScrollViewMarker>
237
);
@@ -245,7 +247,8 @@ export function HomeScreen(props: HomeScreenProps) {
247
const workspace = useWorkspaceTabs();
248
const [initialScrollOffset] = useState(() => workspace?.getScrollOffset("threads") ?? 0);
249
const primaryColumn = use(NativePrimaryColumnContext);
248
- const contentBackground = primaryColumn ? "bg-drawer" : "bg-screen";
250
+ const sidebarSurface = usePaneRole() === "sidebar" && primaryColumn !== null;
251
+ const contentBackground = sidebarSurface ? "bg-drawer" : "bg-screen";
252
const containerClassName = cn(
253
"flex-1",
254
Platform.OS === "android" ? "bg-header" : contentBackground,
@@ -507,7 +510,7 @@ export function HomeScreen(props: HomeScreenProps) {
510
);
511
return (
512
<ThreadListV2PendingRow
510
- pane={primaryColumn ? "sidebar" : "screen"}
513
+ pane={sidebarSurface ? "sidebar" : "screen"}
514
pendingTask={item.pendingTask}
515
selected={
516
activeNewTask?.pendingKey === item.pendingTask.key ||
@@ -569,7 +572,7 @@ export function HomeScreen(props: HomeScreenProps) {
572
const thread = item.item.thread;
573
return (
574
<ThreadListV2Row
572
- pane={primaryColumn ? "sidebar" : "screen"}
575
+ pane={sidebarSurface ? "sidebar" : "screen"}
576
selected={scopedThreadKey(thread.environmentId, thread.id) === selectedThreadKey}
577
fullSwipeWidth={fullSwipeWidth}
578
onNewThreadOnBranch={props.onNewThreadOnBranch}
@@ -719,7 +722,7 @@ export function HomeScreen(props: HomeScreenProps) {
722
{listHeader}
723
{Platform.OS === "ios" && workspace ? (
724
<ThreadListFilters
722
- gutter={primaryColumn ? 8 : 0}
725
+ gutter={sidebarSurface ? 8 : 0}
726
environments={props.environments}
727
projects={pickableProjectGroups(projectScopes).map((scope) => ({
728
key: scope.key,
@@ -786,7 +789,7 @@ export function HomeScreen(props: HomeScreenProps) {
789
<SwipeableScrollGateProvider enabled={swipeEnabled} activation={swipeRowActivation}>
790
<GestureDetector gesture={homeScrollGesture}>
791
<AnimatedLegendList
789
- itemLayoutAnimation={primaryColumn ? THREAD_SIDEBAR_ROW_LAYOUT : undefined}
792
+ itemLayoutAnimation={sidebarSurface ? THREAD_SIDEBAR_ROW_LAYOUT : undefined}
793
ref={listRef}
794
onLoad={() => activateVisibleRows(threadListV2Items)}
795
onTouchStart={(event) => trackListTouches(event, true)}
@@ -840,9 +843,9 @@ export function HomeScreen(props: HomeScreenProps) {
843
scrollEventThrottle={16}
844
contentContainerStyle={{
845
paddingLeft:
843
- (contentSideInsets?.left ?? 0) + (primaryColumn ? 8 : 0) + androidListGutter,
846
+ (contentSideInsets?.left ?? 0) + (sidebarSurface ? 8 : 0) + androidListGutter,
847
paddingRight:
845
- (contentSideInsets?.right ?? 0) + (primaryColumn ? 8 : 0) + androidListGutter,
848
+ (contentSideInsets?.right ?? 0) + (sidebarSurface ? 8 : 0) + androidListGutter,
849
paddingBottom:
850
Platform.OS === "ios"
851
? iosBottomClearance - (columnMetrics?.safeArea.bottom ?? insets.bottom)
apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
+5
-2
@@ -105,6 +105,9 @@ function ColumnScreen(props: {
105
readonly footer?: ReactNode;
106
}) {
107
const { descriptor } = props;
108
+ const { layout } = useAdaptiveWorkspaceLayout();
109
+ // A collapsed split shows the primary column as the page itself, not as a sidebar.
110
+ const sidebar = props.primary === true && layout.usesSplitView;
111
// Options a screen set inside this workspace tab slot, over its route's.
112
const options = slotScreenOptions(
113
use(WorkspaceSlotOptionsContext),
@@ -145,7 +148,7 @@ function ColumnScreen(props: {
148
props.navigation.emit({ type: "transitionEnd", target: key, data: { closing: true } })
149
}
150
>
148
- <PaneContext value={props.primary ? "sidebar" : "content"}>
151
+ <PaneContext value={sidebar ? "sidebar" : "content"}>
152
<NavigationContext value={descriptor.navigation}>
153
<NavigationRouteContext value={descriptor.route}>
154
<V5StackHeader
@@ -161,7 +164,7 @@ function ColumnScreen(props: {
164
}
165
/>
166
<ColumnContent
164
- primary={props.primary}
167
+ primary={sidebar}
168
insetHorizontally={
169
(options as AppNativeStackNavigationOptions).nativeContentInsetHorizontally
170
}
apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx
+3
-1
@@ -1,3 +1,4 @@
1
+import { usePaneRole } from "../../components/ui/Pane";
2
import { Button } from "../../components/ui/Button";
3
import {
4
applyPullRequestDraftFilterChange,
@@ -186,7 +187,8 @@ export function PullRequestsScreen(
187
connectedTargets.map((target) => target.environmentId),
188
result.updateEntry,
189
);
189
- const sidebar = props.sidebar === true || primaryColumn !== null;
190
+ const paneRole = usePaneRole();
191
+ const sidebar = props.sidebar === true || (primaryColumn !== null && paneRole === "sidebar");
192
const selectedKey = props.selectedPullRequestKey ?? primaryColumn?.selectedPullRequestKey;
193
const connectedKey = connectedTargets.map((target) => target.environmentId).join("\n");
194
const entries = useMemo(
apps/mobile/src/features/settings/SettingsRouteScreen.tsx
+1
-3
@@ -18,7 +18,6 @@ import { useAuth, useUser } from "@clerk/expo";
18
import { useNavigation, useNavigationState } from "@react-navigation/native";
19
import { use, type ComponentProps } from "react";
20
import { Platform, View } from "react-native";
21
-import { useWorkspaceSurface } from "../workspace/useWorkspaceSurface";
21
import { useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics";
22
import { deriveProjectGroupLabel } from "@t3tools/client-runtime/state/project-grouping";
23
import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -57,7 +56,6 @@ export function SettingsListScreen(props: {
56
readonly sidebar: boolean;
57
readonly selected: string | null;
58
}) {
60
- const surface = useWorkspaceSurface();
59
const workspace = useWorkspaceTabs();
60
const environmentMenu = useSettingsEnvironmentMenu();
61
const inSidebar = props.sidebar;
@@ -71,7 +69,7 @@ export function SettingsListScreen(props: {
69
70
return (
71
<SettingsSidebarContext value={sidebar}>
74
- <View className={`flex-1 ${inSidebar ? surface.className : "bg-screen"}`}>
72
+ <View className="flex-1 bg-screen">
73
<SettingsEnvironmentFilterHeader />
74
{Platform.OS === "android" ? (
75
<SettingsScreen
apps/mobile/src/features/settings/components/SettingsRow.tsx
+1
-1
@@ -53,7 +53,7 @@ export function SettingsRow(props: {
53
accessibilityState={{ disabled: Boolean(props.disabled), selected }}
54
disabled={props.disabled}
55
onPress={onPress}
56
- className={cn("rounded-2xl", selected && "bg-subtle-strong")}
56
+ className={cn("rounded-2xl", selected && "bg-thread-selected")}
57
>
58
<ListRowLayout {...content} />
59
</RowPressable>
apps/mobile/src/features/settings/components/SettingsScreen.tsx
+1
-5
@@ -6,7 +6,6 @@ import type { AppBarProps } from "../../../components/ui/AppBar.types";
6
import { AppBar } from "../../../components/ui/AppBar";
7
import { ScreenContent as SettingsScreenContent } from "../../../components/ui/ScreenContent";
8
import { useWorkspaceTabs } from "../../workspace/WorkspaceTabsContext";
9
-import { useWorkspaceSurface } from "../../workspace/useWorkspaceSurface";
9
import { useDeviceType } from "../../../native/native-layout-metrics";
10
import { useCompactWorkspaceTabs } from "../../workspace/useSystemWorkspaceTabBar";
11
import { useAdaptiveWorkspaceLayout } from "../../layout/adaptive-workspace-context";
@@ -27,7 +26,6 @@ export function SettingsScreen(
26
const navigation = useNavigation();
27
const route = useRoute();
28
const workspace = useWorkspaceTabs();
30
- const surface = useWorkspaceSurface();
29
const deviceType = useDeviceType();
30
const compactTabs = useCompactWorkspaceTabs();
31
const { layout } = useAdaptiveWorkspaceLayout();
@@ -37,9 +35,7 @@ export function SettingsScreen(
35
props.workspaceRoot ||
36
(Platform.OS === "android" && workspace !== null && route.name === "Settings");
37
40
- // Settings' grouped cards only lift off the screen surface, so the folded Duo doesn't take
41
- // the workspace's drawer surface here.
42
- const surfaceClassName = cover ? "bg-screen" : workspaceRoot ? surface.className : "bg-sheet";
38
+ const surfaceClassName = workspaceRoot || cover ? "bg-screen" : "bg-sheet";
39
40
return (
41
<View collapsable={false} className={`flex-1 ${surfaceClassName}`}>
apps/mobile/src/features/workspace/WorkspaceRootScreen.tsx
+1
-3
@@ -16,7 +16,6 @@ import { NativeStackScreenOptions } from "../../native/StackHeader";
16
import { NativePrimaryColumnContext } from "../../native/v5-workspace-context";
17
import { isDuoDevice } from "../../lib/device-type";
18
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
19
-import { useWorkspaceSurface } from "./useWorkspaceSurface";
19
import {
20
useDeviceType,
21
useNativeColumnLayoutMetrics,
@@ -81,7 +80,6 @@ function WorkspaceRootContent() {
80
const columnMetrics = useNativeColumnLayoutMetrics();
81
const nativeMetrics = useNativeLayoutMetrics();
82
const deviceType = useDeviceType();
84
- const surface = useWorkspaceSurface();
83
const systemTabBar = useSystemWorkspaceTabBar();
84
const compactTabs = useCompactWorkspaceTabs();
85
const enabled = useEnabledNavigationTabs();
@@ -128,7 +126,7 @@ function WorkspaceRootContent() {
126
127
return (
128
<WorkspaceTabsContext value={context}>
131
- <View className={`flex-1 ${sidebarPicker ? "bg-drawer" : surface.className}`}>
129
+ <View className={sidebarPicker ? "flex-1 bg-drawer" : "flex-1 bg-screen"}>
130
{Platform.OS === "ios" ? (
131
<NativeStackScreenOptions
132
optionsVersion={[
apps/mobile/src/features/workspace/android-workspace-navigation-colors.test.ts
+6
@@ -45,6 +45,12 @@ describe("Android workspace navigation colors", () => {
45
] as const) {
46
expectVisibleSelection(androidWorkspaceNavigationColors(variables, rail, floating));
47
}
48
+ if (appearance === "dark") {
49
+ const pill = androidWorkspaceNavigationColors(variables, false, true).containerColor;
50
+ for (const surface of ["--color-screen", "--color-grouped-card"] as const) {
51
+ expect(contrast(pill, variables[surface]), surface).toBeGreaterThanOrEqual(1.25);
52
+ }
53
+ }
54
expect(variables).toEqual(snapshot);
55
}
56
});
apps/mobile/src/features/workspace/android-workspace-navigation-colors.ts
+21
-3
@@ -1,23 +1,41 @@
1
import {
2
flattenThemeColor,
3
+ isDarkThemeColor,
4
themeColorWithAlpha,
5
themeColorWithContrast,
6
type MobileThemeVariables,
7
} from "../../lib/mobileTheme";
8
9
+// A dark page swallows the native shadow, so the fill alone has to lift the pill off the page
10
+// and off the cards it floats over.
11
+function floatingContainerColor(colors: MobileThemeVariables) {
12
+ const screen = colors["--color-screen"];
13
+ const fill = flattenThemeColor(colors["--color-secondary"], screen);
14
+ if (!isDarkThemeColor(screen)) return fill;
15
+ return themeColorWithContrast(
16
+ fill,
17
+ [screen, flattenThemeColor(colors["--color-grouped-card"], screen)],
18
+ 1.25,
19
+ );
20
+}
21
+
22
export function androidWorkspaceNavigationColors(
23
colors: MobileThemeVariables,
24
rail: boolean,
25
floating = false,
26
) {
13
- const header = flattenThemeColor(colors["--color-header"], colors["--color-screen"]);
27
+ const screen = colors["--color-screen"];
28
+ const header = flattenThemeColor(colors["--color-header"], screen);
29
const containerColor = rail
30
? header
31
: floating
17
- ? flattenThemeColor(colors["--color-secondary"], colors["--color-screen"])
32
+ ? floatingContainerColor(colors)
33
: flattenThemeColor(themeColorWithAlpha(colors["--color-header-foreground"], 0.05), header);
34
+ // The lifted dark pill already took the secondary fill's place, so its indicator lifts further.
35
const indicatorColor = themeColorWithContrast(
20
- flattenThemeColor(colors["--color-secondary"], containerColor),
36
+ floating && isDarkThemeColor(screen)
37
+ ? containerColor
38
+ : flattenThemeColor(colors["--color-secondary"], containerColor),
39
containerColor,
40
1.5,
41
);
apps/mobile/src/features/workspace/useWorkspaceSurface.ts
deleted
-11
@@ -1,11 +0,0 @@
1
-import { useControlTheme } from "../../components/ui/useControlTheme";
2
-import { useDeviceType } from "../../native/native-layout-metrics";
3
-
4
-export function useWorkspaceSurface() {
5
- const cover = useDeviceType() === "duo-folded";
6
- const { colors } = useControlTheme();
7
- return {
8
- className: cover ? "bg-drawer" : "bg-screen",
9
- backgroundColor: colors[cover ? "--color-drawer" : "--color-screen"],
10
- };
11
-}
apps/mobile/src/lib/mobileTheme.test.ts
+22
@@ -193,6 +193,28 @@ describe("mobile themes", () => {
193
`${appearance}: ${role} on Android header`,
194
).toBeGreaterThanOrEqual(4.5);
195
}
196
+ if (appearance === "dark") {
197
+ for (const surface of [variables["--color-screen"], header]) {
198
+ expect(
199
+ contrastRatio(group, surface),
200
+ `dark grouped surface on Android ${surface}`,
201
+ ).toBeGreaterThanOrEqual(1.2);
202
+ }
203
+ }
204
+ }
205
+ const selected = variables["--color-thread-selected"];
206
+ expect(
207
+ contrastRatio(selected, flattenThemeColor(variables["--color-drawer"], sheet)),
208
+ `${platform} ${appearance}: selected row on drawer`,
209
+ ).toBeGreaterThanOrEqual(1.2);
210
+ for (const role of [
211
+ "--color-thread-selected-foreground",
212
+ "--color-thread-selected-foreground-muted",
213
+ ] as const) {
214
+ expect(
215
+ contrastRatio(variables[role], selected),
216
+ `${platform} ${appearance}: ${role} on selected row`,
217
+ ).toBeGreaterThanOrEqual(4.5);
218
}
219
expect(
220
contrastRatio(variables["--color-foreground-muted"], variables["--color-secondary"]),
apps/mobile/src/lib/mobileThemeVariables.ts
+53
-1
@@ -1,8 +1,10 @@
1
import defaultThemeVariables from "../../generated-uniwind-default-theme-variables.json";
2
import {
3
DEFAULT_MOBILE_THEME_ID,
4
+ flattenThemeColor,
5
getMobileThemeVariables,
6
themeColorWithAlpha,
7
+ themeColorWithContrast,
8
type MobileThemeAppearance,
9
type MobileThemeId,
10
type MobileThemeVariables,
@@ -12,10 +14,46 @@ const defaults = defaultThemeVariables as Readonly<
14
Record<MobileThemeAppearance, MobileThemeVariables>
15
>;
16
17
+const CARD_TEXT_ROLES = [
18
+ "--color-foreground-secondary",
19
+ "--color-foreground-muted",
20
+ "--color-placeholder",
21
+ "--color-primary-text",
22
+] as const;
23
+
24
+// A selected row in a sidebar sits on the drawer, so it must stay visible there with its labels.
25
+function withVisibleSelection(variables: MobileThemeVariables): MobileThemeVariables {
26
+ const selected = themeColorWithContrast(
27
+ flattenThemeColor(variables["--color-thread-selected"], variables["--color-drawer"]),
28
+ flattenThemeColor(variables["--color-drawer"], variables["--color-screen"]),
29
+ 1.2,
30
+ );
31
+ return {
32
+ ...variables,
33
+ "--color-thread-selected": selected,
34
+ "--color-thread-selected-foreground": themeColorWithContrast(
35
+ variables["--color-thread-selected-foreground"],
36
+ selected,
37
+ ),
38
+ "--color-thread-selected-foreground-muted": themeColorWithContrast(
39
+ variables["--color-thread-selected-foreground-muted"],
40
+ selected,
41
+ ),
42
+ };
43
+}
44
+
45
export function getMobileThemeRuntimeVariables(
46
themeId: MobileThemeId,
47
appearance: MobileThemeAppearance,
48
platform: string,
49
+): MobileThemeVariables {
50
+ return withVisibleSelection(platformThemeVariables(themeId, appearance, platform));
51
+}
52
+
53
+function platformThemeVariables(
54
+ themeId: MobileThemeId,
55
+ appearance: MobileThemeAppearance,
56
+ platform: string,
57
): MobileThemeVariables {
58
const usesDefaultPalette = themeId === DEFAULT_MOBILE_THEME_ID || themeId === "material-you";
59
const variables = usesDefaultPalette
@@ -36,10 +74,24 @@ export function getMobileThemeRuntimeVariables(
74
}
75
if (platform !== "android") return variables;
76
77
+ // Android paints the drawer as the page inside a lighter frame, so dark cards lift off both.
78
+ const screen = variables["--color-screen"];
79
+ const groupedCard =
80
+ appearance === "dark"
81
+ ? themeColorWithContrast(
82
+ variables["--color-grouped-card"],
83
+ [screen, flattenThemeColor(frame, screen)],
84
+ 1.2,
85
+ )
86
+ : variables["--color-grouped-card"];
87
+ const readableOnCard = (role: (typeof CARD_TEXT_ROLES)[number]) =>
88
+ [role, themeColorWithContrast(variables[role], groupedCard)] as const;
89
return {
90
...variables,
91
+ ...Object.fromEntries(CARD_TEXT_ROLES.map(readableOnCard)),
92
"--color-header": frame,
93
"--color-header-foreground": variables["--color-drawer-foreground"],
43
- "--color-drawer": variables["--color-screen"],
94
+ "--color-drawer": screen,
95
+ "--color-grouped-card": groupedCard,
96
};
97
}