@@ -149,7 +149,10 @@ export default class Slider extends Component<SliderProps, SliderState> {
149149 }
150150 getThumbLeft ( value : number ) {
151151 const ratio = ( value - this . props . minValue ! ) / ( this . props . maxValue ! - this . props . minValue ! ) ;
152- return ratio * ( this . state . containerSize . width - this . state . thumbSize . width ) ;
152+ if ( this . props . shownThumb ) {
153+ return ratio * ( this . state . containerSize . width - this . state . thumbSize . width ) ;
154+ }
155+ return ratio * this . state . containerSize . width ;
153156 }
154157 getCurrentValue = ( ) => ( this . state . value as any ) . __getValue ( ) ;
155158 handlePanResponderGrant = ( ) => {
@@ -174,8 +177,11 @@ export default class Slider extends Component<SliderProps, SliderState> {
174177 this . props . onChange ! ( this . getCurrentValue ( ) ) ;
175178 } ;
176179 getValue ( gestureState : PanResponderGestureState ) {
177- const { vertical, minValue, maxValue } = this . props ;
178- const length = this . state . containerSize . width - this . state . thumbSize . width ;
180+ const { vertical, minValue, maxValue, shownThumb } = this . props ;
181+ let length = this . state . containerSize . width - this . state . thumbSize . width ;
182+ if ( ! shownThumb ) {
183+ length = this . state . containerSize . width ;
184+ }
179185 const thumbLeft = this . _previousLeft + ( vertical ? gestureState . dy : gestureState . dx ) ;
180186 const ratio = thumbLeft / length ;
181187 if ( this . props . step ) {
@@ -216,10 +222,12 @@ export default class Slider extends Component<SliderProps, SliderState> {
216222 } = { position : 'absolute' } ;
217223
218224 if ( this . props . vertical ) {
219- minimumTrackStyle . height = Animated . add ( thumbStart , thumbSize . height / 2 ) ;
225+ minimumTrackStyle . height = Animated . add ( thumbStart , 0 ) ;
226+ // minimumTrackStyle.height = Animated.add(thumbStart, thumbSize.height / 2);
220227 minimumTrackStyle . marginLeft = - trackSize . width ;
221228 } else {
222- minimumTrackStyle . width = Animated . add ( thumbStart , thumbSize . width / 2 ) ;
229+ minimumTrackStyle . width = Animated . add ( thumbStart , 0 ) ;
230+ // minimumTrackStyle.width = Animated.add(thumbStart, thumbSize.width / 2);
223231 minimumTrackStyle . marginTop = - trackSize . height ;
224232 }
225233 return minimumTrackStyle ;
@@ -271,9 +279,13 @@ export default class Slider extends Component<SliderProps, SliderState> {
271279 } = this . props ;
272280 const { value, thumbSize, containerSize } = this . state ;
273281 const touchOverflowStyle = { } as ViewStyle ;
282+ let outputRange = containerSize . width ;
283+ if ( shownThumb ) {
284+ outputRange = containerSize . width - thumbSize . width ;
285+ }
274286 const thumbStart = value . interpolate ( {
275287 inputRange : [ minValue ! , maxValue ! ] ,
276- outputRange : [ 0 , containerSize . width - thumbSize . width ] ,
288+ outputRange : [ 0 , outputRange ] ,
277289 // extrapolate: 'clamp',
278290 } ) ;
279291 const minimumTrackStyle = {
@@ -325,6 +337,11 @@ export default class Slider extends Component<SliderProps, SliderState> {
325337 transform : [ ...this . getThumbPositionStyles ( thumbStart ) , ...thumbStyleTransform ] ,
326338 ...valueVisibleStyle ,
327339 } ,
340+ {
341+ width : thumbSize . width ,
342+ height : thumbSize . height ,
343+ borderRadius : thumbSize . width / 2 ,
344+ } ,
328345 ] ) }
329346 />
330347 ) }
0 commit comments