从服务器映射数据的代码:
{
this.state.items.map((item, key) => (
<View style= { styles.row } >
<View style={ [styles.inputWrap, styles.inputWrap2]} >
<TouchableOpacity onPress={ this.FunctionToOpenitempage } >
<Card>
<CardItem>
<Body>
<Image style={{ resizeMode: 'cover' }} source={{
uri: ("http://suburbiya.com/assets/files/item_gallery/" + item.banner_pic)
.replace(" ", "%20")
}} style = { styles.logo1 } />
<Text style={ styles.Text2 }>
{ item.price }
< /Text>
< Text style = { styles.Text2 } >
{ item.name }
< /Text>
< /Body>
< /CardItem></Card >
</TouchableOpacity></View >
</View>
))}
样式编码:
row: {
flexDirection: "row",
flexWrap:"wrap",
inputWrap: {
flex:1,
borderColor: "#cccccc",
borderBottomWidth: 0,
marginBottom: 0,
marginLeft: 2,
justifyContent:"space-between",
},
}