I’m trying to style an app’s status bar color with the StatusBar plugin. Specifically the backgroundColorByHexString function as specified here https://ionicframework.com/docs/native/status-bar/#backgroundColorByHexString.
Here’s my code, really simple:
this.statusBar.styleLightContent();
this.statusBar.backgroundColorByHexString("#2f2e33");
I’m testing on the Android platform for now, and it works fine when I run with ionic cordova run android
. The status bar is the correct grey color.
However, when I run it with ionic cordova run android --prod
the style isn’t applied.
I’ve tried using the vanilla plugin with
(<any>window).StatusBar.styleLightContent();
(<any>window).StatusBar.backgroundColorByHexString("#2f2e33");
with the same results. It works in a debug build but not prod.
I’ve opened an issue in the ionic native github, where some other developers have indicated that they’ve run into the same issue but there hasn’t been any response so far. https://github.com/ionic-team/ionic-native/issues/2307
I don’t know enough about cordova plugin development or the Ionic build process to even know where to start debugging/troubleshooting.
Can anyone provide some insight as to why the --prod
build would break a plugin or look into this?