Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: we'll want to update the cap migrate command with this change soon (or create a task to do it; don't need to do it now)

Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
package com.getcapacitor.myapp;

import android.os.Bundle;
import androidx.activity.EdgeToEdge;
import com.getcapacitor.BridgeActivity;

public class MainActivity extends BridgeActivity {}
public class MainActivity extends BridgeActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function capacitorSystemBarsCheckMetaViewport() {
capacitorSystemBarsCheckMetaViewport();
""";

private String insetsHandling = INSETS_HANDLING_CSS;
private String insetsHandling = INSETS_HANDLING_NATIVE;
private boolean hasViewportCover = false;

private String currentStatusBarStyle = STYLE_DEFAULT;
Expand Down Expand Up @@ -122,7 +122,7 @@ private void initSystemBars() {
String style = getConfig().getString("style", STYLE_DEFAULT).toUpperCase(Locale.US);
boolean hidden = getConfig().getBoolean("hidden", false);

String configuredInsetsHandling = getConfig().getString("insetsHandling", INSETS_HANDLING_CSS);
String configuredInsetsHandling = getConfig().getString("insetsHandling", INSETS_HANDLING_NATIVE);
if (
INSETS_HANDLING_CSS.equals(configuredInsetsHandling) ||
INSETS_HANDLING_DISABLE.equals(configuredInsetsHandling) ||
Expand All @@ -132,9 +132,9 @@ private void initSystemBars() {
} else {
Logger.warn(
"SystemBars",
"Unknown insetsHandling value '" + configuredInsetsHandling + "'. Falling back to '" + INSETS_HANDLING_CSS + "'."
"Unknown insetsHandling value '" + configuredInsetsHandling + "'. Falling back to '" + INSETS_HANDLING_NATIVE + "'."
);
insetsHandling = INSETS_HANDLING_CSS;
insetsHandling = INSETS_HANDLING_NATIVE;
}

warnAboutUnsupportedConfigurationValues();
Expand Down
2 changes: 1 addition & 1 deletion cli/src/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ export interface PluginsConfig {
* This shifts the responsibility from Capacitor to your own code to handle the insets.
* Be aware that this might result in a visually broken UI if your native app code and the content loaded into the webview do not correctly handle safe area insets.
*
* @default "css"
* @default "native"
*/
insetsHandling?: 'native' | 'css' | 'disable';

Expand Down
2 changes: 0 additions & 2 deletions core/system-bars.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ The status bar visibility defaults to visible and the style defaults to

Due to a [bug](https://issues.chromium.org/issues/40699457) in some older versions of Android WebView (< 140), correct safe area values are not available via the `safe-area-inset-x` CSS `env` variables. This plugin has two ways to workaround this. To control this behavior, use the `insetsHandling` configuration setting.

You should also consider calling `EdgeToEdge.enable(this);` inside your application's `BridgeActivity.onCreate` if `insetsHandling` is not set to `disable`. Starting in Capacitor 9, `insetsHandling` will default to `native` and this will be called for you.

## Example

```typescript
Expand Down
Loading