Skip to content

Commit b0f486d

Browse files
Extended message modifier with padding support
1 parent 83f2e0a commit b0f486d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageBubble.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,25 @@ public struct MessageBubbleModifier: ViewModifier {
3838
public var injectedBackgroundColor: UIColor?
3939
public var cornerRadius: CGFloat = 18
4040
public var forceLeftToRight = false
41+
public var topPadding: CGFloat = 0
42+
public var bottomPadding: CGFloat = 0
4143

4244
public init(
4345
message: ChatMessage,
4446
isFirst: Bool,
4547
injectedBackgroundColor: UIColor? = nil,
4648
cornerRadius: CGFloat = 18,
47-
forceLeftToRight: Bool = false
49+
forceLeftToRight: Bool = false,
50+
topPadding: CGFloat = 0,
51+
bottomPadding: CGFloat = 0
4852
) {
4953
self.message = message
5054
self.isFirst = isFirst
5155
self.injectedBackgroundColor = injectedBackgroundColor
5256
self.cornerRadius = cornerRadius
5357
self.forceLeftToRight = forceLeftToRight
58+
self.topPadding = topPadding
59+
self.bottomPadding = bottomPadding
5460
}
5561

5662
public func body(content: Content) -> some View {
@@ -62,6 +68,8 @@ public struct MessageBubbleModifier: ViewModifier {
6268
cornerRadius: cornerRadius
6369
)
6470
)
71+
.padding(.top, topPadding)
72+
.padding(.bottom, bottomPadding)
6573
}
6674

6775
private var corners: UIRectCorner {

0 commit comments

Comments
 (0)