From b0868dabd19333bce4913cdf64fcae471dbb5e8d Mon Sep 17 00:00:00 2001 From: Katherine Petalio Date: Tue, 3 Sep 2019 15:01:59 +0800 Subject: [PATCH] Prevents View push upward when keyboard is active Set view position to 0, once keyboard is active. --- src/ios/CDVKeyboard.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ios/CDVKeyboard.m b/src/ios/CDVKeyboard.m index 4cb7ae3..e7e207e 100644 --- a/src/ios/CDVKeyboard.m +++ b/src/ios/CDVKeyboard.m @@ -204,18 +204,22 @@ - (void)shrinkViewKeyboardWillChangeFrame:(NSNotification*)notif } #pragma mark UIScrollViewDelegate - - (void)scrollViewDidScroll:(UIScrollView*)scrollView { if (_shrinkView && _keyboardIsVisible) { CGFloat maxY = scrollView.contentSize.height - scrollView.bounds.size.height; if (scrollView.bounds.origin.y > maxY) { - scrollView.bounds = CGRectMake(scrollView.bounds.origin.x, maxY, + scrollView.bounds = CGRectMake(scrollView.bounds.origin.x, 0, scrollView.bounds.size.width, scrollView.bounds.size.height); } + + scrollView.frame = CGRectMake(scrollView.bounds.origin.x, 0, + scrollView.bounds.size.width, scrollView.bounds.size.height); + scrollView.backgroundColor = UIColor.whiteColor; + CGPoint bottomOffset = CGPointMake(0, 0); + [scrollView setContentOffset:bottomOffset animated:NO]; } } - #pragma mark Plugin interface - (void)shrinkView:(CDVInvokedUrlCommand*)command