Skip to content

Commit

Permalink
fix: don't prematurely update keyboard height during dismissal on iOS
Browse files Browse the repository at this point in the history
When the keyboard is dismissed via the close button or is undocked, the
interactive dismissal observer will be notified of the geometry change
before the show/hide notification is received.

Bail out before updating the keyboard height if the reported keyboard
height is 0 or if the keyboard is undocked (keyboard width != window
width.)

Note that this still allows some updates through when they shouldn't be,
but it's better than before, especially for floating keyboards.
  • Loading branch information
mhoran committed Nov 27, 2024
1 parent 3c2d160 commit 8895f74
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@ - (void)updateKeyboardHeightDuringInteractiveDismiss:(CGPoint)oldKeyboardFrame
}
float windowHeight = keyboardView.window.bounds.size.height;
float keyboardHeight = keyboardView.frame.size.height;
if (keyboardHeight == 0 || keyboardView.frame.size.width != keyboardView.window.bounds.size.width) {
return;
}
float visibleKeyboardHeight = windowHeight - (newKeyboardFrame.y - keyboardHeight / 2);
if (oldKeyboardFrame.y > newKeyboardFrame.y) {
_state = OPENING;
Expand Down

0 comments on commit 8895f74

Please sign in to comment.