From da38d823186e89f1f3c0254be987ba2c9303e059 Mon Sep 17 00:00:00 2001 From: Andrew Ho Date: Thu, 4 May 2017 13:13:36 -0700 Subject: [PATCH] Fixes multiple lists I had a list of multiple virtual lists, and when the first list was scrolled over, it continued to update, and resulted in an infinite scrollbar --- src/VirtualList.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/VirtualList.js b/src/VirtualList.js index dc87a5c..75d849e 100644 --- a/src/VirtualList.js +++ b/src/VirtualList.js @@ -49,6 +49,8 @@ const VirtualList = (options, mapVirtualToProps = defaultMapToVirtualProps) => ( setStateIfNeeded(list, container, items, itemHeight, itemBuffer) { // get first and lastItemIndex const state = getVisibleItemBounds(list, container, items, itemHeight, itemBuffer); + + if (state.firstItemIndex > state.lastItemIndex) { return; } if (state !== undefined && (state.firstItemIndex !== this.state.firstItemIndex || state.lastItemIndex !== this.state.lastItemIndex)) { this.setState(state);