在我的ReactNative應用程序中,我試圖爲一組項目實現兩列布局。ReactNative iOS應用程序中的兩列布局
的代碼我的工作:
<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' – LGSon
沒有它不工作。我剛剛嘗試過。 – Karan
然後,您可能想要更好地解釋_哪些不工作_,它看起來如何以及它看起來應該是什麼樣子 – LGSon