iDa*_*ams 7 javascript css react-native react-native-flatlist
我正在使用不同的节标题渲染多个节.我按照我想要的方式显示它有些麻烦.我想把我的标题放在顶部和下面,该部分的项目作为网格.
使用此代码:
<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.但我不确定这是可能的.
如果有人对此有任何想法,请告诉我!
谢谢!
小智 2
对我们有用的解决方案是强制 renderSectionHeader 具有整个容器的宽度,从而强制渲染项到下一行。
如果您更新您的问题以包含 renderSectionHeader 的内容(正如 NiFi 已经询问的那样),我可以提供有关如何更新 renderSectionHeader 的更详细答案。
| 归档时间: |
|
| 查看次数: |
5073 次 |
| 最近记录: |