Skip to content

Commit 73c70ec

Browse files
authored
Jump to first unread message button in the message list was not possible to close in some cases (#600)
1 parent c845814 commit 73c70ec

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1414
### 🐞 Fixed
1515
- Typing users did not update reliably in the message list [#591](https://github.com/GetStream/stream-chat-swiftui/pull/591)
1616
- Channel was sometimes marked as read when the first unread message was one of the first not visible messages [#593](https://github.com/GetStream/stream-chat-swiftui/pull/593)
17+
- Jump to first unread message button in the message list was not possible to close in some cases [#600](https://github.com/GetStream/stream-chat-swiftui/pull/600)
1718

1819
# [4.62.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.62.0)
1920
_August 16, 2024_

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public struct MessageListView<Factory: ViewFactory>: View, KeyboardReadable {
3636
@State private var pendingKeyboardUpdate: Bool?
3737
@State private var scrollDirection = ScrollDirection.up
3838
@State private var unreadMessagesBannerShown = false
39+
@State private var unreadButtonDismissed = false
3940

4041
private var messageRenderingUtil = MessageRenderingUtil.shared
4142
private var skipRenderingMessageIds = [String]()
@@ -293,14 +294,15 @@ public struct MessageListView<Factory: ViewFactory>: View, KeyboardReadable {
293294
}
294295
})
295296
.overlay(
296-
(channel.unreadCount.messages > 0 && !unreadMessagesBannerShown && !isMessageThread) ?
297+
(channel.unreadCount.messages > 0 && !unreadMessagesBannerShown && !isMessageThread && !unreadButtonDismissed) ?
297298
factory.makeJumpToUnreadButton(
298299
channel: channel,
299300
onJumpToMessage: {
300301
_ = onJumpToMessage?(firstUnreadMessageId ?? .unknownMessageId)
301302
},
302303
onClose: {
303304
firstUnreadMessageId = nil
305+
unreadButtonDismissed = true
304306
}
305307
) : nil
306308
)

0 commit comments

Comments
 (0)