-
Notifications
You must be signed in to change notification settings - Fork 18
Support calc #40
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
Comments
Actually I think I misunderstood the form the output takes, as viewport widths are not converted to function calls by this module. I guess I'll have to go without. |
How did you get viewport widths to work in the first place? I'm now getting the error "JSON value '30vw' of type NSString cannot be converted to a ABI33_0_0YGValue. Did you forget the % or pt suffix?". |
Hey @xsanda. So let me explain a bit about calc and the viewport units. Both of them need to be calculated at runtime. The viewport units work because they run through a special function that uses the
|
If you only use exact and viewport values (as opposed to percentages), then why would calculating |
That's easy to handle, the problem is that I really would not like to add support for CSS features that are only partially implemented. |
So calc with viewport units is easy, but calc with width/height + percentages is difficult to implement. |
Also, I have made a proof of concept of using percentages and calc. I would just need to finish writing a babel plugin for it. Here's an example: |
I have also created a library that turns calc values to pixels based on the viewport/element size: |
Hey guys, will the |
Hey guys, will the |
@NE-SmallTown @iambool Look at my comment above. It can not just be added, |
As this transformer now supports viewport units (#18), please could we add support for calc? This would allow us to use rules such as
margin-left: calc(50vw - 10px)
, which could compile to{marginLeft: vw(50)-10}
(withvw
from https://github.com/joetakara/react-native-expo-viewport-units).The text was updated successfully, but these errors were encountered: