Uh oh!
There was an error while loading. Please reload this page.
Support user-defined PlatformColors on iOS - #31258
Conversation
Base commit: 66173e1 |
Base commit: 66173e1 |
facebook-github-bot
commented
Jun 1, 2021
@p-sun has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Is there an example of how custom colors can be defined similarly for Android in RN Tester? |
oblador
commented
Jun 1, 2021
@p-sun: In the linked repo there's this for example: https://github.com/klarna-incubator/platform-colors/blob/master/examples/ColorViewerApp/ios/ColorViewerApp/Images.xcassets/accent.colorset/Contents.json Is that what you're asking for? |
p-sun
commented
Jun 1, 2021
I wondering how this similar feature works in Android and whether there's an usage example. |
oblador
commented
Jun 1, 2021
The main use case for me is supporting dark mode without having to re-implement that logic in JavaScript. Additionally it adds accessibility features such as high contrast color support. |
oblador
commented
Jun 1, 2021
The documentation for |
Would this PR cause a different color to appear if the defined in RCTSemanticColorsMap in RCTConvert.m doesn't match the one defined in Apple's UI Element Colors. i.e. Could this PR cause Apple's UI Element Colors to override the one in RCTSemanticColorsMap? Just wondering out loud - I haven't looked deeply into the color logic. This feature this PR adds is similar to custom colors in Android, but hasn't been documented for iOS, since this custom color is neither a "UIColor Standard Colors" or "UIColor UI Element Colors", from the React Native docs. |
oblador
commented
Jun 1, 2021
If you have a custom color defined with a name conflicting with one defined in Re docs: yep that's fair, I'll make a PR updating the docs explicitly stating that custom colors are supported on iOS if this one lands. |
p-sun
commented
Jun 1, 2021
I edited my previous comment with a different question. ^ |
oblador
commented
Jun 1, 2021
Do you mean this one?
If so it doesn't seem that way aside from |
p-sun
commented
Jun 1, 2021
I meant this question.
You don't need to add an example to Android as part of this PR, unless you want too. |
oblador
commented
Jun 2, 2021
To my understanding it would only use |
oblador
commented
Jun 8, 2021
@p-sun: To keep this PR moving, are there any changes you want? |
Summary
This is a continuation of #29683. I've talked to @danilobuerger who does not intend on continue work on it and is OK with me picking up where he left. This PR is identical besides adding a test case in the RN Tester app as requested in the original PR.
In summary it gives iOS feature parity with Android in the sense that one can use user-defined native colors, something even the docs claim is possible. It's useful as it enables accessibility features such as high contrast colors and makes implementing dark mode simple. For an example on how it can be used, see https://github.com/klarna-incubator/platform-colors
Changelog
[iOS] [Added] - Allow PlatformColor to return user-defined named asset color
Test Plan
Test case added to RN Tester.