Fix List View _updateVisibleRows firing for all row component at view loading time issue

Summary:
Sometimes list view row components(even the ones unseen) have a frame but its x and y is 0 or uninitialized at view loading time, which will lead to _updateVisibleRows firing for all the row components incorrectly at loading time.
This is to make the code more defensive.

Reviewed By: sahrens

Differential Revision: D3308515

fbshipit-source-id: 0e30fdf10345629bfd9de3fe0ad641bb1903fe00
This commit is contained in:
Yu Huang 2016-05-16 18:18:58 -07:00 committed by Facebook Github Bot 5
parent 0c40f96c32
commit 34907c3810
1 changed files with 3 additions and 0 deletions

View File

@ -602,6 +602,9 @@ var ListView = React.createClass({
var rowVisible = visibleSection[rowID];
var min = isVertical ? frame.y : frame.x;
var max = min + (isVertical ? frame.height : frame.width);
if ((!min && !max) || (min === max)) {
break;
}
if (min > visibleMax || max < visibleMin) {
if (rowVisible) {
visibilityChanged = true;