Expo SystemUI
一个允许与系统 UI 元素交互的库。
Android
iOS
Web
For the complete documentation index, see llms.txt. Use this Use this file to discover all available pages.
expo-system-ui 使你能够与超出 React 树范围的 UI 元素交互。具体来说,包括根视图背景颜色,以及在 Android 上全局锁定用户界面样式。
安装
Terminal
- npx expo install expo-system-uiIf 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
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();
| Parameter | Type | Description |
|---|---|---|
| color | null | ColorValue | Any valid CSS 3 (SVG) color. |
Changes the root view background color. Call this function in the root file outside of your component.
Returns:
Promise<void>Example
SystemUI.setBackgroundColorAsync("black");