Adjust bottom padding correctly on iOS keyboard hide (flutter/engine#3684)
Handle willChangeFrame to handle keyboard show, resize, reposition
(split, move floating keyboard) events. Handle willBeHidden events for
keyboard dismissal.
Fixes incorrect bottom padding introduced in
4103fe7a40 due to didChangeFrame
notification firing after willBeHidden on keyboard dismissal.
This commit is contained in:
@@ -190,8 +190,8 @@ class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse {
|
||||
object:nil];
|
||||
|
||||
[center addObserver:self
|
||||
selector:@selector(keyboardFrameDidChange:)
|
||||
name:UIKeyboardDidShowNotification
|
||||
selector:@selector(keyboardWillChangeFrame:)
|
||||
name:UIKeyboardWillChangeFrameNotification
|
||||
object:nil];
|
||||
|
||||
[center addObserver:self
|
||||
@@ -199,11 +199,6 @@ class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse {
|
||||
name:UIKeyboardWillHideNotification
|
||||
object:nil];
|
||||
|
||||
[center addObserver:self
|
||||
selector:@selector(keyboardFrameDidChange:)
|
||||
name:UIKeyboardDidChangeFrameNotification
|
||||
object:nil];
|
||||
|
||||
[center addObserver:self
|
||||
selector:@selector(onLocaleUpdated:)
|
||||
name:NSCurrentLocaleDidChangeNotification
|
||||
@@ -399,7 +394,7 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(UITouc
|
||||
|
||||
#pragma mark - Keyboard events
|
||||
|
||||
- (void)keyboardFrameDidChange:(NSNotification*)notification {
|
||||
- (void)keyboardWillChangeFrame:(NSNotification*)notification {
|
||||
NSDictionary* info = [notification userInfo];
|
||||
CGFloat bottom =
|
||||
CGRectGetHeight([[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]);
|
||||
|
||||
Reference in New Issue
Block a user