react-native-slider
react-native-slider copied to clipboard
change the value while sliding
i want to show the values, somewhere while we are sliding. How can i achieve that?
Your value is in the state. So you can just show it anywhere you want.
I want to change the value i am sliding. Once, i have stopped the sliding, i am able to set the value, but no while i am sliding.
Make use of onSlidingStart and onValueChange callbacks
<Slider
value={this.state.isSeeking ? this.state.seek : this.state.position}
minimumValue={0}
step={1}
maximumValue={10}
onSlidingStart={() => {
this.setState({ isSeeking: true });
}}
onValueChange={val => {
this.setState({ seek: val });
}}
onSlidingComplete={val => {
this.setState({ isSeeking: false });
}}
/>