Skip to content
Discussion options

You must be logged in to vote

Unlike StyleSheet in React Native, css.create (and other parts of the css API) is best thought of as a compilation target. In this case, the styles argument can't contain arbitrary functions (like Platform) or other imported values. However, you can currently bend this rule on native.

The way to do platform forking is to use separate files with the relevant platform file extensions - https://facebook.github.io/react-strict-dom/learn/setup/#platform-specific-files. In this case, I suggest creating a separate file (e.g., colors.stylex.js) and using defineConsts to define constant values for specific colors. Then you can create a native version that uses the PlatformColor. Give something lik…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jaknas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants