React Native-flex Layout

Source: Internet
Author: User

React Native-flex Layout
Basic concept of flex Layout

Flex is the abbreviation of Flexible Box, meaning "elastic layout", used to provide maximum flexibility for the Box model. Elements in a flex layout are called flex containers ". All its child elements automatically become container members, known as flex items ".

  

 

By default, the container has two axes: main axis and cross axis ). The starting position (intersection with the border) of the spindle is called main start, and the ending position is called main end. The starting position of the cross axis is called cross start, and the ending position is called cross end. Projects are arranged along the main axis by default. The main axis space occupied by a single project is called main size, and the cross axis space occupied is called cross size. Container properties:

FlexDirection: The layout direction, which determines the direction of the spindle. The default value is column, that is, the vertical layout.

Row | horizontal layout, with the spindle in the horizontal direction

 


Column "vertical layout, the spindle is vertical
Examples/qrbLPC9wPg0KPHA + Y2VudGVyo7rW99bhtcTW0LzkzrvWwzxiciAvPg0KPGltZyBhbHQ9 "here write picture description" src = "http://www.bkjia.com/uploads/allimg/160416/043430J12-3.png" title = "\"/>

Flex-end: the end position of the spindle

Space-between: insert gaps of the same distance between the project and the project

Space-around: insert gaps of the same distance on both sides of the project

AlignItems: Specifies the cross-axis direction alignItems. The default value is flex-start, that is, the start of the Cross-axis.

Flex-start: the beginning of the Cross-Axis

Center: the center of the cross axis

Flex-end: the end position of the cross axis

FlexWrap: contains content. The default value is nowrap. It does not enclose all content.

Nowrap: no package content

Wrap: Package content

Flex: Layout weight
Projects with 0 flex = 0 occupy only the space required for the content. Projects with flex = 1 occupy all the remaining space.

1:1

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.