You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for your report.
I think it seems trivial at first, however, the root problem is more hideous.
there are a lot of differences between styling react-dom and react-native.
By just looking at the code, I can spot one of the differences: unlike react-dom, react-native has a strict prop type on every css prop. The provided css prop must be included in a predefined list, and its value must satisfy the predefined React.PropTypes function. (Note that all of these constraints are checked only on development env).
After researching, I found that by default, react-native doesn't support other units (other than px) like percent, rem, pt, inches, etc. Some external efforts like react-natvie-extended-stylesheet are made to address those sets of problems.
Based on those differences, I don't recommend you to use css-template on react-native, because it's not css by any definition. If you like the idea behind css-template, I think you can create css-template-native and solve those native-specific problems in there.
However, if you understand the differences and still want to use this lib. I'd like to collect ideas how to force css-template to use numbers? for example: { padding-top: ${10} }
Example: When you parse
{ padding-top: 10 }
.The resut should be
{ paddingTop: 10 }
instead of { paddingTop: '10' }It's better if we can config it to ignore px value.
{ padding-top: 10px }
->{ paddingTop: 10 }
The text was updated successfully, but these errors were encountered: