1

这里的示例中,我想知道当项目不能放入一个时,是否可以将它们浮动到新行中?

<View style={{flex: 1, flexDirection: 'row'}}>
  <View style={{width: 50, height: 50, backgroundColor: 'powderblue'}} />
  <View style={{width: 50, height: 50, backgroundColor: 'skyblue'}} />
  <View style={{width: 50, height: 50, backgroundColor: 'steelblue'}} />
  <View style={{width: 50, height: 50, backgroundColor: 'red'}} />
  <View style={{width: 50, height: 50, backgroundColor: 'green'}} />
  <View style={{width: 50, height: 50, backgroundColor: 'blue'}} />
</View>

blue彩色项目应在新行中。flexbox可以吗?

4

1 回答 1

3

应用于flexWrap根容器样式。

<View style={{flex: 1, flexDirection: 'row', flexWrap: 'wrap'}}>
于 2017-03-30T13:26:30.553 回答