Skip to content

fix onValueChanges is called on programmatic value changes on Android #409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Conversation

minhtc
Copy link

@minhtc minhtc commented Aug 1, 2022

Summary:

Revert changes from #367 to fix #395

What #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

Copy link
Member

@BartoszKlonowski BartoszKlonowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@minhtc
Copy link
Author

minhtc commented Aug 2, 2022

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.

@jeffmon
Copy link

jeffmon commented Aug 2, 2022

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.

@minhtc minhtc closed this by deleting the head repository Sep 29, 2022
@laurent22
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

onValueChanges is called on programmatic value changes on Android
5 participants