capacitor-plugin-android-insets
Capacitor plugin for retrieving proper top offset of Android status bar.
This repo is published version with changed name of https://github.com/jorisbertomeu/capacitor-insets-v2, which was based on archived https://github.com/igorcd/capacitor-insets-plugin/. It should work perfectly fine in Capacitor@4
.
Install
npm install --save capacitor-plugin-android-insets
yarn add capacitor-plugin-android-insets
npx cap sync
Why?
This plugin is required only on Android when using StatusBar.setOverlaysWebView({ overlay: true })
. There is a problem with top offset counting, when status bar is transparent. Related issue: https://github.com/ionic-team/capacitor/issues/2840.
Usage
import { AndroidInsets } from 'capacitor-plugin-android-insets'
const { value } = await AndroidInsets.top();
API
top()
top() => Promise<TopBottomReturn>
Returns top offset of the status bar
Returns: Promise<TopBottomReturn>
bottom()
bottom() => Promise<TopBottomReturn>
Returns bottom offset of the status bar
Returns: Promise<TopBottomReturn>
Interfaces
TopBottomReturn