Fixed a minor animation glitch

pull/672/head
Morgan Pretty 3 years ago
parent c33b555c3c
commit 5bf3c2d35d

@ -622,15 +622,19 @@ final class ConversationVC: BaseVC, ConversationSearchControllerDelegate, UITabl
} }
private func handleInteractionUpdates(_ updatedData: [ConversationViewModel.SectionModel], initialLoad: Bool = false) { private func handleInteractionUpdates(_ updatedData: [ConversationViewModel.SectionModel], initialLoad: Bool = false) {
// Ensure the first load or a load when returning from a child screen runs without animations (if // Ensure the first load or a load when returning from a child screen runs without
// we don't do this the cells will animate in from a frame of CGRect.zero or have a buggy transition) // animations (if we don't do this the cells will animate in from a frame of
// CGRect.zero or have a buggy transition)
guard self.hasLoadedInitialInteractionData else { guard self.hasLoadedInitialInteractionData else {
self.hasLoadedInitialInteractionData = true // Need to dispatch async to prevent this from causing glitches in the push animation
self.viewModel.updateInteractionData(updatedData) DispatchQueue.main.async {
self.hasLoadedInitialInteractionData = true
UIView.performWithoutAnimation { self.viewModel.updateInteractionData(updatedData)
self.tableView.reloadData()
self.performInitialScrollIfNeeded() UIView.performWithoutAnimation {
self.tableView.reloadData()
self.performInitialScrollIfNeeded()
}
} }
return return
} }

Loading…
Cancel
Save