小编iDa*_*ams的帖子

反应原生SectionList布局

我正在使用不同的节标题渲染多个节.我按照我想要的方式显示它有些麻烦.我想把我的标题放在顶部和下面,该部分的项目作为网格.

这就是我现在所拥有的

使用此代码:

<SectionList
        contentContainerStyle={styles.sectionListContainer}
        renderItem={this.renderItem}
        keyExtractor={this.getKey}
        renderSectionHeader={this.renderSectionHeader}
        shouldItemUpdate={this.shouldItemUpdate}
        sections={[
          { data: mostViewedArray, key: "most_viewed", title: "Most viewed" },
          { data: recentlyArray, key: "recently", title: "Recently" }
        ]}
      />



const styles = StyleSheet.create({
   sectionListContainer: {
     flex: 1,
     flexDirection: "row",
     flexWrap: "wrap",
     justifyContent: "space-between"
   }
});
Run Code Online (Sandbox Code Playgroud)

所以我希望能够不将sectionListContainer的css应用于sectionHeader.但我不确定这是可能的.

如果有人对此有任何想法,请告诉我!

谢谢!

javascript css react-native react-native-flatlist

7
推荐指数
1
解决办法
5073
查看次数