Ionic 2 can't change color of iOS statusbar

I have followed the instructions in the ionic 2 docs but the code is not changing the color of my iOS status bar. The text in this bar is white and cannot be seen on the white background so I have tried to change it to black as follows:

StatusBar.overlaysWebView(true); StatusBar.styleDefault(); StatusBar.backgroundColorByName('black');

This code is in my app’s constructor. I use the following to import StatusBar:

import {StatusBar} from ‘ionic-native’;

The Cordova status bar plugin has been installed.

1 Like

Have you tried wrapping your code in a Platform.ready().then(…) call?

Yes I did. It turns out that StatusBar.overlaysWebView(true); should have been set to false!

4 Likes

Now the entire background color of the status bar goes invsible and the contents overlaps under the statusses