diff --git a/Mastodon/Scene/PickServer/PickServerViewController.swift b/Mastodon/Scene/PickServer/PickServerViewController.swift index d02276f3e..ef87e8145 100644 --- a/Mastodon/Scene/PickServer/PickServerViewController.swift +++ b/Mastodon/Scene/PickServer/PickServerViewController.swift @@ -384,11 +384,12 @@ extension PickServerViewController: PickServerCellDelegate { expandServerDomainSet.insert(server.domain) } - tableView.performBatchUpdates(updates) { _ in - // Scroll to fully show the expanded cell, do not scroll when collapse - if newMode == .expand, let modeChangeIndex = self.viewModel.searchedServers.value.firstIndex(where: { $0 == server }), self.tableView.indexPathsForVisibleRows?.last?.row == modeChangeIndex { - self.tableView.scrollToRow(at: IndexPath(row: modeChangeIndex, section: 3), at: .bottom, animated: true) - } + tableView.beginUpdates() + updates() + tableView.endUpdates() + + if newMode == .expand, let modeChangeIndex = self.viewModel.searchedServers.value.firstIndex(where: { $0 == server }), self.tableView.indexPathsForVisibleRows?.last?.row == modeChangeIndex { + self.tableView.scrollToRow(at: IndexPath(row: modeChangeIndex, section: 3), at: .bottom, animated: true) } } } diff --git a/Mastodon/Scene/PickServer/TableViewCell/PickServerCell.swift b/Mastodon/Scene/PickServer/TableViewCell/PickServerCell.swift index a6a330ce2..c9ff335d6 100644 --- a/Mastodon/Scene/PickServer/TableViewCell/PickServerCell.swift +++ b/Mastodon/Scene/PickServer/TableViewCell/PickServerCell.swift @@ -249,12 +249,12 @@ extension PickServerCell { // Set expandBox constraints expandBox.leadingAnchor.constraint(equalTo: bgView.leadingAnchor, constant: 16), bgView.trailingAnchor.constraint(equalTo: expandBox.trailingAnchor, constant: 16), - expandBox.topAnchor.constraint(equalTo: descriptionLabel.bottomAnchor, constant: 8), - expandBox.bottomAnchor.constraint(equalTo: infoStackView.bottomAnchor), + expandBox.topAnchor.constraint(equalTo: descriptionLabel.bottomAnchor, constant: 8).priority(.defaultHigh), + expandBox.bottomAnchor.constraint(equalTo: infoStackView.bottomAnchor).priority(.defaultHigh), thumbImageView.leadingAnchor.constraint(equalTo: expandBox.leadingAnchor), expandBox.trailingAnchor.constraint(equalTo: thumbImageView.trailingAnchor), - thumbImageView.topAnchor.constraint(equalTo: expandBox.topAnchor), + thumbImageView.topAnchor.constraint(equalTo: expandBox.topAnchor).priority(.defaultHigh), thumbImageView.heightAnchor.constraint(equalTo: thumbImageView.widthAnchor, multiplier: 151.0 / 303.0).priority(.defaultHigh), infoStackView.leadingAnchor.constraint(equalTo: expandBox.leadingAnchor),