The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): align iPad composer without shifting on keyboard focus (#23355)
Julius Marminge committed
Oct 21, 2026 at 20:57 UTC
e07595714a467e18c750107137d2c2e50f0c3530
1 file changed
+10
-12
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+10
-12
@@ -530,22 +530,22 @@ export const ThreadDetailScreen = function ThreadDetailScreen(props: ThreadDetai
530
const selectedThreadKeyRef = useRef(selectedThreadKey);
531
const lastScrolledSubmittedMessageIdRef = useRef<MessageId | null>(null);
532
const [composerExpanded, setComposerExpanded] = useState(false);
533
- const [composerFocused, setComposerFocused] = useState(false);
534
- const handleComposerFocusChange = (focused: boolean) => {
535
- setComposerFocused(focused);
536
- handleOwnedInputFocusChange(focused);
537
- };
533
const [anchorMessageId, setAnchorMessageId] = useState<MessageId | null>(null);
534
const [submittedMessageId, setSubmittedMessageId] = useState<MessageId | null>(null);
535
const [endFollowEnabled, setEndFollowEnabled] = useState(true);
536
// Android Back hides the keyboard without blurring. Keep its safe-area padding
537
// fixed through the animation and cancel it with matching composer/list offsets.
538
const bottomBarInset = useDuoBottomBarInset();
539
+ // The pill already adds its own gutter; iPad and Duo align its edge with the native bar.
540
+ const alignedBottomInset =
541
+ bottomBarInset ??
542
+ (Platform.OS === "ios" && Platform.isPad ? Math.max(insets.bottom, 12) : undefined);
543
+ // A hardware keyboard can focus the editor without occupying any screen height.
544
const composerBottomInset =
545
- Platform.OS === "ios" && (composerExpanded || composerFocused)
545
+ Platform.OS === "ios" && (composerExpanded || liveKeyboardHeight > 0)
546
? 0
547
- : bottomBarInset !== undefined
548
- ? bottomBarInset - THREAD_COMPOSER_BOTTOM_GUTTER
547
+ : alignedBottomInset !== undefined
548
+ ? Math.max(0, alignedBottomInset - THREAD_COMPOSER_BOTTOM_GUTTER)
549
: Math.max(insets.bottom, 12);
550
const composerKeyboardOffset = Platform.OS === "android" ? composerBottomInset : 0;
551
const contentPresentationKind = props.contentPresentation.kind;
@@ -1088,9 +1088,7 @@ export const ThreadDetailScreen = function ThreadDetailScreen(props: ThreadDetai
1088
1089
useLayoutEffect(() => {
1090
selectedThreadKeyRef.current = selectedThreadKey;
1091
- // A replaced or unmounted native editor may not emit a blur event.
1092
- setComposerFocused(false);
1093
- }, [selectedThreadKey, showContent]);
1091
+ }, [selectedThreadKey]);
1092
1093
useEffect(() => {
1094
setAnchorMessageId(null);
@@ -1665,7 +1663,7 @@ export const ThreadDetailScreen = function ThreadDetailScreen(props: ThreadDetai
1663
onUpdateRuntimeMode={props.onUpdateThreadRuntimeMode}
1664
onUpdateInteractionMode={props.onUpdateThreadInteractionMode}
1665
onExpandedChange={setComposerExpanded}
1668
- onEditorFocusChange={handleComposerFocusChange}
1666
+ onEditorFocusChange={handleOwnedInputFocusChange}
1667
/>
1668
</>
1669
)}