反应本机卡水平scrollView和/或FlatList

时间:2018-08-23 03:25:35

标签: react-native

早上好,我一直在尝试为我的Card创建一个滚动条,其中包含4格的图像。 卡很好,但是scrollView使所有东西都水平 您是否建议我从React-Native-element导入Card?

`{

[File Content Replacer] Applying replacement "\\Server675X\Shared\Artifactory\" to lines matched by pattern "(?<=key="MappingFileLocation" value=").*(?="\/>)" in the files matched by wildcard: **/SolutionName/App.config...

[File Content Replacer] Error replacing "(?<=key="MappingFileLocation" value=").*(?="\/>)" with "\\Server675X\Shared\Artifactory\": string index out of range: 32. Check your settings.

[File Content Replacer] Error replacing file contents: string index out of range: 32

`

1 个答案:

答案 0 :(得分:1)

我从您的问题中了解到,您有多张图像,需要连续排列4张图像,然后换行,然后在下一行再包装4张,依此类推。

所以我建议 flatlist 。尝试以下代码,

renderCard = item => {
  <Card image={item} />
}

render() {
  <FlatList
    data={this.state.data}
    renderItem={(item) => this.renderCard(item)}
    horizontal={false}
    noOfColumns={4}
  />
}