@devries-cameron20 / t3code-1 / commits / ec2fd4d37c
Fork 0

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

fix(mobile): respect Duo safe areas in overlays (#22977)

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

Julius Marminge committed Oct 21, 2026 at 17:58 UTC ec2fd4d37c34fa090268c03400406031ece418e2
4 files changed +194 -181
apps/mobile/src/features/devices/DevicePreviewRouteScreen.tsx
+8 -1
@@ -27,6 +27,8 @@ import {
27 findHeaderMenuAction,
28 } from "../../components/ui/headerMenu.android";
29 import type { AppBarMenuItem } from "../../components/ui/AppBar.types";
30 +import { deriveBottomControlInsets } from "../../lib/reserved-regions";
31 +import { useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics";
32 import { deviceEnvironment, refreshDeviceHubAccess, useDeviceHubAccess } from "../../state/device";
33 import { useEnvironmentQuery } from "../../state/query";
34 import { useAtomCommand } from "../../state/use-atom-command";
@@ -75,6 +77,8 @@ function DevicePreviewScreen({
77 readonly onClose: () => void;
78 }) {
79 const insets = useSafeAreaInsets();
80 + // NativeColumnContent already insets the sides, so only a book fold moves the reveal handle.
81 + const handleBounds = deriveBottomControlInsets(useNativeColumnLayoutMetrics());
82 const { themeVariables } = useAppearancePreferences();
83 const focused = useIsFocused();
84 const [foreground, setForeground] = useState(AppState.currentState !== "background");
@@ -318,7 +322,10 @@ function DevicePreviewScreen({
322 accessibilityHint="Shaking the phone also shows them"
323 hitSlop={12}
324 className="absolute h-6 w-16 items-center justify-center self-center"
321 - style={{ top: Math.max(insets.top - 18, 4) }}
325 + style={{
326 + top: Math.max(insets.top - 18, 4),
327 + transform: [{ translateX: (handleBounds.left - handleBounds.right) / 2 }],
328 + }}
329 onPress={() => setControlsVisible(true)}
330 >
331 <View className="h-1.5 w-10 rounded-full bg-white/40" />
apps/mobile/src/features/keyboard/CommandPalette.tsx
+8 -2
@@ -22,7 +22,9 @@ import { RowPressable } from "../../components/ui/RowPressable";
22 import { AppText as Text } from "../../components/ui/AppText";
23 import { SymbolView, type AppSymbolName } from "../../components/ui/AppSymbol";
24 import { cn } from "../../lib/cn";
25 +import { deriveBottomControlInsets } from "../../lib/reserved-regions";
26 import { scopedProjectKey, scopedThreadKey } from "../../lib/scopedEntities";
27 +import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
28 import { T3KeyboardCommands } from "../../native/T3KeyboardCommands";
29 import { useProjects, useThreadShell, useThreadShells } from "../../state/entities";
30 import { useThreadSearch } from "../../state/queries";
@@ -156,6 +158,9 @@ export function CommandPalette(props: {
158 const inputRef = useRef<TextInputInstance>(null);
159 const listRef = useRef<FlatList<CommandPaletteItem>>(null);
160 const { width, height } = useWindowDimensions();
161 + // The palette floats above every column, so it keeps itself inside the window's side insets
162 + // and to one side of a book fold.
163 + const bounds = deriveBottomControlInsets(useNativeLayoutMetrics());
164 const searchEnvironmentIds = useMemo(
165 () =>
166 environments
@@ -423,7 +428,8 @@ export function CommandPalette(props: {
428 <T3KeyboardCommands enabledCommands={PALETTE_COMMANDS} onCommand={onCommand}>
429 <KeyboardAvoidingView
430 behavior="padding"
426 - className="flex-1 items-center justify-center p-4"
431 + className="flex-1 items-center justify-center py-4"
432 + style={{ paddingLeft: 16 + bounds.left, paddingRight: 16 + bounds.right }}
433 >
434 <Pressable
435 className="absolute inset-0 bg-backdrop"
@@ -436,7 +442,7 @@ export function CommandPalette(props: {
442 tintColorClassName="accent-sheet/20"
443 fallbackColor={themeVariables["--color-sheet"]}
444 style={{
439 - width: Math.min(600, width - 32),
445 + width: Math.min(600, width - 32 - bounds.left - bounds.right),
446 height: Math.min(520, height - 80),
447 borderRadius: 20,
448 }}
apps/mobile/src/features/settings/components/SettingsEnvironmentFilterHeader.tsx
-2
@@ -54,7 +54,6 @@ export function SettingsEnvironmentFilterHeader(props: {
54 options={{
55 unstable_headerRightItems: () => [
56 withNativeGlassHeaderItem({
57 - axisBehavior: "horizontalOnly",
57 accessibilityLabel: "Filter settings environments and projects",
58 icon: { name: filterIcon, type: "sfSymbol" },
59 label: "",
@@ -121,7 +120,6 @@ export function SettingsEnvironmentFilterHeader(props: {
120 ...(closeSettings
121 ? [
122 withNativeGlassHeaderItem({
124 - axisBehavior: "horizontalOnly",
123 accessibilityLabel: "Close settings",
124 icon: { name: "xmark", type: "sfSymbol" },
125 identifier: "settings-close",
apps/mobile/src/features/threads/ThreadArrangementSheet.tsx
+178 -176
@@ -9,7 +9,7 @@ import { Animated, FlatList, Modal, Pressable, View } from "react-native";
9 import { Gesture, GestureDetector, GestureHandlerRootView } from "react-native-gesture-handler";
10 import Reanimated, { ReduceMotion, useAnimatedStyle, withTiming } from "react-native-reanimated";
11 import { threadDragGapOffset } from "./threadDragGap";
12 -import { useSafeAreaInsets } from "react-native-safe-area-context";
12 +import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";
13
14 import { AppText as Text } from "../../components/ui/AppText";
15 import { SymbolView } from "../../components/ui/AppSymbol";
@@ -149,7 +149,6 @@ function DragHandle(props: {
149 }
150
151 export function ThreadArrangementSheet(props: { onClose: () => void }) {
152 - const insets = useSafeAreaInsets();
152 const threads = useAtomValue(environmentThreadShells.navigationThreadShellsAtom);
153 const configs = useAtomValue(environmentServerConfigsAtom);
154 const queuedThreadKeys = useAtomValue(queuedThreadKeysAtom);
@@ -373,184 +372,187 @@ export function ThreadArrangementSheet(props: { onClose: () => void }) {
372 onRequestClose={props.onClose}
373 >
374 <GestureHandlerRootView style={{ flex: 1 }}>
376 - <View
377 - className="flex-1 bg-screen"
378 - style={{ paddingTop: insets.top, paddingBottom: insets.bottom }}
379 - >
380 - <SheetHeader
381 - presentation="inline"
382 - title="Arrange threads"
383 - onClose={props.onClose}
384 - accessibilityLabel="Close arrange threads"
385 - />
386 - <Text className="px-5 pb-3 text-sm text-foreground-muted">
387 - Drag to reorder, pin, or settle. Changes save when you drop.
388 - </Text>
389 - <View
390 - onLayout={(event) => {
391 - geometry.current.height = event.nativeEvent.layout.height;
392 - }}
393 - className="flex-1"
394 - style={{ overflow: "hidden" }}
395 - >
396 - <FlatList
397 - ref={list}
398 - data={rows}
399 - keyExtractor={(row) => row.key}
400 - scrollEnabled={visiblePreview === null}
401 - removeClippedSubviews={false}
402 - onScroll={(event) => {
403 - geometry.current.offset = event.nativeEvent.contentOffset.y;
404 - }}
405 - scrollEventThrottle={16}
406 - getItemLayout={(_, index) => ({
407 - length: rows[index]!.height,
408 - offset: rows[index]!.offset,
409 - index,
410 - })}
411 - renderItem={({ item }) => {
412 - const thread = item.thread;
413 - const planner =
414 - item.section === "pinned" || item.section === "active"
415 - ? planners[item.section]
416 - : null;
417 - const capabilities =
418 - thread && configs.get(thread.environmentId)?.environment.capabilities;
419 - const sectionActions = thread
420 - ? (["pinned", "active", "settled"] as const).flatMap<{
421 - name: "pinned" | "active" | "settled";
422 - label: string;
423 - }>((section) => {
424 - if (section === item.section) return [];
425 - const label = threadDragAction(item.section, section);
426 - if (!label) return [];
427 - if (section === "settled")
428 - return capabilities?.threadSettlement ? [{ name: section, label }] : [];
429 - if (
430 - ((section === "pinned" || thread.pinnedAt != null) &&
431 - !capabilities?.threadPinning) ||
432 - (section === "active" &&
433 - item.section === "settled" &&
434 - !capabilities?.threadSettlement) ||
435 - (section === "active" &&
436 - item.section === "snoozed" &&
437 - !capabilities?.threadSnooze)
438 - )
439 - return [];
440 - return planners[section](item.key, {
441 - section,
442 - targetId: null,
443 - placement: "before",
444 - })
445 - ? [{ name: section, label }]
446 - : [];
447 - })
448 - : [];
449 - return (
450 - <ArrangementRow
451 - height={item.height}
452 - dragging={visiblePreview !== null}
453 - lifted={item.key === sourceRow?.key}
454 - offset={
455 - sourceRow && insertionOffset !== undefined
456 - ? threadDragGapOffset(
457 - item.offset,
458 - sourceRow.offset,
459 - sourceRow.height,
460 - insertionOffset,
375 + {/* A Modal is its own native hierarchy, so measure its own safe area, including side
376 + insets for the camera, instead of the presenting screen's. */}
377 + <SafeAreaProvider style={{ flex: 1 }}>
378 + <View className="flex-1 bg-screen">
379 + <SafeAreaView style={{ flex: 1 }}>
380 + <SheetHeader
381 + presentation="inline"
382 + title="Arrange threads"
383 + onClose={props.onClose}
384 + accessibilityLabel="Close arrange threads"
385 + />
386 + <Text className="px-5 pb-3 text-sm text-foreground-muted">
387 + Drag to reorder, pin, or settle. Changes save when you drop.
388 + </Text>
389 + <View
390 + onLayout={(event) => {
391 + geometry.current.height = event.nativeEvent.layout.height;
392 + }}
393 + className="flex-1"
394 + style={{ overflow: "hidden" }}
395 + >
396 + <FlatList
397 + ref={list}
398 + data={rows}
399 + keyExtractor={(row) => row.key}
400 + scrollEnabled={visiblePreview === null}
401 + removeClippedSubviews={false}
402 + onScroll={(event) => {
403 + geometry.current.offset = event.nativeEvent.contentOffset.y;
404 + }}
405 + scrollEventThrottle={16}
406 + getItemLayout={(_, index) => ({
407 + length: rows[index]!.height,
408 + offset: rows[index]!.offset,
409 + index,
410 + })}
411 + renderItem={({ item }) => {
412 + const thread = item.thread;
413 + const planner =
414 + item.section === "pinned" || item.section === "active"
415 + ? planners[item.section]
416 + : null;
417 + const capabilities =
418 + thread && configs.get(thread.environmentId)?.environment.capabilities;
419 + const sectionActions = thread
420 + ? (["pinned", "active", "settled"] as const).flatMap<{
421 + name: "pinned" | "active" | "settled";
422 + label: string;
423 + }>((section) => {
424 + if (section === item.section) return [];
425 + const label = threadDragAction(item.section, section);
426 + if (!label) return [];
427 + if (section === "settled")
428 + return capabilities?.threadSettlement ? [{ name: section, label }] : [];
429 + if (
430 + ((section === "pinned" || thread.pinnedAt != null) &&
431 + !capabilities?.threadPinning) ||
432 + (section === "active" &&
433 + item.section === "settled" &&
434 + !capabilities?.threadSettlement) ||
435 + (section === "active" &&
436 + item.section === "snoozed" &&
437 + !capabilities?.threadSnooze)
438 )
462 - : 0
463 - }
464 - >
465 - {thread ? (
466 - <>
467 - <Text numberOfLines={2} className="flex-1 text-base">
468 - {thread.title}
469 - </Text>
470 - <DragHandle
471 - title={thread.title}
472 - disabled={
473 - dropBusy ||
474 - pendingOrder !== null ||
475 - !(
476 - configs.get(thread.environmentId)?.environment.capabilities
477 - .threadPinReorder ||
478 - configs.get(thread.environmentId)?.environment.capabilities
479 - .threadActiveReorder
480 - )
481 - }
482 - sectionActions={sectionActions}
483 - onSectionMove={(section) => {
484 - void moveThread(thread, {
485 - section,
486 - targetId: null,
487 - placement: "before",
488 - });
489 - }}
490 - canMoveUp={planner?.(item.key, "up") != null}
491 - canMoveDown={planner?.(item.key, "down") != null}
492 - onStep={(direction) => {
493 - void moveThread(thread, direction);
494 - }}
495 - onStart={() => start(item)}
496 - onMove={update}
497 - onEnd={(cancelled) => {
498 - const current = drag.current;
499 - if (cancelled || !current?.destination) {
500 - stop();
501 - return;
502 - }
503 - if (frame.current !== null) cancelAnimationFrame(frame.current);
504 - frame.current = null;
505 - drag.current = null;
506 - void moveThread(current.thread, current.destination).finally(stop);
507 - }}
508 - />
509 - </>
510 - ) : (
511 - <Pressable
512 - disabled={item.section === "pinned" || item.section === "active"}
513 - className="flex-1 justify-center self-stretch"
514 - onPress={() => {
515 - const section = item.section;
516 - if (section === "snoozed" || section === "settled")
517 - setExpanded((value) => ({ ...value, [section]: !value[section] }));
518 - }}
439 + return [];
440 + return planners[section](item.key, {
441 + section,
442 + targetId: null,
443 + placement: "before",
444 + })
445 + ? [{ name: section, label }]
446 + : [];
447 + })
448 + : [];
449 + return (
450 + <ArrangementRow
451 + height={item.height}
452 + dragging={visiblePreview !== null}
453 + lifted={item.key === sourceRow?.key}
454 + offset={
455 + sourceRow && insertionOffset !== undefined
456 + ? threadDragGapOffset(
457 + item.offset,
458 + sourceRow.offset,
459 + sourceRow.height,
460 + insertionOffset,
461 + )
462 + : 0
463 + }
464 >
520 - <Text className="text-sm font-t3-semibold text-foreground-muted">
521 - {item.section[0]!.toUpperCase() + item.section.slice(1)} (
522 - {sections[item.section].length})
523 - </Text>
524 - </Pressable>
525 - )}
526 - </ArrangementRow>
527 - );
528 - }}
529 - />
530 - {visiblePreview ? (
531 - <Animated.View
532 - pointerEvents="none"
533 - className="absolute left-5 right-5 justify-center rounded-xl border border-border bg-screen px-4"
534 - style={{ top: 0, height: ROW_HEIGHT, transform: [{ translateY }] }}
535 - >
536 - <Text
537 - numberOfLines={visiblePreview.destination?.section ? 1 : 2}
538 - className="text-base font-t3-medium"
539 - >
540 - {visiblePreview.thread.title}
541 - </Text>
542 - {visiblePreview.destination?.section ? (
543 - <Text className="text-xs text-foreground-muted">
544 - {threadDragAction(
545 - visiblePreview.sourceSection,
546 - visiblePreview.destination.section,
547 - )}
548 - </Text>
465 + {thread ? (
466 + <>
467 + <Text numberOfLines={2} className="flex-1 text-base">
468 + {thread.title}
469 + </Text>
470 + <DragHandle
471 + title={thread.title}
472 + disabled={
473 + dropBusy ||
474 + pendingOrder !== null ||
475 + !(
476 + configs.get(thread.environmentId)?.environment.capabilities
477 + .threadPinReorder ||
478 + configs.get(thread.environmentId)?.environment.capabilities
479 + .threadActiveReorder
480 + )
481 + }
482 + sectionActions={sectionActions}
483 + onSectionMove={(section) => {
484 + void moveThread(thread, {
485 + section,
486 + targetId: null,
487 + placement: "before",
488 + });
489 + }}
490 + canMoveUp={planner?.(item.key, "up") != null}
491 + canMoveDown={planner?.(item.key, "down") != null}
492 + onStep={(direction) => {
493 + void moveThread(thread, direction);
494 + }}
495 + onStart={() => start(item)}
496 + onMove={update}
497 + onEnd={(cancelled) => {
498 + const current = drag.current;
499 + if (cancelled || !current?.destination) {
500 + stop();
501 + return;
502 + }
503 + if (frame.current !== null) cancelAnimationFrame(frame.current);
504 + frame.current = null;
505 + drag.current = null;
506 + void moveThread(current.thread, current.destination).finally(stop);
507 + }}
508 + />
509 + </>
510 + ) : (
511 + <Pressable
512 + disabled={item.section === "pinned" || item.section === "active"}
513 + className="flex-1 justify-center self-stretch"
514 + onPress={() => {
515 + const section = item.section;
516 + if (section === "snoozed" || section === "settled")
517 + setExpanded((value) => ({ ...value, [section]: !value[section] }));
518 + }}
519 + >
520 + <Text className="text-sm font-t3-semibold text-foreground-muted">
521 + {item.section[0]!.toUpperCase() + item.section.slice(1)} (
522 + {sections[item.section].length})
523 + </Text>
524 + </Pressable>
525 + )}
526 + </ArrangementRow>
527 + );
528 + }}
529 + />
530 + {visiblePreview ? (
531 + <Animated.View
532 + pointerEvents="none"
533 + className="absolute left-5 right-5 justify-center rounded-xl border border-border bg-screen px-4"
534 + style={{ top: 0, height: ROW_HEIGHT, transform: [{ translateY }] }}
535 + >
536 + <Text
537 + numberOfLines={visiblePreview.destination?.section ? 1 : 2}
538 + className="text-base font-t3-medium"
539 + >
540 + {visiblePreview.thread.title}
541 + </Text>
542 + {visiblePreview.destination?.section ? (
543 + <Text className="text-xs text-foreground-muted">
544 + {threadDragAction(
545 + visiblePreview.sourceSection,
546 + visiblePreview.destination.section,
547 + )}
548 + </Text>
549 + ) : null}
550 + </Animated.View>
551 ) : null}
550 - </Animated.View>
551 - ) : null}
552 + </View>
553 + </SafeAreaView>
554 </View>
553 - </View>
555 + </SafeAreaProvider>
556 </GestureHandlerRootView>
557 </Modal>
558 );