Fixes #2805 - Fixes animation artifacts when focusing on in-reply-to messages
This commit is contained in:
committed by
Stefan Ceriu
parent
434a6428ee
commit
cc4bc179af
@@ -193,8 +193,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
case .focusLive:
|
||||
focusLive()
|
||||
case .scrolledToFocussedItem:
|
||||
// Use a Task to mutate view state after the current view update.
|
||||
Task { didScrollToFocussedItem() }
|
||||
didScrollToFocussedItem()
|
||||
case .hasSwitchedTimeline:
|
||||
Task { state.timelineViewState.isSwitchingTimelines = false }
|
||||
}
|
||||
|
||||
@@ -340,10 +340,13 @@ class TimelineTableViewController: UIViewController {
|
||||
|
||||
/// Scrolls to the item with the corresponding event ID if loaded in the timeline.
|
||||
private func scrollToItem(eventID: String, animated: Bool) {
|
||||
if let kvPair = timelineItemsDictionary.first(where: { $0.value.identifier.eventID == eventID }),
|
||||
let indexPath = dataSource?.indexPath(for: kvPair.key) {
|
||||
tableView.scrollToRow(at: indexPath, at: .middle, animated: animated)
|
||||
coordinator.send(viewAction: .scrolledToFocussedItem)
|
||||
DispatchQueue.main.async { [weak self] in // Fixes #2805
|
||||
guard let self else { return }
|
||||
if let kvPair = timelineItemsDictionary.first(where: { $0.value.identifier.eventID == eventID }),
|
||||
let indexPath = dataSource?.indexPath(for: kvPair.key) {
|
||||
tableView.scrollToRow(at: indexPath, at: .middle, animated: animated)
|
||||
coordinator.send(viewAction: .scrolledToFocussedItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user