@@ -65,13 +65,17 @@ export class Slider extends SliderBase {
6565 [ minValueProperty . setNative ] ( value ) {
6666 this . nativeViewProtected . minimumValue = value ;
6767 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 ) ;
6971 }
7072 }
7173 [ maxValueProperty . setNative ] ( value ) {
7274 this . nativeViewProtected . maximumValue = value ;
7375 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 ) ;
7579 }
7680 }
7781 [ stepSizeProperty . getDefault ] ( ) {
@@ -82,7 +86,11 @@ export class Slider extends SliderBase {
8286 this . nativeViewProtected . discrete = false ;
8387 } else {
8488 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+
8694 this . nativeViewProtected . shouldDisplayDiscreteValueLabel = false ;
8795 }
8896 }
0 commit comments