Skip to content
This repository was archived by the owner on Nov 12, 2019. It is now read-only.

Commit 63e8795

Browse files
author
Lily Hoskin
committed
Add accessibility traits and accessiblityLabel property to NavButton
1 parent 5752f01 commit 63e8795

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

components/NavButton.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { PropTypes } from 'react';
33
import { Platform, TouchableOpacity, View } from 'react-native';
44
import styles from '../styles';
55

6-
function NavButton({ style, onPress, children, disabled, disabledStyle }: Object): React.Element {
6+
function NavButton({ style, onPress, children, disabled, disabledStyle, accessibilityLabel }: Object): React.Element {
77
let navButtonStyles = []
88
if (Platform.OS === 'ios') {
99
navButtonStyles = [styles.navBarButtonIOS]
@@ -19,15 +19,15 @@ function NavButton({ style, onPress, children, disabled, disabledStyle }: Object
1919
const getTouchable = (): React.Element => {
2020
if (disabled) {
2121
return (
22-
<TouchableOpacity>
22+
<TouchableOpacity accessibilityLabel={accessibilityLabel} accessibilityTraits={["button", "disabled"]}>
2323
<View style={navButtonStyles}>
2424
{children}
2525
</View>
2626
</TouchableOpacity>
2727
)
2828
}
2929
return (
30-
<TouchableOpacity onPress={onPress}>
30+
<TouchableOpacity accessibilityLabel={accessibilityLabel} onPress={onPress} accessibilityTraits="button">
3131
<View style={navButtonStyles}>
3232
{children}
3333
</View>

0 commit comments

Comments
 (0)