react-native-slider icon indicating copy to clipboard operation
react-native-slider copied to clipboard

change the value while sliding

Open christopher-18 opened this issue 5 years ago • 3 comments

i want to show the values, somewhere while we are sliding. How can i achieve that?

christopher-18 avatar Mar 26 '19 15:03 christopher-18

Your value is in the state. So you can just show it anywhere you want.

Saad-Bashar avatar Apr 02 '19 06:04 Saad-Bashar

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.

christopher-18 avatar Apr 02 '19 16:04 christopher-18

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 });
          }}
        />

harish-everest avatar May 22 '19 06:05 harish-everest