Summary: Move yoga docs into master branch so that pull requests are able to include doc updates as part of other changes. Reviewed By: JoelMarcey Differential Revision: D4365700 fbshipit-source-id: 2f46a88974104c454c00bcdf1257abb5c4075a68
2.3 KiB
2.3 KiB
docid, title, layout, permalink
docid | title | layout | permalink |
---|---|---|---|
aspect-ratio | Aspect ratio | docs | /docs/aspect-ratio/ |
AspectRatio
is a property introduced by Yoga. AspectRatio
solves the problem of knowing one dimension of an element and an aspect ratio, this is very common when it comes to videos, images, and other media types. AspectRatio
accepts any floating point value > 0, the default is undefined. AspectRatio
can apply to either the width or the height of an item, it depends on which dimension is fixed. AspectRatio
Also respects the Min
and Max
dimensions of an item.
- If an item has a
Width
set thenAspectRatio
controls the item's height. - If an item has a
Height
set thenAspectRatio
controls the item's width. - If an item has a
FlexBasis
set thenAspectRatio
controls the item's cross axis dimension. - If an item's alignment is
Stretch
and its main axis is undefined thenAspectRatio
controls the item's main axis dimension. - If an item has
FlexGrow
orFlexShrink
set thenAspectRatio
controls the item's cross axis dimension if it is undefined. - If both dimensions of an item are fixed then
AspectRatio
is ignored.