From 8382ca19a6a10b7dcaf58b8cc781350fbdcd1aa1 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Wed, 8 May 2019 17:42:38 +0200 Subject: [PATCH] Revert "Fix accessibility event properties for TextInput (#24641)" This reverts commit 0a3bbcd1b2c6c66ebec5c5400de107ed34908b92. --- Libraries/Text/TextInput/RCTBaseTextInputView.m | 15 +++++++++++---- .../Text/TextInput/RCTBaseTextInputViewManager.m | 1 - 2 files changed, 11 insertions(+), 5 deletions(-) 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)