onSlidingComplete is not working on Android
See original GitHub issueEnvironment
System: OS: macOS 10.14.6 CPU: (8) x64 Intel® Core™ i5-8257U CPU @ 1.40GHz Memory: 22.35 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.16.0 - /usr/local/bin/node Yarn: 1.19.0 - /usr/local/bin/yarn npm: 6.11.3 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3 Android SDK: API Levels: 28, 29 Build Tools: 28.0.3, 29.0.1 IDEs: Android Studio: 3.4 AI-183.6156.11.34.5692245 Xcode: 10.3/10G8 - /usr/bin/xcodebuild npmPackages: react: 16.8.6 => 16.8.6 react-native: 0.60.5 => 0.60.5 npmGlobalPackages: react-native-cli: 2.0.1
react-native-slider
version 2.0.2
Description
The same code works as expected on iOS (‘on sliding complete’ is logged in console) but not on android Although currentValue is correctly changed on Android as well as on iOS
Reproducible Demo
const [currentValue, setCurrentValue] = useState();
<Slider
style={{ width: screenWidth - 48, height: 40 }}
minimumTrackTintColor={theme.colors.pinkButton}
maximumTrackTintColor={theme.colors.grayIcon}
value={currentValue}
onValueChange={setCurrentValue}
onSlidingComplete={value => {
console.log('on sliding complete')
}}
/>
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:8
Top GitHub Comments
Same for me, any workarounds to make it works?
To run onSlidingComlete in android please do the following changes in << ReactSliderManager.java >> as given below :-
1. Comment this line -->>
ReactSlidingCompleteEvent.EVENT_NAME, MapBuilder.of(“registrationName”, “onRNCSliderSlidingComplete”), in the getExportedCustomDirectEventTypeConstants() method like given below
2. Add the given below method
Now when event is fired from native code is work properly @michalchudziak