diff --git a/package/src/RNCSliderNativeComponent.web.tsx b/package/src/RNCSliderNativeComponent.web.tsx index 26bf89fc..04784c1f 100644 --- a/package/src/RNCSliderNativeComponent.web.tsx +++ b/package/src/RNCSliderNativeComponent.web.tsx @@ -267,13 +267,18 @@ const RCTSliderWebComponent = React.forwardRef( }; const getValueFromNativeEvent = (pageX: number) => { - const {width = 1} = containerSize.current; + const adjustForThumbSize = (containerSize.current.width || 1) > thumbSize; + const width = + (containerSize.current.width || 1) - + (adjustForThumbSize ? thumbSize : 0); if (containerPositionInvalidated.current) { containerPositionInvalidated.current = false; updateContainerPositionX(); } - const containerX = containerPositionX.current; + + const containerX = + containerPositionX.current + (adjustForThumbSize ? thumbSize / 2 : 0); const lowerValue = minimumValue < lowerLimit ? lowerLimit : minimumValue; const upperValue = maximumValue > upperLimit ? upperLimit : maximumValue;