apps/automated/src/ui/layouts/flexbox-layout.md
Using a FlexboxLayout requires the FlexboxLayout module. {%snippet flexbox-layout-require%}
Using the flexbox layout in the NativeScript framework requires the FlexboxLayout view with children.
The FlexboxLayout will automatically serve as if it were a div with { display: flex; }.
Here is a good guide on using flexbox.
The FlexboxLayout implementation is based on existing Apache-2 licensed flexbox implementation hosted on github.com/google/flexbox-layout.
The flexbox properties supported at the moment can be set in JavaScript, the NativeScript markup or in CSS.
The supported properties on the FlexboxLayout container are:
flex by default on the FlexboxLayoutstyle="flex-direction: row;"fb.flexDirection = FlexDirection.ROW<FlexboxLayout flexDirection="row">style="flex-wrap: wrap;"fb.flexWrap = FlexWrap<FlexboxLayout flexWrap="wrap">style="flex-flow: row wrap;"style="justify-content: space-between;"fb.justifyContent = JustifyContent.SPACE_BETWEEN<FlexboxLayout justifyContent = "space-between">style="align-items: stretch;"fb.alignItems = AlignItems.STRETCH<FlexboxLayout alignItems = "stretch">style="align-content: space-between;"fb.alignContent = AlignContent.SPACE_BETWEEN<FlexboxLayout alignContent = "space-between">NOTE: There is a limitation for
align-itemsin iOS, thebaselineoption can not be used.
The supported flexbox properties on child elements are as follow:
style="order: 1;"flexbox.FlexboxLayout.setOrder(child, 1)order="1"style="flex-grow: 1;"flexbox.FlexboxLayout.setFlexGrow(child, 1)flexGrow="1"style="flex-shrink: 1;"flexbox.FlexboxLayout.setFlexShrink(child, 1)flexShrink="1"style="flex: 1 1;"flex-grow, flex-shrink, width or height insteadflexbox.FlexboxLayout.setAlignSelf(child, AlignSelf.STRETCH)<FlexboxLayout><Button alignSelf="stretch" /></FlexboxLayout>style="flex-wrap-before: true"flexbox.FlexboxLayout.setFlexWrapBefore(child, true)<FlexboxLayout><Button flexWrapBefore="true" /></FlexboxLayout>NOTE: There is a limitation for
align-selfin iOS, thebaselineoption can not be used.
{%snippet flexbox-layout-page%}