Skip to content

Support using PlatformColor for designTokens #1939

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

Merged
merged 6 commits into from
Apr 7, 2022

Conversation

ethanshar
Copy link
Collaborator

Description

I added support for reading native colors using RN PlatfomColor API for loaded design tokens.
This will only work when the user purposely enable this feature by calling Colors.enabledPlatformColors
The reason for that is that the users must load the relevant colors in their native code.

For now, this will be false in the public code.
We will enable this and load the platform colors in native only in private for now.

Unfortunately, PlatformColor API is not so flexible, for instance I can't try/catch it and return the original JS color, like this

try {
  return PlatformColor('$myToken');
} catch (error) {
  return actualTokenValue;
}

Changelog

Support using RN PlatformColor API for loaded design tokens

@ethanshar
Copy link
Collaborator Author

@Inbal-Tish @M-i-k-e-l @lidord-wix
Please review (and approve), don't merge

Object.assign(this, colors);
this.loadSchemes({light: DesignTokens, dark: DesignTokensDM});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll open the dark mode to the community before we ready

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's outstanding for dark mode? also where can I find docs on designTokens?

@ethanshar ethanshar merged commit 5b10bd6 into master Apr 7, 2022
@ethanshar ethanshar deleted the infra/Schemes_platformColor branch June 13, 2022 08:17
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.

4 participants