Skip to content

Commit 0aea74e

Browse files
dmueller39Facebook Github Bot 8
authored andcommitted
Fixed incorrect rows reported in onChangeVisibleRows
Summary: There is a bug in onChangeVisibleRows when the renderSeparator is not null. The _updateVisibleRows function does not account for the presence of separator frames in the _childFrames array. When renderSeparator is not null, increment the totalIndex an additional time for each row that isn't the last in its section, or the last in the entire list. This continues a slightly brittle precedent of having a set of parallel conditions in render and _updateVisibleRows. (i.e. renderSectionHeader is used in both functions, in render as a condition to create a sectionHeader, and in _updateVisibleRows as a condition to increment the totalIndex. Before change: ![yeeqnmvmif](https://cloud.githubusercontent.com/assets/9422359/14515342/38543952-01c7-11e6-984c-7c1a3fc3d820.gif) After change: ![gzbrljclzm](https://cloud.githubusercontent.com/assets/9422359/14515340/3296e294-01c7-11e6-8ae9-1ad313600956.gif) Built using https://gist.github.com/dmueller39/f95028f6fe8bd251944bb604e51f18b2 Closes #6965 Differential Revision: D3328001 Pulled By: vjeux fbshipit-source-id: 977e54382ee07be7a432a54febafcae6acaae905
1 parent d6c2f5f commit 0aea74e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Libraries/CustomComponents/ListView/ListView.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,10 @@ var ListView = React.createClass({
596596
var rowID = rowIDs[rowIdx];
597597
var frame = this._childFrames[totalIndex];
598598
totalIndex++;
599+
if(this.props.renderSeparator &&
600+
(rowIdx !== rowIDs.length - 1 || sectionIdx === allRowIDs.length - 1)){
601+
totalIndex++;
602+
}
599603
if (!frame) {
600604
break;
601605
}

0 commit comments

Comments
 (0)