Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In a SectionList how do i hide the section header of an empty section (data:[])

I'm using react-native's SectionList and can't hide the sectionheaders of the empty sections of my dataset. I want to show only the section headers and the rows of the sections that are not empty.

like image 415
Genesy91 Avatar asked Dec 06 '22 10:12

Genesy91


1 Answers

This is what I did:

<SectionList
   renderSectionHeader={({ section }) => (
      section.data.length > 0 ? this._renderHeader(section.title) : (null)
   )}
   ...
/>
like image 178
Andre Simon Avatar answered Dec 31 '22 13:12

Andre Simon