Fix calculating the position of the keyboard in ComposeContentViewController (#909)
Co-authored-by: Marcus Kida <marcus.kida@bearologics.com>
This commit is contained in:
parent
0b9277db37
commit
e2ef9f07a1
|
@ -207,7 +207,15 @@ extension ComposeContentViewController {
|
|||
self.tableView.contentInset.bottom = padding - self.view.safeAreaInsets.bottom
|
||||
self.tableView.verticalScrollIndicatorInsets.bottom = padding - self.view.safeAreaInsets.bottom
|
||||
UIView.animate(withDuration: 0.3) {
|
||||
self.composeContentToolbarViewBottomLayoutConstraint.constant = endFrame.height
|
||||
// ref: https://developer.apple.com/documentation/uikit/uiresponder/1621578-keyboardframeenduserinfokey
|
||||
let localKeyboardFrame = self.view.convert(endFrame, from: self.view.window!.screen.coordinateSpace)
|
||||
let intersection = self.view.bounds.intersection(localKeyboardFrame)
|
||||
if intersection.isEmpty {
|
||||
self.composeContentToolbarViewBottomLayoutConstraint.constant = 0
|
||||
} else {
|
||||
self.composeContentToolbarViewBottomLayoutConstraint.constant = self.view.bounds.maxY - intersection.minY
|
||||
}
|
||||
|
||||
self.view.layoutIfNeeded()
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue