Skip to content

Commit

Permalink
Add buttons accessibilityLabel support (#5844)
Browse files Browse the repository at this point in the history
Co-authored-by: Guy Carmeli <guyca@users.noreply.github.com>
  • Loading branch information
yogevbd and guyca committed Jan 12, 2020
1 parent 0771d27 commit 07c558c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/ios/RNNNavigationButtons.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ -(RNNUIBarButtonItem*)buildButton: (NSDictionary*)dictionary defaultStyle:(RNNBu
return nil;
}

barButtonItem.accessibilityLabel = dictionary[@"accessibilityLabel"];
barButtonItem.target = self.viewController;
barButtonItem.action = @selector(onButtonPress:);

Expand Down
4 changes: 4 additions & 0 deletions lib/src/interfaces/Options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ export interface OptionsTopBarButton {
* Set the button text
*/
text?: string;
/**
* Overrides the text that's read by the screen reader when the user interacts with the element
*/
accessibilityLabel?: string;
/**
* Set the button font family
*/
Expand Down
3 changes: 2 additions & 1 deletion playground/src/screens/ButtonsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class Options extends Component {
id: 'LEFT',
testID: LEFT_BUTTON,
icon: require('../../img/clear.png'),
color: Colors.primary
color: Colors.primary,
accessibilityLabel: 'Close button'
}
]
}
Expand Down

0 comments on commit 07c558c

Please sign in to comment.