From b2179ebedf719772187839e065195b8096b3233c Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Thu, 2 Feb 2017 19:50:04 -0800 Subject: [PATCH] RN: Fix `renderSeparator` in ListView Summary: Couple fixes to `ListView`'s `renderSeparator`: - Add a `key` by default. - //Actually// avoid rendering the last separator. Reviewed By: sahrens Differential Revision: D4502732 fbshipit-source-id: 7502984cfb8652a22d8b85859e62ccf6e61c9b0e --- Libraries/CustomComponents/ListView/ListView.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Libraries/CustomComponents/ListView/ListView.js b/Libraries/CustomComponents/ListView/ListView.js index 78a8d516e..86ca2659e 100644 --- a/Libraries/CustomComponents/ListView/ListView.js +++ b/Libraries/CustomComponents/ListView/ListView.js @@ -40,6 +40,7 @@ var ScrollView = require('ScrollView'); var ScrollResponder = require('ScrollResponder'); var StaticRenderer = require('StaticRenderer'); var TimerMixin = require('react-timer-mixin'); +var View = require('View'); var cloneReferencedElement = require('react-clone-referenced-element'); var isEmpty = require('isEmpty'); @@ -465,7 +466,8 @@ var ListView = React.createClass({ totalIndex++; if (this.props.renderSeparator && - (rowIdx !== rowIDs.length - 1 || sectionIdx === allRowIDs.length - 1)) { + rowIdx !== rowIDs.length - 1 && + sectionIdx === allRowIDs.length - 1) { var adjacentRowHighlighted = this.state.highlightedRow.sectionID === sectionID && ( this.state.highlightedRow.rowID === rowID || @@ -477,7 +479,11 @@ var ListView = React.createClass({ adjacentRowHighlighted ); if (separator) { - bodyComponents.push(separator); + bodyComponents.push( + + {separator} + + ); totalIndex++; } }