-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Issue with status bar on iPhone X when toolbar is at the top (v3.0.0) #301
Comments
@russcarver is this something I can fix when using Phonegap Build? Or is this an update waiting to happen? |
@vespino I'm waiting for them to fix this. In the mean time, I've just forked it and made the changes shown above. |
@russcarver can I use your fork? |
@vespino I don't have it anymore as I decided to go a different route, but if you fork it yourself and make the change outlined above, it will work fine. You can install plugins from local directories using the "cordova plugin add" command. |
@russcarver then I was just in time :) |
@russcarver do you mind sharing the different route btw? And do you mind pointing me to where the changes have to be made? I can't seem to find "statusBarFrame.size.height = STATUSBAR_HEIGHT;" in this file: https://github.com/vespino/cordova-plugin-inappbrowser/blob/master/src/ios/CDVInAppBrowser.m |
@russcarver think I have found it in this file: https://github.com/vespino/cordova-plugin-inappbrowser/blob/master/src/ios/CDVInAppBrowserNavigationController.m |
Mine was in the other file, but it could be outdated by now. You can also just change the #define of the constant since it looks used in only that one place. |
@russcarver seems like the change I made indeed solves the statusbar issue, but raises another one. When opening a link in the inappbrowser and closing it, the app freezes on iOS. You would think the guys at phonegap would have addressed this issue more than a year after introduction of the iPhone X. |
@vespino Sorry to hear that. That didn't happen to me in my tests, but I didn't test it out on iOS 12. Any details about your environment shared here may help the code owner debug. |
@russcarver I'm using this fork of themeable browser now: https://github.com/toontoet/cordova-plugin-themeablebrowser.git |
It seems to fix also the issue if you just remove the setting of the height Remove this line from CDVInAppBrowserNavigationController.m: Btw Statusbar height should be 44pt. I don't understand that why the statusbar height is hardcoded anyway. |
Besides this fix just pulls the transparent grayish backdrop/overlay to top of the viewport and not the inappbrowser-view. [EDIT]: |
In addition to setting CDVWKInAppBrowser.m:
The logic for hasTopNotch is from here: https://stackoverflow.com/questions/46192280/detect-if-the-device-is-iphone-x. In addition to that, I removed they gray-background: |
@mtlehtin You could probably create a pull request with this fix. |
@mtlehtin I would also appreciate a pull request for your solution |
inappbrowser-wkwebview is deprecated and it is merged with inappbrowser. There is no CDVWKInAppBrowser.m file anymore and if you implement @mtlehtin change in the CDVInAppBrowser.m it doesnt fix the issue... Any help? |
Applied fix from apache#301 (comment). This did not fix the background color of the top portion of the screen. Added additional "fixes" for that. References https://outsystemsrd.atlassian.net/browse/RNMT-3220
This seemed to fix the issue for me: Credit to "Rouven Retzlaff (BERIS)" who had a fix for CDVWKInAppBrowser.m, but I needed it for CDVUIInAppBrowser.m so I ported it over. |
We solved this that way: GEDYSIntraWare@0c75a93 Should I create a PR? |
Hello @NiklasMerz If you test your solution and work perfect on iphone x and previous version of iphone, you can create a PR for this solution, because this issue still not solved for iphone x family devices. Regards |
Thanks @mosababubakr for testing. PR created. Thanks @mtlehtin for your code, I adapted if a little bit. Looking forward for reviews. |
@mosababubakr Yes I already did that, but unfortunately I cannot add reviewers to PRs. But please be patient, Cordova maintainers do their work in free time. Dave has done a lot for this plugin recently. |
@NiklasMerz yes, you are correct, and we are appreciate that, thank you Do you test this solution in landscape mode? (Does this solution also fix notch in landscape mode)? Regards |
I did a quick test again with the test app and it looks good to me. Please test this yourself with your app. You may need to adjust your HTML and CSS to make it look good. There should be plenty Google results for that. |
This doesn't fix this is in landscape mode. even though I have viewport-fit=cover with padding of safe-area-inset.. it doesn't work when u change orientation of inappbrowser. however if opened in landscaped mode works fine then rotate to portrait..doesn't! and vice versa. I am not sure how to set height and width of statusBarFrame detecting orientation change..there is transparent area (where OP has grey area) my notification bar of webpage sticks below notch but page content is displayed through transaparent area while scrolling! really bad User experience :( . I don't have toolbar, its a full screen InAppbrowser |
@mtlehtin : can you please elaborate on how did you configured option for background color and UIStatusBarStyleLightContent or UIStatusBarStyleDefault? i was able to fix the height issue with what you have suggested but i am not able to change the gray background color? |
Hi, sorry not for answering for these. I've not been involved in the project anymore. But as for the background-color these are the code changes that i made in our internal fork: CDVInAppBrowserOptions.h: Expose the options:
CDVWKInAppBrowser.m:
Usage in the app:
|
@mtlehtin : Thanks for the reply. I did those changes and well the status bar does appear but what happens is I have my toolbar on bottom, and the status bar with set color appears in the bottom on top of bottom toolbar instead of status bar appearing on top at its default place. Any idea what is wrong? |
There is an issue with the status bar and the iPhone X as described at https://stackoverflow.com/questions/47399938/issue-with-status-bar-using-cordova-inappbrowser-and-ios-11-and-iphone-x
When the inappbrowser toolbar is at the top of the screen, the status bar on the iPhone X is half white and half gray.
Changing the following line in CDVInAppBrowser.m solves the problem and makes the whole status bar gray. Change line:
statusBarFrame.size.height = STATUSBAR_HEIGHT;
to
statusBarFrame.size.height = 0;
This does not seem to negatively affect other iPhones or iPads.
The text was updated successfully, but these errors were encountered: