Repository navigation
iOS: reload input views when autoCapitalize/autoCorrect/spellCheck change on a focused TextInput (Fabric) - #60319
Conversation
…ange on a focused TextInput On iOS (Fabric), changing autoCapitalize, autoCorrect or spellCheck on a focused TextInput updated the backing view but not the keyboard, which kept its old settings until the input lost and regained focus. Call reloadInputViews when any of them change on the first responder, as is already done for keyboardType and returnKeyType, once per props update when several change together.
|
Hi @rarya618! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Visual regressionNo visual differences at android: no capture |
Summary:
On iOS with the New Architecture, changing
autoCapitalize,autoCorrectorspellCheckon aTextInputthat is focused updates the backingUITextView/UITextField, but the keyboard keeps its old settings until the input loses and regains focus. UIKit only re-reads text input traits for the first responder whenreloadInputViewsis called.RCTTextInputComponentViewalready callsreloadInputViewswhenkeyboardTypeorreturnKeyTypechange on a focused input (#57868). This does the same for autocapitalization, autocorrection and spell checking. When several of them change in one props update, which is common when an app switches an input between modes, the keyboard reloads once, not once for each.A real case: a screenwriting editor switches a line between dialogue (sentence case, autocorrect on) and a character cue (capitals, autocorrect off) while the writer types. Without this change, the keyboard stays in sentence case on the cue until the writer leaves the line.
Changelog:
[IOS] [FIXED] - A focused TextInput's keyboard now follows changes to
autoCapitalize,autoCorrectandspellCheckwithout losing focusTest Plan:
Repro (below): a multiline
TextInputwith buttons outside any ScrollView that toggleautoCapitalizebetweensentencesandcharacters, and toggleautoCorrectandspellCheck. The device needs Settings › General › Keyboard › Auto-Capitalization on, because with it off iOS ignoresautoCapitalizeentirely.autoCapitalize,autoCorrectorspellCheckdoesn't reach the keyboard. It keeps its old settings until you tap out of the input and back in.autoCapitalize(type a word, switch tocharacters, and Shift comes back on),autoCorrect(turned off, "teh" is no longer corrected) andspellCheck(turned off, new misspellings aren't underlined). In an app that switches all three at once on a focused multiline input, the keyboard reloads once and doesn't dismiss.Repro.tsx