[change] add 'testID' prop to 'Button'

Close #386
This commit is contained in:
Nicolas Gallagher
2017-03-09 18:09:27 -08:00
parent 5af9d537c2
commit e929fb572d
+4 -1
View File
@@ -10,6 +10,7 @@ class Button extends Component {
color: ColorPropType, color: ColorPropType,
disabled: PropTypes.bool, disabled: PropTypes.bool,
onPress: PropTypes.func.isRequired, onPress: PropTypes.func.isRequired,
testID: PropTypes.string,
title: PropTypes.string.isRequired title: PropTypes.string.isRequired
}; };
@@ -19,13 +20,14 @@ class Button extends Component {
color, color,
disabled, disabled,
onPress, onPress,
testID,
title title
} = this.props; } = this.props;
return ( return (
<TouchableOpacity <TouchableOpacity
accessibilityLabel={accessibilityLabel} accessibilityLabel={accessibilityLabel}
accessibilityRole={'button'} accessibilityRole="button"
disabled={disabled} disabled={disabled}
onPress={onPress} onPress={onPress}
style={[ style={[
@@ -33,6 +35,7 @@ class Button extends Component {
color && { backgroundColor: color }, color && { backgroundColor: color },
disabled && styles.buttonDisabled disabled && styles.buttonDisabled
]} ]}
testID={testID}
> >
<Text style={[styles.text, disabled && styles.textDisabled]}> <Text style={[styles.text, disabled && styles.textDisabled]}>
{title} {title}