在React Native中连续执行带有两个项目的SectionList部分

时间:2019-05-17 11:04:09

标签: react-native react-native-sectionlist

我已经使用Flatlist通过使用Horizo​​ntal属性并将numColumns设置为2来实现行中的两个项目,并且效果很好。我有大约80个项目的数组,根据研究,Flatlist不应用于大于10的项目数组。相反,出于对我有意义的几个原因,应该使用SectionList。 我试图在SectionList中实现它,但它不起作用。 它是我的整个部分,列表是水平的还是垂直的。

这是我的部分列表代码

<SectionList
            stickySectionHeadersEnabled={false}
            renderItem={ ({item, index, section}) => <Card data={item}/> }
           renderSectionHeader={({section: {title}}) => (
                  <Text style={globalStyles.sectionHeader}>{title}</Text>
                            )}
           sections={[
                  { title: this.props.titled, data: this.state.datas },
                            ]}
                  keyExtractor={(item, index) => item + index}
                  numColumns={2}
                  horizontal={false}

  />

对于解决此问题的任何想法,请多加赞赏。

0 个答案:

没有答案
相关问题