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

Open
MaxTibs opened this issue Nov 5, 2024 · 5 comments · May be fixed by #604
Open

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

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 didley linked a pull request Nov 27, 2024 that will close this issue
@didley
Copy link

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.

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 a pull request may close this issue.

3 participants