diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.m b/Libraries/Text/TextInput/RCTBaseTextInputView.m index 58b987aac83932..a6a15b37c39923 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.m @@ -283,16 +283,16 @@ - (BOOL)secureTextEntry { - (void)setSecureTextEntry:(BOOL)secureTextEntry { UIView *textInputView = self.backedTextInputView; - + if (textInputView.secureTextEntry != secureTextEntry) { textInputView.secureTextEntry = secureTextEntry; - + // Fix #5859, see https://stackoverflow.com/questions/14220187/uitextfield-has-trailing-whitespace-after-securetextentry-toggle/22537788#22537788 NSAttributedString *originalText = [textInputView.attributedText copy]; self.backedTextInputView.attributedText = [NSAttributedString new]; self.backedTextInputView.attributedText = originalText; } - + } #pragma mark - RCTBackedTextInputDelegate @@ -399,7 +399,7 @@ - (BOOL)textInputShouldChangeTextInRange:(NSRange)range replacementText:(NSStrin } NSString *previousText = backedTextInputView.attributedText.string ?: @""; - + if (range.location + range.length > backedTextInputView.attributedText.string.length) { _predictedText = backedTextInputView.attributedText.string; } else { @@ -505,13 +505,6 @@ - (CGSize)sizeThatFits:(CGSize)size return fittingSize; } -#pragma mark - Accessibility - -- (UIView *)reactAccessibilityElement -{ - return self.backedTextInputView; -} - #pragma mark - Focus Control - (void)reactFocus diff --git a/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m b/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m index d226782be62faa..63aa487492ed13 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m @@ -34,6 +34,7 @@ @implementation RCTBaseTextInputViewManager #pragma mark - Unified properties +RCT_REMAP_VIEW_PROPERTY(accessibilityLabel, reactAccessibilityElement.accessibilityLabel, NSString) RCT_REMAP_VIEW_PROPERTY(autoCapitalize, backedTextInputView.autocapitalizationType, UITextAutocapitalizationType) RCT_REMAP_VIEW_PROPERTY(autoCorrect, backedTextInputView.autocorrectionType, UITextAutocorrectionType) RCT_REMAP_VIEW_PROPERTY(contextMenuHidden, backedTextInputView.contextMenuHidden, BOOL)