【发布时间】:2017-04-11 16:06:52
【问题描述】:
我正在使用不同的部分标题来呈现多个部分。我在以我想要的方式显示它时遇到了一些麻烦。 我想让我的标题在顶部和下面,该部分的项目作为网格。
使用此代码:
<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"
}
});
所以我希望不能将 sectionListContainer 的 css 应用到 sectionHeader。但我不确定这是否可能。
如果有人对此有任何想法,请告诉我!
谢谢!
【问题讨论】:
-
可以发一下
renderSectionHeader的内容吗?像here 那样为标题和项目使用单独的样式定义是否有问题?从发布的代码来看,您似乎没有这样做。
标签: javascript css react-native react-native-flatlist