percentage support for transform translate
See original GitHub issueDescription
3f49e74 added support for percentages in some style properties, and its awesome. we should also have support for transform translates.
Reproduction
I want to absolutely position a view and center it vertically.
I can now do top: '50%'
, but thats not centered. To make it centered I would also need transform: [{translateY: '50%'}]
.
Solution
Add support for percentages for translates
Additional Information
- React Native version: 0.42.3
- Platform: iOS
- Development Operating System: MacOS
- Dev tools: Xcode
Issue Analytics
- State:
- Created 6 years ago
- Reactions:28
- Comments:25 (4 by maintainers)
Top Results From Across the Web
translate() - CSS: Cascading Style Sheets - MDN Web Docs
This value describes two <length> or <percentage> values representing both the abscissa (x-coordinate) and the ordinate (y-coordinate) of the ...
Read more >Translate X and Y percentage values based on elements ...
CSS translation by percentage takes the % of the element that is being translated to figure the distance to move. It does not...
Read more >CSS transform translate seems to only work with pixels ...
css > transform > translateY seems to only work with pixel values and ... Percentage-based transforms are based on the size of the...
Read more >Forums - CSS - transform translate percentages and Android
This is odd, since transform percentages are specified as relating to the full box model of the element being transformed — and computed...
Read more >Transforms
Transforms are style properties that will help you modify the appearance and position of your components using 2D or 3D transformations.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
i think it is important, since we have percentages for the top-level styles, to also have it for transforms.
Example Workaround with RN onLayout event: