Layout with Flexbox in React Native part-1
The Flexbox layout mechanism gives you an ability how you can construct the component in the layout. The Flexbox will solve the layout challenges. You can also use Flexbox with multiple components. Flexbox is also used to layout multiple items within the container as well.
So let’s see how we use Flexbox layout in the React Native app. Now let’s add the justifyContent property in the Flexbox. justifyContent have multiple values as listed below:
The Default behaviours of Flexbox is shown in the below diagram. And the JSX is like
It’s basically left align and vertical(column) direction.
When add justifyContent: ‘flex-end’, the all content will shift down to bottom.
When adding justifyContent: ‘center’, all content will shift to the center of the layout.
If we add justifyContent: ‘space-between’, then the Flexbox will add equally space between all the elements. So the container takes all the elements and adds maximum equalize space between each element.
The first item is at the very top of a container and the last item is at very bottom of the container and then all the space in between the intermediate items is equalized so they are completely equal in between their last space around as much like space between.
Space around as much like space between but it also allocates item to the very the head of the very first item and after the very last item as well.
So, in theory, each of these white spaces in here one two three and four should be completely equal whenever we’re using space around.
We see the other property of Flexbox in next article.
Thanks for reading this article. Be sure to 👏 recommend as much as you can and also share with your friends. It means a lot to me.