react-native-slider
react-native-slider copied to clipboard
Property disbaled dont work
Environment
System: OS: macOS 12.0.1 CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz Memory: 1.02 GB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 17.0.1 - /usr/local/bin/node Yarn: 1.22.17 - /usr/local/bin/yarn npm: 8.1.0 - /usr/local/bin/npm Watchman: 2021.11.15.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: 13.1/13A1030d - /usr/bin/xcodebuild Languages: Java: Not Found npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.66.0 => 0.66.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Description
If the value for disabled is set to true, it has no effect. The slider can still be moved. Will try on the web.
Reproducible Demo
<ReactSlider
style={[styles.slider]}
value={value}
disabled={true}
minimumValue={minimumValue}
maximumValue={maximumValue}
step={step}
thumbTintColor={thumbTintColor}
minimumTrackTintColor={minimumTrackTintColor}
maximumTrackTintColor={maximumTrackTintColor}
onValueChange={newValue => onValueChange(newValue)}
/>
Hello @pdaus1405! Can you tell me on which platform do you see this issue? I assume you're using the latest version of the library (v4.1.12), right?
hey @BartoszKlonowski
"@react-native-community/slider": "^4.1.12",
"react-native": "0.66.0",
"react-native-web": "^0.17.5"
i hope this information can help you :)
Same issue here. The disabled property works correctly on iOS devices, but in the browser (Chrome 97) the slider is not disabled.
<Slider maximumValue={6} minimumValue={0} step={1} value={value} disabled onSlidingComplete={onChange} />
"@react-native-community/slider": "4.1.12"
"expo": "^43.0.0"
"react-native": "0.64.3"
"react": "17.0.1"
I have the same issue. Additionally, it does not matter how onValueChange
is set. Even if it does not update the value, the user can still move the slider around.
A quick workaround for me was to just wrap the slider in a View
and disable pointerEvents
on it as a surrogate to disabled
Fixed in https://github.com/callstack/react-native-slider/pull/462