DEV Community

Sujith V S
Sujith V S

Posted on • Edited on

2 1 1 1 1

React Native flex-box concepts

  • By default every view in react native uses flexbox.

  • BY default every view organizes its children in a column.

  • if we add height and width in the parent view, the child element will align themself along the cross axis by stretching.
    eg: if the main axis is row, then all the child element will take the height of the parent and the width has no impact.
    So inorder to give width to the child elements, we can use flex property.flex property works along main axis.

  • The default value of alignItems is 'stretch'.

  • flexDirection - values: row, column, row-reverse, column-reverse.

  • justifyContent(to organize elements along main axis.) - values: center, flex-end, flex-start, space-between, space-around

  • alignItems(to organize elements along cross axis.)

  • For child elements.
    flex - flex will define how your items are going to “fill” over the available space along your main axis. Space will be divided according to each element's flex property.

Read more about react native flebox

Image of Datadog

Master Mobile Monitoring for iOS Apps

Monitor your app’s health with real-time insights into crash-free rates, start times, and more. Optimize performance and prevent user churn by addressing critical issues like app hangs, and ANRs. Learn how to keep your iOS app running smoothly across all devices by downloading this eBook.

Get The eBook

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay