【发布时间】:2023-03-06 18:50:01
【问题描述】:
在我的 ReactNative 应用程序中,我试图为一组项目实现两列布局。
我正在处理的代码:
<Content>
<Grid style={{flexWrap: 'wrap', flex: 1}}>
{this.state.stories.map(function(story, index){
if (index % 2 === 0) {
return <Col key={ index } style={{margin: 5, width: Dimensions.get('window').width / 2.2}}>
<View>
<Image style={{ height: 250, borderRadius: 10}} source={{uri: story.picture_url}} />
</View>
</Col>
} else{
return <Col key={ index } style={{margin: 5, width: Dimensions.get('window').width / 2.2}}>
<View style={{marginTop: 25}}>
<Image style={{height: 250, borderRadius: 10}} source={{uri: story.picture_url}} />
</View>
</Col>
}
}.bind(this))
}
</Grid>
</Content>
我做错了什么?
【问题讨论】:
-
删除
flexWrap: wrap -
不,它不起作用。我刚试过。
-
那么您可能想更好地解释什么不起作用,它的外观以及它应该是什么样子
标签: reactjs mobile react-native flexbox