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, 19:30 UTC
fix(mobile): the iPhone Duo's search field and composer line up with its tab bar (#23148)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 21, 2026 at 17:58 UTC
e6c2aeb3608da8c7d64c0be68b777d2660fcd93e
7 files changed
+39
-8
apps/mobile/modules/t3-native-controls/ios/T3LayoutMetricsView.swift
+5
-1
@@ -69,6 +69,7 @@ final class T3LayoutMetricsView: ExpoView {
69
}
70
var verticalBarEdge = "none"
71
var regions: [[String: Any]] = []
72
+ var bottomBarInset: CGFloat?
73
#if canImport(UIKit, _version: 9127.0.85)
74
if #available(iOS 27.1, *) {
75
let rtl = effectiveUserInterfaceLayoutDirection == .rightToLeft
@@ -77,6 +78,8 @@ final class T3LayoutMetricsView: ExpoView {
78
case .trailing: verticalBarEdge = rtl ? "left" : "right"
79
default: break
80
}
81
+ // Where UIKit floats a bar as tall as the app's bottom controls, level with its tab bar.
82
+ bottomBarInset = edgeInsets(for: .bar(onEdge: UIRectEdge.bottom, extent: 48)).bottom
83
for kind in [UIView.ReservedRegion.Kind.division, .occlusion] {
84
for region in reservedRegions(kind: kind) where region.isActive {
85
let frame = region.frame.intersection(bounds)
@@ -90,7 +93,7 @@ final class T3LayoutMetricsView: ExpoView {
93
}
94
}
95
#endif
93
- let metrics: [String: Any] = [
96
+ var metrics: [String: Any] = [
97
"width": bounds.width, "height": bounds.height,
98
"hasHinge": hasHinge,
99
"horizontalSizeClass": traitCollection.horizontalSizeClass == .regular ? "regular" : "compact",
@@ -101,6 +104,7 @@ final class T3LayoutMetricsView: ExpoView {
104
],
105
"reservedRegions": regions,
106
]
107
+ metrics["bottomBarInset"] = bottomBarInset
108
let next = metrics as NSDictionary
109
guard lastMetrics?.isEqual(next) != true else { return }
110
lastMetrics = next
apps/mobile/src/features/threads/ThreadComposer.tsx
+4
-1
@@ -349,6 +349,9 @@ export function ComposerSurface(props: {
349
);
350
}
351
352
+/** Space below the composer pill, inside the bottom inset it is given. */
353
+export const THREAD_COMPOSER_BOTTOM_GUTTER = 6;
354
+
355
export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps) {
356
const project = useProject(scopeProjectRef(props.environmentId, props.selectedThread.projectId));
357
const { themeVariables: materialTheme } = useAppearancePreferences();
@@ -804,7 +807,7 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
807
className="px-[12px]"
808
style={{
809
paddingTop: usesCard ? 8 : 6,
807
- paddingBottom: (props.bottomInset ?? 0) + (usesCard ? 8 : 6),
810
+ paddingBottom: (props.bottomInset ?? 0) + (usesCard ? 8 : THREAD_COMPOSER_BOTTOM_GUTTER),
811
backgroundColor:
812
Platform.OS === "android" ? themeColorWithAlpha(composerPanel, 1) : undefined,
813
}}
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+9
-2
@@ -102,7 +102,10 @@ import Animated, {
102
import { useSafeAreaInsets } from "react-native-safe-area-context";
103
import { useWorkspaceContentWidth } from "../layout/workspace-content-width";
104
import { useNativeWorkspaceColumnsSupported } from "../../native/NativeWorkspaceColumns";
105
-import { useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics";
105
+import {
106
+ useDuoBottomBarInset,
107
+ useNativeColumnLayoutMetrics,
108
+} from "../../native/native-layout-metrics";
109
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
110
import { collectProviderUsageLimits } from "@t3tools/shared/usageLimits";
111
import type { ComposerEditorHandle } from "../../components/ComposerEditor";
@@ -159,6 +162,7 @@ import {
162
COMPOSER_EXPANDED_CHROME,
163
COMPOSER_LAYOUT_TRANSITION,
164
COMPOSER_TRANSITION_DURATION_MS,
165
+ THREAD_COMPOSER_BOTTOM_GUTTER,
166
ThreadComposer,
167
} from "./ThreadComposer";
168
import { ComposerPopoverHost } from "./ComposerPopoverHost";
@@ -536,10 +540,13 @@ export const ThreadDetailScreen = function ThreadDetailScreen(props: ThreadDetai
540
const [endFollowEnabled, setEndFollowEnabled] = useState(true);
541
// Android Back hides the keyboard without blurring. Keep its safe-area padding
542
// fixed through the animation and cancel it with matching composer/list offsets.
543
+ const bottomBarInset = useDuoBottomBarInset();
544
const composerBottomInset =
545
Platform.OS === "ios" && (composerExpanded || composerFocused)
546
? 0
542
- : Math.max(insets.bottom, 12);
547
+ : bottomBarInset !== undefined
548
+ ? bottomBarInset - THREAD_COMPOSER_BOTTOM_GUTTER
549
+ : Math.max(insets.bottom, 12);
550
const composerKeyboardOffset = Platform.OS === "android" ? composerBottomInset : 0;
551
const contentPresentationKind = props.contentPresentation.kind;
552
const realThreadSyncLabel = (() => {
apps/mobile/src/features/workspace/WorkspaceRootScreen.tsx
+5
-1
@@ -11,6 +11,7 @@ import { NativeStackScreenOptions } from "../../native/StackHeader";
11
import { NativePrimaryColumnContext } from "../../native/v5-workspace-context";
12
import {
13
useDeviceType,
14
+ useDuoBottomBarInset,
15
useNativeColumnLayoutMetrics,
16
useNativeLayoutMetrics,
17
} from "../../native/native-layout-metrics";
@@ -70,6 +71,7 @@ function WorkspaceRootContent() {
71
(nativeMetrics !== null && nativeMetrics.verticalBarEdge !== "none"));
72
const width = columnMetrics?.width ?? windowWidth;
73
const insets = useSafeAreaInsets();
74
+ const bottomBarInset = useDuoBottomBarInset();
75
const keyboardHeight = useKeyboardState((keyboard) => keyboard.height);
76
const workspace = useWorkspaceTabs()!;
77
const { state } = workspace;
@@ -90,7 +92,9 @@ function WorkspaceRootContent() {
92
const tab = state.tabs[state.selectedTab];
93
const bottomClearance =
94
Platform.OS === "ios" && isDuoDevice(deviceType)
93
- ? Math.max(insets.bottom, 12, keyboardHeight + 8) + WORKSPACE_TOOLBAR.height + 16
95
+ ? Math.max(bottomBarInset ?? Math.max(insets.bottom, 12), keyboardHeight + 8) +
96
+ WORKSPACE_TOOLBAR.height +
97
+ 16
98
: Platform.OS === "ios"
99
? Math.max(insets.bottom, keyboardHeight) +
100
(systemTabBar || sidebarTabs || tab.searchMode !== "resting"
apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx
+3
-2
@@ -6,7 +6,7 @@ import { useReanimatedKeyboardAnimation } from "react-native-keyboard-controller
6
import Animated, { useAnimatedStyle } from "react-native-reanimated";
7
import { useSafeAreaInsets } from "react-native-safe-area-context";
8
import { isDuoDevice } from "../../lib/device-type";
9
-import { useDeviceType } from "../../native/native-layout-metrics";
9
+import { useDeviceType, useDuoBottomBarInset } from "../../native/native-layout-metrics";
10
import type { SearchBarCommands } from "react-native-screens";
11
12
import { SymbolView } from "../../components/ui/AppSymbol";
@@ -75,6 +75,7 @@ export function WorkspaceToolbar(props: {
75
// each fold replaces the search field.
76
const listSearch = isDuoDevice(deviceType);
77
const insets = useSafeAreaInsets();
78
+ const bottomBarInset = useDuoBottomBarInset();
79
const { isTabActive } = workspace;
80
const tabActive = use(NativeWorkspaceTabActivityContext)?.active ?? true;
81
const { panes, togglePrimarySidebar } = useAdaptiveWorkspaceLayout();
@@ -216,7 +217,7 @@ export function WorkspaceToolbar(props: {
217
) : null}
218
</Toolbar>
219
{listSearch ? (
219
- <AboveKeyboard bottom={Math.max(insets.bottom, 12)}>
220
+ <AboveKeyboard bottom={bottomBarInset ?? Math.max(insets.bottom, 12)}>
221
<WorkspaceSearchField
222
ref={fieldRef}
223
tab={selectedTab}
apps/mobile/src/lib/reserved-regions.ts
+2
@@ -19,6 +19,8 @@ export interface NativeLayoutMetrics {
19
readonly right: number;
20
};
21
readonly reservedRegions: ReadonlyArray<ReservedRegion>;
22
+ /** How far above the bottom edge UIKit floats a 48pt bottom bar, level with its tab bar. iOS 27.1+. */
23
+ readonly bottomBarInset?: number;
24
}
25
26
export function deriveBottomControlInsets(metrics: NativeLayoutMetrics | null) {
apps/mobile/src/native/native-layout-metrics.tsx
+11
-1
@@ -1,6 +1,6 @@
1
import { createContext, use, useState, type ReactNode } from "react";
2
import { Platform } from "react-native";
3
-import { deriveDeviceType, type DeviceType } from "../lib/device-type";
3
+import { deriveDeviceType, isDuoDevice, type DeviceType } from "../lib/device-type";
4
import type { NativeLayoutMetrics } from "../lib/reserved-regions";
5
import { NativeLayoutObserver } from "./NativeLayoutObserver";
6
@@ -38,3 +38,13 @@ export function useNativeColumnLayoutMetrics() {
38
export function useDeviceType() {
39
return use(DeviceTypeContext);
40
}
41
+
42
+/**
43
+ * Where the Duo's floating bottom controls end in this column. Its tab bar floats below the safe
44
+ * area, and the controls beside it sit on the same line.
45
+ */
46
+export function useDuoBottomBarInset() {
47
+ const deviceType = useDeviceType();
48
+ const inset = use(NativeColumnLayoutMetricsContext)?.bottomBarInset;
49
+ return isDuoDevice(deviceType) ? inset : undefined;
50
+}