Skip to content

Commit acd0bc9

Browse files
author
Clauderic Demers
committed
fix: 🐞 related to nextProps.estimatedItemSize not being properly passed down
1 parent 7e94213 commit acd0bc9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default class VirtualList extends PureComponent {
3838
sizeAndPositionManager = new SizeAndPositionManager({
3939
itemCount: this.props.itemCount,
4040
itemSizeGetter: ({index}) => this.getSize(index),
41-
estimatedItemSize: this.props.estimatedItemSize || typeof this.props.itemSize === "number" && this.props.itemSize || 50,
41+
estimatedItemSize: this.getEstimatedItemSize(),
4242
});
4343

4444
state = {
@@ -90,7 +90,7 @@ export default class VirtualList extends PureComponent {
9090
) {
9191
this.sizeAndPositionManager.updateConfig({
9292
itemCount: nextProps.itemCount,
93-
estimatedItemSize: nextProps.itemSize,
93+
estimatedItemSize: this.getEstimatedItemSize(nextProps),
9494
});
9595
}
9696

@@ -131,6 +131,10 @@ export default class VirtualList extends PureComponent {
131131
}
132132
};
133133

134+
getEstimatedItemSize(props = this.props) {
135+
return props.estimatedItemSize || typeof props.itemSize === "number" && props.itemSize || 50;
136+
}
137+
134138
getNodeOffset() {
135139
const {scrollDirection} = this.props;
136140
return this.rootNode[scrollProp[scrollDirection]];

0 commit comments

Comments
 (0)