Skip to content

Commit ef02a50

Browse files
fix(mobile): lists end at the search field, and HTML previews start below the header
Duo sidebars counted the native search toolbar twice, Settings added the bottom safe area UIKit already applies (plus an extra 80pt dock inset), and Settings and PR lists read a bottom inset of 0 instead of their column's. Full-screen WebViews defaulted to contentInsetAdjustmentBehavior "never", so HTML previews started under the glass header. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 354f6c8 commit ef02a50

5 files changed

Lines changed: 54 additions & 55 deletions

File tree

‎apps/mobile/src/features/files/WorkspaceFileWebPreview.tsx‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export function WorkspaceFileWebPreview(props: { readonly uri: string | null })
2323
function DocumentWebPreview(props: { readonly uri: string }) {
2424
const insets = useSafeAreaInsets();
2525
const columnMetrics = useNativeColumnLayoutMetrics();
26-
const pdfTopInset = Platform.OS === "ios" ? (columnMetrics?.safeArea.top ?? insets.top) : 0;
26+
// iOS headers float over this column, so content starts below them.
27+
const headerInset = Platform.OS === "ios" ? (columnMetrics?.safeArea.top ?? insets.top) : 0;
2728
const [loadProgress, setLoadProgress] = useState(0);
2829
const [loadError, setLoadError] = useState<string | null>(null);
2930
const [linkedPdf, setLinkedPdf] = useState<string | null>(null);
@@ -35,7 +36,7 @@ function DocumentWebPreview(props: { readonly uri: string }) {
3536

3637
if (isPdfPreviewUri(props.uri)) {
3738
return (
38-
<View className="flex-1" style={{ paddingTop: pdfTopInset }}>
39+
<View className="flex-1" style={{ paddingTop: headerInset }}>
3940
<PdfPreview uri={props.uri} />
4041
</View>
4142
);
@@ -44,7 +45,7 @@ function DocumentWebPreview(props: { readonly uri: string }) {
4445
return (
4546
<View className="relative flex-1 bg-card">
4647
{linkedPdf ? (
47-
<View className="flex-1" style={{ paddingTop: pdfTopInset }}>
48+
<View className="flex-1" style={{ paddingTop: headerInset }}>
4849
<PdfPreview key={linkedPdf} uri={linkedPdf} />
4950
<SafeAreaView edges={["bottom"]} className="border-t border-border px-4 py-2">
5051
<ControlPill
@@ -56,15 +57,10 @@ function DocumentWebPreview(props: { readonly uri: string }) {
5657
</View>
5758
) : null}
5859
<View className="flex-1" style={linkedPdf ? { display: "none" } : undefined}>
59-
{loadProgress > 0 && loadProgress < 1 ? <LoadingStrip progress={loadProgress} /> : null}
60-
{loadError ? (
61-
<View className="border-b border-border bg-card px-4 py-2">
62-
<Text className="text-xs font-t3-bold text-foreground">Preview failed</Text>
63-
<Text className="mt-0.5 text-xs leading-snug text-foreground-muted">{loadError}</Text>
64-
</View>
65-
) : null}
6660
<WebView
6761
source={{ uri: props.uri }}
62+
// react-native-webview defaults to "never", which starts the page under the header.
63+
contentInsetAdjustmentBehavior="automatic"
6864
originWhitelist={["*"]}
6965
allowsBackForwardNavigationGestures
7066
allowsFullscreenVideo
@@ -98,6 +94,15 @@ function DocumentWebPreview(props: { readonly uri: string }) {
9894
)}
9995
style={{ flex: 1, backgroundColor: "transparent" }}
10096
/>
97+
<View pointerEvents="box-none" className="absolute inset-x-0" style={{ top: headerInset }}>
98+
{loadProgress > 0 && loadProgress < 1 ? <LoadingStrip progress={loadProgress} /> : null}
99+
{loadError ? (
100+
<View className="border-b border-border bg-card px-4 py-2">
101+
<Text className="text-xs font-t3-bold text-foreground">Preview failed</Text>
102+
<Text className="mt-0.5 text-xs leading-snug text-foreground-muted">{loadError}</Text>
103+
</View>
104+
) : null}
105+
</View>
101106
</View>
102107
</View>
103108
);

‎apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
2222
import { AppText as Text } from "../../components/ui/AppText";
2323
import { EmptyState } from "../../components/ui/EmptyState";
2424
import { NativePrimaryColumnContext } from "../../native/v5-workspace-context";
25+
import { useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics";
2526
import { useWorkspaceState } from "../../state/workspace";
2627
import { useProjects } from "../../state/entities";
2728
import { environmentServerConfigsAtom } from "../../state/server";
@@ -96,6 +97,10 @@ export function PullRequestsScreen(
9697
const { environments } = useWorkspaceState();
9798
const configs = useAtomValue(environmentServerConfigsAtom);
9899
const insets = useSafeAreaInsets();
100+
// UIKit insets the list by its column's safe area, which this context can report as 0.
101+
const columnSafeBottom = useNativeColumnLayoutMetrics()?.safeArea.bottom;
102+
const bottomSafeArea =
103+
Platform.OS === "ios" ? (columnSafeBottom ?? insets.bottom) : insets.bottom;
99104
const listRef = useRef<LegendListRef>(null);
100105
const tab = workspace.state.tabs.pullRequests;
101106
const [initialScrollOffset] = useState(() => workspace.getScrollOffset("pullRequests"));
@@ -314,8 +319,8 @@ export function PullRequestsScreen(
314319
contentInsetStartAdjustment={Platform.OS === "ios" ? insets.top : 0}
315320
contentContainerStyle={{
316321
paddingBottom:
317-
Math.max(insets.bottom, workspace.bottomClearance) -
318-
(Platform.OS === "ios" ? insets.bottom : 0),
322+
Math.max(bottomSafeArea, workspace.bottomClearance) -
323+
(Platform.OS === "ios" ? bottomSafeArea : 0),
319324
}}
320325
onScroll={(event) => {
321326
workspace.recordScrollOffset(

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

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,14 @@ import { currentWorkspaceSelections } from "../workspace/workspace-selection-sto
1212
import { rememberedSettingsPage } from "../workspace/workspace-tab-navigation";
1313
import { useSelectWorkspaceTab } from "../workspace/useSelectWorkspaceTab";
1414
import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
15-
import {
16-
ScreenScrollView as ScrollView,
17-
ScreenScrollViewBottomInset,
18-
} from "../../components/ui/ScreenScrollView";
15+
import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
1916
import { EmptyState } from "../../components/ui/EmptyState";
2017
import { useAuth, useUser } from "@clerk/expo";
2118
import { useNavigation, useNavigationState } from "@react-navigation/native";
2219
import { use, useMemo, type ComponentProps } from "react";
2320
import { Platform, View } from "react-native";
2421
import { useWorkspaceSurface } from "../workspace/useWorkspaceSurface";
25-
import { useDeviceType } from "../../native/native-layout-metrics";
26-
import { useCompactWorkspaceTabs } from "../workspace/useSystemWorkspaceTabBar";
22+
import { useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics";
2723
import { deriveProjectGroupLabel } from "@t3tools/client-runtime/state/project-grouping";
2824
import { useSafeAreaInsets } from "react-native-safe-area-context";
2925

@@ -44,8 +40,6 @@ import { NativePrimaryColumnContext } from "../../native/v5-workspace-context";
4440

4541
export function SettingsRouteScreen() {
4642
const surface = useWorkspaceSurface();
47-
const deviceType = useDeviceType();
48-
const compactTabs = useCompactWorkspaceTabs();
4943
const workspace = useWorkspaceTabs();
5044
const { layout } = useAdaptiveWorkspaceLayout();
5145
const inSidebar = use(NativePrimaryColumnContext) !== null && layout.usesSplitView;
@@ -69,28 +63,26 @@ export function SettingsRouteScreen() {
6963
<SettingsSidebarContext value={sidebar}>
7064
<View className={`flex-1 ${inSidebar ? surface.className : "bg-screen"}`}>
7165
<SettingsEnvironmentFilterHeader />
72-
<ScreenScrollViewBottomInset value={deviceType === "pad" || compactTabs ? 80 : 0}>
73-
{Platform.OS === "android" ? (
74-
<SettingsScreen
75-
title="Settings"
76-
trailing={<AndroidSettingsEnvironmentFilter />}
77-
search={
78-
workspace
79-
? {
80-
value: workspace.state.tabs.settings.query,
81-
onChangeText: (query) =>
82-
workspace.dispatch({ type: "query", tab: "settings", query }),
83-
placeholder: "Search settings",
84-
}
85-
: undefined
86-
}
87-
>
88-
{content}
89-
</SettingsScreen>
90-
) : (
91-
content
92-
)}
93-
</ScreenScrollViewBottomInset>
66+
{Platform.OS === "android" ? (
67+
<SettingsScreen
68+
title="Settings"
69+
trailing={<AndroidSettingsEnvironmentFilter />}
70+
search={
71+
workspace
72+
? {
73+
value: workspace.state.tabs.settings.query,
74+
onChangeText: (query) =>
75+
workspace.dispatch({ type: "query", tab: "settings", query }),
76+
placeholder: "Search settings",
77+
}
78+
: undefined
79+
}
80+
>
81+
{content}
82+
</SettingsScreen>
83+
) : (
84+
content
85+
)}
9486
</View>
9587
</SettingsSidebarContext>
9688
);
@@ -159,6 +151,8 @@ function SettingsList(props: { readonly connections: readonly SettingsListRow[]
159151
// Grouped cards only lift off the screen surface; the drawer is as dark as they are.
160152
const listSurface = use(SettingsSidebarContext) ? "bg-drawer" : "bg-screen";
161153
const insets = useSafeAreaInsets();
154+
// UIKit insets the scroll view by its column's safe area, which this context can report as 0.
155+
const bottomSafeArea = useNativeColumnLayoutMetrics()?.safeArea.bottom ?? insets.bottom;
162156
const workspace = useWorkspaceTabs();
163157
const query = workspace?.state.tabs.settings.query ?? "";
164158
const overflowRows = useOverflowRows();
@@ -178,10 +172,11 @@ function SettingsList(props: { readonly connections: readonly SettingsListRow[]
178172
contentContainerClassName="gap-4 px-5 pt-4"
179173
contentContainerStyle={{
180174
// The workspace's clearance keeps the last row above its search field and keyboard.
181-
paddingBottom: Math.max(
182-
Math.max(insets.bottom, 18) + 18,
183-
workspace?.bottomClearance ?? 0,
184-
),
175+
paddingBottom:
176+
Platform.OS === "ios"
177+
? Math.max(Math.max(bottomSafeArea, 18) + 18, workspace?.bottomClearance ?? 0) -
178+
bottomSafeArea
179+
: Math.max(Math.max(insets.bottom, 18) + 18, workspace?.bottomClearance ?? 0),
185180
}}
186181
>
187182
{sections.length ? (

‎apps/mobile/src/features/threads/HtmlRenderWebView.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export function HtmlRenderWebView(props: {
131131
accessibilityLabel={props.title}
132132
style={{ flex: 1, backgroundColor: "transparent" }}
133133
allowsInlineMediaPlayback
134-
automaticallyAdjustContentInsets={!props.nested}
134+
contentInsetAdjustmentBehavior={props.nested ? "never" : "automatic"}
135135
bounces={!props.nested}
136136
showsVerticalScrollIndicator={!props.nested}
137137
showsHorizontalScrollIndicator={!props.nested}

‎apps/mobile/src/features/workspace/WorkspaceRootScreen.tsx‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
1818
import { useWorkspaceSurface } from "./useWorkspaceSurface";
1919
import {
2020
useDeviceType,
21-
useDuoBottomBarInset,
2221
useNativeColumnLayoutMetrics,
2322
useNativeLayoutMetrics,
2423
} from "../../native/native-layout-metrics";
@@ -35,7 +34,6 @@ import {
3534
import { WorkspaceToolbar } from "./WorkspaceToolbar";
3635
import {
3736
WORKSPACE_DOCK,
38-
workspaceSearchBottomClearance,
3937
workspaceDockBottomClearance,
4038
workspaceToolbarHeight,
4139
} from "./workspace-tabs-state";
@@ -94,7 +92,6 @@ function WorkspaceRootContent() {
9492
(nativeMetrics !== null && nativeMetrics.verticalBarEdge !== "none"));
9593
const width = columnMetrics?.width ?? windowWidth;
9694
const insets = useSafeAreaInsets();
97-
const bottomBarInset = useDuoBottomBarInset();
9895
const keyboardHeight = useKeyboardState((keyboard) => keyboard.height);
9996
const workspace = useWorkspaceTabs()!;
10097
const { state } = workspace;
@@ -114,11 +111,8 @@ function WorkspaceRootContent() {
114111
layout.primarySidebarOverlaysContent && state.selectedTab === "usage"
115112
? workspaceDockBottomClearance({ bottomInset: insets.bottom, keyboardHeight })
116113
: Platform.OS === "ios" && isDuoDevice(deviceType)
117-
? workspaceSearchBottomClearance({
118-
bottomInset: insets.bottom,
119-
bottomBarInset,
120-
keyboardHeight,
121-
})
114+
? // The column's safe area already holds the Duo's search toolbar and keyboard.
115+
Math.max(insets.bottom, keyboardHeight) + 16
122116
: compactTabs || deviceType === "pad"
123117
? workspaceDockBottomClearance({ bottomInset: insets.bottom, keyboardHeight })
124118
: Platform.OS === "ios"

0 commit comments

Comments
 (0)