Skip to content

Commit

Permalink
refactor: use touchable disabled prop (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
gawrysiak authored and satya164 committed May 26, 2018
1 parent 951572f commit c696883
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,10 @@ class Button extends React.Component<Props, State> {
<TouchableRipple
borderless
delayPressIn={0}
onPress={disabled ? undefined : onPress}
onPressIn={disabled ? undefined : this._handlePressIn}
onPressOut={disabled ? undefined : this._handlePressOut}
onPress={onPress}
onPressIn={this._handlePressIn}
onPressOut={this._handlePressOut}
disabled={disabled}
rippleColor={rippleColor}
style={touchableStyle}
>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Checkbox.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class Checkbox extends React.Component<Props> {
{...rest}
borderless
rippleColor={rippleColor}
onPress={disabled ? undefined : onPress}
onPress={onPress}
disabled={disabled}
style={styles.container}
>
<View style={{ opacity: checked ? 1 : 0 }}>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ class Checkbox extends React.Component<Props, State> {
{...rest}
borderless
rippleColor={rippleColor}
onPress={disabled ? undefined : onPress}
onPress={onPress}
disabled={disabled}
style={styles.container}
>
<Animated.View style={{ transform: [{ scale: this.state.scaleAnim }] }}>
Expand Down

0 comments on commit c696883

Please sign in to comment.