Layout and Flexbox
Since Flexbox is the foundation of React Native's layout, we are going to explore it in depth. If you are already familiar with the intricacies of Flexbox, feel free to jump to the Styling the NavigationBar component section. There we will focus more on the styling of the components that we made in the previous chapter.
Flex container
The flex container is the parent element that describes how children or flex items are laid out. The flexDirection
property of the container specifies the main-axis
; the primary direction in which the items are rendered. The line perpendicular to the main-axis
is called the cross-axis
. Different flex properties on the container affect how the items are aligned across each axis. The flexDirection
property has two possible values; row
values for horizontal layouts (left to right) and column
for vertical layouts (top to bottom). The following figure shows the flexDirection
: row
items aligned from left to right:
The next figure shows the items...