feat: lots updates

This commit is contained in:
zerosoul
2022-03-10 10:30:38 +08:00
parent e6f5b6e428
commit d497e7df4f
22 changed files with 415 additions and 174 deletions
+24
View File
@@ -0,0 +1,24 @@
// import React from "react";
import { VariableSizeList as List } from "react-window";
import Message from "../../common/component/Message";
export default function MessageList({ messages = [] }) {
const Row = ({ index, style }) => (
<div style={style}>
<Message {...messages[index]} />
</div>
);
const getItemSize = (index) =>
messages[index].content_type.startsWith("image") ? 150 : 56;
return (
<List
height={window.innerHeight - 56}
width={"100%"}
itemCount={messages.length}
itemSize={getItemSize}
// estimatedItemSize={56}
>
{Row}
</List>
);
}