From f36359454d2dc7fd7aca914bc127e8239223fb9c Mon Sep 17 00:00:00 2001 From: PhilReact Date: Thu, 26 Sep 2024 22:03:25 +0300 Subject: [PATCH] reduce flicker on mobile --- src/components/Chat/ChatList.tsx | 10 +++++----- src/components/Chat/MessageItem.tsx | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/Chat/ChatList.tsx b/src/components/Chat/ChatList.tsx index 67e58ae..2791593 100644 --- a/src/components/Chat/ChatList.tsx +++ b/src/components/Chat/ChatList.tsx @@ -32,7 +32,7 @@ export const ChatList = ({ initialMessages, myAddress, tempMessages, chatId, onR if (virtuosoRef.current) { - if (virtuosoRef.current && !isAtBottomRef.current) { + if (virtuosoRef.current && !isAtBottomRef.current && hasUnreadMessages) { @@ -76,7 +76,7 @@ export const ChatList = ({ initialMessages, myAddress, tempMessages, chatId, onR }) const index = initialMsgs ? initialMsgs.length - 1 : messages.length - 1 if (virtuosoRef.current) { - virtuosoRef.current.scrollToIndex({ index, behavior: 'smooth' }); + virtuosoRef.current.scrollToIndex({ index}); } }; @@ -126,7 +126,7 @@ export const ChatList = ({ initialMessages, myAddress, tempMessages, chatId, onR } return ( -
+
{showScrollButton && ( diff --git a/src/components/Chat/MessageItem.tsx b/src/components/Chat/MessageItem.tsx index bfaf5cc..eabe671 100644 --- a/src/components/Chat/MessageItem.tsx +++ b/src/components/Chat/MessageItem.tsx @@ -13,6 +13,7 @@ import Underline from "@tiptap/extension-underline"; import { executeEvent } from "../../utils/events"; import { WrapperUserAction } from "../WrapperUserAction"; import ReplyIcon from "@mui/icons-material/Reply"; +import { Spacer } from "../../common/Spacer"; export const MessageItem = ({ message, @@ -120,9 +121,10 @@ export const MessageItem = ({ )} {reply && ( + <> + + )} {message?.messageText && (