Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Add testID
Browse files Browse the repository at this point in the history
  • Loading branch information
den1spolyakov committed Feb 9, 2018
1 parent eac9ceb commit 7d55a77
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Button extends Component {
PropTypes.element
]),
accessibilityLabel: PropTypes.string,
testID: PropTypes.string,
activeOpacity: PropTypes.number,
allowFontScaling: PropTypes.bool,
isLoading: PropTypes.bool,
Expand All @@ -46,6 +47,7 @@ class Button extends Component {
if (typeof item === 'string' || typeof item === 'number') {
const element = (
<Text
testID={`${item}-text`}
style={[styles.textButton, this.props.textStyle]}
allowFontScaling={this.props.allowFontScaling}
key={item}>
Expand Down Expand Up @@ -84,14 +86,15 @@ class Button extends Component {
render() {
if (this.props.isDisabled === true || this.props.isLoading === true) {
return (
<View style={[styles.button, this.props.style, (this.props.disabledStyle || styles.opacity)]}>
<View testID={this.props.testID} style={[styles.button, this.props.style, (this.props.disabledStyle || styles.opacity)]}>
{this._renderInnerText()}
</View>
);
}
// Extract Touchable props
let touchableProps = {
accessibilityLabel: this.props.accessibilityLabel,
testID: this.props.testID,
onPress: this.props.onPress,
onPressIn: this.props.onPressIn,
onPressOut: this.props.onPressOut,
Expand Down

0 comments on commit 7d55a77

Please sign in to comment.