@@ -92,13 +92,12 @@ class MessageListViewController: UIViewController {
9292 RxKeyboard . instance. visibleHeight
9393 . drive ( onNext: { [ weak self] keyboardVisibleHeight in
9494 guard let `self` = self , self . didSetupViewConstraints else { return }
95- var actualKeyboardHeight = keyboardVisibleHeight
96- if #available( iOS 11 . 0 , * ) , keyboardVisibleHeight > 0 {
97- actualKeyboardHeight = actualKeyboardHeight - self . view. safeAreaInsets. bottom
98- }
99-
10095 self . messageInputBar. snp. updateConstraints { make in
101- make. bottom. equalTo ( self . bottomLayoutGuide. snp. top) . offset ( - actualKeyboardHeight)
96+ if #available( iOS 11 . 0 , * ) {
97+ make. bottom. equalTo ( self . view. safeAreaLayoutGuide. snp. bottom) . offset ( - keyboardVisibleHeight)
98+ } else {
99+ make. bottom. equalTo ( self . bottomLayoutGuide. snp. top) . offset ( - keyboardVisibleHeight)
100+ }
102101 }
103102 self . view. setNeedsLayout ( )
104103 UIView . animate ( withDuration: 0 ) {
@@ -140,7 +139,11 @@ class MessageListViewController: UIViewController {
140139 }
141140 self . messageInputBar. snp. makeConstraints { make in
142141 make. left. right. equalTo ( 0 )
143- make. bottom. equalTo ( self . bottomLayoutGuide. snp. top)
142+ if #available( iOS 11 . 0 , * ) {
143+ make. bottom. equalTo ( self . view. safeAreaLayoutGuide. snp. bottom)
144+ } else {
145+ make. bottom. equalTo ( self . bottomLayoutGuide. snp. top)
146+ }
144147 }
145148 }
146149
0 commit comments