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.
Android Device | Android Emulator | iOS Device | iOS Simulator | Web |
---|---|---|---|---|
-
expo install expo-system-ui
If you're installing this in a bare React Native app, you should also follow these additional installation instructions.
import * as SystemUI from 'expo-system-ui';
SystemUI.getBackgroundColorAsync()
Gets the root view background color.
const color = await SystemUI.getBackgroundColorAsync();
Promise<ColorValue | null>
Current root view background color in hex format. Returns null
if the background color is not set.
SystemUI.setBackgroundColorAsync(color)
Name | Type | Description |
---|---|---|
color | ColorValue | Any valid CSS 3 (SVG) color. |
Changes the root view background color.
SystemUI.setBackgroundColorAsync("white");
Promise<void>