Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,17 @@ export function RawList<T>(props: ListProps<T>, ref: React.Ref<ListRef>) {
const changedRecord = heights.getRecord();
if (changedRecord.size === 1) {
const recordKey = Array.from(changedRecord)[0];
const startIndexKey = getKey(mergedData[start]);
if (startIndexKey === recordKey) {
const realStartHeight = heights.get(recordKey);
const diffHeight = realStartHeight - itemHeight;
syncScrollTop((ori) => {
return ori + diffHeight;
});
// Quick switch data may cause `start` not in `mergedData` anymore
const startItem = mergedData[start];
if (startItem) {
const startIndexKey = getKey(startItem);
if (startIndexKey === recordKey) {
const realStartHeight = heights.get(recordKey);
const diffHeight = realStartHeight - itemHeight;
syncScrollTop((ori) => {
return ori + diffHeight;
});
}
}
}

Expand Down