-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ios 12 black area when keyboard is showing and shrink param is true #85
base: master
Are you sure you want to change the base?
Conversation
I've been trying to fix this bug with workarounds for a couple of days now. I've just tested this fix and its working perfectly - iOS 12, iPhone XS. @costin-moraru Thanks a lot! |
Do we know when this might be merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a step towards a fix, but it only works because it disallows scrolling. That is not the way the webview works on other platforms, or previous versions.
@@ -227,6 +244,9 @@ - (void)shrinkView:(CDVInvokedUrlCommand*)command | |||
} | |||
|
|||
self.shrinkView = [value boolValue]; | |||
// Scroll webview content to bottom | |||
CGPoint bottomOffset = CGPointMake(0.0f, 0.0f); | |||
[self.webView.scrollView setContentOffset:bottomOffset animated:NO]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function shrinkView
is only meant to set the variable above. Should not make changes to the scrollView.
} | ||
// Scroll webview content to bottom | ||
CGPoint bottomOffset = CGPointMake(0.0f, 0.0f); | ||
[self.webView.scrollView setContentOffset:bottomOffset animated:NO]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works, but doesn't match expectations across the board. This scrollsToTop when the keyboard is opened. In some instances that means scrolling the input out of view.
self.keyboardHeight = keyboardIntersection.size.height; | ||
|
||
// self.webView.scrollView.scrollEnabled = !self.disableScrollingInShrinkView; | ||
self.webView.scrollView.scrollEnabled = NO; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not force this toNO
. That overrides the settings users have made.
@@ -193,10 +194,14 @@ - (void)shrinkViewKeyboardWillChangeFrame:(NSNotification*)notif | |||
// Note: we check for _shrinkView at this point instead of the beginning of the method to handle | |||
// the case where the user disabled shrinkView while the keyboard is showing. | |||
// The webview should always be able to return to full size | |||
_shrinkView = YES; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not force this to YES
. This overrides settings users have made.
still having a black screen here. How do i fix this? |
I spent a fair amount of time digging into this today. The UIView and UIScrollView are both updated properly, but the problem comes from the UIWebBrowserView frame not updating. This is an internal class we can't touch directly. Based on what I've read today, I would guess that there's an issue with one of the view constraints, or something regarding layout, however I'm not an expert in iOS development. @Steco17 - I ended up using the WKWebView. Its a newer webview that is supposed to be faster, more up to date, etc. So far its worked as a drop-in replacement with zero issues for me. If you can switch to that, it may solve your problems. |
@disciplezero thanks am going to try WKwebview |
Any updates on this issue? I tested on iOS 14.3 and still got the black background when Keyboard opens. |
#82