6

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

4

2 回答 2

18

这就是我所做的:

<SectionList
   renderSectionHeader={({ section }) => (
      section.data.length > 0 ? this._renderHeader(section.title) : (null)
   )}
   ...
/>
于 2019-01-15T19:04:11.450 回答
0
<SectionList>
    renderSectionHeader={({ section: { title, data } }) =>
            data.length > 0 && <Text>{title}</Text>
            }
    ...
</SectionList>
于 2022-02-28T23:16:40.403 回答