From d1141c7924807f9ca340c9afcb1c43b5d454e041 Mon Sep 17 00:00:00 2001 From: Nathan Tannar Date: Thu, 7 Dec 2017 12:31:46 -0800 Subject: [PATCH 1/2] Correct bottomAnchor to Window --- Sources/Views/MessageInputBar.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/Views/MessageInputBar.swift b/Sources/Views/MessageInputBar.swift index 91f8aab5..b5057552 100644 --- a/Sources/Views/MessageInputBar.swift +++ b/Sources/Views/MessageInputBar.swift @@ -369,6 +369,7 @@ open class MessageInputBar: UIView { rightStackViewLayoutSet?.right = rightStackView.rightAnchor.constraint(equalTo: safeAreaLayoutGuide.rightAnchor, constant: -padding.right) bottomStackViewLayoutSet?.left = bottomStackView.leftAnchor.constraint(equalTo: safeAreaLayoutGuide.leftAnchor, constant: padding.left) bottomStackViewLayoutSet?.right = bottomStackView.rightAnchor.constraint(equalTo: safeAreaLayoutGuide.rightAnchor, constant: -padding.right) + bottomStackViewLayoutSet?.bottom = bottomStackView.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor, constant: -padding.bottom) } activateConstraints() } @@ -379,11 +380,10 @@ open class MessageInputBar: UIView { // Respect iPhone X safeAreaInsets guard UIScreen.main.nativeBounds.height == 2436 else { return } if let window = window { - bottomStackViewLayoutSet?.bottom?.isActive = false - bottomStackViewLayoutSet?.bottom = bottomStackView.bottomAnchor.constraintLessThanOrEqualToSystemSpacingBelow(window.safeAreaLayoutGuide.bottomAnchor, multiplier: 1) - // Needs to be less than .defaultHigh so constraints don't break - bottomStackViewLayoutSet?.bottom?.priority = UILayoutPriority(rawValue: 750) - activateConstraints() + let windowConstraint = bottomStackView.bottomAnchor.constraintLessThanOrEqualToSystemSpacingBelow(window.safeAreaLayoutGuide.bottomAnchor, multiplier: 1) + windowConstraint.constant = -padding.bottom + windowConstraint.priority = UILayoutPriority(rawValue: 750) + windowConstraint.isActive = true } } } From 940be25b18fa98e308192edbc92fcbd8af8cd081 Mon Sep 17 00:00:00 2001 From: Nathan Tannar Date: Thu, 7 Dec 2017 12:36:59 -0800 Subject: [PATCH 2/2] layoutStackViews typo --- Sources/Views/MessageInputBar.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Views/MessageInputBar.swift b/Sources/Views/MessageInputBar.swift index b5057552..93da2c4d 100644 --- a/Sources/Views/MessageInputBar.swift +++ b/Sources/Views/MessageInputBar.swift @@ -479,8 +479,8 @@ open class MessageInputBar: UIView { bottomStackView.setNeedsLayout() bottomStackView.layoutIfNeeded() case .top: - bottomStackView.setNeedsLayout() - bottomStackView.layoutIfNeeded() + topStackView.setNeedsLayout() + topStackView.layoutIfNeeded() } } }