The best way to control Claude Code, Codex and more from any computer or phone
feat(mobile): close the keyboard from the Duo's side bar (#24696)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Oct 25, 2026 at 00:57 UTC
f694a19a9927d35e4c814a8743e3c1507a89c69b
1 file changed
+24
apps/mobile/src/native/V5StackHeader.ios.tsx
+24
@@ -5,6 +5,7 @@ import type {
5
} from "@react-navigation/native-stack";
6
import { isValidElement, useEffect, useRef } from "react";
7
import { StyleSheet } from "react-native";
8
+import { KeyboardController, useKeyboardState } from "react-native-keyboard-controller";
9
import { isDuoDevice } from "../lib/device-type";
10
import { useMobileNavigationTheme } from "../lib/useMobileNavigationTheme";
11
import { useDeviceType, useNativeLayoutMetrics } from "../native/native-layout-metrics";
@@ -153,6 +154,7 @@ export function V5StackHeader(props: {
154
const theme = useMobileNavigationTheme();
155
const nativeMetrics = useNativeLayoutMetrics();
156
const deviceType = useDeviceType();
157
+ const keyboardVisible = useKeyboardState((state) => state.isVisible);
158
const searchRef = useRef<SearchBarCommands>(null);
159
const itemProps = { tintColor: options.headerTintColor, canGoBack: props.canGoBack };
160
const leading = convertItems(options.unstable_headerLeftItems?.(itemProps) ?? [], "leading");
@@ -231,6 +233,28 @@ export function V5StackHeader(props: {
233
trailing.push({ type: "spacer", id: "compose-group", sizing: "fixed", width: 8 });
234
trailing.push(compose);
235
}
236
+ // The vertical bar has no keyboard accessory row, so it carries its own dismiss. A regular-width
237
+ // primary column draws a horizontal bar beside the detail column's vertical one. The first
238
+ // trailing item sits at the bar's far end; the flexible space keeps it next to the keyboard.
239
+ if (
240
+ keyboardVisible &&
241
+ nativeMetrics &&
242
+ nativeMetrics.verticalBarEdge !== "none" &&
243
+ (props.column !== "primary" || nativeMetrics.horizontalSizeClass === "compact")
244
+ ) {
245
+ trailing.unshift(
246
+ {
247
+ type: "item",
248
+ id: "dismiss-keyboard",
249
+ title: "Dismiss keyboard",
250
+ icon: { type: "sfSymbol", name: "keyboard.chevron.compact.down" },
251
+ onPress: () => void KeyboardController.dismiss(),
252
+ // The folded bar is short; keep this out of the overflow menu.
253
+ visibilityPriority: "high",
254
+ },
255
+ { type: "spacer", id: "dismiss-keyboard-space", sizing: "flexible" },
256
+ );
257
+ }
258
const left = options.headerLeft?.(itemProps);
259
const right = options.headerRight?.(itemProps);
260
if (!options.unstable_headerLeftItems && isValidElement(left))