From ba61f6e74fd21020e09428ea553b5d51ea11f9d0 Mon Sep 17 00:00:00 2001 From: Anton Karpechenkov Date: Sat, 13 Mar 2021 20:52:15 +0100 Subject: [PATCH 1/2] updated target bottom offset of collection view despite the contentSize is smaller than viewport --- Sources/Controllers/MessagesViewController+Keyboard.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Controllers/MessagesViewController+Keyboard.swift b/Sources/Controllers/MessagesViewController+Keyboard.swift index 8511c0f6..59e0926e 100644 --- a/Sources/Controllers/MessagesViewController+Keyboard.swift +++ b/Sources/Controllers/MessagesViewController+Keyboard.swift @@ -98,6 +98,10 @@ internal extension MessagesViewController { let newBottomInset = requiredScrollViewBottomInset(forKeyboardFrame: keyboardEndFrame) let differenceOfBottomInset = newBottomInset - messageCollectionViewBottomInset + UIView.performWithoutAnimation { + messageCollectionViewBottomInset = newBottomInset + } + if maintainPositionOnKeyboardFrameChanged && differenceOfBottomInset != 0 { let contentOffset = CGPoint(x: messagesCollectionView.contentOffset.x, y: messagesCollectionView.contentOffset.y + differenceOfBottomInset) // Changing contentOffset to bigger number than the contentSize will result in a jump of content @@ -107,10 +111,6 @@ internal extension MessagesViewController { } messagesCollectionView.setContentOffset(contentOffset, animated: false) } - - UIView.performWithoutAnimation { - messageCollectionViewBottomInset = newBottomInset - } } // MARK: - Inset Computation From cfa8b2e370e620adc316d51aa280e5668de0fd03 Mon Sep 17 00:00:00 2001 From: Anton Karpechenkov Date: Sat, 13 Mar 2021 21:39:20 +0100 Subject: [PATCH 2/2] updated changelog for #1529 fix --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 724dab33..990ff2b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The changelog for `MessageKit`. Also see the [releases](https://github.com/Messa ### Fixed +- Fixes an issue with Scroll problem on new messages with keyboard open [#1529](https://github.com/MessageKit/MessageKit/pull/1529) by [@politan8](https://github.com/politan8) + ### Added ### Changed