diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+DataSource.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+DataSource.swift index 7806a1c010..6e839d227e 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+DataSource.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+DataSource.swift @@ -52,9 +52,12 @@ extension ComposeContentViewModel { guard let self = self else { return } guard self.composeContentTableViewCellIsInTableView(tableView) else { return } UIView.performWithoutAnimation { - tableView.beginUpdates() - self.composeContentTableViewCell.frame.size.height = height - tableView.endUpdates() + if height != self.composeContentTableViewCell.contentHeight { + tableView.beginUpdates() + self.composeContentTableViewCell.contentHeight = height + self.composeContentTableViewCell.invalidateIntrinsicContentSize() + tableView.endUpdates() + } } } .store(in: &disposeBag) diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/TableViewCell/ComposeContentTableViewCell.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/TableViewCell/ComposeContentTableViewCell.swift index c81da3be34..5a70439260 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/TableViewCell/ComposeContentTableViewCell.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/TableViewCell/ComposeContentTableViewCell.swift @@ -9,6 +9,13 @@ import UIKit import UIHostingConfigurationBackport final class ComposeContentTableViewCell: UITableViewCell { + + var contentHeight: CGFloat? + + override var intrinsicContentSize: CGSize { + let superContentSize = super.intrinsicContentSize + return CGSize(width: superContentSize.width, height: contentHeight ?? superContentSize.height) + } override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier)