diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift index 1ea52f28..98499dfb 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.messageListItemSpacing + } + private var groupMessageInterItemSpacing: CGFloat { + utils.messageListConfig.messageGroupItemSpacing + } 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..c3d691ef 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListConfig.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListConfig.swift @@ -35,7 +35,9 @@ public struct MessageListConfig { userBlockingEnabled: Bool = false, bouncedMessagesAlertActionsEnabled: Bool = true, skipEditedMessageLabel: @escaping (ChatMessage) -> Bool = { _ in false }, - draftMessagesEnabled: Bool = false + draftMessagesEnabled: Bool = false, + messageListItemSpacing: CGFloat = 8, + messageGroupItemSpacing: CGFloat = 2 ) { self.messageListType = messageListType self.typingIndicatorPlacement = typingIndicatorPlacement @@ -64,6 +66,8 @@ public struct MessageListConfig { self.bouncedMessagesAlertActionsEnabled = bouncedMessagesAlertActionsEnabled self.skipEditedMessageLabel = skipEditedMessageLabel self.draftMessagesEnabled = draftMessagesEnabled + self.messageListItemSpacing = messageListItemSpacing + self.messageGroupItemSpacing = messageGroupItemSpacing } public let messageListType: MessageListType @@ -102,6 +106,9 @@ public struct MessageListConfig { /// /// If enabled, the SDK will save the message content as a draft when the user navigates away from the composer. public let draftMessagesEnabled: Bool + + public let messageListItemSpacing: CGFloat + public let messageGroupItemSpacing: CGFloat } /// Contains information about the message paddings.