首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >React本机异构节列表

React本机异构节列表
EN

Stack Overflow用户
提问于 2017-06-27 21:59:21
回答 1查看 2.8K关注 0票数 4

有没有人有更详细的SectionLists异构渲染示例?

代码语言:javascript
复制
<SectionList
  sections={[ // heterogeneous rendering between sections
      {data: [...], key: ..., renderItem: ...},
      {data: [...], key: ..., renderItem: ...},
      {data: [...], key: ..., renderItem: ...},
  ]}
/>

非常感谢您的帮助!

EN

回答 1

Stack Overflow用户

发布于 2017-07-25 21:29:33

下面是我如何为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是一个数组

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44782268

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档