apache / apache/cordova-plugin-inappbrowser

Webview offset and height issue on ios when `toolbarposition=top`

Open
#374 1 comment 4 reactions 0 assignees View on GitHub
support
Dominant language
Java
Stars
1.1k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

When `toolbarposition=top` on ios, the body was covered by the webview at the top, it's the default behavior of this plugin.
![0](https://user-images.githubusercontent.com/5656924/49909493-2ef54c00-feba-11e8-9ae4-5625cdb86080.jpg)

Then I found this [pull request](https://github.com/apache/cordova-plugin-inappbrowser/pull/265), change the `rePositionViews` function would sove this problem, but it leads to a new one.

On iphoneX, the webview is out of the screen at the bottom, it seems the webview is 20px higher than it should be.
![1](https://user-images.githubusercontent.com/5656924/49909497-36b4f080-feba-11e8-8f72-3ee1aab4de68.png)

So, I cut the webview's height, `[self.webView setFrame:CGRectMake(self.webView.frame.origin.x, TOOLBAR_HEIGHT + [self getStatusBarOffset], self.webView.frame.size.width, self.webView.frame.size.height - [self getStatusBarOffset])];`, but it leaves 20px grey area at the bottom, the webview is 20px shorter than it should be.
![2](https://user-images.githubusercontent.com/5656924/49909506-3c123b00-feba-11e8-9593-fe0b194171e0.png)

Could it be `[self.webView setFrame:CGRectMake(self.webView.frame.origin.x, TOOLBAR_HEIGHT + [self getStatusBarOffset], self.webView.frame.size.width, self.webView.frame.size.height - [self getStatusBarOffset] + STATUSBAR_HEIGHT)];`, because the viewbounds height is subtracted by `STATUSBAR_HEIGHT` in `viewWillApear`? It looks pretty good!
![3](https://user-images.githubusercontent.com/5656924/49909527-4c2a1a80-feba-11e8-9f2e-6a47592a437e.png)

Contributor guide

Open the contributing guide

Research direction

Start with the iOS implementation's rePositionViews function and viewWillApear handling, then compare the behavior introduced by pull request 265. Reproduce toolbarposition=top on iOS, including iPhone X, and verify that the webview does not cover the body or leave a bottom gap.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, objective-c
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.