Height and Width
A component's height and width determine its size on the screen.
The general way to set the dimensions of a component is by adding a fixed
height to style. All dimensions in React Native are unitless, and represent density-independent pixels.
Setting dimensions this way is common for components whose size should always be fixed to a number of points and not calculated based on screen size.
There is no universal mapping from points to physical units of measurement. This means that a component with fixed dimensions might not have the same physical size, across different devices and screen sizes. However, this difference is unnoticable for most use cases.
flex in a component's style to have the component expand and shrink dynamically based on available space. Normally you will use
flex: 1, which tells a component to fill all available space, shared evenly amongst other components with the same parent. The larger the
flex given, the higher the ratio of space a component will take compared to its siblings.
A component can only expand to fill available space if its parent has dimensions greater than
0. If a parent does not have either a fixed
flex, the parent will have dimensions of
flexchildren will not be visible.
After you can control a component's size, the next step is to learn how to lay it out on the screen.
If you want to fill a certain portion of the screen, but you don't want to use the
flex layout, you can use percentage values in the component's style. Similar to flex dimensions, percentage dimensions require parent with a defined size.