Configure the SafeArea plugin in capacitor.config.ts
masterYou can configure initial system bar styles and Android-specific viewport behavior in your capacitor.config.ts file under the plugins object using the SafeArea key.
Configuration Options
| Key | Type | Default | Description |
|---|---|---|---|
statusBarStyle | SystemBarsStyle | null | The initial style applied to the status bar. |
navigationBarStyle | SystemBarsStyle | null | The initial style applied to the navigation bar. Note: On iOS, the home indicator color is managed automatically by the OS and cannot be styled. |
detectViewportFitCoverChanges | boolean | true | Android Only. If true, the plugin detects changes to the viewport-fit=cover meta tag. Setting this to false may cause UI issues if the webview content doesn't handle safe area insets correctly. |
initialViewportFitCover | boolean | true | Android Only. Sets the initial value for viewport-fit=cover to prevent layout jumps. The plugin will eventually sync with the actual value if detectViewportFitCoverChanges is true. |
offsetForKeyboardInsetBug | boolean | N/A | Deprecated. This is no longer necessary as the fix is included by default. |
const config: CapacitorConfig = {
plugins: {
SafeArea: {
statusBarStyle: 'DARK',
navigationBarStyle: 'LIGHT',
detectViewportFitCoverChanges: true,
initialViewportFitCover: true
}
}
};