Skip to content

Commit 2bd0d9a

Browse files
authored
Added fallback to the accessibleHitSlop (#3549)
1 parent 80b4c9c commit 2bd0d9a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/components/button/index.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,17 @@ class Button extends PureComponent<Props, ButtonState> {
368368
}
369369

370370
render() {
371-
const {onPress, disabled, style, testID, animateLayout, modifiers, forwardedRef, ...others} = this.props;
371+
const {
372+
onPress,
373+
disabled,
374+
style,
375+
testID,
376+
animateLayout,
377+
modifiers,
378+
forwardedRef,
379+
hitSlop: hitSlopProp,
380+
...others
381+
} = this.props;
372382
const shadowStyle = this.getShadowStyle();
373383
const {margins, paddings} = modifiers;
374384
const backgroundColor = this.getBackgroundColor();
@@ -399,7 +409,7 @@ class Button extends PureComponent<Props, ButtonState> {
399409
onPress={onPress}
400410
disabled={disabled}
401411
testID={testID}
402-
hitSlop={this.getAccessibleHitSlop()}
412+
hitSlop={hitSlopProp ?? this.getAccessibleHitSlop()}
403413
{...others}
404414
ref={forwardedRef}
405415
>

0 commit comments

Comments
 (0)