2
我正在使用不同節標題呈現多個部分。我有些麻煩要以我想要的方式顯示它。 我希望將我的標題放置在頂部和底部,作爲網格的部分項目。React native 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"
}
});
所以我希望能夠sectionListContainer的CSS不適用於sectionHeader。但我不確定這是可能的。
如果有人有任何想法,請告訴我!
謝謝!
你可以發佈'renderSectionHeader'的內容嗎?對於標題和項目使用單獨的樣式定義是否存在一些問題(在這裏)(https://facebook.github.io/react-native/docs/sectionlist.html#examples)?從發佈的代碼看來,你並沒有這樣做。 – NiFi