Skip to content

Commit 85f8b99

Browse files
authored
fix(issue):修复遗留问题lowerLimit和upperLimit只对值生效未对滑动做限制 (#11)
1 parent 17051d1 commit 85f8b99

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

package/harmony/slider/src/main/ets/Slider.ets

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ const TAG: string = "[RNOH] RNCSlider"
3737

3838
export const SLIDER_TYPE: string = "RNCSlider"
3939

40+
const DEFAULT_LIMIT_VALUE = -9007199254740991;
41+
const DEFAULT_MAX_VALUE = 9007199254740991;
42+
4043
export interface SliderProps extends ViewBaseProps {
4144
thumbImage?: string
4245
maximumTrackTintColor?: ColorSegments
@@ -170,6 +173,10 @@ export struct RNCSlider {
170173
.showSteps(false)
171174
.blockStyle(this.descriptorWrapper?.BlockStyle)
172175
.onChange((value: number, mode: SliderChangeMode) => this.onSliderChange(value, mode))
176+
.slideRange({
177+
from: this.lowerLimit === DEFAULT_LIMIT_VALUE ? this.descriptorWrapper?.minimumValue : this.lowerLimit,
178+
to: this.upperLimit === DEFAULT_MAX_VALUE ? this.descriptorWrapper?.maximumValue : this.upperLimit
179+
})
173180
}
174181
}
175182
}

0 commit comments

Comments
 (0)