Skip to content

Commit

Permalink
fix: new mesage pill flickering (#1854)
Browse files Browse the repository at this point in the history
* fix: new mesage pill flickering

* fix: memo

* fix: clean up
  • Loading branch information
KaustubhKumar05 authored Sep 7, 2023
1 parent 9c31f7b commit c0f0547
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/roomkit-react/src/Prebuilt/components/Chat/Chat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ export const Chat = ({ screenType }) => {
const { elements } = useRoomLayoutConferencingScreen();
const isMobile = useMedia(cssConfig.media.md);

let isScrolledToBottom = false;
if (listRef.current) {
const currentRef = listRef.current._outerRef;
isScrolledToBottom = currentRef.scrollHeight - currentRef.clientHeight - currentRef.scrollTop < 10;
}

const messagesCount = useHMSStore(storeMessageSelector) || 0;
const scrollToBottom = useCallback(
(unreadCount = 0) => {
Expand Down Expand Up @@ -142,7 +148,7 @@ export const Chat = ({ screenType }) => {
}}
peerId={chatOptions.peerId}
>
{!isSelectorOpen && (
{!isSelectorOpen && !isScrolledToBottom && (
<NewMessageIndicator role={chatOptions.role} peerId={chatOptions.peerId} scrollToBottom={scrollToBottom} />
)}
</ChatFooter>
Expand Down

0 comments on commit c0f0547

Please sign in to comment.