Skip to content
TypeScript

fix(mobile): the iPhone Duo's inspector panes use the full column (#23150)

Julius Marminge89fe509232e7
diff --git a/apps/mobile/src/features/files/thread-file-navigator-pane.tsx b/apps/mobile/src/features/files/thread-file-navigator-pane.tsx
index 901024a2782..5f3deb6089c 100644
--- a/apps/mobile/src/features/files/thread-file-navigator-pane.tsx
+++ b/apps/mobile/src/features/files/thread-file-navigator-pane.tsx
@@ -21,6 +21,7 @@ import { useEnvironmentQuery } from "../../state/query";
import { useEnvironmentPresentation } from "../../state/presentation";
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import { FileTreeBrowser } from "./FileTreeBrowser";
+import { NativeInspectorContent } from "../../native/NativeInspectorContent";
import { useFileTreeEntries } from "./useFileTreeEntries";
import { preloadWorkspaceFileContents } from "./preload-workspace-file";
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
@@ -120,7 +121,7 @@ export function ThreadFileNavigatorPane(props: {
scrollEdgeEffects={headerScrollEdgeEffects}
style={{ backgroundColor: sheetColor, flex: 1 }}
>
- {fileTree}
+ <NativeInspectorContent>{fileTree}</NativeInspectorContent>
<ScreenStackHeaderConfig
backgroundColor="rgba(0,0,0,0)"
color={foregroundColor}
diff --git a/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx b/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
index 4b870df4582..5acc33b8703 100644
--- a/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
+++ b/apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
@@ -305,7 +305,9 @@ function WorkspaceColumns(
</Split.Column>
<Split.Inspector>
<Split.HeaderConfig hidden />
- <ColumnContent>
+ {/* Inspector panes host their own native stacks, which UIKit insets for the Duo's
+ vertical bar wherever they sit, so each pane insets its own content instead. */}
+ <ColumnContent insetHorizontally={false}>
<View className="flex-1 bg-screen">{inspector.render?.()}</View>
</ColumnContent>
</Split.Inspector>
diff --git a/apps/mobile/src/features/review/ReviewSheet.tsx b/apps/mobile/src/features/review/ReviewSheet.tsx
index 5660301371d..3dd9667f9b5 100644
--- a/apps/mobile/src/features/review/ReviewSheet.tsx
+++ b/apps/mobile/src/features/review/ReviewSheet.tsx
@@ -30,6 +30,7 @@ import {
} from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics";
+import { NativeInspectorContent } from "../../native/NativeInspectorContent";
import { AppText as Text } from "../../components/ui/AppText";
import { SymbolView } from "../../components/ui/AppSymbol";
@@ -40,7 +41,6 @@ import { environmentCatalog } from "../../connection/catalog";
import { useEnvironmentPresentation } from "../../state/presentation";
import { useAtomCommand } from "../../state/use-atom-command";
import { useUniwindTheme } from "../../lib/useUniwindTheme";
-import { IOS_NAV_BAR_HEIGHT } from "../../lib/layoutMetrics";
import { useThreadDraftForThread } from "../../state/use-thread-composer-state";
import { EnvironmentConnectionNotice } from "../connection/EnvironmentConnectionNotice";
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
@@ -307,7 +307,6 @@ function ReviewFileNavigator({
onSelectFile,
ref,
}: ReviewFileNavigatorProps) {
- const insets = useSafeAreaInsets();
const theme = useUniwindTheme();
const sheetColor = theme["--color-sheet"];
const foregroundColor = theme["--color-foreground"];
@@ -359,15 +358,8 @@ function ReviewFileNavigator({
data={files}
extraData={selectedFileId}
keyExtractor={(file) => file.id}
- contentContainerStyle={{
- paddingHorizontal: 8,
- paddingBottom: 8,
-
- paddingTop: Platform.OS === "ios" ? insets.top + IOS_NAV_BAR_HEIGHT + 8 : 8,
- }}
- scrollIndicatorInsets={
- Platform.OS === "ios" ? { top: insets.top + IOS_NAV_BAR_HEIGHT } : undefined
- }
+ contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
+ contentContainerStyle={{ paddingHorizontal: 8, paddingVertical: 8 }}
renderItem={renderFile}
/>
);
@@ -384,7 +376,7 @@ function ReviewFileNavigator({
scrollEdgeEffects={headerScrollEdgeEffects}
style={{ backgroundColor: sheetColor, flex: 1 }}
>
- {fileList}
+ <NativeInspectorContent>{fileList}</NativeInspectorContent>
<ScreenStackHeaderConfig
backgroundColor="rgba(0,0,0,0)"
color={foregroundColor}
diff --git a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
index 43b0c5238ec..d47f18f1e18 100644
--- a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
+++ b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
@@ -20,7 +20,7 @@ import { Platform, Pressable, RefreshControl, ScrollView, View } from "react-nat
import { ScreenStack } from "react-native-screens";
import { useSafeAreaInsets } from "react-native-safe-area-context";
-import { NativeSheetContent } from "../../../native/NativeSheetContent";
+import { NativeInspectorContent } from "../../../native/NativeInspectorContent";
import { NativeHeader, NativeScreen } from "../../../native/ThemedScreenStack";
import {
AndroidHeaderIconButton,
@@ -349,7 +349,7 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
scrollEdgeEffects={HEADER_SCROLL_EDGE_EFFECTS}
className="flex-1 bg-sheet"
>
- <NativeSheetContent>{content}</NativeSheetContent>
+ <NativeInspectorContent>{content}</NativeInspectorContent>
<NativeHeader
backgroundColor="rgba(0,0,0,0)"
tintColorClassName="accent-foreground"
diff --git a/apps/mobile/src/features/threads/thread-inspector-content-stack.tsx b/apps/mobile/src/features/threads/thread-inspector-content-stack.tsx
index b36218cd29a..fd274857407 100644
--- a/apps/mobile/src/features/threads/thread-inspector-content-stack.tsx
+++ b/apps/mobile/src/features/threads/thread-inspector-content-stack.tsx
@@ -2,6 +2,7 @@ import { useEffect, useState, type ReactNode } from "react";
import { View } from "react-native";
import { RenderErrorBoundary, RenderFailureView } from "../../components/RenderErrorBoundary";
+import { NativeInspectorContent } from "../../native/NativeInspectorContent";
export type ThreadInspectorMode = "route" | "git" | "files";
@@ -33,7 +34,9 @@ function InspectorContentPane(props: {
<RenderErrorBoundary
resetKeys={props.resetKeys}
renderFallback={(fallback) => (
- <RenderFailureView {...fallback} title="The inspector couldn't be displayed" />
+ <NativeInspectorContent>
+ <RenderFailureView {...fallback} title="The inspector couldn't be displayed" />
+ </NativeInspectorContent>
)}
>
{props.children}
diff --git a/apps/mobile/src/native/NativeInspectorContent.tsx b/apps/mobile/src/native/NativeInspectorContent.tsx
new file mode 100644
index 00000000000..4907618f2d4
--- /dev/null
+++ b/apps/mobile/src/native/NativeInspectorContent.tsx
@@ -0,0 +1,17 @@
+import type { ReactNode } from "react";
+import { SafeAreaView } from "react-native-safe-area-context";
+
+import { useNativeWorkspaceColumnsSupported } from "./NativeWorkspaceColumns";
+
+// Pads with the inspector column's insets, which the column leaves to its panes so their
+// native headers lay out against the vertical bar themselves.
+export function NativeInspectorContent(props: { readonly children: ReactNode }) {
+ const usesNativeWorkspaceColumns = useNativeWorkspaceColumnsSupported();
+ if (!usesNativeWorkspaceColumns) return <>{props.children}</>;
+
+ return (
+ <SafeAreaView edges={["left", "right"]} style={{ flex: 1 }}>
+ {props.children}
+ </SafeAreaView>
+ );
+}
diff --git a/apps/mobile/src/native/NativeSheetContent.tsx b/apps/mobile/src/native/NativeSheetContent.tsx
deleted file mode 100644
index ec44dc0dde2..00000000000
--- a/apps/mobile/src/native/NativeSheetContent.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import type { ReactNode } from "react";
-import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";
-
-import { useNativeWorkspaceColumnsSupported } from "./NativeWorkspaceColumns";
-
-export function NativeSheetContent(props: { readonly children: ReactNode }) {
- const usesNativeWorkspaceColumns = useNativeWorkspaceColumnsSupported();
- if (!usesNativeWorkspaceColumns) return <>{props.children}</>;
-
- return (
- <SafeAreaProvider style={{ flex: 1 }}>
- <SafeAreaView edges={["left", "right"]} style={{ flex: 1 }}>
- {props.children}
- </SafeAreaView>
- </SafeAreaProvider>
- );
-}