@@ -16,18 +16,18 @@ import PropTypes from 'prop-types';
1616// Layout constants
1717const HORIZONTAL_PADDING = 15 ;
1818const TOUCH_HITSLOP = { top : 20 , bottom : 20 , left : 20 , right : 20 } ;
19- const MIN_MARKER_SPACING = 16 ;
19+ const MIN_THUMB_SPACING = 16 ;
2020
2121// Default values constants
2222const DEFAULT_VALUES = {
2323 SLIDER_WIDTH : 270 ,
24- MARKER_SIZE : 32 ,
24+ THUMB_SIZE : 32 ,
2525 TRACK_HEIGHT : 2.5 ,
2626 STEP : 1 ,
27- LEFT_MARKER_LABEL : 'Left handle' ,
28- RIGHT_MARKER_LABEL : 'Right handle' ,
29- MINIMUM_DISTANCE : MIN_MARKER_SPACING ,
30- SHOW_MARKER_LINES : true ,
27+ LEFT_THUMB_LABEL : 'Left handle' ,
28+ RIGHT_THUMB_LABEL : 'Right handle' ,
29+ MINIMUM_DISTANCE : MIN_THUMB_SPACING ,
30+ SHOW_THUMB_LINES : true ,
3131} ;
3232
3333const createDynamicStyles = ( props ) => ( {
@@ -45,10 +45,10 @@ const createDynamicStyles = (props) => ({
4545 position : 'absolute' ,
4646 height : props . trackHeight ,
4747 } ,
48- marker : {
49- height : props . markerSize ,
50- width : props . markerSize ,
51- borderRadius : props . markerSize / 2 ,
48+ thumb : {
49+ height : props . thumbSize ,
50+ width : props . thumbSize ,
51+ borderRadius : props . thumbSize / 2 ,
5252 backgroundColor : 'white' , // Move default color here
5353 position : 'absolute' ,
5454 shadowColor : '#000' ,
@@ -58,7 +58,7 @@ const createDynamicStyles = (props) => ({
5858 elevation : 5 ,
5959 left : 0 ,
6060 top : '50%' ,
61- marginTop : - ( props . markerSize / 2 ) ,
61+ marginTop : - ( props . thumbSize / 2 ) ,
6262 borderWidth : 0.5 ,
6363 borderColor : '#CECECE' ,
6464 justifyContent : 'center' ,
@@ -80,13 +80,13 @@ const RangeSlider = forwardRef(
8080 // Style props
8181 selectedTrackStyle,
8282 unselectedTrackStyle,
83- markerStyle ,
84- pressedMarkerStyle ,
83+ thumbStyle ,
84+ pressedThumbStyle ,
8585 containerStyle,
8686
8787 // Customization props
8888 sliderWidth = DEFAULT_VALUES . SLIDER_WIDTH ,
89- markerSize = DEFAULT_VALUES . MARKER_SIZE ,
89+ thumbSize = DEFAULT_VALUES . THUMB_SIZE ,
9090 trackHeight = DEFAULT_VALUES . TRACK_HEIGHT ,
9191 minimumDistance = DEFAULT_VALUES . MINIMUM_DISTANCE ,
9292
@@ -100,11 +100,11 @@ const RangeSlider = forwardRef(
100100 onValuesChangeStart = ( ) => { } ,
101101
102102 // Accessibility props
103- leftMarkerAccessibilityLabel = DEFAULT_VALUES . LEFT_MARKER_LABEL ,
104- rightMarkerAccessibilityLabel = DEFAULT_VALUES . RIGHT_MARKER_LABEL ,
103+ leftThumbAccessibilityLabel = DEFAULT_VALUES . LEFT_THUMB_LABEL ,
104+ rightThumbAccessibilityLabel = DEFAULT_VALUES . RIGHT_THUMB_LABEL ,
105105
106- // Marker lines prop
107- showMarkerLines = DEFAULT_VALUES . SHOW_MARKER_LINES ,
106+ // Visual props
107+ showThumbLines = DEFAULT_VALUES . SHOW_THUMB_LINES ,
108108 } ,
109109 ref
110110 ) => {
@@ -152,11 +152,11 @@ const RangeSlider = forwardRef(
152152 } ;
153153 } ) ;
154154
155- const leftMarkerStyle = useAnimatedStyle ( ( ) => ( {
155+ const leftThumbStyle = useAnimatedStyle ( ( ) => ( {
156156 transform : leftTransform . value ,
157157 } ) ) ;
158158
159- const rightMarkerStyle = useAnimatedStyle ( ( ) => ( {
159+ const rightThumbStyle = useAnimatedStyle ( ( ) => ( {
160160 transform : rightTransform . value ,
161161 } ) ) ;
162162
@@ -284,7 +284,7 @@ const RangeSlider = forwardRef(
284284
285285 const dynamicStyles = createDynamicStyles ( {
286286 sliderWidth,
287- markerSize ,
287+ thumbSize ,
288288 trackHeight,
289289 enabled,
290290 } ) ;
@@ -321,17 +321,17 @@ const RangeSlider = forwardRef(
321321 >
322322 < Animated . View
323323 accessible = { true }
324- accessibilityLabel = { leftMarkerAccessibilityLabel }
324+ accessibilityLabel = { leftThumbAccessibilityLabel }
325325 accessibilityRole = "adjustable"
326326 style = { [
327- dynamicStyles . marker ,
327+ dynamicStyles . thumb ,
328328 styles . markerContainer ,
329- markerStyle ,
330- pressed . left && pressedMarkerStyle ,
331- leftMarkerStyle ,
329+ thumbStyle ,
330+ pressed . left && pressedThumbStyle ,
331+ leftThumbStyle ,
332332 ] }
333333 >
334- { showMarkerLines && (
334+ { showThumbLines && (
335335 < >
336336 < View style = { staticStyles . markerLine } />
337337 < View style = { staticStyles . markerLine } />
@@ -349,17 +349,17 @@ const RangeSlider = forwardRef(
349349 >
350350 < Animated . View
351351 accessible = { true }
352- accessibilityLabel = { rightMarkerAccessibilityLabel }
352+ accessibilityLabel = { rightThumbAccessibilityLabel }
353353 accessibilityRole = "adjustable"
354354 style = { [
355- dynamicStyles . marker ,
355+ dynamicStyles . thumb ,
356356 styles . markerContainer ,
357- markerStyle ,
358- pressed . right && pressedMarkerStyle ,
359- rightMarkerStyle ,
357+ thumbStyle ,
358+ pressed . right && pressedThumbStyle ,
359+ rightThumbStyle ,
360360 ] }
361361 >
362- { showMarkerLines && (
362+ { showThumbLines && (
363363 < >
364364 < View style = { staticStyles . markerLine } />
365365 < View style = { staticStyles . markerLine } />
@@ -411,13 +411,13 @@ RangeSlider.propTypes = {
411411 // Style props
412412 selectedTrackStyle : PropTypes . object ,
413413 unselectedTrackStyle : PropTypes . object ,
414- markerStyle : PropTypes . object ,
415- pressedMarkerStyle : PropTypes . object ,
414+ thumbStyle : PropTypes . object ,
415+ pressedThumbStyle : PropTypes . object ,
416416 containerStyle : PropTypes . object ,
417417
418418 // Customization props
419419 sliderWidth : PropTypes . number ,
420- markerSize : PropTypes . number ,
420+ thumbSize : PropTypes . number ,
421421 trackHeight : PropTypes . number ,
422422 minimumDistance : PropTypes . number ,
423423
@@ -431,26 +431,26 @@ RangeSlider.propTypes = {
431431 onValuesChangeStart : PropTypes . func ,
432432
433433 // Accessibility props
434- leftMarkerAccessibilityLabel : PropTypes . string ,
435- rightMarkerAccessibilityLabel : PropTypes . string ,
434+ leftThumbAccessibilityLabel : PropTypes . string ,
435+ rightThumbAccessibilityLabel : PropTypes . string ,
436436
437- // Marker lines prop
438- showMarkerLines : PropTypes . bool ,
437+ // Visual props
438+ showThumbLines : PropTypes . bool ,
439439} ;
440440
441441RangeSlider . defaultProps = {
442442 step : DEFAULT_VALUES . STEP ,
443443 sliderWidth : DEFAULT_VALUES . SLIDER_WIDTH ,
444- markerSize : DEFAULT_VALUES . MARKER_SIZE ,
444+ thumbSize : DEFAULT_VALUES . THUMB_SIZE ,
445445 trackHeight : DEFAULT_VALUES . TRACK_HEIGHT ,
446446 enabled : true ,
447447 allowOverlap : false ,
448448 onValuesChange : ( ) => { } ,
449449 onValuesChangeFinish : ( ) => { } ,
450450 onValuesChangeStart : ( ) => { } ,
451- leftMarkerAccessibilityLabel : DEFAULT_VALUES . LEFT_MARKER_LABEL ,
452- rightMarkerAccessibilityLabel : DEFAULT_VALUES . RIGHT_MARKER_LABEL ,
453- showMarkerLines : DEFAULT_VALUES . SHOW_MARKER_LINES ,
451+ leftThumbAccessibilityLabel : DEFAULT_VALUES . LEFT_THUMB_LABEL ,
452+ rightThumbAccessibilityLabel : DEFAULT_VALUES . RIGHT_THUMB_LABEL ,
453+ showThumbLines : DEFAULT_VALUES . SHOW_THUMB_LINES ,
454454} ;
455455
456456export default RangeSlider ;
0 commit comments