Default flexDirection should be 'row', not 'column'
See original GitHub issueThe default style value for flexDirection
is 'column'
.
According to the specs (referenced in LayoutPropTypes.js), it should be 'row'
.
React Native version: 0.24.1 Device: Android (Genymotion)
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
flex-direction - CSS: Cascading Style Sheets - MDN Web Docs
The flex-direction CSS property sets how flex items are placed in the flex container defining the main axis and the direction (normal or ......
Read more >flex-direction
The flex-direction property is a sub-property of the Flexible Box Layout module. It establishes the main-axis, thus defining the direction ...
Read more >flex-direction: row is not working; it's still displaying as a ...
My problem is that I do not know why "flex-direction: row;" won't change the nav bar to fit side by side. .top-nav li...
Read more >CSS | flex-direction Property
row :It arrange the row same as text direction .The default value of flex-direction is row. It is used to specify that the...
Read more >Layout with Flexbox
The defaults are different, with flexDirection defaulting to column instead of row , alignContent defaulting to flex-start instead of ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I tried to document the decisions behind the default values here and a css reset you can use on your web projects to have the same behavior: https://github.com/facebook/css-layout/blob/master/README.md
For the default row, I have never understood why this choice was made in CSS, it doesn’t make any sense to me. The only reason I can think of is that the original use cases where flexbox was designed for were things that normal css doesn’t work and involve horizontal things maybe?
If you are not convinced that this is a good choice, look at the number of View you output in your app and the number of flexDirection: ‘row’. The second number is likely ridiculously small.
Imho it’s okay to not care about specs, but only if there is a good reason. Otherwise what’s the point of using the Flexbox model if we can’t rely on our existing knowledge? In any case, it would be good to provide the default values in the docs then.