-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Bug: aspectRatio not being applied via style #21098
Comments
Yes, I have the same issue with another style property |
Try passing a string instead of number. React special cases numbers (to add the "px" suffix) and only doesn't for certain known attributes. So new ones sometimes need to be added to this list if they shouldn't get a px suffix (most should): https://github.com/facebook/react/blob/master/packages/react-dom/src/shared/CSSProperty.js#L11 |
@adyz Your issue is unrelated. Would you mind opening a separate issue for that thread? Basically try |
Thanks @sebmarkbage |
@mattgperry how soon do you need this? Are you blocked? |
@gaearon no, no rush at all! Just something I stumbled upon. Thanks for the lightning-quick response though! |
React version: 16.14.0, 17.0.2
Steps To Reproduce
style
- no aspectRatio appliedNeeds Chrome 79 or above:
Link to code example: https://codesandbox.io/s/react-bug-not-applying-aspect-ratio-via-style-w2pqh?file=/src/App.js
The current behavior
No aspectRatio rule applied:
https://codesandbox.io/s/react-bug-not-applying-aspect-ratio-via-style-w2pqh?file=/src/App.js
The expected behavior
aspectRatio applied, here I'm adding it via a
useLayoutEffect
:https://codesandbox.io/s/currying-hill-i09qn?file=/src/App.js
The text was updated successfully, but these errors were encountered: