From bb72d9a8360283d0f15772a9bf557e65b540f141 Mon Sep 17 00:00:00 2001 From: adids1221 Date: Sun, 15 Mar 2026 16:33:57 +0200 Subject: [PATCH 1/2] fix: remove touchArea overlay to fix Android thumb hitSlop The touchArea view (absoluteFillObject) sat between the track and thumb in z-order, intercepting touches in the thumb's hitSlop zone on Android. Replaced with onStartShouldSetResponder + onResponderRelease on the container, leveraging the responder system's bubbling pattern where the deepest child (thumb) wins for direct touches. Made-with: Cursor --- .../src/components/slider/index.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/react-native-ui-lib/src/components/slider/index.tsx b/packages/react-native-ui-lib/src/components/slider/index.tsx index da663cf2d9..0460b86c47 100644 --- a/packages/react-native-ui-lib/src/components/slider/index.tsx +++ b/packages/react-native-ui-lib/src/components/slider/index.tsx @@ -498,6 +498,10 @@ class Slider extends PureComponent { this.handleMeasure('thumbSize', nativeEvent); }; + handleContainerShouldSetResponder = () => { + return !this.props.disabled; + }; + handleTrackPress = (event: GestureResponderEvent) => { if (this.props.disabled) { return; @@ -672,10 +676,11 @@ class Slider extends PureComponent { onLayout={this.onContainerLayout} onAccessibilityAction={this.onAccessibilityAction} testID={testID} + onStartShouldSetResponder={this.handleContainerShouldSetResponder} + onResponderRelease={this.handleTrackPress} {...this.getAccessibilityProps()} > {this.renderTrack()} - {this.renderRangeThumb()} {this.renderThumb()} @@ -700,9 +705,5 @@ const styles = StyleSheet.create({ }, trackDisableRTL: { right: 0 - }, - touchArea: { - ...StyleSheet.absoluteFillObject, - backgroundColor: 'transparent' } }); From c237fc564fdb2bc240c4298488b4fea60f1cec45 Mon Sep 17 00:00:00 2001 From: adids1221 Date: Mon, 23 Mar 2026 11:24:36 +0200 Subject: [PATCH 2/2] fix: add hitSlop to Incubator.Slider gesture for Android thumb drag --- packages/react-native-ui-lib/jestSetup/jest-setup.js | 1 + packages/react-native-ui-lib/src/incubator/slider/Thumb.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/react-native-ui-lib/jestSetup/jest-setup.js b/packages/react-native-ui-lib/jestSetup/jest-setup.js index ee9e0f5325..97c32e1614 100644 --- a/packages/react-native-ui-lib/jestSetup/jest-setup.js +++ b/packages/react-native-ui-lib/jestSetup/jest-setup.js @@ -77,6 +77,7 @@ jest.mock('react-native-gesture-handler', PanMock.onFinalize = getDefaultMockedHandler('onFinalize'); PanMock.activateAfterLongPress = getDefaultMockedHandler('activateAfterLongPress'); PanMock.enabled = getDefaultMockedHandler('enabled'); + PanMock.hitSlop = getDefaultMockedHandler('hitSlop'); PanMock.onTouchesMove = getDefaultMockedHandler('onTouchesMove'); PanMock.prepare = jest.fn(); PanMock.initialize = jest.fn(); diff --git a/packages/react-native-ui-lib/src/incubator/slider/Thumb.tsx b/packages/react-native-ui-lib/src/incubator/slider/Thumb.tsx index 9e7aa67526..38d7af1b7e 100644 --- a/packages/react-native-ui-lib/src/incubator/slider/Thumb.tsx +++ b/packages/react-native-ui-lib/src/incubator/slider/Thumb.tsx @@ -62,6 +62,7 @@ const Thumb = (props: ThumbProps) => { const lastOffset = useSharedValue(0); const gesture = Gesture.Pan() + .hitSlop(hitSlop ?? DEFAULT_THUMB_HIT_SLOP) .onBegin(() => { onSeekStart?.(); isPressed.value = true;