Closed selva21kd closed 3 years ago
i have the same problem
Hi,
It was an amazing component, helpful. I need to know how to reset the selected range value into default value. is this possible?
@shayan1998 You can use ref
:
https://github.com/githuboftigran/rn-range-slider#methods
I'm working on version 2 which will be a pure JS component with Animated api. So I don't update this version anymore.
And yes, you can use setLowValue, setHighValue methods, please read the Readme file.
@shayan1998 @selva21kd until version 2.0 will be published, if you are having some trouble you can use setHighValue
and setLowValue
like this:
const myComponent = () => {
...
const sliderRef = React.useRef(null);
...
const resetSlider = () => {
sliderRef?.current.setLowValue(0);
sliderRef?.current.setHighValue(10);
}
return (
<RangeSlider
ref={sliderRef}
...
/>
)
.....
}
@shayan1998 @selva21kd until version 2.0 will be published, if you are having some trouble you can use
setHighValue
andsetLowValue
like this:const myComponent = () => { ... const sliderRef = React.useRef(null); ... const resetSlider = () => { sliderRef?.current.setLowValue(0); sliderRef?.current.setHighValue(10); } return ( <RangeSlider ref={sliderRef} ... /> ) ..... }
thank you. that's solve my problem
@selva21kd , @shayan1998 , just released v2 of the library. To set the value you can simply pass low
/ high
props.
Hi,
It was an amazing component, helpful. I need to know how to reset the selected range value into default value. is this possible?