Skip to content

Commit 0f84b5b

Browse files
Fix batched rendering when mcvp adjustment changes
1 parent 07785f1 commit 0f84b5b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Libraries/Lists/VirtualizedList.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ export default class VirtualizedList extends StateSafePureComponent<
11251125
}
11261126
}
11271127

1128-
componentDidUpdate(prevProps: Props) {
1128+
componentDidUpdate(prevProps: Props, prevState: State) {
11291129
const {data, extraData} = this.props;
11301130
if (data !== prevProps.data || extraData !== prevProps.extraData) {
11311131
// clear the viewableIndices cache to also trigger
@@ -1147,6 +1147,15 @@ export default class VirtualizedList extends StateSafePureComponent<
11471147
if (hiPriInProgress) {
11481148
this._hiPriInProgress = false;
11491149
}
1150+
1151+
// Make sure to cancel any pending updates if maintainVisibleContentPositionAdjustment
1152+
// changed since they are now invalid.
1153+
if (
1154+
prevState.maintainVisibleContentPositionAdjustment !==
1155+
this.state.maintainVisibleContentPositionAdjustment
1156+
) {
1157+
this._updateCellsToRenderBatcher.dispose({abort: true});
1158+
}
11501159
}
11511160

11521161
_averageCellLength = 0;

0 commit comments

Comments
 (0)