Skip to content

[iOS] Possible race condition when setting Switch background color #10101

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

Open
3 tasks done
fpaaske opened this issue Nov 21, 2022 · 1 comment
Open
3 tasks done

[iOS] Possible race condition when setting Switch background color #10101

fpaaske opened this issue Nov 21, 2022 · 1 comment
Labels
bug-pending-triage Reported bug, pending triage to confirm.

Comments

@fpaaske
Copy link

fpaaske commented Nov 21, 2022

Issue Description

We experience a null pointer exception in our app, and it seems to be related to Switch and background color.
It looks suspiciously similar to this NativeScript/nativescript-angular#2134 and #9922, but for iOS.

Reproduction

I'm unable to reliably reproduce this.

Relevant log output (if applicable)

TypeError: Cannot set property 'onTintColor' of null
at Switch.setNativeBackgroundColor
at Switch._onCheckedPropertyChanged
at onCheckedPropertyChanged
at Switch.checked
at ViewUtil.setPropertyInternal
at ViewUtil.setProperty
at EmulatedRenderer.setProperty
at ZoneDelegate.invoke
at Zone.run

Environment

No response

Please accept these terms

@fpaaske fpaaske added the bug-pending-triage Reported bug, pending triage to confirm. label Nov 21, 2022
@fpaaske
Copy link
Author

fpaaske commented Apr 25, 2023

A small update on this, it seems like this is only happening when binding to (tap) instead of (checkedChange).

The reason for binding to tap was to avoid a call to checkedChange during initialization, like mentioned in these SO posts:

https://stackoverflow.com/questions/41118760/nativescript-switch-prevent-change-event-firing-on-initial-binding
https://stackoverflow.com/questions/40914604/nativescript-switch-not-to-fire-initial-binding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-pending-triage Reported bug, pending triage to confirm.
Projects
None yet
Development

No branches or pull requests

1 participant