Skip to content

Commit

Permalink
Content height listener issue fix
Browse files Browse the repository at this point in the history
  • Loading branch information
manish.patwari committed Oct 1, 2020
1 parent 557d938 commit 4c9565e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 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": "3.0.7",
"version": "3.0.8",
"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
9 changes: 5 additions & 4 deletions src/core/RecyclerListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ export default class RecyclerListView<P extends RecyclerListViewProps, S extends
}

private _checkAndChangeLayouts(newProps: RecyclerListViewProps, forceFullRender?: boolean): void {
const { height: oldContentHeight, width: oldContentWidth } = this.getContentDimension();
this._params.isHorizontal = newProps.isHorizontal;
this._params.itemCount = newProps.dataProvider.getSize();
this._virtualRenderer.setParamsAndDimensions(this._params, this._layout);
Expand Down Expand Up @@ -444,6 +445,10 @@ export default class RecyclerListView<P extends RecyclerListViewProps, S extends
this._refreshViewability();
}
}
const {height: newContentHeight, width: newContentWidth} = this.getContentDimension();
if (this.props.onSizeChange && (oldContentHeight !== newContentHeight || oldContentWidth !== newContentWidth)) {
this.props.onSizeChange(this.getRenderedSize(), this.getContentDimension());
}
}

private _refreshViewability(): void {
Expand Down Expand Up @@ -484,7 +489,6 @@ export default class RecyclerListView<P extends RecyclerListViewProps, S extends
this._refreshViewability();
}
}

if (this.props.onSizeChange) {
this.props.onSizeChange(this.getRenderedSize(), this.getContentDimension());
}
Expand Down Expand Up @@ -619,9 +623,6 @@ export default class RecyclerListView<P extends RecyclerListViewProps, S extends
}
this._queueStateRefresh();
}
if (this.props.onSizeChange) {
this.props.onSizeChange(this.getRenderedSize(), this.getContentDimension());
}
}

private _checkExpectedDimensionDiscrepancy(itemRect: Dimension, type: string | number, index: number): void {
Expand Down

0 comments on commit 4c9565e

Please sign in to comment.