Remove React Virtualized from <Timeline>

This commit is contained in:
Evan Hahn 2022-03-03 14:23:10 -06:00 committed by GitHub
parent 1eafe79905
commit 0c31ad25ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 798 additions and 2512 deletions

23
ts/util/scrollUtil.ts Normal file
View file

@ -0,0 +1,23 @@
// Copyright 2021-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
export const getScrollBottom = (
el: Readonly<Pick<HTMLElement, 'clientHeight' | 'scrollHeight' | 'scrollTop'>>
): number => el.scrollHeight - el.scrollTop - el.clientHeight;
export function setScrollBottom(
el: Pick<HTMLElement, 'clientHeight' | 'scrollHeight' | 'scrollTop'>,
newScrollBottom: number
): void {
// We want to mutate the parameter here.
// eslint-disable-next-line no-param-reassign
el.scrollTop = el.scrollHeight - newScrollBottom - el.clientHeight;
}
export function scrollToBottom(
el: Pick<HTMLElement, 'scrollHeight' | 'scrollTop'>
): void {
// We want to mutate the parameter here.
// eslint-disable-next-line no-param-reassign
el.scrollTop = el.scrollHeight;
}