From 4cfb3da534eaa2c58a2167f9224af9d38c0f6136 Mon Sep 17 00:00:00 2001 From: Danqing Liu Date: Tue, 15 Oct 2024 12:08:04 -0400 Subject: [PATCH 1/7] Perform animation async --- Sources/InputBarAccessoryView.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/InputBarAccessoryView.swift b/Sources/InputBarAccessoryView.swift index f67c0937..db915f27 100755 --- a/Sources/InputBarAccessoryView.swift +++ b/Sources/InputBarAccessoryView.swift @@ -655,7 +655,9 @@ open class InputBarAccessoryView: UIView { self.deactivateConstraints() if animated { - UIView.animate(withDuration: 0.3, animations: animations) + DispatchQueue.main.async { + UIView.animate(withDuration: 0.3, animations: animations) + } } else { UIView.performWithoutAnimation { animations() } } From fa7f7e462488b861ef1f285a91270aeead94d54a Mon Sep 17 00:00:00 2001 From: Danqing Liu Date: Tue, 15 Oct 2024 12:12:33 -0400 Subject: [PATCH 2/7] Update InputBarAccessoryView.swift --- Sources/InputBarAccessoryView.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sources/InputBarAccessoryView.swift b/Sources/InputBarAccessoryView.swift index db915f27..0c01a30a 100755 --- a/Sources/InputBarAccessoryView.swift +++ b/Sources/InputBarAccessoryView.swift @@ -653,6 +653,7 @@ open class InputBarAccessoryView: UIView { internal func performLayout(_ animated: Bool, _ animations: @escaping () -> Void) { DispatchQueue.main.async { self.deactivateConstraints() + self.activateConstraints() if animated { DispatchQueue.main.async { @@ -661,8 +662,6 @@ open class InputBarAccessoryView: UIView { } else { UIView.performWithoutAnimation { animations() } } - - self.activateConstraints() } } From 95ccfcae71321ac7627fa67a06ac39a32f2d411c Mon Sep 17 00:00:00 2001 From: Danqing Liu Date: Tue, 15 Oct 2024 12:14:37 -0400 Subject: [PATCH 3/7] Update InputBarAccessoryView.swift --- Sources/InputBarAccessoryView.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/InputBarAccessoryView.swift b/Sources/InputBarAccessoryView.swift index 0b51f104..2b111768 100755 --- a/Sources/InputBarAccessoryView.swift +++ b/Sources/InputBarAccessoryView.swift @@ -658,12 +658,12 @@ open class InputBarAccessoryView: UIView { self.deactivateConstraints() self.activateConstraints() - if animated { - DispatchQueue.main.async { + DispatchQueue.main.async { + if animated { UIView.animate(withDuration: 0.3, animations: animations) + } else { + UIView.performWithoutAnimation { animations() } } - } else { - UIView.performWithoutAnimation { animations() } } } } From aa3f511229afef61dd020000c6e107d0a3e246ae Mon Sep 17 00:00:00 2001 From: Danqing Liu Date: Tue, 15 Oct 2024 12:15:51 -0400 Subject: [PATCH 4/7] Update InputBarAccessoryView.swift --- Sources/InputBarAccessoryView.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/InputBarAccessoryView.swift b/Sources/InputBarAccessoryView.swift index 2b111768..d74d1a68 100755 --- a/Sources/InputBarAccessoryView.swift +++ b/Sources/InputBarAccessoryView.swift @@ -656,7 +656,6 @@ open class InputBarAccessoryView: UIView { internal func performLayout(_ animated: Bool, _ animations: @escaping () -> Void) { DispatchQueue.main.async { self.deactivateConstraints() - self.activateConstraints() DispatchQueue.main.async { if animated { @@ -665,6 +664,8 @@ open class InputBarAccessoryView: UIView { UIView.performWithoutAnimation { animations() } } } + + self.activateConstraints() } } From f02046e3938eda4a118197f1c32dda6364a6fe5b Mon Sep 17 00:00:00 2001 From: Danqing Liu Date: Tue, 15 Oct 2024 12:19:39 -0400 Subject: [PATCH 5/7] Update InputBarAccessoryView.swift --- Sources/InputBarAccessoryView.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/InputBarAccessoryView.swift b/Sources/InputBarAccessoryView.swift index d74d1a68..dbe47261 100755 --- a/Sources/InputBarAccessoryView.swift +++ b/Sources/InputBarAccessoryView.swift @@ -657,12 +657,12 @@ open class InputBarAccessoryView: UIView { DispatchQueue.main.async { self.deactivateConstraints() - DispatchQueue.main.async { - if animated { + if animated { + DispatchQueue.main.async { UIView.animate(withDuration: 0.3, animations: animations) - } else { - UIView.performWithoutAnimation { animations() } } + } else { + UIView.performWithoutAnimation { animations() } } self.activateConstraints() From ff19f34ad09cd24360798f2ca145be6b4476399c Mon Sep 17 00:00:00 2001 From: Danqing Liu Date: Tue, 15 Oct 2024 13:32:21 -0400 Subject: [PATCH 6/7] Update InputBarAccessoryView.swift --- Sources/InputBarAccessoryView.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Sources/InputBarAccessoryView.swift b/Sources/InputBarAccessoryView.swift index dbe47261..16890db0 100755 --- a/Sources/InputBarAccessoryView.swift +++ b/Sources/InputBarAccessoryView.swift @@ -654,17 +654,17 @@ open class InputBarAccessoryView: UIView { /// - animated: If the layout should be animated /// - animations: Animation logic internal func performLayout(_ animated: Bool, _ animations: @escaping () -> Void) { - DispatchQueue.main.async { - self.deactivateConstraints() + self.deactivateConstraints() - if animated { - DispatchQueue.main.async { - UIView.animate(withDuration: 0.3, animations: animations) - } - } else { - UIView.performWithoutAnimation { animations() } + if animated { + DispatchQueue.main.async { + UIView.animate(withDuration: 0.3, animations: animations) } + } else { + UIView.performWithoutAnimation { animations() } + } + DispatchQueue.main.async { self.activateConstraints() } } From 85fb7de2fe88b3ffdda38ac32ad140c78a643477 Mon Sep 17 00:00:00 2001 From: Danqing Liu Date: Tue, 15 Oct 2024 13:35:04 -0400 Subject: [PATCH 7/7] Update InputBarAccessoryView.swift --- Sources/InputBarAccessoryView.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Sources/InputBarAccessoryView.swift b/Sources/InputBarAccessoryView.swift index 16890db0..ada0d077 100755 --- a/Sources/InputBarAccessoryView.swift +++ b/Sources/InputBarAccessoryView.swift @@ -664,9 +664,7 @@ open class InputBarAccessoryView: UIView { UIView.performWithoutAnimation { animations() } } - DispatchQueue.main.async { - self.activateConstraints() - } + self.activateConstraints() } /// Activates the NSLayoutConstraintSet's