githuboftigran / rn-range-slider

A native slider with range
MIT License
237 stars 133 forks source link

Reset thumb to default #3

Closed Saad-Bashar closed 5 years ago

Saad-Bashar commented 5 years ago

Is there a way we can reset the thumb again to min and max default value when a button is pressed?

erdemildiz commented 5 years ago

+1

githuboftigran commented 5 years ago

@Saad-Bashar, slider doesn't remember thumb positions and doesn't actually have default values. So if you have default values for slider, you probably should add high and low props to slider if the button is pressed like this:

render() {
...
const defValues = this.state.buttonPressed ? {lowValue: _defaultLow, highValue: _defaultHigh} : {}
...
<RangeSlider
...
{...defValues}
>
...
githuboftigran commented 5 years ago

Updated the api, added methods to set high and low values.