Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,22 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
const auto &newTextInputProps = static_cast<const TextInputProps &>(*props);

// Traits:
BOOL needsReloadInputViews = NO;

if (newTextInputProps.multiline != oldTextInputProps.multiline) {
[self _setMultiline:newTextInputProps.multiline];
}

if (newTextInputProps.traits.autocapitalizationType != oldTextInputProps.traits.autocapitalizationType) {
_backedTextInputView.autocapitalizationType =
RCTUITextAutocapitalizationTypeFromAutocapitalizationType(newTextInputProps.traits.autocapitalizationType);
needsReloadInputViews = YES;
}

if (newTextInputProps.traits.autoCorrect != oldTextInputProps.traits.autoCorrect) {
_backedTextInputView.autocorrectionType =
RCTUITextAutocorrectionTypeFromOptionalBool(newTextInputProps.traits.autoCorrect);
needsReloadInputViews = YES;
}

if (newTextInputProps.traits.contextMenuHidden != oldTextInputProps.traits.contextMenuHidden) {
Expand Down Expand Up @@ -251,6 +255,14 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
if (newTextInputProps.traits.spellCheck != oldTextInputProps.traits.spellCheck) {
_backedTextInputView.spellCheckingType =
RCTUITextSpellCheckingTypeFromOptionalBool(newTextInputProps.traits.spellCheck);
needsReloadInputViews = YES;
}

// Without the call to reloadInputViews, a change to the capitalization, autocorrection or spell checking of the
// focused field (the first responder) doesn't reach the keyboard until the field loses and regains focus. One
// reload covers all three when they change together.
if (needsReloadInputViews && _backedTextInputView.isFirstResponder) {
[_backedTextInputView reloadInputViews];
}

if (newTextInputProps.traits.caretHidden != oldTextInputProps.traits.caretHidden) {
Expand Down
Loading