Skip to content

Commit c1080f7

Browse files
chore: addedd initial anim on adjustin thumb position
1 parent 64b13d4 commit c1080f7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/sliders/slider /useSlider.hook.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const useSlider = ({max, min, step, damping}: SliderConfig, value: number
1818
const remainingTrackAnimatedStyle = useAnimatedStyle(() => ({flex: interpolate(thumbTranslationX.value, [0, sliderWidth], [1, 0])}), [sliderWidth]);
1919

2020
useEffect(() => {
21-
adjustThumbsPosition(sliderWidth, true);
21+
adjustThumbPosition(sliderWidth);
2222
}, [value, sliderWidth]);
2323

2424
const calcValueBasedOnThumbTranslationX = (translationX: number) => {
@@ -59,14 +59,14 @@ export const useSlider = ({max, min, step, damping}: SliderConfig, value: number
5959
});
6060

6161
const setUpSliderLayout = (width: number) => {
62-
adjustThumbsPosition(width);
62+
adjustThumbPosition(width);
6363
setSliderWith(width);
6464
};
6565

66-
const adjustThumbsPosition = (width: number, isUpdaing: boolean = false) => {
66+
const adjustThumbPosition = (width: number) => {
6767
const initialTthumbTranslationX = calcTranslationXBasedOnValue({min, max}, normalize(value, step), width);
6868

69-
thumbTranslationX.value = isUpdaing ? withSpring(initialTthumbTranslationX, {damping}) : initialTthumbTranslationX;
69+
thumbTranslationX.value = withSpring(initialTthumbTranslationX, {damping});
7070
thumbTranslationXContext.value = initialTthumbTranslationX;
7171
};
7272

0 commit comments

Comments
 (0)