From 803a9168f27d9c7c7f5d51e53f6308dc446b9ef8 Mon Sep 17 00:00:00 2001 From: ashoat Date: Thu, 25 May 2017 03:12:04 -0700 Subject: [PATCH] Pass data prop instead of props to _updateViewableItems in _onScroll Summary: This is a simple bugfix. `_updateViewableItems` expects the `data` prop, as it calls `getItemCount` on it. Without this, `onViewableItemsChanged` updates twice for each scroll position, once from `_onScroll` with the incorrect results, and once from `_updateCellsToRender` with the correct results. This means the callback nigh-on unusable. I simply logged the results of `onViewableItemsChanged` and made sure they were correct. Closes https://github.com/facebook/react-native/pull/14162 Differential Revision: D5128363 Pulled By: sahrens fbshipit-source-id: 3faef812068921a26ed871339da79870fd0d911c --- Libraries/Lists/VirtualizedList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index 889aeb445..68aefe40e 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -734,7 +734,7 @@ class VirtualizedList extends React.PureComponent { const dOffset = offset - this._scrollMetrics.offset; const velocity = dOffset / dt; this._scrollMetrics = {contentLength, dt, dOffset, offset, timestamp, velocity, visibleLength}; - this._updateViewableItems(this.props); + this._updateViewableItems(this.props.data); if (!this.props) { return; }