Skip to content

Commit bdfb988

Browse files
committed
Fixed font invalidation of attributedString in MessageLabel
1 parent 6fcd2d6 commit bdfb988

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Sources/Views/Cells/TextMessageCell.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ open class TextMessageCell: MessageContentCell {
4545
super.apply(layoutAttributes)
4646
if let attributes = layoutAttributes as? MessagesCollectionViewLayoutAttributes {
4747
messageLabel.textInsets = attributes.messageLabelInsets
48-
messageLabel.font = attributes.messageLabelFont
48+
messageLabel.messageLabelFont = attributes.messageLabelFont
4949
messageLabel.frame = messageContainerView.bounds
5050
}
5151
}
@@ -81,6 +81,9 @@ open class TextMessageCell: MessageContentCell {
8181
case .text(let text), .emoji(let text):
8282
messageLabel.text = text
8383
messageLabel.textColor = textColor
84+
if let font = messageLabel.messageLabelFont {
85+
messageLabel.font = font
86+
}
8487
case .attributedText(let text):
8588
messageLabel.attributedText = text
8689
default:

Sources/Views/MessageLabel.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ open class MessageLabel: UILabel {
112112
if !isConfiguring { setNeedsDisplay() }
113113
}
114114
}
115+
116+
internal var messageLabelFont: UIFont?
115117

116118
private var attributesNeedUpdate = false
117119

0 commit comments

Comments
 (0)