updated thread component

This commit is contained in:
Ren Amamiya
2023-02-21 16:09:00 +07:00
parent 6f9f55a229
commit 0b28bf4ee8
3 changed files with 69 additions and 3 deletions

View File

@@ -27,6 +27,13 @@ export function Thread({ data }: { data: any }) {
[data]
);
const computeItemKey = useCallback(
(index) => {
return data[index].id;
},
[data]
);
return (
<Virtuoso
data={data}
@@ -35,6 +42,7 @@ export function Thread({ data }: { data: any }) {
EmptyPlaceholder: () => <Placeholder />,
ScrollSeekPlaceholder: () => <Placeholder />,
}}
computeItemKey={computeItemKey}
scrollSeekConfiguration={{
enter: (velocity) => Math.abs(velocity) > 800,
exit: (velocity) => Math.abs(velocity) < 500,