Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova iOS white bar at top

After adding StatusBarOverlaysWebview to config.xml, i get a white bar at the top of the screen and all the content is pushed down (see screenshot - there is a white bar on top of the statusbar). So instead of just adding the statusbar height (20px) to the screen, it adds 40px.

I double-checked all my styling and everything looks fine, so i guess its caused by the plugin somehow. Can anyone tell me how to solve this?

This is my config:

<preference name="StatusBarOverlaysWebview" value="false" />
<preference name="StatusBarBackgroundColor" value="#FF543E" />
<preference name="fullscreen" value="true" />

enter image description here

This is what it looks like without setting a color and using window.StatusBar.overlaysWebView(false); instead of config.xml

enter image description here

like image 826
user3740962 Avatar asked Apr 26 '16 06:04

user3740962


People also ask

How to get black background for StatusBar in Cordova?

Plugin cordova-plugin-statusbar will help you achieve what you want to do. After adding plugin add following preference in config.xml to get black background Available values are default, lightcontent, blacktranslucent, blackopaque.

How do I change the iOS status bar of my App?

In order to change the iOS status bar of your progressive web app, you must use the apple-mobile-web-app-status-bar-style meta tag. Unfortunately, the number of ways to customize the status bar is fairly limited, but Apple offers three distinct settings: default, black, and black-translucent.

How to show/hide the status bar in ionic application?

How to Show/ Hide the Status Bar in Ionic Application? After checking if it is visible by using the inVisible () method We can call the overlaysWebView method which takes a boolean to hide the overlap when to show apps in full screen.

What does the default status bar look like?

The default setting has a white background with black text and symbols. The black setting has a black background and black text and symbols, making it appear completely black. If you do not use the status bar meta tag, this is what status bar will look like.


2 Answers

Try this, below code is working for me:

<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#2D81C1" />
<preference name="Fullscreen" value="false" />

if you still have problem and if the same code was working for you in the previous builds, please check if plug in is installed and working properly

Update: For iOS 11 and iPhone X there are some changes in the library and HTML meta tags

In index.html change meta tag to this:

<meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

Please update ionic-angular library also for the latest devices support

More information here: iOS 11 ionic checklist

like image 50
HardikDG Avatar answered Oct 13 '22 06:10

HardikDG


This appears to be a bug with the way Cordova handles iOS 11's statusbar. As a fix, you can put

    <meta name="viewport" content="viewport-fit=cover">

in your index.html.

like image 23
Steve W Avatar answered Oct 13 '22 07:10

Steve W