apache / apache/cordova-plugin-inappbrowser
Webview offset and height issue on ios when `toolbarposition=top`
- 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.

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.

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.

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!

Contributor 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