githuboftigran / rn-range-slider

A native slider with range
MIT License
234 stars 130 forks source link

Range slider UI isn't updated on resetting initialLowValue and initialHighValue #82

Closed SaadAli-rolustech closed 3 years ago

SaadAli-rolustech commented 3 years ago

I am setting initialLowValue and initialHighValue value via state. If I reset the state to initial values, the slider re-renders but does not reflect the changes physically. The initialLowValue and initialHighValue values are reset but the slider UI doesn't change. How can I achieve this?

githuboftigran commented 3 years ago

@SaadAli-rolustech , there are no initialLowValue and initialHighValue props anymore. Please read the documentation.

SaadAli-rolustech commented 3 years ago

@githuboftigran I just went through the documentation. initialHighValue and initialLowValue have been replaced with high and low props respectively. I have assigned them values too but UI doesn't reflect any changes. Please guide me.

githuboftigran commented 3 years ago

@SaadAli-rolustech , they are not replaced, those props are removed. low and high values are not initial values. They are the actual values. If you set them to a constant, your slider will have pinned thumbs. These props work just like prop value in TextInput.

githuboftigran commented 3 years ago

@SaadAli-rolustech https://reactnative.dev/docs/textinput#value

SaadAli-rolustech commented 3 years ago

@githuboftigran then which props are the initial values?

githuboftigran commented 3 years ago

There are no initial values. You should have state variables for low and high and then update them in onValueChange listener.

mrshahzeb7 commented 3 years ago

underStood ! thanks