[DynamicColorMacOS] Downgrade to warning if appearance is nil #1885
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please select one of the following
Summary
When a user cuts/copies text from a
<TextInput>
that has it's text color styled usingDynamicColorMacOS
, we would get a Redbox saying that the current appearance could not be resolved. Looking into it, it seems that at this point in native code, Appkit returns an appearance ofNSAppearanceNameSystem
, which seems to correspond to the "Any" case of an asset catalog if you were specifying a color that way instead.While I'm not sure why cutting/copying text gets us in this state, it seems this is a valid state to be in, where the OS doesn't have the current appearance and just reports back a generic one. Let's fall back to the light color (as you would with an asset catalog) with a warning instead of an error.
Changelog
[MACOS] [CHANGED] - Downgrade DynamicColorMacOS error to warning if appearance is nil
Test Plan
Testing in RNTester, we get a yellow box instead of a redbox.