Fix an issue (Sticky header index was outside the range) when renderSeparator is defined but returns null

Summary:Fix an issue when using ListView and define `renderSeparator` but the implementation returns null.

In such cases the sectionHeaderIndices mismatch the child element index and the app shows a warning like "Sticky header index 18 was outside the range {0, 13}".
Closes https://github.com/facebook/react-native/pull/5800

Differential Revision: D2980005

Pulled By: vjeux

fb-gh-sync-id: cd2d51d83698ed189bb65ea40b7b073644136b49
shipit-source-id: cd2d51d83698ed189bb65ea40b7b073644136b49
This commit is contained in:
Christoph Jerolimov
2016-02-25 17:07:37 -08:00
committed by facebook-github-bot-7
parent a9846da9fa
commit c449d9e72d

View File

@@ -394,8 +394,10 @@ var ListView = React.createClass({
rowID,
adjacentRowHighlighted
);
bodyComponents.push(separator);
totalIndex++;
if (separator) {
bodyComponents.push(separator);
totalIndex++;
}
}
if (++rowCount === this.state.curRenderedRowsCount) {
break;