Skip to content
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

React Native (Web) and Emotion 11 should use StyleSheet.create ? #2059

Closed
efoken opened this issue Oct 29, 2020 · 3 comments
Closed

React Native (Web) and Emotion 11 should use StyleSheet.create ? #2059

efoken opened this issue Oct 29, 2020 · 3 comments

Comments

@efoken
Copy link
Contributor

efoken commented Oct 29, 2020

The problem

I think Emotion should use StyleSheet.create instead of StyleSheet.flatten, even if this maybe affects performance (?) it is in my opinion the best solution, because StyleSheet.flatten only creates "inline styles" and StyleSheet.create create an instance which is referenced later.

And besides that, when someones uses React Native Web it is always better to use StyleSheet.create, because it creates atomic CSS classes while StyleSheet.flatten only creates inline styles...

Proposed solution

Switch to StyleSheet.create in primitives-core package.

Alternative solutions

N/A

Additional context

N/A

@Andarist
Copy link
Member

I've checked what Styled Components do and they indeed use StyleSheet.create: https://github.com/styled-components/styled-components/blob/28b4c28f1ebd1ea5a34717df2fe49634461285b1/packages/styled-components/src/models/InlineStyle.js#L28

If you are interested in changing this - we are open for pull requests 😉

@efoken
Copy link
Contributor Author

efoken commented Oct 30, 2020

#2060

@Andarist
Copy link
Member

Got implemented in #2060

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants