From c449d9e72d46f840a70668cfda18ec6e5d7e024d Mon Sep 17 00:00:00 2001 From: Christoph Jerolimov Date: Thu, 25 Feb 2016 17:07:37 -0800 Subject: [PATCH] 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 --- Libraries/CustomComponents/ListView/ListView.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Libraries/CustomComponents/ListView/ListView.js b/Libraries/CustomComponents/ListView/ListView.js index b4931fedb..357994735 100644 --- a/Libraries/CustomComponents/ListView/ListView.js +++ b/Libraries/CustomComponents/ListView/ListView.js @@ -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;