Skip to content

Commit f7d4e80

Browse files
authored
Take caption width into account for grouped files and audio layout in chat (#99)
* fix(ChatUI): take caption width into account for grouped files layout * fix(ChatUI): remove redundant grouped-file label measurement
1 parent b33c855 commit f7d4e80

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎packages/ChatUI/Sources/ChatUI/ChatGroupedItem.swift‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,11 @@ public class ChatGroupedItem: ChatRowItem {
397397
var _width: CGFloat = 0
398398
switch layout.type {
399399
case .files:
400+
let maxCaptionWidth = min(width, 360) - (hasBubble ? bubbleDefaultInnerInset : 0)
401+
for layout in captionLayouts {
402+
layout.layout.measure(width: maxCaptionWidth)
403+
_width = max(_width, layout.layout.size.width + (hasBubble ? bubbleDefaultInnerInset : 0))
404+
}
400405
for parameter in parameters {
401406
let value = parameter.makeLabelsForWidth(min(width, 360))
402407
_width = max(_width, value)

0 commit comments

Comments
 (0)