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

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

fix(mobile): preserve autocorrect in custom question answers (#30744)

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

shivam committed Nov 5, 2026 at 06:43 UTC cda88429475ba7e21098af10b5ad305009ec65fd
1 file changed +19 -3
apps/mobile/src/features/threads/QuestionAttachments.tsx
+19 -3
@@ -7,7 +7,7 @@ import { useNativePaste } from "../../lib/useNativePaste";
7 import { convertPastedImagesToAttachments } from "../../lib/composerImages";
8 import { PROVIDER_SEND_TURN_MAX_ATTACHMENTS, type UserInputQuestion } from "@t3tools/contracts";
9 import { useAtomValue } from "@effect/atom-react";
10 -import { View } from "react-native";
10 +import { View, type TextInputInstance } from "react-native";
11 import { useEffect, useEffectEvent, useRef, useState } from "react";
12 import { ComposerAttachmentButton } from "./ComposerAttachmentButton";
13 import { ComposerAttachmentStrip } from "../../components/ComposerAttachmentStrip";
@@ -64,6 +64,18 @@ export function QuestionAttachments(props: {
64 });
65 // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- releases keyboard ownership on unmount, since an unmounted native input never emits blur
66 useEffect(() => () => releaseFocus(), []);
67 + // A controlled value makes Fabric rebuild the native text on every keystroke, which discards
68 + // iOS's pending autocorrection. The input owns its text; the only outside write is an option
69 + // selection clearing the draft.
70 + const inputRef = useRef<TextInputInstance>(null);
71 + const [initialText] = useState(props.value);
72 + const nativeText = useRef(props.value);
73 + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- pushes an option selection's cleared draft into the uncontrolled native input
74 + useEffect(() => {
75 + if (props.value !== "" || nativeText.current === "") return;
76 + nativeText.current = "";
77 + inputRef.current?.clear();
78 + }, [props.value]);
79 const append = (
80 key: string,
81 attachments: Parameters<typeof appendComposerDraftAttachments>[1],
@@ -195,11 +207,15 @@ export function QuestionAttachments(props: {
207 <VideoPreviewModal source={previewVideo} onRequestClose={() => setPreviewVideo(null)} />
208 <TextInputWrapper onPaste={paste}>
209 <TextInput
198 - value={props.value}
210 + ref={inputRef}
211 + defaultValue={initialText}
212 multiline={props.question.initialAnswer !== undefined}
213 submitBehavior={props.question.initialAnswer !== undefined ? "newline" : undefined}
214 editable={!props.disabled}
202 - onChangeText={props.onChangeText}
215 + onChangeText={(text) => {
216 + nativeText.current = text;
217 + props.onChangeText(text);
218 + }}
219 onFocus={() => {
220 focusedRef.current = true;
221 onInputFocusChange?.(true);