feat: add autoCorrect and spellCheck props - #519
Conversation
Adds boolean autoCorrect and spellCheck props to control iOS autocorrection and spell checking. Both default to system behavior when not specified.
exploIF
left a comment
There was a problem hiding this comment.
For the autoCorrect, it would be the best to introduce this prop on Android too, so it's consistent with react native TextInput
|
Any updates on this? |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved platform behavior, runtime-toggle, documentation, and test-coverage findings remain.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds autoCorrect and spellCheck props to the enriched text input API and native implementations.
Changes:
- Adds public and native prop definitions.
- Forwards values and configures iOS input traits.
- Adds Android autocorrection handling.
File summaries
| File | Review summary |
|---|---|
src/types.ts |
Moderate: web silently ignores autoCorrect. Nits: update API documentation and fix malformed JSDoc. |
src/spec/EnrichedTextInputNativeComponent.ts |
Adds native codegen props; no findings. |
src/native/EnrichedTextInput.tsx |
Forwards the new props. Nit: add Maestro coverage for false, default, and runtime-toggle cases. |
ios/EnrichedTextInputView.mm |
Moderate: refresh the active input when toggling autoCorrect or spellCheck. |
android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputViewManager.kt |
Moderate: spellCheck is ignored on Android. |
android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputView.kt |
Updates Android autocorrection flags; no findings. |
Review details
Suppressed comments (4)
android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputViewManager.kt:265
- This handler silently ignores
spellCheck, sospellCheck={false}has no effect on Android even though the compatibility table marks Android as implemented. Please either implement the Android behavior if both platforms are intended, or mark this prop as iOS-only and update the compatibility/documentation to match.
@ReactProp(name = "spellCheck")
override fun setSpellCheck(
view: EnrichedTextInputView?,
spellCheck: Boolean,
) {
// not supported in Android's RN TextInput
ios/EnrichedTextInputView.mm:844
- Changing
spellCheckwhile the editor is focused only assigns the UITextView trait. UIKit may not reconfigure spell checking for the current first responder until the input view is reloaded/refocused, so toggling this prop at runtime can leave the existing underline behavior unchanged. Apply the same active-input refresh used for the other input traits.
if (newViewProps.spellCheck != oldViewProps.spellCheck) {
textView.spellCheckingType = newViewProps.spellCheck
? UITextSpellCheckingTypeYes
: UITextSpellCheckingTypeNo;
}
src/native/EnrichedTextInput.tsx:346
- The new native prop paths have no Maestro coverage for the documented false, omitted/default, or runtime-toggle cases, even though this repository runs a native E2E suite on both iOS and Android (
.maestro/scripts/run-tests-all.sh). Please add focused flows for these cases so regressions in the platform-specific behavior are caught.
autoCorrect={autoCorrect}
spellCheck={spellCheck ?? autoCorrect}
src/types.ts:669
EnrichedTextInputPropsis shared by the web build, butsrc/web/EnrichedTextInput.tsxdoes not readautoCorrect, and this prop has no@platformannotation. A web consumer can therefore pass the newly typed boolean and get no behavior; either wire it to the editor DOM or mark it as native-only (Android/iOS) to avoid advertising a silently ignored API.
/** If false, disables auto-correct. Defaults `true`. */
autoCorrect?: boolean;
- Files reviewed: 6/6 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
szydlovsky
left a comment
There was a problem hiding this comment.
overall looks good, one small comment
|
Thank you @fendent for your work and coming up with this idea! |
|
Of course! Glad to help. Sorry I couldn't follow up on this further past the initial PR. Life 🙃 |
Summary
Adds
autoCorrectandspellCheckboolean props to control iOSUITextAutocorrectionTypeandUITextSpellCheckingType.Currently there's no way to disable autocorrect or spell checking on the input. These props follow the same pattern as the existing
autoCapitalizeprop.When not specified, both default to the system behavior (enabled).
Test Plan
autoCorrect={false}— verify iOS does not suggest autocorrect replacementsspellCheck={false}— verify iOS does not underline misspelled wordsCompatibility
Checklist