@@ -16,18 +16,18 @@ import PropTypes from 'prop-types';
16
16
// Layout constants
17
17
const HORIZONTAL_PADDING = 15 ;
18
18
const TOUCH_HITSLOP = { top : 20 , bottom : 20 , left : 20 , right : 20 } ;
19
- const MIN_MARKER_SPACING = 16 ;
19
+ const MIN_THUMB_SPACING = 16 ;
20
20
21
21
// Default values constants
22
22
const DEFAULT_VALUES = {
23
23
SLIDER_WIDTH : 270 ,
24
- MARKER_SIZE : 32 ,
24
+ THUMB_SIZE : 32 ,
25
25
TRACK_HEIGHT : 2.5 ,
26
26
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 ,
31
31
} ;
32
32
33
33
const createDynamicStyles = ( props ) => ( {
@@ -45,10 +45,10 @@ const createDynamicStyles = (props) => ({
45
45
position : 'absolute' ,
46
46
height : props . trackHeight ,
47
47
} ,
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 ,
52
52
backgroundColor : 'white' , // Move default color here
53
53
position : 'absolute' ,
54
54
shadowColor : '#000' ,
@@ -58,7 +58,7 @@ const createDynamicStyles = (props) => ({
58
58
elevation : 5 ,
59
59
left : 0 ,
60
60
top : '50%' ,
61
- marginTop : - ( props . markerSize / 2 ) ,
61
+ marginTop : - ( props . thumbSize / 2 ) ,
62
62
borderWidth : 0.5 ,
63
63
borderColor : '#CECECE' ,
64
64
justifyContent : 'center' ,
@@ -80,13 +80,13 @@ const RangeSlider = forwardRef(
80
80
// Style props
81
81
selectedTrackStyle,
82
82
unselectedTrackStyle,
83
- markerStyle ,
84
- pressedMarkerStyle ,
83
+ thumbStyle ,
84
+ pressedThumbStyle ,
85
85
containerStyle,
86
86
87
87
// Customization props
88
88
sliderWidth = DEFAULT_VALUES . SLIDER_WIDTH ,
89
- markerSize = DEFAULT_VALUES . MARKER_SIZE ,
89
+ thumbSize = DEFAULT_VALUES . THUMB_SIZE ,
90
90
trackHeight = DEFAULT_VALUES . TRACK_HEIGHT ,
91
91
minimumDistance = DEFAULT_VALUES . MINIMUM_DISTANCE ,
92
92
@@ -100,11 +100,11 @@ const RangeSlider = forwardRef(
100
100
onValuesChangeStart = ( ) => { } ,
101
101
102
102
// 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 ,
105
105
106
- // Marker lines prop
107
- showMarkerLines = DEFAULT_VALUES . SHOW_MARKER_LINES ,
106
+ // Visual props
107
+ showThumbLines = DEFAULT_VALUES . SHOW_THUMB_LINES ,
108
108
} ,
109
109
ref
110
110
) => {
@@ -152,11 +152,11 @@ const RangeSlider = forwardRef(
152
152
} ;
153
153
} ) ;
154
154
155
- const leftMarkerStyle = useAnimatedStyle ( ( ) => ( {
155
+ const leftThumbStyle = useAnimatedStyle ( ( ) => ( {
156
156
transform : leftTransform . value ,
157
157
} ) ) ;
158
158
159
- const rightMarkerStyle = useAnimatedStyle ( ( ) => ( {
159
+ const rightThumbStyle = useAnimatedStyle ( ( ) => ( {
160
160
transform : rightTransform . value ,
161
161
} ) ) ;
162
162
@@ -284,7 +284,7 @@ const RangeSlider = forwardRef(
284
284
285
285
const dynamicStyles = createDynamicStyles ( {
286
286
sliderWidth,
287
- markerSize ,
287
+ thumbSize ,
288
288
trackHeight,
289
289
enabled,
290
290
} ) ;
@@ -321,17 +321,17 @@ const RangeSlider = forwardRef(
321
321
>
322
322
< Animated . View
323
323
accessible = { true }
324
- accessibilityLabel = { leftMarkerAccessibilityLabel }
324
+ accessibilityLabel = { leftThumbAccessibilityLabel }
325
325
accessibilityRole = "adjustable"
326
326
style = { [
327
- dynamicStyles . marker ,
327
+ dynamicStyles . thumb ,
328
328
styles . markerContainer ,
329
- markerStyle ,
330
- pressed . left && pressedMarkerStyle ,
331
- leftMarkerStyle ,
329
+ thumbStyle ,
330
+ pressed . left && pressedThumbStyle ,
331
+ leftThumbStyle ,
332
332
] }
333
333
>
334
- { showMarkerLines && (
334
+ { showThumbLines && (
335
335
< >
336
336
< View style = { staticStyles . markerLine } />
337
337
< View style = { staticStyles . markerLine } />
@@ -349,17 +349,17 @@ const RangeSlider = forwardRef(
349
349
>
350
350
< Animated . View
351
351
accessible = { true }
352
- accessibilityLabel = { rightMarkerAccessibilityLabel }
352
+ accessibilityLabel = { rightThumbAccessibilityLabel }
353
353
accessibilityRole = "adjustable"
354
354
style = { [
355
- dynamicStyles . marker ,
355
+ dynamicStyles . thumb ,
356
356
styles . markerContainer ,
357
- markerStyle ,
358
- pressed . right && pressedMarkerStyle ,
359
- rightMarkerStyle ,
357
+ thumbStyle ,
358
+ pressed . right && pressedThumbStyle ,
359
+ rightThumbStyle ,
360
360
] }
361
361
>
362
- { showMarkerLines && (
362
+ { showThumbLines && (
363
363
< >
364
364
< View style = { staticStyles . markerLine } />
365
365
< View style = { staticStyles . markerLine } />
@@ -411,13 +411,13 @@ RangeSlider.propTypes = {
411
411
// Style props
412
412
selectedTrackStyle : PropTypes . object ,
413
413
unselectedTrackStyle : PropTypes . object ,
414
- markerStyle : PropTypes . object ,
415
- pressedMarkerStyle : PropTypes . object ,
414
+ thumbStyle : PropTypes . object ,
415
+ pressedThumbStyle : PropTypes . object ,
416
416
containerStyle : PropTypes . object ,
417
417
418
418
// Customization props
419
419
sliderWidth : PropTypes . number ,
420
- markerSize : PropTypes . number ,
420
+ thumbSize : PropTypes . number ,
421
421
trackHeight : PropTypes . number ,
422
422
minimumDistance : PropTypes . number ,
423
423
@@ -431,26 +431,26 @@ RangeSlider.propTypes = {
431
431
onValuesChangeStart : PropTypes . func ,
432
432
433
433
// Accessibility props
434
- leftMarkerAccessibilityLabel : PropTypes . string ,
435
- rightMarkerAccessibilityLabel : PropTypes . string ,
434
+ leftThumbAccessibilityLabel : PropTypes . string ,
435
+ rightThumbAccessibilityLabel : PropTypes . string ,
436
436
437
- // Marker lines prop
438
- showMarkerLines : PropTypes . bool ,
437
+ // Visual props
438
+ showThumbLines : PropTypes . bool ,
439
439
} ;
440
440
441
441
RangeSlider . defaultProps = {
442
442
step : DEFAULT_VALUES . STEP ,
443
443
sliderWidth : DEFAULT_VALUES . SLIDER_WIDTH ,
444
- markerSize : DEFAULT_VALUES . MARKER_SIZE ,
444
+ thumbSize : DEFAULT_VALUES . THUMB_SIZE ,
445
445
trackHeight : DEFAULT_VALUES . TRACK_HEIGHT ,
446
446
enabled : true ,
447
447
allowOverlap : false ,
448
448
onValuesChange : ( ) => { } ,
449
449
onValuesChangeFinish : ( ) => { } ,
450
450
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 ,
454
454
} ;
455
455
456
456
export default RangeSlider ;
0 commit comments