sacmii / rn-vertical-slider

React Native Vertical Slider
MIT License
202 stars 45 forks source link

Slider not responding to touch interaction #20

Closed prometheas closed 3 months ago

prometheas commented 4 years ago

I can't seem to get this slider to actually respond to interactions. I've attempted placing the component in an otherwise-empty screen (nested within SafeAreaView > View, with no other components on the screen).

I'm using react-native@37.0.1, expo@37.0.10, and I'm seeing this problem iOS (both simulator and physical device).

seanconrad1 commented 3 years ago

@prometheas if you're using the example provided, make sure you change the value prop and attach it to state. Then edit the onChange and have that update the state. eg:

import React, { useState } from 'React'
import RnVerticalSlider from 'rn-vertical-slider';

const Slider = () = {
 const [value, setValue] = useState(0)

return (
<RnVerticalSlider
        value={value}
        disabled={false}
        min={0}
        max={100}
        onChange={(value: number) => {
          setValue(value);
        }}
        onComplete={(value: number) => {
          // run your callbacks
        }}
        width={50}
        height={300}
        step={1}
        borderRadius={5}
        minimumTrackTintColor={'gray'}
        maximumTrackTintColor={'tomato'}
        showBallIndicator
        ballIndicatorColor={'gray'}
        ballIndicatorTextColor={'white'}
      />
)
}