-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Uses css classes for styling instead of inline styles #283
Conversation
Noticed similar on an internal mobile.twitter.com branch. Now that this library essentially has full support for RN styles and i18n, we can go back to introducing a more efficient |
I'm still new to React-native, so my question is mainly to learn. I had the impression that js inline styling solves some CSS issues; such as eliminating dead code, avoid global scoping and minification. Also IMO it's a gateway to lots of fun programmable styling, such as react-native-extended-stylesheet. I'm wondering what advantages does CSS bring. Also if it's still possible with this merge request to use inline styling besides CSS. |
Alright, checked the merge request as well as the underlying library (classnames). Seems that inline styling will still work and that library is actually interesting. Thanks! |
I'm closing this because it doesn't really solve the problem and creates others. Any styles set via RNW will still override the styles set via className. It only works if you use |
Hey, try using 0.0.62. Styles are resolved to className where possible—which should allow you to use Uranium—and rendering performance is about 13x better against the benchmarks. |
Hey yup, it works :) Thanks. It is a little difficult to debug directly though, would be nice if in the future there could be a single classname per element. |
This patch solves the following problem
Compatibility with Uranium and ultimately Carbon UI.
More generally, adds compatibility with classnames. Currently, any library that uses classnames to apply styles, or any user-provided css classes, will get overridden by RNW's inline styles.
This also pretty significantly reduces the css footprint, and I wouldn't be surprised if it also improved performance. material-ui noticed a 25% decrease in performance when moving to inline styles from classes.
Test plan
Updated the jest test snapshots, and confirmed it worked with the carbon ui documentation site.
This pull request