-
Notifications
You must be signed in to change notification settings - Fork 7.7k
add shorthand for specifying pixel values in style props to docs #55
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
Conversation
Deploy preview ready! Built with commit f3aea25 |
return <div style={divStyle}>Hello World!</div>; | ||
} | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the section about which props are unitless is also worth adding just to avoid potential confusion that all numeric style props are stringified like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be updated to reflect the latest changes in this file(20 of them are not on the list)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, or maybe just mention the type of props that aren't converted and list a few examples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I left it as is and include a link to the file.
Thanks! |
</div> | ||
``` | ||
|
||
Not all style properties are converted to pixel strings though. Certain ones remain unitless (eg `zoom`, `order`, `flex`). A complete list of unitless properties can be seen [here](https://github.com/facebook/react/blob/4131af3e4bf52f3a003537ec95a1655147c81270/src/renderers/dom/shared/CSSProperty.js#L15-L59). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually got me curious -- while the first and second values of flex
are unitless, the third is not. Luckily, it's not possible to provide more than one value other than as a string...
* Translate: Context * Translate: Context first review
Fix #27