【发布时间】:2020-02-08 19:53:53
【问题描述】:
我正在测试 https://yogalayout.com/playground 并创建了该模板:
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>
);
}
};
我希望得到这样的结果:
相反,我有这个:
什么会破坏我的 flexbox 布局?
【问题讨论】:
-
将
flexDirection: "row"添加到您的父视图
标签: javascript css react-native flexbox react-native-web