Skip to content

StatusBar: Cannot set style after hiding splash screen without waiting #2385

@korb-sc

Description

@korb-sc

Bug Report

Plugin(s)

 "@capacitor/splash-screen": "^7.0.1",
 "@capacitor/status-bar": "7.0.1",

Capacitor Version

Latest Dependencies:

  @capacitor/cli: 7.4.2
  @capacitor/core: 7.4.2
  @capacitor/android: 7.4.2
  @capacitor/ios: 7.4.2

Installed Dependencies:

  @capacitor/ios: not installed
  @capacitor/cli: 7.4.2
  @capacitor/core: 7.4.2
  @capacitor/android: 7.4.2

[success] Android looking great! 👌

Platform(s)

Android

Current Behavior

I cannot set the status bar style to "Light" directly after hiding the splash screen.
The call to await StatusBar.setStyle({ style: Style.Light }); does not seem to have any effect, resulting in white text on white background.

Image

Expected Behavior

I want to be able to change the status bar style after hiding the splash screen.

Image

Code Reproduction

I have provided a sample application here:
https://github.com/korb-sc/statusbar-demo/tree/main

You should be able to run this application in an Android emulator with API-Level 35.

There seems to be some kind of timing problem. I added an alert after hiding the status bar here: https://github.com/korb-sc/statusbar-demo/blob/a55e69dbcc546863e92ab6435d1cde957c4df8ca/src/app/app.component.ts#L23.
After closing this alert, the status bar text switches to dark as expected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions