Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

expo/status-bar-height

Repository files navigation

🚨 This package has been deprecated in favor of react-native-safe-area-context which works in Expo Go and across iOS, Android, and web!

Listen to status bar changes during incoming calls and other multi-tasking events 💙

Test in a simulator with (⌘ Y) to toggle the status bar height.

Snack: https://snack.expo.io/@bacon/status-bar-height-example

Installation

yarn add @expo/status-bar-height

Usage

Import the library into your JavaScript file:

import StatusBarHeight from '@expo/status-bar-height';

Functions

StatusBarHeight.addEventListener( (height: number) => {} )

Given a callback this will be invoked whenever the status bar height changes. The status bar height changes when another app is running a background activity.

  • Phone Calls
  • Navigating
  • Facetime

StatusBarHeight.removeEventListener( (height: number) => {} )

The provided function will stop receiving updates

StatusBarHeight.getAsync(): Promise<number>

Get the current height of the status bar async.

const height = await StatusBarHeight.getAsync();

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •