Skip to content

Commit becc7d0

Browse files
PollyGlotclaude
andcommitted
fix(mobile): keep chat composer above the Android gesture bar
The thread composer zeroed its bottom safe-area padding whenever the editor was focused, assuming the keyboard covers that area. On Android the back gesture closes the keyboard without blurring the editor, so the toolbar row (+, model picker, send) landed under the gesture bar. Key the padding on keyboard visibility instead of focus, matching the convention already used by NewTaskDraftScreen. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 9821bca commit becc7d0

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎apps/mobile/src/features/threads/ThreadDetailScreen.tsx‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ import type {
1717
import * as Haptics from "expo-haptics";
1818
import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
1919
import { Platform, View, type GestureResponderEvent } from "react-native";
20-
import { KeyboardController, KeyboardStickyView } from "react-native-keyboard-controller";
20+
import {
21+
KeyboardController,
22+
KeyboardStickyView,
23+
useKeyboardState,
24+
} from "react-native-keyboard-controller";
2125
import Animated, { FadeInDown, FadeOut } from "react-native-reanimated";
2226
import { useSafeAreaInsets } from "react-native-safe-area-context";
2327

@@ -183,7 +187,11 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
183187
const lastScrolledAnchorMessageIdRef = useRef<MessageId | null>(null);
184188
const [composerExpanded, setComposerExpanded] = useState(false);
185189
const [anchorMessageId, setAnchorMessageId] = useState<MessageId | null>(null);
186-
const composerBottomInset = composerExpanded ? 0 : Math.max(insets.bottom, 12);
190+
// Key the safe-area padding on keyboard visibility, not focus: on Android
191+
// the back gesture closes the keyboard while the editor stays focused, and
192+
// a focus-keyed inset would leave the toolbar under the gesture bar.
193+
const isKeyboardVisible = useKeyboardState((state) => state.isVisible);
194+
const composerBottomInset = isKeyboardVisible ? 0 : Math.max(insets.bottom, 12);
187195
const contentPresentationKind = props.contentPresentation.kind;
188196
// The raw sync status enters "synchronizing" on every full fetch, cached or
189197
// not. Whether messages are already on screen decides the pill label: no

0 commit comments

Comments
 (0)