miblanchard / react-native-slider

A pure JavaScript <Slider> component for react-native and react-native-web
MIT License
374 stars 67 forks source link

Cannot slide, but only click. #348

Open Stophface opened 2 years ago

Stophface commented 2 years ago

I cannot smoothly slide the slider, but only click on the track to move the thumb. Is that expected behavious?

 <Slider
        thumbTouchSize={{ width: 50, height: 50 }}
        containerStyle={[styles.sliderContainer, elevation]}
        style={styles.slider}
        trackStyle={{marginLeft: 10}}
        minimumValue={30}
        maximumValue={100}
        minimumTrackTintColor={colors.highlight}
        maximumTrackTintColor={colors.otherElements}
        onValueChange={value => dispatch(setRadius(value))}
        step={10}
        value={radius} />
miblanchard commented 2 years ago

How are you managing updating the current slider value?

RobertoCostaTupinamba commented 2 years ago

I'm having the same problem, I'm using it inside a tabview that has the behavior of dragging to the side

timoisalive commented 2 years ago

I used something like this to ensure the slider value wouldn't constantly get updated from the state:

const [initialValue] = useState(value);

return <Slider value={initialValue} ... />

but this seemed to stop the thumb from moving, and instead I used the value prop directly from state. This did the trick and the thumb moves again.

timoisalive commented 2 years ago

but this seemed to stop the thumb from moving, and instead I used the value prop directly from state. This did the trick and the thumb moves again.

Having read the doc another time, the behaviour I'm experiencing doesn't seem expected. Also, the react-community version of the Slider was working with my initialValue, so the behaviour is not one-to-one here. Not sure if this is a bug or feature, but just to let you know!

miblanchard commented 1 year ago

It's unclear what the request is here. If you @Stophface or anyone else can provide I reproducible example I may be able to help. It is not expected that you can't slide the slider, and in all my use cases this is working as expected.

Stophface commented 1 year ago

@miblanchard Simlpy set up a new project, include the slider and you are unable to press and hold the large circle and slide it up and down. You have to repeatedly press on the line above or below the circle for the circle to move in small steps up or down.