Skip to content

Commit 7a4797e

Browse files
authored
[CLNP-3775] fix: reset new messages on scroll bottom reached (#1138)
Fixes https://sendbird.atlassian.net/browse/SBISSUE-16266 The `newMessages` array was not being reset even after the message list scroll reached the bottom. This issue was causing the message notification bar to not disappear properly. To address the issue, I manually called `resetNewMessages()` under certain conditions.
1 parent a8297f6 commit 7a4797e

File tree

1 file changed

+8
-1
lines changed
  • src/modules/GroupChannel/components/MessageList

1 file changed

+8
-1
lines changed

src/modules/GroupChannel/components/MessageList/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export const MessageList = (props: GroupChannelMessageListProps) => {
8484
loadNext,
8585
loadPrevious,
8686
setIsScrollBottomReached,
87+
resetNewMessages,
8788
} = useGroupChannelContext();
8889

8990
const store = useSendbirdStateContext();
@@ -167,7 +168,13 @@ export const MessageList = (props: GroupChannelMessageListProps) => {
167168
scrollDistanceFromBottomRef={scrollDistanceFromBottomRef}
168169
onLoadNext={loadNext}
169170
onLoadPrevious={loadPrevious}
170-
onScrollPosition={(it) => setIsScrollBottomReached(it === 'bottom')}
171+
onScrollPosition={(it) => {
172+
const isScrollBottomReached = it === 'bottom';
173+
if (newMessages.length > 0 && isScrollBottomReached) {
174+
resetNewMessages();
175+
}
176+
setIsScrollBottomReached(isScrollBottomReached);
177+
}}
171178
messages={messages}
172179
renderMessage={({ message, index }) => {
173180
const { chainTop, chainBottom, hasSeparator } = getMessagePartsInfo({

0 commit comments

Comments
 (0)