diff --git a/CHANGELOG.md b/CHANGELOG.md index cdf5c88d..ad7fc640 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### ✅ Added - Add extra data to user display info [#819](https://github.com/GetStream/stream-chat-swiftui/pull/819) +- Make message spacing in message list configurable [#830](https://github.com/GetStream/stream-chat-swiftui/pull/830) ### 🐞 Fixed - Fix swipe to reply enabled when quoting a message is disabled [#824](https://github.com/GetStream/stream-chat-swiftui/pull/824) - Fix mark unread action not removed when read events are disabled [#823](https://github.com/GetStream/stream-chat-swiftui/pull/823) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift index 1ea52f28..9086d189 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift @@ -33,7 +33,12 @@ public struct MessageContainerView: View { @GestureState private var offset: CGSize = .zero private let replyThreshold: CGFloat = 60 - private let paddingValue: CGFloat = 8 + private var paddingValue: CGFloat { + utils.messageListConfig.messagePaddings.singleBottom + } + private var groupMessageInterItemSpacing: CGFloat { + utils.messageListConfig.messagePaddings.groupBottom + } var isSwipeToReplyPossible: Bool { message.isInteractionEnabled && channel.canQuoteMessage @@ -275,7 +280,7 @@ public struct MessageContainerView: View { topReactionsShown && !isMessagePinned ? messageListConfig.messageDisplayOptions.reactionsTopPadding(message) : 0 ) .padding(.horizontal, messageListConfig.messagePaddings.horizontal) - .padding(.bottom, showsAllInfo || isMessagePinned ? paddingValue : 2) + .padding(.bottom, showsAllInfo || isMessagePinned ? paddingValue : groupMessageInterItemSpacing) .padding(.top, isLast ? paddingValue : 0) .background(isMessagePinned ? Color(colors.pinnedBackground) : nil) .padding(.bottom, isMessagePinned ? paddingValue / 2 : 0) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListConfig.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListConfig.swift index e9fa2fe2..297cd90a 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListConfig.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListConfig.swift @@ -110,13 +110,19 @@ public struct MessagePaddings { /// Horizontal padding for messages. public let horizontal: CGFloat public let quotedViewPadding: CGFloat + public let singleBottom: CGFloat + public let groupBottom: CGFloat public init( horizontal: CGFloat = 8, - quotedViewPadding: CGFloat = 8 + quotedViewPadding: CGFloat = 8, + singleBottom: CGFloat = 8, + groupBottom: CGFloat = 2 ) { self.horizontal = horizontal self.quotedViewPadding = quotedViewPadding + self.singleBottom = singleBottom + self.groupBottom = groupBottom } }