Skip to content

Commit

Permalink
relayoutReqIndex mismatches with dataProvider length (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
inayat1 authored and naqvitalha committed Jul 30, 2019
1 parent a707a7f commit a796ad4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "recyclerlistview",
"version": "2.0.8",
"version": "2.0.9",
"description": "The listview that you need and deserve. It was built for performance, uses cell recycling to achieve smooth scrolling.",
"main": "dist/reactnative/index.js",
"types": "dist/reactnative/index.d.ts",
Expand Down
3 changes: 2 additions & 1 deletion src/core/RecyclerListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,8 @@ export default class RecyclerListView<P extends RecyclerListViewProps, S extends
} else if (this._relayoutReqIndex >= 0) {
const layoutManager = this._virtualRenderer.getLayoutManager();
if (layoutManager) {
layoutManager.relayoutFromIndex(this._relayoutReqIndex, newProps.dataProvider.getSize());
const dataProviderSize = newProps.dataProvider.getSize();
layoutManager.relayoutFromIndex(Math.min(Math.max(dataProviderSize - 1, 0), this._relayoutReqIndex), dataProviderSize);
this._relayoutReqIndex = -1;
this._refreshViewability();
}
Expand Down

0 comments on commit a796ad4

Please sign in to comment.