gpt4 book ai didi

react-native - React Native 异构节列表

转载 作者:行者123 更新时间:2023-12-04 15:52:28 27 4
gpt4 key购买 nike

有没有人有更详细的异构渲染示例
节列表?

<SectionList
sections={[ // heterogeneous rendering between sections
{data: [...], key: ..., renderItem: ...},
{data: [...], key: ..., renderItem: ...},
{data: [...], key: ..., renderItem: ...},
]}
/>

非常感谢帮助!

最佳答案

这是我如何能够为 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}
/>

注意:onAirShowsoffAirShows是一个数组

关于react-native - React Native 异构节列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44782268/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com