Reputation: 14353
I am testing https://yogalayout.com/playground and have created that template:
import React, {Component} from 'react';
import {View} from 'react-native';
export default class MyLayout extends Component {
render() {
return (
<View style={{
flex: 1,
width: 500,
height: 500,
justifyContent: 'space-between',
backgroundColor: 'red',
}}>
<View style={{
flex: 1,
width: 100,
height: 100,
backgroundColor: 'blue',
}} />
<View style={{
flex: 1,
width: 100,
height: 100,
backgroundColor: 'green',
}} />
<View style={{
flex: 1,
width: 100,
height: 100,
backgroundColor: 'purple',
}} />
</View>
);
}
};
I expect to have this result:
Instead, I have this:
What could have break my flexbox layout?
Upvotes: 0
Views: 138
Reputation: 4540
The default flexDirection
is column
in React Native. So, try setting it to row
in your container View
.
<View style={{
flex: 1,
width: 500,
height: 500,
justifyContent: 'space-between',
backgroundColor: 'red',
flexDirection: "row"
}}>
.
.
.
Upvotes: 1