Skip to content

Commit 085730f

Browse files
committed
move iOS functionalities to a new PR
facebook#35908
1 parent e19d492 commit 085730f

File tree

12 files changed

+0
-109
lines changed

12 files changed

+0
-109
lines changed

Libraries/Text/TextInput/Multiline/RCTUITextView.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ NS_ASSUME_NONNULL_BEGIN
2626
@property (nonatomic, assign, readonly) BOOL textWasPasted;
2727
@property (nonatomic, copy, nullable) NSString *placeholder;
2828
@property (nonatomic, strong, nullable) UIColor *placeholderColor;
29-
@property (nonatomic, assign, nullable) NSString *accessibilityErrorMessage;
30-
@property (nonatomic, readwrite, nullable) NSString *currentAccessibilityError;
31-
@property (nonatomic, readwrite, nullable) NSString *previousAccessibilityError;
3229

3330
@property (nonatomic, assign) CGFloat preferredMaxLayoutWidth;
3431

Libraries/Text/TextInput/Multiline/RCTUITextView.m

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -121,24 +121,6 @@ - (void)setDefaultTextAttributes:(NSDictionary<NSAttributedStringKey, id> *)defa
121121
[self _updatePlaceholder];
122122
}
123123

124-
- (void)setAccessibilityErrorMessage:(NSString *)accessibilityErrorMessage
125-
{
126-
self.previousAccessibilityError = [self.currentAccessibilityError mutableCopy];
127-
self.currentAccessibilityError = accessibilityErrorMessage;
128-
NSString *text = self.attributedText == nil ? @"" : self.attributedText.string;
129-
NSString *lastChar = [text length] == 0 ? @"" : [text substringFromIndex:[text length] - 1];
130-
if (accessibilityErrorMessage != nil) {
131-
NSString *errorWithLastCharacter = [NSString stringWithFormat: @"%@ %@", lastChar, accessibilityErrorMessage];
132-
NSString *errorWithText = [NSString stringWithFormat: @"%@ %@", text, accessibilityErrorMessage];
133-
self.accessibilityValue = errorWithText;
134-
// onChangeText announce only the last typed/deleted character
135-
// more info at https://bit.ly/3zOHsda
136-
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, errorWithLastCharacter);
137-
} else {
138-
self.accessibilityValue = nil;
139-
}
140-
}
141-
142124
- (NSDictionary<NSAttributedStringKey, id> *)defaultTextAttributes
143125
{
144126
return _defaultTextAttributes;

Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ NS_ASSUME_NONNULL_BEGIN
1515
@protocol RCTBackedTextInputViewProtocol <UITextInput>
1616

1717
@property (nonatomic, copy, nullable) NSAttributedString *attributedText;
18-
@property (nonatomic, assign, nullable) NSString *accessibilityErrorMessage;
19-
@property (nonatomic, readwrite, nullable) NSString *currentAccessibilityError;
20-
@property (nonatomic, readwrite, nullable) NSString *previousAccessibilityError;
2118
@property (nonatomic, copy, nullable) NSString *placeholder;
2219
@property (nonatomic, strong, nullable) UIColor *placeholderColor;
2320
@property (nonatomic, assign, readonly) BOOL textWasPasted;

Libraries/Text/TextInput/RCTBaseTextInputView.m

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,6 @@ - (void)setAttributedText:(NSAttributedString *)attributedText
148148

149149
textNeedsUpdate = ([self textOf:attributedTextCopy equals:backedTextInputViewTextCopy] == NO);
150150

151-
NSString *currentAccessibilityError = self.backedTextInputView.currentAccessibilityError;
152-
NSString *previousAccessibilityError = self.backedTextInputView.previousAccessibilityError;
153-
BOOL accessibilityErrorMessageWasRemoved = currentAccessibilityError == nil && ![currentAccessibilityError isEqualToString: previousAccessibilityError];
154-
if (accessibilityErrorMessageWasRemoved) {
155-
BOOL validString = attributedText && [attributedText.string length] != 0;
156-
NSString *lastChar = validString ? [attributedText.string substringFromIndex:[attributedText.string length] - 1] : @"";
157-
self.backedTextInputView.accessibilityValue = nil;
158-
// Triggering the announcement manually fixes screenreader announcement getting cut off
159-
// https://bit.ly/3w18QmV https://bit.ly/3AdVKW3 https://bit.ly/3QHm7c7 https://bit.ly/3BVnmAy
160-
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, lastChar);
161-
}
162151
if (eventLag == 0 && textNeedsUpdate) {
163152
UITextRange *selection = self.backedTextInputView.selectedTextRange;
164153
NSInteger oldTextLength = self.backedTextInputView.attributedText.string.length;

Libraries/Text/TextInput/RCTBaseTextInputViewManager.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ @implementation RCTBaseTextInputViewManager {
3636
RCT_REMAP_VIEW_PROPERTY(autoCorrect, backedTextInputView.autocorrectionType, UITextAutocorrectionType)
3737
RCT_REMAP_VIEW_PROPERTY(contextMenuHidden, backedTextInputView.contextMenuHidden, BOOL)
3838
RCT_REMAP_VIEW_PROPERTY(editable, backedTextInputView.editable, BOOL)
39-
RCT_REMAP_VIEW_PROPERTY(accessibilityErrorMessage, backedTextInputView.accessibilityErrorMessage, NSString)
4039
RCT_REMAP_VIEW_PROPERTY(enablesReturnKeyAutomatically, backedTextInputView.enablesReturnKeyAutomatically, BOOL)
4140
RCT_REMAP_VIEW_PROPERTY(keyboardAppearance, backedTextInputView.keyboardAppearance, UIKeyboardAppearance)
4241
RCT_REMAP_VIEW_PROPERTY(placeholder, backedTextInputView.placeholder, NSString)

Libraries/Text/TextInput/Singleline/RCTUITextField.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ NS_ASSUME_NONNULL_BEGIN
2727
@property (nonatomic, strong, nullable) UIColor *placeholderColor;
2828
@property (nonatomic, assign) UIEdgeInsets textContainerInset;
2929
@property (nonatomic, assign, getter=isEditable) BOOL editable;
30-
@property (nonatomic, assign, nullable) NSString *accessibilityErrorMessage;
31-
@property (nonatomic, readwrite, nullable) NSString *currentAccessibilityError;
32-
@property (nonatomic, readwrite, nullable) NSString *previousAccessibilityError;
3330
@property (nonatomic, getter=isScrollEnabled) BOOL scrollEnabled;
3431
@property (nonatomic, strong, nullable) NSString *inputAccessoryViewID;
3532
@property (nonatomic, assign, readonly) CGFloat zoomScale;

Libraries/Text/TextInput/Singleline/RCTUITextField.m

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,24 +99,6 @@ - (void)setEditable:(BOOL)editable
9999
self.enabled = editable;
100100
}
101101

102-
- (void)setAccessibilityErrorMessage:(NSString *)accessibilityErrorMessage
103-
{
104-
self.previousAccessibilityError = [self.currentAccessibilityError mutableCopy];
105-
self.currentAccessibilityError = accessibilityErrorMessage;
106-
NSString *text = self.attributedText == nil ? @"" : self.attributedText.string;
107-
NSString *lastChar = [text length] == 0 ? @"" : [text substringFromIndex:[text length] - 1];
108-
if (accessibilityErrorMessage != nil) {
109-
NSString *errorWithLastCharacter = [NSString stringWithFormat: @"%@ %@", lastChar, accessibilityErrorMessage];
110-
NSString *errorWithText = [NSString stringWithFormat: @"%@ %@", text, accessibilityErrorMessage];
111-
self.accessibilityValue = errorWithText;
112-
// onChangeText announce only the last typed/deleted character
113-
// more info at https://bit.ly/3zOHsda
114-
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, errorWithLastCharacter);
115-
} else {
116-
self.accessibilityValue = nil;
117-
}
118-
}
119-
120102
- (void)setSecureTextEntry:(BOOL)secureTextEntry
121103
{
122104
if (self.secureTextEntry == secureTextEntry) {

React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ @implementation RCTTextInputComponentView {
3232
UIView<RCTBackedTextInputViewProtocol> *_backedTextInputView;
3333
NSUInteger _mostRecentEventCount;
3434
NSAttributedString *_lastStringStateWasUpdatedWith;
35-
NSString *currentAccessibilityError;
36-
NSString *previousAccessibilityError;
3735

3836
/*
3937
* UIKit uses either UITextField or UITextView as its UIKit element for <TextInput>. UITextField is for single line
@@ -57,12 +55,6 @@ @implementation RCTTextInputComponentView {
5755
*/
5856
BOOL _comingFromJS;
5957
BOOL _didMoveToWindow;
60-
61-
/*
62-
* A flag that triggers the accessibilityElement.accessibilityValue update and VoiceOver announcement
63-
* to avoid duplicated announcements of accessibilityErrorMessage more info https://bit.ly/3yfUXD8
64-
*/
65-
BOOL _errorMessageRemoved;
6658
}
6759

6860
#pragma mark - UIView overrides
@@ -79,7 +71,6 @@ - (instancetype)initWithFrame:(CGRect)frame
7971
_ignoreNextTextInputCall = NO;
8072
_comingFromJS = NO;
8173
_didMoveToWindow = NO;
82-
_errorMessageRemoved = NO;
8374
[self addSubview:_backedTextInputView];
8475
}
8576

@@ -142,22 +133,6 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &
142133
_backedTextInputView.editable = newTextInputProps.traits.editable;
143134
}
144135

145-
if (newTextInputProps.accessibilityErrorMessage != oldTextInputProps.accessibilityErrorMessage || newTextInputProps.text != oldTextInputProps.text) {
146-
NSString *text = RCTNSStringFromString(newTextInputProps.text);
147-
NSString *error = RCTNSStringFromString(newTextInputProps.accessibilityErrorMessage);
148-
NSString *lastChar = [text length] == 0 ? @"" : [text substringFromIndex:[text length] - 1];
149-
if ([error length] != 0) {
150-
NSString *errorWithLastCharacter = [NSString stringWithFormat: @"%@ %@", lastChar, error];
151-
NSString *errorWithText = [NSString stringWithFormat: @"%@ %@", text, error];
152-
self.accessibilityElement.accessibilityValue = errorWithText;
153-
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, errorWithLastCharacter);
154-
self->_errorMessageRemoved = NO;
155-
} else {
156-
self.accessibilityElement.accessibilityValue = text;
157-
self->_errorMessageRemoved = YES;
158-
}
159-
}
160-
161136
if (newTextInputProps.traits.enablesReturnKeyAutomatically !=
162137
oldTextInputProps.traits.enablesReturnKeyAutomatically) {
163138
_backedTextInputView.enablesReturnKeyAutomatically = newTextInputProps.traits.enablesReturnKeyAutomatically;
@@ -619,13 +594,6 @@ - (void)_setAttributedString:(NSAttributedString *)attributedString
619594
UITextRange *selectedRange = _backedTextInputView.selectedTextRange;
620595
NSInteger oldTextLength = _backedTextInputView.attributedText.string.length;
621596
_backedTextInputView.attributedText = attributedString;
622-
if (self->_errorMessageRemoved) {
623-
_backedTextInputView.accessibilityValue = attributedString.string;
624-
self.accessibilityElement.accessibilityValue = attributedString.string;
625-
NSString *lastChar = [attributedString.string substringFromIndex:[attributedString.string length] - 1];
626-
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, lastChar);
627-
self->_errorMessageRemoved = NO;
628-
}
629597
if (selectedRange.empty) {
630598
// Maintaining a cursor position relative to the end of the old text.
631599
NSInteger offsetStart = [_backedTextInputView offsetFromPosition:_backedTextInputView.beginningOfDocument

React/Views/UIView+React.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@
121121
@property (nonatomic, copy) NSArray<NSDictionary *> *accessibilityActions;
122122
@property (nonatomic, copy) NSDictionary *accessibilityValueInternal;
123123
@property (nonatomic, copy) NSString *accessibilityLanguage;
124-
@property (nonatomic, copy) NSString *accessibilityErrorMessage;
125124

126125
/**
127126
* Used in debugging to get a description of the view hierarchy rooted at

React/Views/UIView+React.m

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -320,17 +320,6 @@ - (NSString *)accessibilityLanguage
320320
return objc_getAssociatedObject(self, _cmd);
321321
}
322322

323-
- (NSString *)accessibilityErrorMessage
324-
{
325-
return objc_getAssociatedObject(self, _cmd);
326-
}
327-
328-
- (void)setAccessibilityErrorMessage:(NSString *)accessibilityErrorMessage
329-
{
330-
objc_setAssociatedObject(
331-
self, @selector(accessibilityErrorMessage), accessibilityErrorMessage, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
332-
}
333-
334323
- (void)setAccessibilityLanguage:(NSString *)accessibilityLanguage
335324
{
336325
objc_setAssociatedObject(

ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,6 @@ TextInputProps::TextInputProps(
8787
"selection",
8888
sourceProps.selection,
8989
std::optional<Selection>())),
90-
accessibilityErrorMessage(convertRawProp(
91-
context,
92-
rawProps,
93-
"accessibilityErrorMessage",
94-
sourceProps.accessibilityErrorMessage,
95-
{})),
9690
inputAccessoryViewID(convertRawProp(
9791
context,
9892
rawProps,

ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ class TextInputProps final : public ViewProps, public BaseTextProps {
6868

6969
std::string const inputAccessoryViewID{};
7070

71-
std::string accessibilityErrorMessage{""};
72-
7371
bool onKeyPressSync{false};
7472
bool onChangeSync{false};
7573

0 commit comments

Comments
 (0)