Skip to content

Commit 0a3bbcd

Browse files
Estevão Lucasgrabbou
Estevão Lucas
authored andcommitted
Fix accessibility event properties for TextInput (#24641)
Summary: When a `TextInput` receives any accessibility event prop (`onAccessibilityTap`, `onMagicTap`, `onAccessibilityEscape`, `onAccessibilityEscape`), causes a crash. <p align=center><img src=https://user-images.githubusercontent.com/20709038/56871548-84f00980-69ed-11e9-8906-0206899e5435.jpg width=300></p> [iOS] [Fixed] - Fix accessibility event properties for `TextInput` Pull Request resolved: #24641 Differential Revision: D15120211 Pulled By: cpojer fbshipit-source-id: 7996ab9f9b78588fab4986c3de6114817ec37296
1 parent 39776a8 commit 0a3bbcd

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

Libraries/Text/TextInput/RCTBaseTextInputView.m

+4-11
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,16 @@ - (BOOL)secureTextEntry {
289289

290290
- (void)setSecureTextEntry:(BOOL)secureTextEntry {
291291
UIView<RCTBackedTextInputViewProtocol> *textInputView = self.backedTextInputView;
292-
292+
293293
if (textInputView.secureTextEntry != secureTextEntry) {
294294
textInputView.secureTextEntry = secureTextEntry;
295-
295+
296296
// Fix #5859, see https://stackoverflow.com/questions/14220187/uitextfield-has-trailing-whitespace-after-securetextentry-toggle/22537788#22537788
297297
NSAttributedString *originalText = [textInputView.attributedText copy];
298298
self.backedTextInputView.attributedText = [NSAttributedString new];
299299
self.backedTextInputView.attributedText = originalText;
300300
}
301-
301+
302302
}
303303

304304
#pragma mark - RCTBackedTextInputDelegate
@@ -405,7 +405,7 @@ - (BOOL)textInputShouldChangeTextInRange:(NSRange)range replacementText:(NSStrin
405405
}
406406

407407
NSString *previousText = backedTextInputView.attributedText.string ?: @"";
408-
408+
409409
if (range.location + range.length > backedTextInputView.attributedText.string.length) {
410410
_predictedText = backedTextInputView.attributedText.string;
411411
} else {
@@ -511,13 +511,6 @@ - (CGSize)sizeThatFits:(CGSize)size
511511
return fittingSize;
512512
}
513513

514-
#pragma mark - Accessibility
515-
516-
- (UIView *)reactAccessibilityElement
517-
{
518-
return self.backedTextInputView;
519-
}
520-
521514
#pragma mark - Focus Control
522515

523516
- (void)reactFocus

Libraries/Text/TextInput/RCTBaseTextInputViewManager.m

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ @implementation RCTBaseTextInputViewManager
3434

3535
#pragma mark - Unified <TextInput> properties
3636

37+
RCT_REMAP_VIEW_PROPERTY(accessibilityLabel, reactAccessibilityElement.accessibilityLabel, NSString)
3738
RCT_REMAP_VIEW_PROPERTY(autoCapitalize, backedTextInputView.autocapitalizationType, UITextAutocapitalizationType)
3839
RCT_REMAP_VIEW_PROPERTY(autoCorrect, backedTextInputView.autocorrectionType, UITextAutocorrectionType)
3940
RCT_REMAP_VIEW_PROPERTY(contextMenuHidden, backedTextInputView.contextMenuHidden, BOOL)

0 commit comments

Comments
 (0)