style: update scrollToBottom

pull/56/head
moonrailgun 3 years ago
parent 09b11b17e6
commit 0520e3b6a0

@ -54,11 +54,7 @@ export const VirtualizedMessageList: React.FC<MessageListProps> = React.memo(
if (isAtBottom) {
setTimeout(() => {
// 这里 Virtuoso 有个动态渲染高度的bug, 因此需要异步再次滚动到底部以确保代码功能work
listRef.current?.scrollToIndex({
index:
PREPEND_OFFSET - numItemsPrepended + props.messages.length - 1,
align: 'end',
});
listRef.current?.autoscrollToBottom();
}, 20);
}

@ -42,7 +42,7 @@ export const UserListItem: React.FC<UserListItemProps> = React.memo((props) => {
#{userInfo.discriminator}
</span>
</div>
<Space>{...actions}</Space>
<Space>{actions}</Space>
</Skeleton>
</div>
);

Loading…
Cancel
Save