npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@expo-harmony/expo-system-ui

v57.0.4-harmony.1

Published

HarmonyOS port of expo-system-ui

Readme

@expo-harmony/expo-system-ui

GitHub 仓库 | 官方文档

为 HarmonyOS 上的 React Native 应用提供 Expo System UI 的原生实现,与官方 expo-system-ui 配套使用。

安装

本包适配 Expo SDK 57。

引入本包前,需要确保应用使用的 HarmonyOS SDK 至少为 API 13(HarmonyOS 5.0.1)。

npm install @expo-harmony/expo-system-ui expo-system-ui@~57.0.4

构建期配置

要在构建期配置背景色和界面模式,在 app.json 的 plugins 中注册 @expo-harmony/expo-system-ui,配置写在 harmony 字段下。这两项在窗口页面加载完成后应用,不改变系统启动图:

{
  "expo": {
    "plugins": ["@expo-harmony/expo-system-ui"],
    "harmony": {
      "bundleName": "com.example.app",
      "backgroundColor": "#FFFFFF",
      "userInterfaceStyle": "automatic"
    }
  }
}

也可以在 app.config.ts 中使用 TypeScript 配置插件:

import systemUI from '@expo-harmony/expo-system-ui/plugin';

export default {
  expo: {
    plugins: [systemUI()],
    harmony: {
      bundleName: 'com.example.app',
      backgroundColor: '#FFFFFF',
      userInterfaceStyle: 'automatic',
    },
  },
};

backgroundColor 接受 React Native 支持的 CSS 颜色。userInterfaceStyle 可设为 light、dark 或 automatic,省略时按 light 处理。两项优先读取 harmony 字段下的值,没有时读取 Expo 顶层的同名配置。

userInterfaceStyle 在每次窗口页面首次就绪时应用。light 和 dark 设置浅色或深色模式。automatic 继承应用或系统当前的模式。API 18 及以上界面模式设置在当前 UIAbility 上,automatic 跟随宿主的应用级设置,没有时跟随系统。API 13–17 设置在整个应用上,多个 Ability 共享这一设置。

运行时读写背景色直接使用 SystemUI.getBackgroundColorAsync 和 SystemUI.setBackgroundColorAsync,插件只用于构建期的初始配置。

API 对照表

Methods

SystemUI.setBackgroundColorAsync(color: ColorValue | null): Promise<void>

将当前窗口背景色设为 color。color 接受有效的 CSS 3 (SVG) 颜色;传入 null 会清除已设置的颜色,恢复当前界面模式对应的默认背景色。

在窗口页面就绪前调用会等待页面就绪。如果等待期间窗口销毁或替换,Promise 会以错误拒绝。

设置的颜色会在应用重启后恢复,并覆盖构建期配置的背景色。Dev Launcher 中打开的项目使用项目配置的背景色,未配置时使用当前界面模式的默认颜色。离开开发项目时,窗口恢复宿主应用的背景色。系统无法保存颜色时,本次调用仍会更新当前窗口,但重启后不保证恢复。

SystemUI.getBackgroundColorAsync(): Promise<ColorValue | null>

返回当前窗口背景色,格式为不带透明度的小写 #rrggbb。若当前窗口尚无本包记录的背景色,则返回 null。

  • HarmonyOS 不支持直接读取窗口背景色,因此返回本包为当前窗口记录并应用的颜色;如果其他代码修改了窗口背景色,返回值不会反映该修改。

未设置背景色时,默认背景色跟随当前有效的界面模式。浅色模式为白色,深色模式为黑色。

Error codes

  • ERR_SYSTEM_UI_COLOR:传入的颜色参数无效,无法用于当前窗口。
  • ERR_SYSTEM_UI_WINDOW:当前应用窗口不可用,或操作完成前窗口已销毁或替换。
  • ERR_SYSTEM_UI_ABILITY_NOT_INITIALIZED:当前 UIAbility 尚未完成 System UI 初始化。
  • ERR_SYSTEM_UI_DESTROYED:调用时 Expo 运行时或 UIAbility 已销毁。

Author

expo-harmony © Baoshuo, Released under the MIT License. Authored and maintained by Baoshuo with help from contributors.

Personal Website · Blog · GitHub @renbaoshuo · Twitter @renbaoshuo