@brightlayer-ui/react-native-themes

中文文档
8.1.1发布于 2026/07/22BSD-3-ClauseTypeScriptESM + CJS近 30 天下载 1.4万

React Native themes for Brightlayer UI applications

原始使用文档
文档目录5 节
  1. Installation
  2. React Native Paper Components Style Override
  3. TypeScript
  4. Usage of useFontWeight hook in your project
  5. Upgrading from version 6 -> 7

Brightlayer UI themes for React Native applications

Build

This package provides theming support for Eaton applications using the Brightlayer UI design system. It includes resources for developers using React Native with react-native-paper. This package comes with two theme options: a Blue theme (standard) and a Dark theme.

For other frameworks, check out our related packages:

Installation

Install with npm

npm install --save @brightlayer-ui/react-native-themes

or yarn

yarn add @brightlayer-ui/react-native-themes

or expo

yarn expo install @brightlayer-ui/react-native-themes

Usage

NOTE: Using the Brightlayer UI React Native theme requires that you add the Open Sans font to your application. You can learn how to do this by reading the instructions for Vanilla React Native or Expo. This will be added automatically if you start your project with the @brightlayer-ui/cli.

When using Expo, you will need to specify the name for each font weight you load using the format OpenSans-<Weight>, e.g., OpenSans-SemiBold. Refer to one of our React Native demos for reference.

To use our themes in your application, simply wrap the app in a Provider and pass in your desired theme (e.g., blue, blueDark).

Light Theme

import { Provider as ThemeProvider} from 'react-native-paper';
import * as BLUIThemes from '@brightlayer-ui/react-native-themes';
...
// Default Theme
<ThemeProvider theme={BLUIThemes.blue}>
    <App />
</ThemeProvider>

Dark Theme

import { Provider as ThemeProvider} from 'react-native-paper';
import * as BLUIThemes from '@brightlayer-ui/react-native-themes';
...
<ThemeProvider theme={BLUIThemes.blueDark}>
    <App />
</ThemeProvider>

React Native Paper Components Style Override

This Document contains a set of style overrides in components around various React Native Paper components.

By default, the theming mechanism provided by RNP is very minimal and does not allow us to style components precisely the way we want for Brightlayer UI applications. The theme does not cover all cases to circumvent this issue, for some components, you may need to add extra styles or theme overrides inline that can be used to bring them in alignment with Brightlayer UI applications

To style components listed in the document to look correct in the application, you should use the Brightlayer UI Components Style Override in place of the respective components from React Native Paper.

TypeScript

Our Brightlayer UI themes extend the themes provided by React Native Paper. If you are using these themes in a TypeScript project and want to access any of the properties that were added to the defaults, you need to use useExtendedTheme hook in your project:

import { useExtendedTheme } from '@brightlayer-ui/react-native-themes';
...
const theme = useExtendedTheme();
<Button mode="contained" style={{ backgroundColor: theme.colors.onOrangeFilledContainer }}>
    Label
</Button>

Usage of useFontWeight hook in your project

When the fontFamily of a Text element in your application needs to be modified, you can use the useFontWeight hook.For instance, to set the fontWeight to "bold", you can utilize the useFontWeight() hook as demonstrated below:

import { useFontWeight } from '@brightlayer-ui/react-native-themes';
...
const fontStyleBold = useFontWeight('700');
<Text variant={'headlineLarge'} style={{ ...fontStyleBold }}>
    headlineLarge
</Text>

Upgrading from version 6 -> 7

In the version 7, the library has been updated to use React Native Paper v5, which is adopting Material Design 3. The themes have now been updated to use Material Design 3 Themes.

版本与发布记录

@brightlayer-ui/react-native-themes 共发布 25 个版本,首次发布于 2021/11/03;过去 12 个月发布了 3 个版本。

版本发布日期距今
8.1.1latest2026/07/223 个月前
8.1.1-alpha.0alpha2026/07/143 个月前
8.1.02026/03/028 个月前
8.0.02025/07/281.3 年前
8.0.0-alpha.12025/07/181.3 年前
8.0.0-alpha.02025/07/011.4 年前

其他发布通道:beta → 6.0.0-beta.0,alpha → 8.1.1-alpha.0。

关于 @brightlayer-ui/react-native-themes 的常见问题

@brightlayer-ui/react-native-themes 是什么?

React Native themes for Brightlayer UI applications

如何安装 @brightlayer-ui/react-native-themes?

在项目目录运行 npm install @brightlayer-ui/react-native-themes,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react-native-paper(^5.15.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@brightlayer-ui/react-native-themes 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@brightlayer-ui/react-native-themes 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@brightlayer-ui/react-native-themes 可以商用吗?

@brightlayer-ui/react-native-themes 使用 BSD-3-Clause 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。另外不得用原作者名义为衍生产品背书。以上为概括,不构成法律意见,请以许可原文为准。

@brightlayer-ui/react-native-themes 的下载量有多少?

根据 npm 官方下载统计,@brightlayer-ui/react-native-themes 在 2026/10/09 – 2026/11/07 这 30 天内被下载 13,955 次,日均约 465 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@brightlayer-ui/react-native-themes 还在维护吗?

最新版本 8.1.1 发布于 2026/07/22(3 个月前);至今共发布 25 个版本,其中过去 12 个月发布了 3 个;首次发布于 2021/11/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。