@@ -82,19 +82,21 @@ internal fun MessageNodeScope.MessageReplyContent(
8282
8383 val replyPreviewPlaceable = subcompose(" MessageReplyPreview" ) {
8484 MessageReplyPreview (
85- modifier = Modifier
86- .width(messageContentPlaceable.width.toDp())
87- .noRippleClickable { onOriginalMessageClicked() },
85+ modifier = Modifier .noRippleClickable { onOriginalMessageClicked() },
8886 sender = originalMessage.sender,
8987 message = originalMessage.message,
9088 backgroundColor = Color .Black .copy(0.1f )
9189 )
92- }.first().measure(constraints.copy(maxWidth = messageContentPlaceable.width))
90+ }.first().measure(constraints)
91+
92+ // Determine the final width based on the longer of the two components
93+ val finalWidth = maxOf(messageContentPlaceable.width, replyPreviewPlaceable.width)
9394
94- val totalHeight =
95- replyPreviewPlaceable.height + spacing + messageContentPlaceable.height
95+ // Calculate the total height
96+ val totalHeight = replyPreviewPlaceable.height + spacing + messageContentPlaceable.height
9697
97- layout(messageContentPlaceable.width, totalHeight) {
98+ // Layout the components
99+ layout(finalWidth, totalHeight) {
98100 replyPreviewPlaceable.place(0 , 0 )
99101 messageContentPlaceable.place(0 , replyPreviewPlaceable.height + spacing)
100102 }
0 commit comments