Skip to content

Commit 895de4b

Browse files
TechWilklukewalczak
authored andcommitted
fix: hitslop passed to touchable (#4678)
1 parent eb27d4a commit 895de4b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/Button/Button.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ import { splitStyles } from '../../utils/splitStyles';
2828
import ActivityIndicator from '../ActivityIndicator';
2929
import Icon, { IconSource } from '../Icon';
3030
import Surface from '../Surface';
31-
import TouchableRipple from '../TouchableRipple/TouchableRipple';
31+
import TouchableRipple, {
32+
Props as TouchableRippleProps,
33+
} from '../TouchableRipple/TouchableRipple';
3234
import Text from '../Typography/Text';
3335

3436
export type Props = $Omit<React.ComponentProps<typeof Surface>, 'mode'> & {
@@ -134,6 +136,10 @@ export type Props = $Omit<React.ComponentProps<typeof Surface>, 'mode'> & {
134136
* Specifies the largest possible scale a text font can reach.
135137
*/
136138
maxFontSizeMultiplier?: number;
139+
/**
140+
* Sets additional distance outside of element in which a press can be detected.
141+
*/
142+
hitSlop?: TouchableRippleProps['hitSlop'];
137143
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
138144
/**
139145
* Style for the button text.
@@ -185,6 +191,7 @@ const Button = (
185191
accessibilityLabel,
186192
accessibilityHint,
187193
accessibilityRole = 'button',
194+
hitSlop,
188195
onPress,
189196
onPressIn,
190197
onPressOut,
@@ -358,6 +365,7 @@ const Button = (
358365
accessibilityRole={accessibilityRole}
359366
accessibilityState={{ disabled }}
360367
accessible={accessible}
368+
hitSlop={hitSlop}
361369
disabled={disabled}
362370
rippleColor={rippleColor}
363371
style={getButtonTouchableRippleStyle(touchableStyle, borderWidth)}

0 commit comments

Comments
 (0)