You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 62834cd
Browse filesBrowse the repository at this point in the historyBrowse files
fix(mobile): keep iOS autocorrect in custom question answers
The custom-answer field was a controlled TextInput, so every keystroke
changed its text prop and Fabric rebuilt the native attributed string.
That reassignment drops the pending autocorrection, so typos stayed as
typed while the native composer, which syncs by revision, corrected
them. Setting autoCorrect and spellCheck did not help and is removed.
The input is now uncontrolled: it starts from the stored draft and
reports changes to it as before. The only outside write while it is
mounted, an option selection clearing the draft, clears the native
input through its ref.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@@ -64,6 +64,18 @@ export function QuestionAttachments(props: {
64
64
});
65
65
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- releases keyboard ownership on unmount, since an unmounted native input never emits blur
66
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
+
constinputRef=useRef<TextInputInstance>(null);
71
+
const[initialText]=useState(props.value);
72
+
constnativeText=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
0 commit comments