Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

costin-moraru
Copy link

#82

@sinn1
Copy link

sinn1 commented Jan 28, 2019

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!

@brian-g
Copy link

brian-g commented Apr 18, 2019

Do we know when this might be merged?

Copy link

@disciplezero disciplezero left a 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];

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];

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;

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;

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.

@Steco17
Copy link

Steco17 commented Jul 8, 2019

still having a black screen here. How do i fix this?

@disciplezero
Copy link

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.

@Steco17
Copy link

Steco17 commented Jul 9, 2019

@disciplezero thanks am going to try WKwebview

@BrOrlandi
Copy link

Any updates on this issue? I tested on iOS 14.3 and still got the black background when Keyboard opens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants