From 3df9bddfad54891e592961885f7308e1f3177767 Mon Sep 17 00:00:00 2001 From: Eric Silverberg Date: Tue, 25 May 2021 20:24:25 -0400 Subject: [PATCH] Invalidate layout when view is transitioning sizes Fix issue where cells are not drawn properly when rotating from portrait to landscape --- Chatto/Source/ChatController/BaseChatViewController.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Chatto/Source/ChatController/BaseChatViewController.swift b/Chatto/Source/ChatController/BaseChatViewController.swift index e94221ce..53ed6ab6 100644 --- a/Chatto/Source/ChatController/BaseChatViewController.swift +++ b/Chatto/Source/ChatController/BaseChatViewController.swift @@ -588,6 +588,7 @@ extension BaseChatViewController { // Rotation let shouldScrollToBottom = self.isScrolledAtBottom() let referenceIndexPath = collectionView.indexPathsForVisibleItems.first let oldRect = self.rectAtIndexPath(referenceIndexPath) + collectionView.collectionViewLayout.invalidateLayout() coordinator.animate(alongsideTransition: { (_) -> Void in if shouldScrollToBottom { self.scrollToBottom(animated: false)