Skip to content

Commit a838739

Browse files
authored
Fix/ Slider's thumb position (#1334)
* fix thumb position * fix overflow issue
1 parent 152faee commit a838739

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/slider/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ export default class Slider extends PureBaseComponent {
250250
}
251251

252252
if (this.minTrack) {
253-
this._minTrackStyles.width = x;
253+
this._minTrackStyles.width = Math.min(this.state.trackSize.width, x);
254254
this.minTrack.setNativeProps(this._minTrackStyles);
255255
}
256256
}
@@ -306,7 +306,7 @@ export default class Slider extends PureBaseComponent {
306306
const relativeValue = minimumValue - v;
307307
const value = minimumValue < 0 ? Math.abs(relativeValue) : v - minimumValue; // for negatives
308308
const ratio = value / range;
309-
const x = ratio * (this.state.trackSize.width - this.initialThumbSize.width / 2);
309+
const x = ratio * this.state.trackSize.width;
310310
return x;
311311
}
312312

0 commit comments

Comments
 (0)