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

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

fix(mobile): the question card uses the whole screen while the keyboard is closed (#24363)

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

shivam committed Oct 24, 2026 at 17:40 UTC d0e621e9f9db38816211c3fbb423a68af7e7e427
3 files changed +36 -45
apps/mobile/src/features/threads/PendingUserInputCard.tsx
+13 -26
@@ -8,10 +8,9 @@ import Animated, {
8 Easing,
9 FadeInUp,
10 FadeOutDown,
11 - LinearTransition,
11 useAnimatedStyle,
12 useSharedValue,
14 - withTiming,
13 + type DerivedValue,
14 type SharedValue,
15 } from "react-native-reanimated";
16
@@ -33,7 +32,7 @@ import {
32 export interface PendingUserInputCardProps {
33 readonly canOperateThread: boolean;
34 readonly pendingUserInput: PendingUserInput;
36 - readonly maxHeight: number;
35 + readonly maxHeight: DerivedValue<number>;
36 readonly collapsed: boolean;
37 readonly onToggleCollapsed: () => void;
38 readonly onStopThread?: () => void;
@@ -64,8 +63,6 @@ export interface PendingUserInputCardProps {
63 */
64 const EXPANDED_CARD_IS_OVERLAY = Platform.OS === "ios";
65
67 -const CARD_LAYOUT_TRANSITION = LinearTransition.duration(200);
68 -
66 function QuestionText(props: { readonly markdown: string }) {
67 const styles = useMarkdownPreviewStyles();
68 const openLink = useOpenPullRequest();
@@ -92,18 +89,9 @@ export function PendingUserInputCard(props: PendingUserInputCardProps) {
89 if (!cardCoverage) {
90 return;
91 }
95 - const coverage = Math.max(0, cardHeightRef.current - barHeightRef.current);
96 - if (coverage === cardCoverage.value) {
97 - return;
98 - }
99 - if (cardCoverage.value === 0) {
100 - cardCoverage.value = coverage;
101 - return;
102 - }
103 - cardCoverage.value = withTiming(coverage, {
104 - duration: USER_INPUT_TOGGLE_DURATION_MS,
105 - easing: Easing.out(Easing.cubic),
106 - });
92 + // The card resizes with the keyboard every frame, so easing each sample would leave the
93 + // feed inset and floating controls trailing it.
94 + cardCoverage.value = Math.max(0, cardHeightRef.current - barHeightRef.current);
95 }, [cardCoverage]);
96 const handleBarLayout = useCallback(
97 (event: LayoutChangeEvent) => {
@@ -121,12 +109,16 @@ export function PendingUserInputCard(props: PendingUserInputCardProps) {
109 [cardHeight, notifyCoverage],
110 );
111 const cardProgress = props.cardProgress;
112 + const maxHeight = props.maxHeight;
113 const cardAnimatedStyle = useAnimatedStyle(() => {
114 const progress = cardProgress === undefined ? 1 : cardProgress.value;
115 return {
116 + maxHeight: maxHeight.value,
117 transform: [{ translateY: (1 - progress) * cardHeight.value }],
118 };
119 });
120 + const cardMaxHeightStyle = useAnimatedStyle(() => ({ maxHeight: maxHeight.value }));
121 + const overlayHeightStyle = useAnimatedStyle(() => ({ height: maxHeight.value }));
122
123 // On iOS the card stays MOUNTED while collapsed (hidden via the animated
124 // style): expanding animates existing views on the UI thread the same
@@ -192,13 +184,8 @@ export function PendingUserInputCard(props: PendingUserInputCardProps) {
184 ? undefined
185 : FadeOutDown.duration(USER_INPUT_TOGGLE_DURATION_MS).easing(Easing.out(Easing.cubic))
186 }
195 - layout={CARD_LAYOUT_TRANSITION}
187 className="overflow-hidden gap-2.5 rounded-[20px] border border-border bg-card-alt p-4"
197 - style={
198 - EXPANDED_CARD_IS_OVERLAY
199 - ? [{ maxHeight: props.maxHeight }, cardAnimatedStyle]
200 - : { maxHeight: props.maxHeight }
201 - }
188 + style={EXPANDED_CARD_IS_OVERLAY ? cardAnimatedStyle : cardMaxHeightStyle}
189 >
190 <Pressable
191 accessibilityRole="button"
@@ -330,13 +317,13 @@ export function PendingUserInputCard(props: PendingUserInputCardProps) {
317 <View className="relative">
318 {bar}
319 {EXPANDED_CARD_IS_OVERLAY ? (
333 - <View
320 + <Animated.View
321 pointerEvents={props.collapsed ? "none" : "box-none"}
322 className="absolute inset-x-0 bottom-0 justify-end overflow-hidden"
336 - style={{ height: props.maxHeight }}
323 + style={overlayHeightStyle}
324 >
325 {card}
339 - </View>
326 + </Animated.View>
327 ) : (
328 card
329 )}
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+22 -19
@@ -99,6 +99,7 @@ import {
99 KeyboardController,
100 KeyboardStickyView,
101 useKeyboardState,
102 + useReanimatedKeyboardAnimation,
103 } from "react-native-keyboard-controller";
104 import Animated, {
105 Easing,
@@ -956,10 +957,8 @@ export const ThreadDetailScreen = function ThreadDetailScreen(props: ThreadDetai
957 );
958 const userInputCollapsed =
959 activeUserInputRequestId !== null && collapsedUserInputRequestId === activeUserInputRequestId;
959 - // The card's height RESERVES keyboard space at all times instead of tracking the keyboard:
960 - // transforms (the sticky translation) apply same-frame on the UI thread while layout props lag
961 - // a Yoga pass behind, so any height that follows the keyboard flashes the card over the nav
962 - // header on the way up.
960 + // A height React sets from keyboard state lags the sticky translation by a Yoga pass and
961 + // flashes over the nav header on the way up, so the usage panel reserves the keyboard instead.
962 const [lastKnownKeyboardHeight, setLastKnownKeyboardHeight] = useState(0);
963 useEffect(() => {
964 if (liveKeyboardHeight > 0 && liveKeyboardHeight !== lastKnownKeyboardHeight) {
@@ -968,12 +967,11 @@ export const ThreadDetailScreen = function ThreadDetailScreen(props: ThreadDetai
967 }, [lastKnownKeyboardHeight, liveKeyboardHeight]);
968 const reservedKeyboardHeight =
969 lastKnownKeyboardHeight > 0 ? lastKnownKeyboardHeight : ESTIMATED_KEYBOARD_HEIGHT;
971 - const pendingUserInputMaxHeight = derivePendingUserInputMaxHeight({
972 - windowHeight,
973 - keyboardHeight: reservedKeyboardHeight,
974 - navigationHeaderHeight,
975 - composerOverlapHeight: composerBottomInset,
976 - });
970 + // Waiting for a visibility render misses the first keyboard frames.
971 + const keyboardStickyEnabled =
972 + Platform.OS === "ios"
973 + ? deviceType !== "duo-unfolded" || (composerOwnsKeyboard && !sidebarSearchActive)
974 + : !keyboardStateSuspect;
975 const estimatedOverlayHeight = composerOverlapHeight;
976 // The overlay's measured height includes the home-indicator inset (the
977 // composer pads it), but contentInsetAdjustmentBehavior="automatic" makes
@@ -1000,6 +998,18 @@ export const ThreadDetailScreen = function ThreadDetailScreen(props: ThreadDetai
998 setScreenHeight(event.nativeEvent.layout.height);
999 }, []);
1000 const screenAreaHeight = screenHeight ?? windowHeight;
1001 + // The question card reads the keyboard frame on the UI thread, in the same frame the sticky
1002 + // view translates, so it gets the full height while the keyboard is closed and never crosses
1003 + // the header while the keyboard moves.
1004 + const { height: keyboardTranslation } = useReanimatedKeyboardAnimation();
1005 + const pendingUserInputMaxHeight = useDerivedValue(() =>
1006 + derivePendingUserInputMaxHeight({
1007 + windowHeight: screenAreaHeight,
1008 + keyboardHeight: keyboardStickyEnabled ? -keyboardTranslation.value : 0,
1009 + navigationHeaderHeight,
1010 + composerOverlapHeight: composerBottomInset,
1011 + }),
1012 + );
1013 // The usage panel stacks with the composer and any approval card, so it gets
1014 // whatever room they leave below the header. Measured only while it is open
1015 // so typing in the composer does not re-render the screen.
@@ -1024,9 +1034,7 @@ export const ThreadDetailScreen = function ThreadDetailScreen(props: ThreadDetai
1034 usageLimitsLayout.overlay > 0
1035 ? usageLimitsLayout.overlay - usageLimitsLayout.panel
1036 : composerOverlapHeight;
1027 - // The keyboard is reserved even while closed, like the question card, so the
1028 - // panel never grows over the header while the keyboard animates. The floor
1029 - // keeps the close row on screen when the stack below leaves no room at all.
1037 + // The floor keeps the close row on screen when the stack below leaves no room at all.
1038 const usageLimitsMaxHeight = Math.max(
1039 USAGE_LIMITS_PANEL_MIN_HEIGHT,
1040 Math.min(
@@ -1536,12 +1544,7 @@ export const ThreadDetailScreen = function ThreadDetailScreen(props: ThreadDetai
1544
1545 {showContent ? (
1546 <KeyboardStickyView
1539 - // Waiting for a visibility render misses the first keyboard frames.
1540 - enabled={
1541 - Platform.OS === "ios"
1542 - ? deviceType !== "duo-unfolded" || (composerOwnsKeyboard && !sidebarSearchActive)
1543 - : !keyboardStateSuspect
1544 - }
1547 + enabled={keyboardStickyEnabled}
1548 pointerEvents="box-none"
1549 style={{ position: "absolute", bottom: 0, left: 0, right: 0, top: 0 }}
1550 offset={{ closed: 0, opened: composerKeyboardOffset }}
apps/mobile/src/features/threads/pendingUserInputLayout.ts
+1
@@ -16,6 +16,7 @@ export function derivePendingUserInputMaxHeight(input: {
16 readonly navigationHeaderHeight: number;
17 readonly composerOverlapHeight: number;
18 }): number {
19 + "worklet";
20 const availableHeight =
21 input.windowHeight -
22 Math.max(0, input.keyboardHeight) -