React Native Styling : Learn about axis

Tasnuva MehnazTasnuva Mehnaz
1 min read

We use justifyContent and alignItems when we design our web applications through CSS. But what exactly are they?

justifyContent is a property which helps to align the flexible container's items when the items don't take all the space of the main axis . As the default value of the flex direction is row , the main axis of a web page is the horizontal axis .

alignItems does the same thing justifyContent do , but it helps to align items on the cross axis , which in web is the vertical axis.

But in the React Native, they don't work like web. Because in React Native Design,the design flow direction is by default column. So the elements we add in our React Native design, goes from top to bottom in the screen. So here, the main axis is the vertical axis, and the cross axis is the horizontal axis.

0
Subscribe to my newsletter

Read articles from Tasnuva Mehnaz directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Tasnuva Mehnaz
Tasnuva Mehnaz