mirror of
https://github.com/status-im/react-native.git
synced 2025-01-28 18:25:06 +00:00
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
This commit is contained in:
parent
4b89a4ac20
commit
b2179ebedf
@ -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(
|
||||
<View key={'s_' + comboID}>
|
||||
{separator}
|
||||
</View>
|
||||
);
|
||||
totalIndex++;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user