Open mahavi opened 5 years ago
I also faced with this bug
hey @maks-g ! Did you solve this issue?
nope :(
A bit late, but found a fix for this. Also, happens when toggling between the emoji and the Text keyboard. Just add these lines:
var displacedOriginToWindow = triggerView.convert(triggerView.bounds, to: nil)
displacedOriginToWindow.origin.y -= displacement
if (keyboardFrame.intersects(displacedOriginToWindow) && keyboardHeightDiff != 0) {
displacement = keyboardFrame.origin.y - displacedOriginToWindow.maxY - keyboardFrame.intersection(displacedOriginToWindow).height
}
just below the these constraint conditions (lines ~162):
if let secondItem = constraint.secondItem as? NSObject,
secondItem == self.avoidingView! && (constraint.secondAttribute == .centerY || constraint.secondAttribute == .top || constraint.secondAttribute == .bottom) {
Then, the displacement is adjusted to the displacement given the case the keyboard IS NOT hiding but resizing instead.
There is an issue when switching from keyboard with suggestions on one screen to keyboard without suggestions on another screen: avoidview offset is calculated incorrectly and textfiled is placed under keyboard.
How to reproduce: I have created sample project to reproduce this issue: https://github.com/maks-g/IHKeyboardAvoidingIssueSample
Also, you can check recorded video: https://github.com/maks-g/IHKeyboardAvoidingIssueSample/blob/master/issue_sample.mp4