From 7e21b08d6594d06a12b4391b503dfedca45a0ffb Mon Sep 17 00:00:00 2001 From: Kyle Van Essen Date: Tue, 9 Feb 2021 18:25:20 -0800 Subject: [PATCH] Reuse contentInset values when updating for keyboard to ensure we don't clobber other values. --- CHANGELOG.md | 2 ++ ListableUI/Sources/ListView/ListView.swift | 9 +++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0923196c6..11eca3ce6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ### Fixed +- [When updating `contentInset`, retain the values pulled from the `CollectionView`](TODO). This is to avoid clobbering the content inset potentially set by other things like navigation controllers. + ### Added ### Removed diff --git a/ListableUI/Sources/ListView/ListView.swift b/ListableUI/Sources/ListView/ListView.swift index 92298f3db..1d1a505dc 100644 --- a/ListableUI/Sources/ListView/ListView.swift +++ b/ListableUI/Sources/ListView/ListView.swift @@ -325,12 +325,9 @@ public final class ListView : UIView, KeyboardObserverDelegate $0.bottom = max($0.bottom, keyboardBottomInset) } - let contentInsets = UIEdgeInsets( - top: 0, - left: 0, - bottom: keyboardBottomInset, - right: 0 - ) + let contentInsets = modified(self.collectionView.contentInset) { + $0.bottom = keyboardBottomInset + } return (contentInsets, scrollIndicatorInsets) }