From 10bbe459db1c850d62ed4fd4ba64f655ed566352 Mon Sep 17 00:00:00 2001 From: Saeb Amini Date: Wed, 30 Sep 2026 16:07:05 +1000 Subject: [PATCH] fix(ios): resize webview in sync with the keyboard animation Co-authored-by: aeharding <2166114+aeharding@users.noreply.github.com> --- ios/Sources/KeyboardPlugin/Keyboard.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ios/Sources/KeyboardPlugin/Keyboard.m b/ios/Sources/KeyboardPlugin/Keyboard.m index 72cfe2f..7729488 100644 --- a/ios/Sources/KeyboardPlugin/Keyboard.m +++ b/ios/Sources/KeyboardPlugin/Keyboard.m @@ -212,7 +212,7 @@ - (void)resetScrollView - (void)onKeyboardWillHide:(NSNotification *)notification { - [self setKeyboardHeight:0 delay:0.01]; + [self setKeyboardHeight:0 delay:0]; [self resetScrollView]; hideTimer = [NSTimer scheduledTimerWithTimeInterval:0 repeats:NO block:^(NSTimer * _Nonnull timer) { [self.bridge triggerWindowJSEventWithEventName:@"keyboardWillHide"]; @@ -254,8 +254,7 @@ - (void)onKeyboardWillShow:(NSNotification *)notification height = 0.0; } - double duration = [[notification.userInfo valueForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]+0.2; - [self setKeyboardHeight:(int)height delay:duration]; + [self setKeyboardHeight:(int)height delay:0]; [self resetScrollView]; NSString * data = [NSString stringWithFormat:@"{ 'keyboardHeight': %d }", (int)height]; @@ -329,7 +328,7 @@ - (void)resizeElement:(NSString *)element withPaddingBottom:(int)paddingBottom w height = screenHeight - paddingBottom; } - [self.bridge evalWithJs: [NSString stringWithFormat:@"(function() { var el = %@; var height = %d; if (el) { el.style.height = height > -1 ? height + 'px' : null; } })()", element, height]]; + [self.bridge evalWithJs: [NSString stringWithFormat:@"requestAnimationFrame(() => { var el = %@; var height = %d; if (el) { el.style.height = height > -1 ? height + 'px' : null; } })", element, height]]; } - (void)_updateFrame