Skip to content

[Android] overlaysWebView(true) doesn't work as expected when called in deviceready event #158

@breautek

Description

@breautek

Bug Report

Problem

Statusbar doesn't go into overlaymode when using overlaysWebView(true) when called inside the deviceready callback.

What is expected to happen?

The statusbar should go into overlay mode.

What does actually happen?

The statusbar stays in solid.

Information

I've provided a reproduction app available at https://github.com/breautek/statusbar-overlay-issue

I simply call StatusBar.overlaysWebView(true), however the statusbar remains a solid black colour.

If I open up the dev tools, and call StatusBar.overlaysWebView(true) again via the javascript console, it still doesn't work.

In the console, if I do:

StatusBar.overlaysWebView(false);
StatusBar.overlaysWebView(true);

Then the statusbar finally goes into the overlay state.

Additionally, if I comment out the StatusBar.overlaysWebView(true); line in deviceready and launch the app. Then call StatusBar.overlaysWebView(true); in the console, the statusbar does go into overlay mode the first time. Surrounding StatusBar.overlaysWebView(true); also works the first time in deviceready IF I surround the statement in a setTimeout of 1 second.

Occassionally the code in the reproduction app works as expected as is the first time. This suggests there is a race condition at play here.

Original discovery of this bug was found at #155 (comment)

Command or Code

Environment, Platform, Device

Observed on Android 6 & Android 9, cordova-android 8.1.0
Cordova 9

Version information

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions