react-native-slider
react-native-slider copied to clipboard
fix onValueChanges is called on programmatic value changes on Android
Summary:
Revert changes from https://github.com/callstack/react-native-slider/pull/367 to fix https://github.com/callstack/react-native-slider/issues/395
What https://github.com/callstack/react-native-slider/pull/367 trying to fix is not an issue actually. The onValueChange should be called only when user is dragging the slide and it is matching with the behaviour on iOS
Intuitively the
onValueChangeshould be called also when user taps on Slider, as tapping also changes the value, I think it's the mistake of mine that we have the opposite written in the docs. I think that instead of reverting the fix of one to fix another we should create an issue about the lack ofonValueChangeon iOS and work on a decent fix for the current issue keeping the backward compatibility.
If the onValueChange event is always be called, I think it should send with an extra flag to know if it is from dragging or tapping.
In my case, I need to check if the slider value is changed from dragging action to prevent some performance issue. If the slider value is changed by set the value prop, I do not need onValueChange because I already know the value.
Sorry if this is not applicable here, but using the latest version "@react-native-community/slider": "^4.2.4", onValueChange still fires automatically when the scrubber first starts up.
Also still happening in react-native-community/[email protected]