miblanchard / react-native-slider

A pure JavaScript <Slider> component for react-native and react-native-web

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot slide, but only click.

Stophface opened this issue · comments

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

How are you managing updating the current slider value?

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

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.

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!

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.

@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.