Skip to content
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

[Android] onValueChange stopped firing event for false values (null, undefined, 0, "", false, etc) #590

Closed
MaxTibs opened this issue Nov 5, 2024 · 10 comments · Fixed by #604
Labels

Comments

@MaxTibs
Copy link

MaxTibs commented Nov 5, 2024

Library version: 2.8.1
React native version: 0.74.6

After upgrading from 7.6.2 to 8.2.0, the onValueChange handler stopped being called for false values (false, "", undefined, null, etc).
It seems it also stopped firing event on placeholder touch event. See this thread.

After some research I found where the breaking change has been introduced: here

IMO it's should be up to the developer to interpret the value returned by the picker. If null is meant to represent the placeholder value, then it should be the developer responsibility to handle that null value from it's onValueChange handler. I don't think the values should be muted from within the picker implementation.

In other words, this change should probably be reverted

@MaxTibs MaxTibs changed the title onValueChange is broken for false values on Android onValueChange is broken for false values (null, undefined, 0, "", false, etc) on Android Nov 5, 2024
@MaxTibs MaxTibs changed the title onValueChange is broken for false values (null, undefined, 0, "", false, etc) on Android [Android] onValueChange stopped firing event for false values (null, undefined, 0, "", false, etc) Nov 5, 2024
@dmk3141618
Copy link

Same issue on Android.

I can set empty string as a value on the iOS device.

But I can not set empty string as a value on the Android device. It does not trigger onValueChange.
value is '', 'option1', 'option2'
then '' >> 'option1' , it triggers onValueChange.
then 'option1' >> 'option2' , it triggers onValueChange.
But 'option2' >> '' , it does not trigger onValueChange.
So I can not reset value to the empty state.

on the iOS device, it works.

@dmk3141618
Copy link

Any updates? Sorry but I really need this fixed.

@didley
Copy link
Contributor

didley commented Nov 26, 2024

@dmk3141618 temporary fix, if you haven't tired, is downgrading to 2.7.6.

@dmk3141618
Copy link

@didley But I am using RN 0.76.3 New Architecture

@didley
Copy link
Contributor

didley commented Nov 27, 2024

@dmk3141618 Ahh thats unfortunate.

I've just opened a PR. It's a one line fix, so hopefully it can get looked at and merged shortly.

@dmk3141618
Copy link

Is there any update?

@dmk3141618
Copy link

This PR works. When is going to be applied to the real version?
fix: setting nullish values on android #604
if (value !== undefined) {

@didley
Copy link
Contributor

didley commented Dec 3, 2024

Sorry @Naturalclar, any chance #604 can be reviewed?

@Naturalclar
Copy link
Contributor

🎉 This issue has been resolved in version 2.10.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@dmk3141618
Copy link

Thank you kindly.

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

Successfully merging a pull request may close this issue.

4 participants