Skip to content

Commit 516c820

Browse files
authored
Fix bug with double thumb background color (#414)
1 parent 5e16c6c commit 516c820

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/index.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,7 @@ export class Slider extends PureComponent<SliderProps, SliderState> {
701701
const minTrackWidth = _startFromZero
702702
? Math.abs(_value) * sliderWidthCoefficient - thumbSize.width / 2
703703
: interpolatedTrackValues[0];
704+
const maxTrackWidth = interpolatedTrackValues[1];
704705
const clearBorderRadius = {} as ViewStyle;
705706
if (_startFromZero && _value < 0 + step) {
706707
clearBorderRadius.borderBottomRightRadius = 0;
@@ -716,14 +717,11 @@ export class Slider extends PureComponent<SliderProps, SliderState> {
716717
left:
717718
interpolatedTrackValues.length === 1
718719
? new Animated.Value(startPositionOnTrack)
719-
: Animated.add(minThumbValue, thumbSize.width / 2),
720+
: Animated.add(minTrackWidth, thumbSize.width / 2),
720721
width:
721722
interpolatedTrackValues.length === 1
722723
? Animated.add(minTrackWidth, thumbSize.width / 2)
723-
: Animated.add(
724-
Animated.multiply(minThumbValue, -1),
725-
maxThumbValue,
726-
),
724+
: Animated.add(Animated.multiply(minTrackWidth, -1), maxTrackWidth),
727725
backgroundColor: minimumTrackTintColor,
728726
...valueVisibleStyle,
729727
...clearBorderRadius,

0 commit comments

Comments
 (0)