diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.m b/Libraries/Text/TextInput/RCTBaseTextInputView.m index de78c074d86..fac75588340 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.m @@ -289,16 +289,16 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) - (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 @@ -405,7 +405,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) } NSString *previousText = backedTextInputView.attributedText.string ?: @""; - + if (range.location + range.length > backedTextInputView.attributedText.string.length) { _predictedText = backedTextInputView.attributedText.string; } else { @@ -511,6 +511,13 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) 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 63aa487492e..d226782be62 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m @@ -34,7 +34,6 @@ RCT_EXPORT_MODULE() #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)