Skip to content

Commit

Permalink
remove snapToValue bool
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierdonnellon committed Aug 1, 2023
1 parent b32eb8a commit 3998df7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/components/RangeSlider/RangeSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ export const RangeSlider = ({
);
}

const snapToValue = dragHandleAttachment === 'value';

const { prefersReducedMotion } = useAccessibilityPreferences();
const isInitializing = useRef(true);

Expand Down Expand Up @@ -430,13 +428,13 @@ export const RangeSlider = ({

// For snap to value, listen to changes in value and always animate to value
useEffect(() => {
if (snapToValue) {
if (dragHandleAttachment === 'value') {
springRef.start({
dragHandleX: pixelPositions[0],
immediate: prefersReducedMotion,
});
}
}, [snapToValue, springRef, pixelPositions, prefersReducedMotion, sliderBounds]);
}, [dragHandleAttachment, springRef, pixelPositions, prefersReducedMotion, sliderBounds]);

// Dispose of debounce timers
useEffect(() => {
Expand Down

0 comments on commit 3998df7

Please sign in to comment.