Support virtualization and onViewableItemsChanged for nested, same-orientation VirtualizedLists

Reviewed By: sahrens

Differential Revision: D6330846

fbshipit-source-id: c555f4d449b75753befbd376dbf4e6fb4812fa75
This commit is contained in:
Logan Daniels
2017-12-18 13:16:04 -08:00
committed by Facebook Github Bot
parent d2dc451407
commit 2668dc8e1b
2 changed files with 277 additions and 25 deletions

View File

@@ -114,6 +114,15 @@ function computeWindowedRenderLimits(
);
const overscanEnd = Math.max(0, visibleEnd + leadFactor * overscanLength);
const lastItemOffset = getFrameMetricsApprox(itemCount - 1).offset;
if (lastItemOffset < overscanBegin) {
// Entire list is before our overscan window
return {
first: Math.max(0, itemCount - 1 - maxToRenderPerBatch),
last: itemCount - 1,
};
}
// Find the indices that correspond to the items at the render boundaries we're targetting.
let [overscanFirst, first, last, overscanLast] = elementsThatOverlapOffsets(
[overscanBegin, visibleBegin, visibleEnd, overscanEnd],