Commit 416d55ee authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk

UI: fix keyboard appearance.

This patch fixes two problems:
- during creation an account a screen could become not scrollable and
keyboard overly button "Create Account"
- keyboard shortly overly messages when appearing on a conversation
screen.

Change-Id: Ibcea9e1b6e933739cae9c2d2ae27337a3228ed45
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent e3c54027
......@@ -27,7 +27,7 @@ extension NotificationCenter {
.from([
NotificationCenter.default.rx.notification(NSNotification.Name.UIKeyboardWillShow)
.map { notification -> CGFloat in
(notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue.height ?? 0
return (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue.height ?? 0
},
NotificationCenter.default.rx.notification(NSNotification.Name.UIKeyboardWillHide)
.map { _ -> CGFloat in
......
......@@ -64,7 +64,7 @@ class ConversationViewController: UIViewController, UITextFieldDelegate, Storybo
Register to keyboard notifications to adjust tableView insets when the keybaord appears
or disappears
*/
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(withNotification:)), name: NSNotification.Name.UIKeyboardDidShow, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(withNotification:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(withNotification:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil)
}
......@@ -79,7 +79,7 @@ class ConversationViewController: UIViewController, UITextFieldDelegate, Storybo
self.tableView.contentInset.bottom = keyboardHeight
self.tableView.scrollIndicatorInsets.bottom = keyboardHeight
self.scrollToBottom(animated: true)
self.scrollToBottom(animated: false)
self.updateBottomOffset()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment