Fix crash with empty section headers

Summary: It's ok for them to be empty, so we should check!

Reviewed By: yungsters

Differential Revision: D4664411

fbshipit-source-id: c66e98458708eee59757fa665b3a05972f1c1b70
This commit is contained in:
Spencer Ahrens 2017-03-06 21:16:55 -08:00 committed by Facebook Github Bot
parent 7005f54ab5
commit 28b43aa05c
1 changed files with 10 additions and 9 deletions

View File

@ -430,15 +430,16 @@ var ListView = React.createClass({
} }
if (renderSectionHeader) { if (renderSectionHeader) {
bodyComponents.push(React.cloneElement( const element = renderSectionHeader(
renderSectionHeader( dataSource.getSectionHeaderData(sectionIdx),
dataSource.getSectionHeaderData(sectionIdx), sectionID
sectionID );
), if (element) {
{key: 's_' + sectionID}, bodyComponents.push(React.cloneElement(element, {key: 's_' + sectionID}));
)); if (this.props.stickySectionHeadersEnabled) {
if (this.props.stickySectionHeadersEnabled) { stickySectionHeaderIndices.push(totalIndex);
stickySectionHeaderIndices.push(totalIndex++); }
totalIndex++;
} }
} }