capacitor icon indicating copy to clipboard operation
capacitor copied to clipboard

[Bug]: capacitor 7 android navigation bar overlap

Open danielehrhardt opened this issue 1 year ago • 15 comments

Capacitor Version

💊 Capacitor Doctor 💊

Latest Dependencies:

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

Installed Dependencies:

@capacitor/cli: 7.0.0-rc.0 @capacitor/core: 7.0.0-rc.0 @capacitor/android: 7.0.0-rc.0 @capacitor/ios: 7.0.0-rc.0

[success] iOS looking great! 👌 [success] Android looking great! 👌

Other API Details


Platforms Affected

  • [ ] iOS
  • [x] Android
  • [ ] Web

Current Behavior

since capacitor 7 the app on android overlaps the navigation bar and

StatusBar.setOverlaysWebView({
        overlay: false,
      });

does not work anymore

Expected Behavior

tha navigation and statusbar should not overlap

Project Reproduction

new capacitor project

Additional Information

No response

danielehrhardt avatar Jan 22 '25 10:01 danielehrhardt

I switched to https://github.com/capacitor-community/safe-area

mleister97 avatar Jan 22 '25 10:01 mleister97

I switched to https://github.com/capacitor-community/safe-area

me too

danielehrhardt avatar Jan 22 '25 10:01 danielehrhardt

Can you update your Capacitor and plugins especially to 7.0.1 and see if it goes away.

markemer avatar Jan 22 '25 15:01 markemer

Even just the release version of 7.0.0 and let me know how that goes.

markemer avatar Jan 22 '25 17:01 markemer

This issue needs more information before it can be addressed. In particular, the reporter needs to provide a minimal sample app that demonstrates the issue. If no sample app is provided within 15 days, the issue will be closed. Please see the Contributing Guide for how to create a Sample App. Thanks! Ionitron 💙

ionitron-bot[bot] avatar Jan 23 '25 18:01 ionitron-bot[bot]

Can I get an example of exactly what you're seeing?

markemer avatar Jan 23 '25 18:01 markemer

I am not sure why this was closed as I see no message indicating a valid resolution, just a switch to using a different plugin for something we probably ought to be handling OOTB.

As such, I have created a proper sample reproduction: https://github.com/kensodemann/status-bar

See the README.md in the sample for a simple rundown of what I am seeing across a few different versions of Android and how that compares to Capacitor v6 behaviors.

kensodemann avatar Jan 25 '25 13:01 kensodemann

Is this related to issue #7648?

This issue is caused by Android WebView being broken and not returning proper values for safe area.

Android 15 (SDK 35) introduced edge-to-edge layout. Using SDK 34 forces the old behvior without the edge-to-edge layout, but this is not a long-term solution. Another option may be to opt-out of edge-to-edge but this also doesn't embrace the changes.

neave avatar Jan 26 '25 10:01 neave

I'm facing the same issue, is there a fix planned for this? this is a stopper for migration for me

m7alshehri avatar Jan 27 '25 10:01 m7alshehri

This does seem to be the same problem as described in issues #6423, #7648, and #7804. Android WebView provides incorrect values for the safe area insets in CSS. The only workaround seems to be to downgrade to SDK 34, or use android:windowOptOutEdgeToEdgeEnforcement="true", or try to use CSS variables via @capacitor-community/safe-area. Even if Google do fix this eventually, it will be a longstanding problem which should be addressed by Capacitor.

neave avatar Jan 27 '25 13:01 neave

@capacitor-community/safe-area

I tried to implement it with the safe-area plugin but it is not really consistent over the API Levels. It would be great if Capacitor / Ionic will provide some Solution.

danielehrhardt avatar Jan 27 '25 18:01 danielehrhardt

I am also facing the same issue, I am wondering why this has not been fixed yet.

AvniAnay avatar Feb 03 '25 01:02 AvniAnay

Add to capacitor.config.ts

const config: CapacitorConfig = {
........
plugins: {
    StatusBar: {
      overlaysWebView: false,
    },
  },
}

https://capacitorjs.com/docs/apis/status-bar#configuration

comandos avatar Feb 05 '25 23:02 comandos

@markemer when this fix #7871 will be released? any target date?

m7alshehri avatar Feb 25 '25 07:02 m7alshehri

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Mar 27 '25 08:03 ionitron-bot[bot]