owlsdepartment / capacitor-plugin-android-insets

Capacitor plugin for calculating proper Android top offset of status bar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

# with npm
npm install --save capacitor-plugin-android-insets
# with yarn
yarn add capacitor-plugin-android-insets
# after any install
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: ionic-team/capacitor#2840.

Usage

import { AndroidInsets } from 'capacitor-plugin-android-insets'

const { value } = await AndroidInsets.top();

API

top()

top() => Promise<TopReturn>

Returns top offset of the status bar

Returns: Promise<TopReturn>


Interfaces

TopReturn

Prop Type
value number

About

Capacitor plugin for calculating proper Android top offset of status bar


Languages

Language:JavaScript 35.8%Language:Java 22.6%Language:Swift 11.1%Language:HTML 9.1%Language:Ruby 7.8%Language:TypeScript 7.8%Language:Objective-C 5.4%Language:CSS 0.4%