Skip to content

Conversation

Saadnajmi
Copy link
Collaborator

Summary:

React Native primarily runs on 2 threads: the UI thread (main thread for apple) and the JS thread (where the Javascript engine is running). This poses a challenge when JS synchronously wants a value that can only be accessed on the main thread (getColorScheme() is the issue in this case).

React Native upstream solves this via proxy objects (all initialized in RCTInitializeUIKitProxies() called on RN instance startup) that set an initial value, and then guard reading / setting updated values of the main-thead-only values we want.

Lets implement that for NSAppearance so we can fix a bunch of main thread violations we've been seeing on boot. I chose not to ifdef RCTTraitCollectionProxy because the names are quite different.. althought that would be the right file.

Test Plan:

No main thread checker violations on RNTester boot.

@Saadnajmi
Copy link
Collaborator Author

Saadnajmi and others added 2 commits October 14, 2025 07:07
Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com>
@Saadnajmi Saadnajmi merged commit 337dff4 into microsoft:main Oct 14, 2025
21 checks passed
@Saadnajmi Saadnajmi deleted the appearance branch October 14, 2025 15:07
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.

2 participants