Skip to content

Commit 8081bb6

Browse files
gawrysiaksatya164
authored andcommitted
refactor: use touchable disabled prop (#372)
1 parent 65e28bb commit 8081bb6

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/components/Button.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,10 @@ class Button extends React.Component<Props, State> {
215215
<TouchableRipple
216216
borderless
217217
delayPressIn={0}
218-
onPress={disabled ? undefined : onPress}
219-
onPressIn={disabled ? undefined : this._handlePressIn}
220-
onPressOut={disabled ? undefined : this._handlePressOut}
218+
onPress={onPress}
219+
onPressIn={this._handlePressIn}
220+
onPressOut={this._handlePressOut}
221+
disabled={disabled}
221222
rippleColor={rippleColor}
222223
style={touchableStyle}
223224
>

src/components/Checkbox.ios.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ class Checkbox extends React.Component<Props> {
6161
{...rest}
6262
borderless
6363
rippleColor={rippleColor}
64-
onPress={disabled ? undefined : onPress}
64+
onPress={onPress}
65+
disabled={disabled}
6566
style={styles.container}
6667
>
6768
<View style={{ opacity: checked ? 1 : 0 }}>

src/components/Checkbox.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ class Checkbox extends React.Component<Props, State> {
141141
{...rest}
142142
borderless
143143
rippleColor={rippleColor}
144-
onPress={disabled ? undefined : onPress}
144+
onPress={onPress}
145+
disabled={disabled}
145146
style={styles.container}
146147
>
147148
<Animated.View style={{ transform: [{ scale: this.state.scaleAnim }] }}>

0 commit comments

Comments
 (0)