有没有人有更详细的异构渲染示例 SectionLists?
<SectionList
sections={[ // heterogeneous rendering between sections
{data: [...], key: ..., renderItem: ...},
{data: [...], key: ..., renderItem: ...},
{data: [...], key: ..., renderItem: ...},
]}
/>
非常感谢!
答案 0 :(得分:4)
以下是我如何能够为SectionLists实现异构呈现的示例摘录
所以这就是我的sectionsData
数组看起来像
const sectionsData = {
key: 'On Air',
data: onAirShows,
renderItem: ({item}) => <View><Text>{item}</Text></View> //This is what you want this particular section to look like
},
{
key: 'Off Air',
data: offAirShows,
renderItem: this._renderOffAirItems //Same thing for here. You can define it as a helper method and call it here like so
}
<SectionList
data={sectionsData}
/>
注意:onAirShows
和offAirShows
是一个数组