Expo SystemUI

GitHub

npm

A library that allows interacting with system UI elements.

Bundled version:
~2.9.4

expo-system-ui enables you to interact with UI elements that fall outside of the React tree. Specifically the root view background color, and locking the user interface style globally on Android.

Platform Compatibility

Android DeviceAndroid EmulatoriOS DeviceiOS SimulatorWeb

Installation

Terminal
npx expo install expo-system-ui

If you are installing this in an existing React Native app, make sure to install expo in your project.

API

import * as SystemUI from 'expo-system-ui';

Methods

SystemUI.getBackgroundColorAsync()

Gets the root view background color.

Returns:
Promise<ColorValue | null>

Current root view background color in hex format. Returns null if the background color is not set.

Example

const color = await SystemUI.getBackgroundColorAsync();

SystemUI.setBackgroundColorAsync(color)

ParameterTypeDescription
colornull | ColorValue

Changes the root view background color. Call this function in the root file outside of you component.

Returns:
Promise<void>

Example

SystemUI.setBackgroundColorAsync("black");