Fix jump to present not scrolling all the way to the top

This commit is contained in:
Shadowfacts 2022-11-23 11:58:52 -05:00
parent 9f7d16a70e
commit 40800f964d
1 changed files with 7 additions and 3 deletions

View File

@ -348,9 +348,13 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
config.action = { [unowned self] toast in
toast.dismissToast(animated: true)
self.dataSource.apply(snapshot, animatingDifferences: false)
self.collectionView.scrollToTop()
self.dataSource.apply(snapshot, animatingDifferences: true) {
// TODO: we can't set prevScrollOffsetBeforeScrollToTop here to allow undoing the scroll-to-top
// because that would involve scrolling through unmeasured-cell which fucks up the content offset values.
// we probably need a data-source aware implementation of scrollToTop which uses item & offset w/in item
// to track the restore position
self.collectionView.scrollToItem(at: IndexPath(row: 0, section: 0), at: .top, animated: true)
}
}
self.showToast(configuration: config, animated: true)
}