vitalets / react-native-extended-stylesheet

Extended StyleSheets for React Native
MIT License
2.93k stars 132 forks source link

Thoughts on converting from JS obj to actual CSS syntax? #78

Closed corysimmons closed 5 years ago

corysimmons commented 6 years ago
foo: {
  backgroundColor: 'red',
  padding: 10
}

becomes

.foo {
  background-color: red;
  padding: 10;
}

Not important. Just a stylistic tweak.

vitalets commented 6 years ago

How this will be look inside the code? Just a string? Maybe have a look on styled-components.

corysimmons commented 6 years ago

I hear styled-components hit React Native performance pretty hard.

In styled-jsx they do:

<div>
  <h1>hi</h1>

  <style jsx>{`
    div { background: red; }
    h1 { color: blue; }
  `}</style>
</div>

The perf hit might be converting the template literal to a pojo during runtime which might hit mobile devices harder than PCs.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.