@@ -65,13 +65,17 @@ export class Slider extends SliderBase {
65
65
[ minValueProperty . setNative ] ( value ) {
66
66
this . nativeViewProtected . minimumValue = value ;
67
67
if ( this . stepSize !== 0 ) {
68
- this . nativeViewProtected . numberOfDiscreteValues = ( this . maxValue - this . minValue ) / value ;
68
+ // add one to get amount of values and not difference between min and max
69
+ const valuesCount = this . maxValue - this . minValue + 1 ;
70
+ this . nativeViewProtected . numberOfDiscreteValues = Math . ceil ( valuesCount / value ) ;
69
71
}
70
72
}
71
73
[ maxValueProperty . setNative ] ( value ) {
72
74
this . nativeViewProtected . maximumValue = value ;
73
75
if ( this . stepSize !== 0 ) {
74
- this . nativeViewProtected . numberOfDiscreteValues = ( this . maxValue - this . minValue ) / value ;
76
+ // add one to get amount of values and not difference between min and max
77
+ const valuesCount = this . maxValue - this . minValue + 1 ;
78
+ this . nativeViewProtected . numberOfDiscreteValues = Math . ceil ( valuesCount / value ) ;
75
79
}
76
80
}
77
81
[ stepSizeProperty . getDefault ] ( ) {
@@ -82,7 +86,11 @@ export class Slider extends SliderBase {
82
86
this . nativeViewProtected . discrete = false ;
83
87
} else {
84
88
this . nativeViewProtected . discrete = true ;
85
- this . nativeViewProtected . numberOfDiscreteValues = ( this . maxValue - this . minValue ) / value ;
89
+
90
+ // add one to get amount of values and not difference between min and max
91
+ const valuesCount = this . maxValue - this . minValue + 1 ;
92
+ this . nativeViewProtected . numberOfDiscreteValues = Math . ceil ( valuesCount / value ) ;
93
+
86
94
this . nativeViewProtected . shouldDisplayDiscreteValueLabel = false ;
87
95
}
88
96
}
0 commit comments