我正在查看 react-360 和 react-native 代码,并找到以下有关该View
组件的示例。
class ViewColoredBoxesWithText extends Component {
render() {
return (
<View style={{flexDirection: 'row', height: 100, padding: 20}}>
<View style={{backgroundColor: 'blue', flex: 0.3}} />
<View style={{backgroundColor: 'red', flex: 0.5}} />
<Text>Hello World!</Text>
</View>
);
}
}
为什么子 View 组件会自动关闭,而父 View 组件不会。