react-native-slider icon indicating copy to clipboard operation
react-native-slider copied to clipboard

fix onValueChanges is called on programmatic value changes on Android

Open minhtc opened this issue 3 years ago • 2 comments

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

minhtc avatar Aug 01 '22 11:08 minhtc

Intuitively the onValueChange should 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 of onValueChange on 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.

minhtc avatar Aug 02 '22 07:08 minhtc

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.

jeffmon avatar Aug 02 '22 21:08 jeffmon

Also still happening in react-native-community/[email protected]

laurent22 avatar Jan 02 '23 18:01 laurent22