Skip to content

Commit d26946f

Browse files
adids1221claude
andauthored
[Incubator.Slider] Fix Android hitSlop on thumb (#3967)
Added .hitSlop() to the RNGH Gesture.Pan() on the thumb so the gesture handler natively recognizes touches in the expanded hit area on Android. Also added hitSlop to the Pan gesture mock in jest setup. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 75a3e4a commit d26946f

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

packages/react-native-ui-lib/jestSetup/jest-setup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ jest.mock('react-native-gesture-handler',
7777
PanMock.onFinalize = getDefaultMockedHandler('onFinalize');
7878
PanMock.activateAfterLongPress = getDefaultMockedHandler('activateAfterLongPress');
7979
PanMock.enabled = getDefaultMockedHandler('enabled');
80+
PanMock.hitSlop = getDefaultMockedHandler('hitSlop');
8081
PanMock.onTouchesMove = getDefaultMockedHandler('onTouchesMove');
8182
PanMock.prepare = jest.fn();
8283
PanMock.initialize = jest.fn();

packages/react-native-ui-lib/src/incubator/slider/Thumb.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ const Thumb = (props: ThumbProps) => {
6262
const lastOffset = useSharedValue(0);
6363

6464
const gesture = Gesture.Pan()
65+
.hitSlop(hitSlop)
6566
.onBegin(() => {
6667
onSeekStart?.();
6768
isPressed.value = true;

0 commit comments

Comments
 (0)