Skip to content

Commit

Permalink
update Accessibility Example
Browse files Browse the repository at this point in the history
  • Loading branch information
fabOnReact committed Jun 21, 2022
1 parent 99b39d5 commit 34c5526
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Libraries/Text/TextInput/RCTBaseTextInputView.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ - (void)setAttributedText:(NSAttributedString *)attributedText
NSString *currentScreenreaderError = self.backedTextInputView.currentScreenreaderError;
NSString *previousScreenreaderError = self.backedTextInputView.previousScreenreaderError;
BOOL errorMessageRemoved = currentScreenreaderError == nil && ![currentScreenreaderError isEqualToString: previousScreenreaderError];
if (currentScreenreaderError == nil && errorMessageRemoved) {
if (errorMessageRemoved) {
BOOL validString = attributedText && [attributedText.string length] != 0;
NSString *lastChar = validString ? [attributedText.string substringFromIndex:[attributedText.string length] - 1] : @"";
self.backedTextInputView.accessibilityValue = nil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,24 +736,7 @@ class AccessibilityActionsExample extends React.Component<{}> {
</RNTesterBlock>

<RNTesterBlock title="Text with custom accessibility actions">
<Text
accessible={true}
accessibilityActions={[
{name: 'activate', label: 'activate label'},
{name: 'copy', label: 'copy label'},
]}
onAccessibilityAction={event => {
switch (event.nativeEvent.actionName) {
case 'activate':
Alert.alert('Alert', 'Activate accessiblity action');
break;
case 'copy':
Alert.alert('Alert', 'copy action success');
break;
}
}}>
Text
</Text>
<Text accessible={true}>Text</Text>
</RNTesterBlock>
</View>
);
Expand Down Expand Up @@ -1185,13 +1168,10 @@ function AccessibilityErrorWithButtons(): React.Node {
accessibilityInvalid={accessibilityInvalid}
onChangeText={newText => {
setText(newText);
setError('the newText is: ' + newText);
if (newText === 'Error') {
setError('the newText is: ' + newText);
setAccessibilityInvalid(true);
} else if (newText === 'empty') {
setError(newText);
setAccessibilityInvalid(true);
} else if (newText === 'null') {
} else {
setError('');
setAccessibilityInvalid(false);
}
Expand Down

0 comments on commit 34c5526

Please sign in to comment.