When updating the Status Bar via the Capacitor Status Bar API (https://capacitorjs.com/docs/apis/status-bar#api) the changes may not take effect on Android devices. In newer versions of Android there is a Splash Screen Activity provided by the OS which blocks the status bar from being updated while the splash screen is present. This results in situations where a developer might update the styling to the status bar but not see any changes.
Fortunately, there is a workaround for this situation. When you want to update the status bar, first hide the splash screen and then set a timeout for 500ms. In that timeout you can change any of the styles of the status bar. Here is an example
await SplashScreen.hide()
setTimeout(async () => {
await StatusBar.setStyle({ style: Style.Dark })
await StatusBar.setBackgroundColor({ color: '#0060a9' })
}, 500);
Comments
0 comments
Please sign in to leave a comment.