在SectionList中,如何隐藏空节的节标题(数据:[])

时间:2018-11-28 12:28:05

标签: list react-native header sectionheader react-native-sectionlist

我正在使用react-native的SectionList,并且无法隐藏数据集中空白部分的sectionheaders。我只想显示部分标题和不为空的部分行。

1 个答案:

答案 0 :(得分:2)

这就是我所做的:

<SectionList
   renderSectionHeader={({ section }) => (
      section.data.length > 0 ? this._renderHeader(section.title) : (null)
   )}
   ...
/>
相关问题