@devries-cameron20 / t3code Mirror · read-only / commits / e68e19d605
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 04:30 UTC

fix(mobile): every Android content pane gets its rounded card from ScreenContent (#30500)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 3, 2026 at 21:12 UTC e68e19d605485db6ef31b2033f67a9d07634fc2b
10 files changed +355 -353
apps/mobile/src/components/ui/ScreenContent.tsx
+28 -3
@@ -1,21 +1,46 @@
1 import type { ReactNode } from "react";
2 -import { Platform, View } from "react-native";
2 +import { Platform, View, type LayoutChangeEvent } from "react-native";
3
4 +const SURFACE_CLASS_NAMES = {
5 + sheet: "bg-sheet-solid",
6 + screen: "bg-screen",
7 + canvas: "bg-thread-canvas",
8 + drawer: "bg-drawer",
9 +} as const;
10 +
11 +/**
12 + * The body below a screen's AppBar. On Android it is the rounded card every pane and sheet
13 + * draws under its bar; a screen picks only the card's surface.
14 + */
15 export function ScreenContent({
16 children,
17 + surface = "sheet",
18 insetHorizontal = false,
19 fitToContents = false,
20 + onLayout,
21 }: {
22 readonly children: ReactNode;
23 + readonly surface?: keyof typeof SURFACE_CLASS_NAMES;
24 readonly insetHorizontal?: boolean;
25 readonly fitToContents?: boolean;
26 + readonly onLayout?: (event: LayoutChangeEvent) => void;
27 }) {
13 - if (Platform.OS !== "android") return children;
28 + if (Platform.OS !== "android") {
29 + return onLayout ? (
30 + <View className="flex-1" onLayout={onLayout}>
31 + {children}
32 + </View>
33 + ) : (
34 + children
35 + );
36 + }
37
38 return (
39 <View className={fitToContents ? "shrink bg-header" : "flex-1 bg-header"}>
40 <View
18 - className="overflow-hidden rounded-t-[28px] bg-sheet-solid"
41 + className={`overflow-hidden rounded-t-[28px] ${SURFACE_CLASS_NAMES[surface]}`}
42 + collapsable={false}
43 + onLayout={onLayout}
44 style={{
45 flexShrink: 1,
46 flexGrow: fitToContents ? 0 : 1,
apps/mobile/src/features/home/HomeScreen.tsx
+122 -119
@@ -1,4 +1,5 @@
1 import { usePaneRole } from "../../components/ui/Pane";
2 +import { ScreenContent } from "../../components/ui/ScreenContent";
3 import { useActiveNewTask } from "../../state/active-new-task";
4 import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
5 import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
@@ -672,45 +673,51 @@ export function HomeScreen(props: HomeScreenProps) {
673 if (!hasAnyThreads) {
674 return (
675 <View className={containerClassName}>
675 - <View
676 - className={cn(
677 - "flex-1 items-center justify-center px-8",
678 - contentBackground,
679 - Platform.OS === "android" && "overflow-hidden rounded-t-[28px]",
680 - )}
681 - style={{
682 - paddingBottom: Platform.OS === "ios" ? iosBottomClearance : Math.max(insets.bottom, 24),
683 - paddingTop: NATIVE_LIQUID_GLASS_SUPPORTED ? insets.top + 72 : 0,
684 - paddingLeft: 32 + (contentSideInsets?.left ?? 0),
685 - paddingRight: 32 + (contentSideInsets?.right ?? 0),
686 - }}
687 - >
688 - <View className="w-full max-w-[430px]">
689 - <EmptyState
690 - title={emptyState.title}
691 - detail={emptyState.detail}
692 - actionLabel={!props.catalogState.hasReadyEnvironment ? "Add environment" : undefined}
693 - onAction={!props.catalogState.hasReadyEnvironment ? props.onAddConnection : undefined}
694 - action={
695 - Platform.OS === "android" && !props.catalogState.hasReadyEnvironment ? (
696 - <FloatingActionButton
697 - label="Add environment"
698 - icon="plus"
699 - variant="extended"
700 - tone="primary"
701 - onPress={props.onAddConnection}
702 - />
703 - ) : undefined
704 - }
705 - variant="plain"
706 - />
707 - {emptyState.loading ? (
708 - <View className="mt-4 items-center">
709 - <AppActivityIndicator colorClassName="accent-icon-muted" />
710 - </View>
711 - ) : null}
676 + <ScreenContent surface={sidebarSurface ? "drawer" : "screen"}>
677 + <View
678 + className={cn(
679 + "flex-1 items-center justify-center px-8",
680 + Platform.OS !== "android" && contentBackground,
681 + )}
682 + style={{
683 + paddingBottom:
684 + Platform.OS === "ios" ? iosBottomClearance : Math.max(insets.bottom, 24),
685 + paddingTop: NATIVE_LIQUID_GLASS_SUPPORTED ? insets.top + 72 : 0,
686 + paddingLeft: 32 + (contentSideInsets?.left ?? 0),
687 + paddingRight: 32 + (contentSideInsets?.right ?? 0),
688 + }}
689 + >
690 + <View className="w-full max-w-[430px]">
691 + <EmptyState
692 + title={emptyState.title}
693 + detail={emptyState.detail}
694 + actionLabel={
695 + !props.catalogState.hasReadyEnvironment ? "Add environment" : undefined
696 + }
697 + onAction={
698 + !props.catalogState.hasReadyEnvironment ? props.onAddConnection : undefined
699 + }
700 + action={
701 + Platform.OS === "android" && !props.catalogState.hasReadyEnvironment ? (
702 + <FloatingActionButton
703 + label="Add environment"
704 + icon="plus"
705 + variant="extended"
706 + tone="primary"
707 + onPress={props.onAddConnection}
708 + />
709 + ) : undefined
710 + }
711 + variant="plain"
712 + />
713 + {emptyState.loading ? (
714 + <View className="mt-4 items-center">
715 + <AppActivityIndicator colorClassName="accent-icon-muted" />
716 + </View>
717 + ) : null}
718 + </View>
719 </View>
713 - </View>
720 + </ScreenContent>
721 </View>
722 );
723 }
@@ -766,97 +773,93 @@ export function HomeScreen(props: HomeScreenProps) {
773
774 if (Platform.OS === "android" && threadListV2Items.length === 0) {
775 return (
769 - <View className="flex-1 bg-header">
776 + <ScreenContent surface="screen">
777 <View
771 - className="flex-1 items-center justify-center overflow-hidden rounded-t-[28px] bg-screen px-4"
778 + className="flex-1 items-center justify-center px-4"
779 style={{ paddingBottom: insets.bottom }}
780 >
781 {v2ListEmpty}
782 </View>
776 - </View>
783 + </ScreenContent>
784 );
785 }
786
787 return (
788 <View className={containerClassName}>
782 - <View
783 - className={
784 - Platform.OS === "android"
785 - ? "flex-1 overflow-hidden rounded-t-[28px] bg-screen"
786 - : cn("flex-1", contentBackground)
787 - }
788 - >
789 - <SwipeableScrollGateProvider enabled={swipeEnabled} activation={swipeRowActivation}>
790 - <GestureDetector gesture={homeScrollGesture}>
791 - <AnimatedLegendList
792 - itemLayoutAnimation={sidebarSurface ? THREAD_SIDEBAR_ROW_LAYOUT : undefined}
793 - ref={listRef}
794 - onLoad={() => activateVisibleRows(threadListV2Items)}
795 - onTouchStart={(event) => trackListTouches(event, true)}
796 - onTouchEnd={(event) => trackListTouches(event, false)}
797 - onTouchCancel={(event) => trackListTouches(event, false)}
798 - renderScrollComponent={Platform.OS === "ios" ? renderHomeScrollView : undefined}
799 - data={threadListV2Items}
800 - renderItem={renderV2Item}
801 - keyExtractor={v2KeyExtractor}
802 - getItemType={(item) => item.type}
803 - itemsAreEqual={threadListV2ListItemsAreEqual}
804 - estimatedItemSize={ESTIMATED_THREAD_LIST_V2_ROW_HEIGHT}
805 - drawDistance={THREAD_LIST_V2_DRAW_DISTANCE}
806 - recycleItems
807 - extraData={v2ExtraData}
808 - ListHeaderComponent={v2ListHeader}
809 - ListFooterComponent={
810 - settledShelfExpanded && threadListV2Layout.hiddenSettledCount > 0 ? (
811 - <ThreadListV2ShowMoreRow
812 - hiddenCount={threadListV2Layout.hiddenSettledCount}
813 - {...(olderSettledShelf.loading
814 - ? { state: "loading" as const }
815 - : olderSettledShelf.failed
816 - ? { state: "failed" as const }
817 - : {})}
818 - onPress={() => {
819 - olderSettledShelf.retry();
820 - showMoreSettled();
821 - }}
822 - />
823 - ) : null
824 - }
825 - ListEmptyComponent={v2ListEmpty}
826 - style={{ flex: 1 }}
827 - automaticallyAdjustsScrollIndicatorInsets={Platform.OS === "ios"}
828 - // UIKit owns the bar's inset, so a minimizing bar and a resized column move
829 - // the list in the same frame as the bar.
830 - contentInsetAdjustmentBehavior="automatic"
831 - contentInsetStartAdjustment={Platform.OS === "ios" ? insets.top : 0}
832 - // RN scrollTo clamps against raw insets and ignores the automatic bar inset.
833 - scrollToOverflowEnabled
834 - initialScrollOffset={
835 - initialScrollOffset > 0
836 - ? initialScrollOffset - (Platform.OS === "ios" ? insets.top : 0)
837 - : undefined
838 - }
839 - showsVerticalScrollIndicator={false}
840 - keyboardDismissMode="on-drag"
841 - keyboardShouldPersistTaps="handled"
842 - {...scrollGateHandlers}
843 - scrollEventThrottle={16}
844 - contentContainerStyle={{
845 - paddingLeft:
846 - (contentSideInsets?.left ?? 0) + (sidebarSurface ? 8 : 0) + androidListGutter,
847 - paddingRight:
848 - (contentSideInsets?.right ?? 0) + (sidebarSurface ? 8 : 0) + androidListGutter,
849 - paddingBottom:
850 - Platform.OS === "ios"
851 - ? iosBottomClearance - (columnMetrics?.safeArea.bottom ?? insets.bottom)
852 - : (workspace?.bottomClearance ??
853 - Math.max(insets.bottom, 16) +
854 - (Platform.OS === "android" ? fabClearance : 88)),
855 - }}
856 - />
857 - </GestureDetector>
858 - </SwipeableScrollGateProvider>
859 - </View>
789 + <ScreenContent surface="screen">
790 + <View className={cn("flex-1", Platform.OS !== "android" && contentBackground)}>
791 + <SwipeableScrollGateProvider enabled={swipeEnabled} activation={swipeRowActivation}>
792 + <GestureDetector gesture={homeScrollGesture}>
793 + <AnimatedLegendList
794 + itemLayoutAnimation={sidebarSurface ? THREAD_SIDEBAR_ROW_LAYOUT : undefined}
795 + ref={listRef}
796 + onLoad={() => activateVisibleRows(threadListV2Items)}
797 + onTouchStart={(event) => trackListTouches(event, true)}
798 + onTouchEnd={(event) => trackListTouches(event, false)}
799 + onTouchCancel={(event) => trackListTouches(event, false)}
800 + renderScrollComponent={Platform.OS === "ios" ? renderHomeScrollView : undefined}
801 + data={threadListV2Items}
802 + renderItem={renderV2Item}
803 + keyExtractor={v2KeyExtractor}
804 + getItemType={(item) => item.type}
805 + itemsAreEqual={threadListV2ListItemsAreEqual}
806 + estimatedItemSize={ESTIMATED_THREAD_LIST_V2_ROW_HEIGHT}
807 + drawDistance={THREAD_LIST_V2_DRAW_DISTANCE}
808 + recycleItems
809 + extraData={v2ExtraData}
810 + ListHeaderComponent={v2ListHeader}
811 + ListFooterComponent={
812 + settledShelfExpanded && threadListV2Layout.hiddenSettledCount > 0 ? (
813 + <ThreadListV2ShowMoreRow
814 + hiddenCount={threadListV2Layout.hiddenSettledCount}
815 + {...(olderSettledShelf.loading
816 + ? { state: "loading" as const }
817 + : olderSettledShelf.failed
818 + ? { state: "failed" as const }
819 + : {})}
820 + onPress={() => {
821 + olderSettledShelf.retry();
822 + showMoreSettled();
823 + }}
824 + />
825 + ) : null
826 + }
827 + ListEmptyComponent={v2ListEmpty}
828 + style={{ flex: 1 }}
829 + automaticallyAdjustsScrollIndicatorInsets={Platform.OS === "ios"}
830 + // UIKit owns the bar's inset, so a minimizing bar and a resized column move
831 + // the list in the same frame as the bar.
832 + contentInsetAdjustmentBehavior="automatic"
833 + contentInsetStartAdjustment={Platform.OS === "ios" ? insets.top : 0}
834 + // RN scrollTo clamps against raw insets and ignores the automatic bar inset.
835 + scrollToOverflowEnabled
836 + initialScrollOffset={
837 + initialScrollOffset > 0
838 + ? initialScrollOffset - (Platform.OS === "ios" ? insets.top : 0)
839 + : undefined
840 + }
841 + showsVerticalScrollIndicator={false}
842 + keyboardDismissMode="on-drag"
843 + keyboardShouldPersistTaps="handled"
844 + {...scrollGateHandlers}
845 + scrollEventThrottle={16}
846 + contentContainerStyle={{
847 + paddingLeft:
848 + (contentSideInsets?.left ?? 0) + (sidebarSurface ? 8 : 0) + androidListGutter,
849 + paddingRight:
850 + (contentSideInsets?.right ?? 0) + (sidebarSurface ? 8 : 0) + androidListGutter,
851 + paddingBottom:
852 + Platform.OS === "ios"
853 + ? iosBottomClearance - (columnMetrics?.safeArea.bottom ?? insets.bottom)
854 + : (workspace?.bottomClearance ??
855 + Math.max(insets.bottom, 16) +
856 + (Platform.OS === "android" ? fabClearance : 88)),
857 + }}
858 + />
859 + </GestureDetector>
860 + </SwipeableScrollGateProvider>
861 + </View>
862 + </ScreenContent>
863 </View>
864 );
865 }
apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+4 -3
@@ -933,10 +933,11 @@ function AdaptiveWorkspaceLayoutContent(
933 // Android can resize the native row before React removes its split panes on a fold.
934 const androidSplit = Platform.OS === "android" && layout.usesSplitView;
935 // In the strip the column itself slides with the sidebar: Android only delivers touches inside a
936 - // parent's bounds, so content may not slide out of its column.
936 + // parent's bounds, so content may not slide out of its column. Every branch sets every key:
937 + // Reanimated keeps a key a branch drops, so a fold mid-slide would leave the column shifted.
938 const androidContentSlotStyle = useAnimatedStyle(() =>
939 !androidSplit
939 - ? { width: "100%" as const }
940 + ? { width: "100%" as const, marginRight: 0, transform: [{ translateX: 0 }] }
941 : stripSidebar
942 ? {
943 // Wide enough for the pane at either width; the margin gives the sidebar's share
@@ -948,7 +949,7 @@ function AdaptiveWorkspaceLayoutContent(
949 marginRight: -sidebarSlotWidth,
950 transform: [{ translateX: stripOffset.value }],
951 }
951 - : { width: renderedContentWidth.value },
952 + : { width: renderedContentWidth.value, marginRight: 0, transform: [{ translateX: 0 }] },
953 );
954 // While the sidebar animates, clip the settled navigator instead of reflowing its text every frame.
955 // In the strip it lifts entirely: the content outgrows its column, and a cap that follows
apps/mobile/src/features/layout/WorkspaceEmptyDetail.tsx
+67 -64
@@ -5,6 +5,7 @@ import { AppText as Text } from "../../components/ui/AppText";
5 import { NewThreadButton } from "../../components/NewThreadButton";
6 import { FloatingActionButton } from "../../components/ui/FloatingActionButton";
7 import { EmptyState } from "../../components/ui/EmptyState";
8 +import { ScreenContent } from "../../components/ui/ScreenContent";
9 import type { WorkspaceTab } from "../workspace/workspace-tabs-state";
10
11 export function WorkspaceEmptyDetail(props: {
@@ -16,69 +17,71 @@ export function WorkspaceEmptyDetail(props: {
17 const settings = props.tab === "settings";
18 if (props.tab === "usage") return <View className="flex-1 bg-screen" />;
19 return (
19 - <View
20 - className={
21 - Platform.OS === "android"
22 - ? "flex-1 items-center justify-center px-10"
23 - : "flex-1 items-center justify-center bg-screen px-10"
24 - }
25 - >
26 - {props.onAddConnection ? (
27 - <View className="w-full max-w-[430px]">
28 - <EmptyState
29 - title="No environments connected"
30 - detail="Add an environment to load projects and start coding sessions."
31 - variant="plain"
32 - action={
33 - <FloatingActionButton
34 - label="Add environment"
35 - icon="plus"
36 - variant="extended"
37 - tone="primary"
38 - onPress={props.onAddConnection}
39 - />
40 - }
41 - />
42 - </View>
43 - ) : (
44 - <View className="max-w-[360px] items-center gap-3">
45 - <SymbolView
46 - name="sidebar.left"
47 - size={34}
48 - tintColorClassName="accent-icon-subtle"
49 - type="hierarchical"
50 - />
51 - <Text className="text-center text-xl font-t3-bold">
52 - {settings
53 - ? "Select a setting"
54 - : pullRequests
55 - ? "Select a pull request"
56 - : "Select a thread"}
57 - </Text>
58 - <Text className="text-center text-base text-foreground-muted">
59 - {settings
60 - ? "Choose a page from the sidebar."
61 - : pullRequests
62 - ? "Choose a pull request from the sidebar to review it."
63 - : Platform.OS === "android"
64 - ? "Choose a thread from the sidebar or start a new thread."
65 - : "Choose a thread from the sidebar or start a new task."}
66 - </Text>
67 - {props.onStartNewTask && !pullRequests && !settings ? (
68 - Platform.OS === "android" ? (
69 - <NewThreadButton extended className="mt-2" onPress={props.onStartNewTask} />
70 - ) : (
71 - <Pressable
72 - accessibilityRole="button"
73 - className="mt-2 flex-row items-center gap-2 rounded-full bg-primary px-5 py-3 active:opacity-70"
74 - onPress={props.onStartNewTask}
75 - >
76 - <Text className="text-base font-t3-bold text-primary-foreground">New thread</Text>
77 - </Pressable>
78 - )
79 - ) : null}
80 - </View>
81 - )}
82 - </View>
20 + <ScreenContent surface="screen">
21 + <View
22 + className={
23 + Platform.OS === "android"
24 + ? "flex-1 items-center justify-center px-10"
25 + : "flex-1 items-center justify-center bg-screen px-10"
26 + }
27 + >
28 + {props.onAddConnection ? (
29 + <View className="w-full max-w-[430px]">
30 + <EmptyState
31 + title="No environments connected"
32 + detail="Add an environment to load projects and start coding sessions."
33 + variant="plain"
34 + action={
35 + <FloatingActionButton
36 + label="Add environment"
37 + icon="plus"
38 + variant="extended"
39 + tone="primary"
40 + onPress={props.onAddConnection}
41 + />
42 + }
43 + />
44 + </View>
45 + ) : (
46 + <View className="max-w-[360px] items-center gap-3">
47 + <SymbolView
48 + name="sidebar.left"
49 + size={34}
50 + tintColorClassName="accent-icon-subtle"
51 + type="hierarchical"
52 + />
53 + <Text className="text-center text-xl font-t3-bold">
54 + {settings
55 + ? "Select a setting"
56 + : pullRequests
57 + ? "Select a pull request"
58 + : "Select a thread"}
59 + </Text>
60 + <Text className="text-center text-base text-foreground-muted">
61 + {settings
62 + ? "Choose a page from the sidebar."
63 + : pullRequests
64 + ? "Choose a pull request from the sidebar to review it."
65 + : Platform.OS === "android"
66 + ? "Choose a thread from the sidebar or start a new thread."
67 + : "Choose a thread from the sidebar or start a new task."}
68 + </Text>
69 + {props.onStartNewTask && !pullRequests && !settings ? (
70 + Platform.OS === "android" ? (
71 + <NewThreadButton extended className="mt-2" onPress={props.onStartNewTask} />
72 + ) : (
73 + <Pressable
74 + accessibilityRole="button"
75 + className="mt-2 flex-row items-center gap-2 rounded-full bg-primary px-5 py-3 active:opacity-70"
76 + onPress={props.onStartNewTask}
77 + >
78 + <Text className="text-base font-t3-bold text-primary-foreground">New thread</Text>
79 + </Pressable>
80 + )
81 + ) : null}
82 + </View>
83 + )}
84 + </View>
85 + </ScreenContent>
86 );
87 }
apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
+118 -131
@@ -73,6 +73,7 @@ import { useAndroidWorkspaceBack } from "../workspace/useAndroidWorkspaceNavigat
73 import { EmptyState } from "../../components/ui/EmptyState";
74 import { SegmentedControl } from "../../components/ui/SegmentedControl";
75 import { SymbolView } from "../../components/ui/AppSymbol";
76 +import { ScreenContent } from "../../components/ui/ScreenContent";
77 import { RelativeTime } from "../../components/RelativeTime";
78 import { NativeStackScreenOptions } from "../../native/StackHeader";
79 import { usePullRequestConnected } from "./usePullRequestConnected";
@@ -695,16 +696,8 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP
696 ) : null}
697 </Toolbar.Menu>
698 </Toolbar>
698 - <View
699 - style={{
700 - flex: 1,
701 - marginHorizontal: Platform.OS === "android" && layout.usesSplitView ? 4 : 0,
702 - }}
703 - className={
704 - Platform.OS === "android"
705 - ? "overflow-hidden rounded-t-[28px] bg-sheet-solid"
706 - : undefined
707 - }
699 + <ScreenContent
700 + insetHorizontal={layout.usesSplitView}
701 onLayout={(event) => setViewportHeight(event.nativeEvent.layout.height)}
702 >
703 {(["overview", "guide", "activity"] as const)
@@ -926,7 +919,7 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP
919 />
920 </View>
921 ))}
929 - </View>
922 + </ScreenContent>
923 <PullRequestActionToolbar
924 pr={pr}
925 params={params}
@@ -1288,132 +1281,126 @@ function PullRequestFileRouteContent({ route }: PullRequestFileRouteProps) {
1281 />
1282 </View>
1283 ) : null}
1291 - <View
1292 - className={
1293 - Platform.OS === "android"
1294 - ? "flex-1 overflow-hidden rounded-t-[28px] bg-sheet-solid"
1295 - : "flex-1"
1296 - }
1297 - collapsable={false}
1298 - style={{ marginHorizontal: Platform.OS === "android" && layout.usesSplitView ? 4 : 0 }}
1299 - >
1300 - {loadingDiff || result.error ? (
1301 - <View style={{ paddingTop: Platform.OS === "ios" && !staleDiff ? insets.top : 0 }}>
1302 - <PullRequestReadStatus
1303 - pending={loadingDiff}
1304 - error={result.error}
1305 - terminology={terminology}
1306 - />
1307 - </View>
1308 - ) : null}
1309 - {NativeDiffView && data.rows.length && !seekingFile ? (
1310 - <View className="flex-1" collapsable={false}>
1311 - <NativeDiffView
1312 - {...pullRequestDiffInitialPosition(targetFile?.id, focusIndex)}
1313 - nativeViewRef={nativeView}
1314 - refreshing={result.refreshing}
1315 - onPullToRefresh={result.onPullRefresh}
1316 - style={StyleSheet.absoluteFill}
1317 - rowsJson={bridge.rowsJson}
1318 - themeJson={bridge.themeJson}
1319 - styleJson={bridge.styleJson}
1320 - tokensPatchJson={bridge.tokensPatchJson}
1321 - tokensResetKey={bridge.tokensResetKey}
1322 - collapsedFileIdsJson={bridge.collapsedFileIdsJson}
1323 - onDebug={onDebug}
1324 - viewedFileIdsJson={bridge.viewedFileIdsJson}
1325 - selectedRowIdsJson={bridge.selectedRowIdsJson}
1326 - onPressLine={(event) => {
1327 - const rowId = event.nativeEvent.rowId ?? null;
1328 - setSelectedRowId(rowId);
1329 - if (event.nativeEvent.gesture !== "longPress") commentOnLine(rowId);
1330 - }}
1331 - onToggleViewedFile={(event) => {
1332 - const file = data.files.find((file) => file.id === event.nativeEvent.fileId);
1333 - if (!file || (!commit && !viewed.canToggle)) return;
1334 - const wasViewed = commit
1335 - ? commitViewedPaths.has(file.path)
1336 - : viewed.isViewed(file.path);
1337 - setCollapsedIds((ids) =>
1338 - wasViewed
1339 - ? ids.filter((id) => id !== file.id)
1340 - : ids.includes(file.id)
1341 - ? ids
1342 - : [...ids, file.id],
1343 - );
1344 - if (commit)
1345 - setCommitViewedPaths((current) => {
1346 - const next = new Set(current);
1347 - if (next.has(file.path)) next.delete(file.path);
1348 - else next.add(file.path);
1349 - return next;
1350 - });
1351 - else void viewed.toggle(file.path);
1352 - }}
1353 - onToggleComment={(event) => {
1354 - const id = event.nativeEvent.commentId;
1355 - if (id?.startsWith("discussion:"))
1356 - navigation.navigate("PullRequestDiscussion", {
1357 - ...route.params,
1358 - discussionId: id.slice("discussion:".length),
1359 - });
1360 - if (id?.startsWith("draft:")) {
1361 - const draft = reviewDraft.draft.comments.find(
1362 - (draft) => draft.id === id.slice("draft:".length),
1284 + <ScreenContent insetHorizontal={layout.usesSplitView}>
1285 + <View className="flex-1" collapsable={false}>
1286 + {loadingDiff || result.error ? (
1287 + <View style={{ paddingTop: Platform.OS === "ios" && !staleDiff ? insets.top : 0 }}>
1288 + <PullRequestReadStatus
1289 + pending={loadingDiff}
1290 + error={result.error}
1291 + terminology={terminology}
1292 + />
1293 + </View>
1294 + ) : null}
1295 + {NativeDiffView && data.rows.length && !seekingFile ? (
1296 + <View className="flex-1" collapsable={false}>
1297 + <NativeDiffView
1298 + {...pullRequestDiffInitialPosition(targetFile?.id, focusIndex)}
1299 + nativeViewRef={nativeView}
1300 + refreshing={result.refreshing}
1301 + onPullToRefresh={result.onPullRefresh}
1302 + style={StyleSheet.absoluteFill}
1303 + rowsJson={bridge.rowsJson}
1304 + themeJson={bridge.themeJson}
1305 + styleJson={bridge.styleJson}
1306 + tokensPatchJson={bridge.tokensPatchJson}
1307 + tokensResetKey={bridge.tokensResetKey}
1308 + collapsedFileIdsJson={bridge.collapsedFileIdsJson}
1309 + onDebug={onDebug}
1310 + viewedFileIdsJson={bridge.viewedFileIdsJson}
1311 + selectedRowIdsJson={bridge.selectedRowIdsJson}
1312 + onPressLine={(event) => {
1313 + const rowId = event.nativeEvent.rowId ?? null;
1314 + setSelectedRowId(rowId);
1315 + if (event.nativeEvent.gesture !== "longPress") commentOnLine(rowId);
1316 + }}
1317 + onToggleViewedFile={(event) => {
1318 + const file = data.files.find((file) => file.id === event.nativeEvent.fileId);
1319 + if (!file || (!commit && !viewed.canToggle)) return;
1320 + const wasViewed = commit
1321 + ? commitViewedPaths.has(file.path)
1322 + : viewed.isViewed(file.path);
1323 + setCollapsedIds((ids) =>
1324 + wasViewed
1325 + ? ids.filter((id) => id !== file.id)
1326 + : ids.includes(file.id)
1327 + ? ids
1328 + : [...ids, file.id],
1329 );
1364 - if (draft)
1365 - navigation.navigate("PullRequestInlineComment", {
1330 + if (commit)
1331 + setCommitViewedPaths((current) => {
1332 + const next = new Set(current);
1333 + if (next.has(file.path)) next.delete(file.path);
1334 + else next.add(file.path);
1335 + return next;
1336 + });
1337 + else void viewed.toggle(file.path);
1338 + }}
1339 + onToggleComment={(event) => {
1340 + const id = event.nativeEvent.commentId;
1341 + if (id?.startsWith("discussion:"))
1342 + navigation.navigate("PullRequestDiscussion", {
1343 ...route.params,
1367 - ...draft,
1368 - draftId: draft.id,
1344 + discussionId: id.slice("discussion:".length),
1345 });
1370 - }
1371 - }}
1372 - onToggleFile={onToggleFile}
1373 - onVisibleFileChange={(event) => setVisibleFileId(event.nativeEvent.fileId ?? null)}
1374 - appearanceScheme={themeAppearance}
1375 - rowHeight={nativeReviewDiffStyle.rowHeight}
1376 - contentWidth={NATIVE_REVIEW_DIFF_CONTENT_WIDTH}
1377 - contentInsetTop={Platform.OS === "ios" ? (staleDiff ? 0 : insets.top) : undefined}
1378 - contentInsetBottom={Platform.OS === "android" ? toolbarHeight : insets.bottom}
1379 - contentResetKey={`pull-request:${route.params.environmentId}:${route.params.repository}:${route.params.number}:${commit ?? "all"}`}
1380 - />
1381 - </View>
1382 - ) : filter.hiddenCount > 0 &&
1383 - !data.rows.length &&
1384 - !result.isPending &&
1385 - !result.error &&
1386 - !seekingFile ? (
1387 - <View style={{ paddingTop: Platform.OS === "ios" ? insets.top : 0 }}>
1346 + if (id?.startsWith("draft:")) {
1347 + const draft = reviewDraft.draft.comments.find(
1348 + (draft) => draft.id === id.slice("draft:".length),
1349 + );
1350 + if (draft)
1351 + navigation.navigate("PullRequestInlineComment", {
1352 + ...route.params,
1353 + ...draft,
1354 + draftId: draft.id,
1355 + });
1356 + }
1357 + }}
1358 + onToggleFile={onToggleFile}
1359 + onVisibleFileChange={(event) => setVisibleFileId(event.nativeEvent.fileId ?? null)}
1360 + appearanceScheme={themeAppearance}
1361 + rowHeight={nativeReviewDiffStyle.rowHeight}
1362 + contentWidth={NATIVE_REVIEW_DIFF_CONTENT_WIDTH}
1363 + contentInsetTop={Platform.OS === "ios" ? (staleDiff ? 0 : insets.top) : undefined}
1364 + contentInsetBottom={Platform.OS === "android" ? toolbarHeight : insets.bottom}
1365 + contentResetKey={`pull-request:${route.params.environmentId}:${route.params.repository}:${route.params.number}:${commit ?? "all"}`}
1366 + />
1367 + </View>
1368 + ) : filter.hiddenCount > 0 &&
1369 + !data.rows.length &&
1370 + !result.isPending &&
1371 + !result.error &&
1372 + !seekingFile ? (
1373 + <View style={{ paddingTop: Platform.OS === "ios" ? insets.top : 0 }}>
1374 + <EmptyState
1375 + title="Only test files changed"
1376 + detail="Test files are hidden from this review."
1377 + action={<Button label="Show test files" tone="contrast" onPress={filter.showAll} />}
1378 + variant="plain"
1379 + />
1380 + </View>
1381 + ) : !result.isPending && !result.error && !seekingFile ? (
1382 <EmptyState
1389 - title="Only test files changed"
1390 - detail="Test files are hidden from this review."
1391 - action={<Button label="Show test files" tone="contrast" onPress={filter.showAll} />}
1383 + title="Diff unavailable"
1384 + detail={`Open this ${terminology.singular} on its provider to view the changes.`}
1385 variant="plain"
1386 />
1394 - </View>
1395 - ) : !result.isPending && !result.error && !seekingFile ? (
1396 - <EmptyState
1397 - title="Diff unavailable"
1398 - detail={`Open this ${terminology.singular} on its provider to view the changes.`}
1399 - variant="plain"
1400 - />
1401 - ) : null}
1402 - {result.nextCursor && result.isPending && data.rows.length && !seekingFile ? (
1403 - <View className="flex-row items-center justify-center gap-2 py-2">
1404 - <AppActivityIndicator size="small" />
1405 - <Text className="text-xs text-foreground-muted">Loading more files…</Text>
1406 - </View>
1407 - ) : null}
1408 - {result.error && result.nextCursor ? (
1409 - <View className="self-center">
1410 - <Button label="Retry loading remaining files" tone="text" onPress={result.refresh} />
1411 - </View>
1412 - ) : null}
1413 - {parsed.kind === "files" && parsed.notice ? (
1414 - <Text className="px-4 py-2 text-2xs text-foreground-muted">{parsed.notice}</Text>
1415 - ) : null}
1416 - </View>
1387 + ) : null}
1388 + {result.nextCursor && result.isPending && data.rows.length && !seekingFile ? (
1389 + <View className="flex-row items-center justify-center gap-2 py-2">
1390 + <AppActivityIndicator size="small" />
1391 + <Text className="text-xs text-foreground-muted">Loading more files…</Text>
1392 + </View>
1393 + ) : null}
1394 + {result.error && result.nextCursor ? (
1395 + <View className="self-center">
1396 + <Button label="Retry loading remaining files" tone="text" onPress={result.refresh} />
1397 + </View>
1398 + ) : null}
1399 + {parsed.kind === "files" && parsed.notice ? (
1400 + <Text className="px-4 py-2 text-2xs text-foreground-muted">{parsed.notice}</Text>
1401 + ) : null}
1402 + </View>
1403 + </ScreenContent>
1404 <PullRequestActionToolbar
1405 pr={detail.data}
1406 params={route.params}
apps/mobile/src/features/settings/SettingsKeyboardRouteScreen.tsx
+3 -13
@@ -1,19 +1,16 @@
1 import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
2 import { useAtomSet, useAtomValue } from "@effect/atom-react";
3 import { AsyncResult } from "effect/reactivity";
4 -import { Platform, View } from "react-native";
4 import { useSafeAreaInsets } from "react-native-safe-area-context";
5
7 -import { AppBar } from "../../components/ui/AppBar";
8 -import { useSettingsPageBack } from "./useSettingsPageBack";
6 import { AppText as Text } from "../../components/ui/AppText";
10 -import { NativeStackScreenOptions } from "../../native/StackHeader";
7 import {
8 DEFAULT_COMPOSER_ENTER_BEHAVIOR,
9 type ComposerEnterBehavior,
10 } from "../../lib/composerEnterBehavior";
11 import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";
12 import { ListChoiceRow as SettingsChoiceRow } from "../../components/ui/ListChoiceRow";
13 +import { SettingsScreen } from "./components/SettingsScreen";
14 import { SettingsSection } from "./components/SettingsSection";
15
16 const ENTER_BEHAVIOR_OPTIONS: ReadonlyArray<{
@@ -34,7 +31,6 @@ const ENTER_BEHAVIOR_OPTIONS: ReadonlyArray<{
31 ];
32
33 export function SettingsKeyboardRouteScreen() {
37 - const back = useSettingsPageBack();
34 const insets = useSafeAreaInsets();
35 const preferencesResult = useAtomValue(mobilePreferencesAtom);
36 const savePreferences = useAtomSet(updateMobilePreferencesAtom);
@@ -44,13 +40,7 @@ export function SettingsKeyboardRouteScreen() {
40 : null;
41
42 return (
47 - <View collapsable={false} className="flex-1 bg-sheet">
48 - {Platform.OS === "android" ? (
49 - <>
50 - <NativeStackScreenOptions options={{ headerShown: false }} />
51 - <AppBar embedded title="Keyboard" onBack={back} />
52 - </>
53 - ) : null}
43 + <SettingsScreen title="Keyboard">
44 <ScrollView
45 contentInsetAdjustmentBehavior="automatic"
46 showsVerticalScrollIndicator={false}
@@ -75,6 +65,6 @@ export function SettingsKeyboardRouteScreen() {
65 Applies to the composer when a hardware keyboard is connected.
66 </Text>
67 </ScrollView>
78 - </View>
68 + </SettingsScreen>
69 );
70 }
apps/mobile/src/features/settings/SettingsMicrophoneRouteScreen.tsx
+6 -5
@@ -22,6 +22,7 @@ import { ListRowLayout } from "../../components/ui/ListRowLayout";
22 import { ThreadSwipeable } from "../home/thread-swipe-actions";
23 import { ListActionRow as SettingsActionRow } from "../../components/ui/ListActionRow";
24 import { SettingsDragHandle } from "./components/SettingsDragHandle";
25 +import { SettingsScreen } from "./components/SettingsScreen";
26 import { SettingsSection } from "./components/SettingsSection";
27 import {
28 deviceMicrophoneOrder,
@@ -102,14 +103,14 @@ const UNAVAILABLE_EXPLANATION =
103 export function SettingsMicrophoneRouteScreen() {
104 const transcriber = useAtomValue(localVoiceTranscriberAtom);
105 // Android's probe is asynchronous; an empty sheet avoids flashing "unavailable" first.
105 - if (transcriber === "checking") return <View collapsable={false} className="flex-1 bg-sheet" />;
106 + if (transcriber === "checking") return <SettingsScreen title="Microphone">{null}</SettingsScreen>;
107 return transcriber === null ? <VoiceInputUnavailable /> : <MicrophoneSettings />;
108 }
109
110 function VoiceInputUnavailable() {
111 const insets = useSafeAreaInsets();
112 return (
112 - <View collapsable={false} className="flex-1 bg-sheet">
113 + <SettingsScreen title="Microphone">
114 <ScrollView
115 contentInsetAdjustmentBehavior="automatic"
116 showsVerticalScrollIndicator={false}
@@ -122,7 +123,7 @@ function VoiceInputUnavailable() {
123 </SettingsSection>
124 <Text className="px-2 text-sm text-foreground-muted">{UNAVAILABLE_EXPLANATION}</Text>
125 </ScrollView>
125 - </View>
126 + </SettingsScreen>
127 );
128 }
129
@@ -174,7 +175,7 @@ function MicrophoneSettings() {
175 const dragTo = drag === null ? -1 : dragFrom + dropSteps(dragFrom, drag.translation);
176
177 return (
177 - <View collapsable={false} className="flex-1 bg-sheet">
178 + <SettingsScreen title="Microphone">
179 <ScrollView
180 contentInsetAdjustmentBehavior="automatic"
181 showsVerticalScrollIndicator={false}
@@ -243,7 +244,7 @@ function MicrophoneSettings() {
244 : null}
245 </Text>
246 </ScrollView>
246 - </View>
247 + </SettingsScreen>
248 );
249 }
250
apps/mobile/src/features/threads/ThreadScreenHost.tsx
+4 -6
@@ -6,7 +6,9 @@ import {
6 useSyncExternalStore,
7 type ReactNode,
8 } from "react";
9 -import { Platform, View } from "react-native";
9 +import { View } from "react-native";
10 +
11 +import { ScreenContent } from "../../components/ui/ScreenContent";
12 import { ThreadDetailScreen, type ThreadDetailScreenProps } from "./ThreadDetailScreen";
13
14 type ThreadScreenContent =
@@ -40,11 +42,7 @@ function ThreadScreenOutlet() {
42 return (
43 <>
44 {"props" in content ? content.props.header : content.header}
43 - {Platform.OS === "android" ? (
44 - <View className="flex-1 overflow-hidden rounded-t-[28px] bg-thread-canvas">{body}</View>
45 - ) : (
46 - body
47 - )}
45 + <ScreenContent surface="canvas">{body}</ScreenContent>
46 </>
47 );
48 }
apps/mobile/src/features/workspace/WorkspaceRootScreen.android.tsx
+2 -8
@@ -8,7 +8,7 @@ import { View } from "react-native";
8 import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
9 import { NativeStackScreenOptions } from "../../native/StackHeader";
10 import { AppBar } from "../../components/ui/AppBar";
11 -import { EmptyState } from "../../components/ui/EmptyState";
11 +import { WorkspaceEmptyDetail } from "../layout/WorkspaceEmptyDetail";
12 import { ScreenContent } from "../../components/ui/ScreenContent";
13 import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
14 import { HomeRouteScreen } from "../home/HomeRouteScreen";
@@ -89,13 +89,7 @@ function WorkspaceRoot() {
89 <>
90 <NativeStackScreenOptions options={{ headerShown: false }} />
91 <AppBar embedded title="Pull requests" />
92 - <View className="flex-1 items-center justify-center px-10">
93 - <EmptyState
94 - title="Select a pull request"
95 - detail="Choose a pull request from the sidebar to review it."
96 - variant="plain"
97 - />
98 - </View>
92 + <WorkspaceEmptyDetail tab="pullRequests" />
93 </>
94 ) : (
95 <PullRequestsScreen
apps/mobile/src/features/workspace/workspace-tabs-state.test.ts
+1 -1
@@ -213,7 +213,7 @@ vi.mock("./WorkspaceExtraTab", () => ({
213 }));
214 vi.mock("../../native/StackHeader", () => ({ NativeStackScreenOptions: () => null }));
215 vi.mock("../../components/ui/AppBar", () => ({ AppBar: () => null }));
216 -vi.mock("../../components/ui/EmptyState", () => ({ EmptyState: () => null }));
216 +vi.mock("../layout/WorkspaceEmptyDetail", () => ({ WorkspaceEmptyDetail: () => null }));
217 vi.mock("../../components/ui/ScreenContent", () => ({
218 ScreenContent: ({ children }: { children: ReactNode }) => createElement("div", null, children),
219 }));