mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
Fix scroll positioning after viewing archive
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import React, { useEffect, useRef, useCallback, useMemo } from 'react';
|
import React, { useRef, useCallback, useMemo, useLayoutEffect } from 'react';
|
||||||
import type { Index, ListRowRenderer } from 'react-virtualized';
|
import type { Index, ListRowRenderer } from 'react-virtualized';
|
||||||
import { List } from 'react-virtualized';
|
import { List } from 'react-virtualized';
|
||||||
import { ScrollBehavior } from '../types/Util';
|
import { ScrollBehavior } from '../types/Util';
|
||||||
@@ -38,12 +38,12 @@ export function ListView({
|
|||||||
}: Props): JSX.Element {
|
}: Props): JSX.Element {
|
||||||
const listRef = useRef<null | List>(null);
|
const listRef = useRef<null | List>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useLayoutEffect(() => {
|
||||||
const list = listRef.current;
|
const list = listRef.current;
|
||||||
if (shouldRecomputeRowHeights && list) {
|
if (shouldRecomputeRowHeights && list) {
|
||||||
list.recomputeRowHeights();
|
list.recomputeRowHeights();
|
||||||
}
|
}
|
||||||
});
|
}, [shouldRecomputeRowHeights]);
|
||||||
|
|
||||||
const rowHeight = useCallback(
|
const rowHeight = useCallback(
|
||||||
(index: Index) => calculateRowHeight(index.index),
|
(index: Index) => calculateRowHeight(index.index),
|
||||||
|
|||||||
Reference in New Issue
Block a user