Skip to content
This repository has been archived by the owner on Feb 8, 2020. It is now read-only.

Commit

Permalink
fix: specify default values for getAccessibilityX
Browse files Browse the repository at this point in the history
fixes #116
  • Loading branch information
satya164 committed Aug 18, 2019
1 parent fb98e7d commit 3c7918d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ type State = {
class TabNavigationView extends React.PureComponent<Props, State> {
static defaultProps = {
lazy: true,
getAccessibilityRole: () => 'button',
getAccessibilityStates: ({ focused }) => (focused ? ['selected'] : []),
};

static getDerivedStateFromProps(nextProps, prevState) {
Expand Down
13 changes: 4 additions & 9 deletions packages/bottom-tabs/src/views/BottomTabBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,18 +356,13 @@ class TabBarBottom extends React.Component<Props, State> {
route,
});

const accessibilityRole =
this.props.getAccessibilityRole({
route,
}) || 'button';

let accessibilityStates = this.props.getAccessibilityStates({
const accessibilityRole = this.props.getAccessibilityRole({
route,
});

if (!accessibilityStates) {
accessibilityStates = focused ? ['selected'] : [];
}
const accessibilityStates = this.props.getAccessibilityStates(
scene
);

const testID = this.props.getTestID({ route });

Expand Down

0 comments on commit 3c7918d

Please sign in to comment.