@brightlayer-ui/react-native-vector-icons

中文文档
4.0.0发布于 2026/10/27BSD-3-ClauseTypeScriptCommonJS近 30 天下载 1.5万

Brightlayer UI vector icons for use in React Native projects, based on react-native-vector-icons

原始使用文档
文档目录7 节
  1. Installation for RN CLI
  2. Installation for Expo
  3. Setup guide for Expo Apps
  4. Set up font config plugin
  5. How to Fix iOS Issues
  6. Usage
  7. SVG Clip-Path Slashed Icons

React Native Vector Icons

This package allows you to use Brightlayer UI supplemental icons in the same way as you use react-native-vector-icons for Material Icons.

Installation for RN CLI

To install the Brightlayer UI react native vector icons from NPM as a dependency for your project, you can run one of the following commands in your project root:

npm install --save @brightlayer-ui/react-native-vector-icons
or
yarn add @brightlayer-ui/react-native-vector-icons

This package relies on react-native-vector-icons as a peer dependency:

npm install --save react-native-vector-icons
or
yarn add react-native-vector-icons

Slashed SVG helpers in this package also require react-native-svg:

npm install --save react-native-svg
or
yarn add react-native-svg

Carefully follow the integration instructions in their documentation for making the icons available in your project.

iOS

To use this package in iOS projects, Edit your Info.plist

  • Under the "UIAppFonts" key, add an entry for BrightlayerUIIcons.ttf.
<key>UIAppFonts</key>
<array>
  <string>BrightlayerUIIcons.ttf</string>
</array>

After updating these files you will need to install the Pods and recompile your application:

cd ios
pod install

Android

To use this package in Android projects, if you had previously provided the path for fonts.gradle under build.gradle you need to remove this path now:

Edit android/app/build.gradle ( NOT android/build.gradle ) and remove the following:

- apply from: "../../node_modules/@brightlayer-ui/react-native-vector-icons/fonts.gradle"

Installation for Expo

To install the Brightlayer UI React Native Vector Icons in your Expo project, run the following command in your project root:

yarn add @brightlayer-ui/react-native-vector-icons

Setup guide for Expo Apps

react-native-vector-icons supports Expo, and no further steps are required for native platforms, but you can optionally follow the steps below to set up the font config plugin.

Set up font config plugin

This is optional but recommended because through the config plugin, the icon font will be available in the app since build time, rather than being loaded at runtime - see more.

You need to use prebuild, to be able to use config plugins.

  1. In your app.config.json / js, add the following:
module.exports = {
    expo: {
        plugins: [
            [
                'expo-font',
                {
                    fonts: ['./node_modules/@brightlayer-ui/react-native-vector-icons/Fonts/BrightlayerUIIcons.ttf'],
                },
            ],
        ],
    },
};
  1. Run npx expo prebuild.
  2. Rebuild the app: npx expo run:ios or npx expo run:android.

How to Fix iOS Issues

If you encounter issues with iOS builds, follow these steps to clean your environment and resolve common problems:

Clean Derived Data and iOS Build Artifacts

From your project root, run:

rm -rf ios/build
rm -rf ios/Pods
rm -rf ios/Podfile.lock
cd ios
pod install
cd ..

Clean Xcode derived data:

rm -rf ~/Library/Developer/Xcode/DerivedData

Regenerate Codegen Files (Expo Managed Workflow)

If you are using Expo prebuild (managed workflow), run:

npx expo prebuild --clean

Remove Font from iOS

If you need to remove the icon font from your iOS project:

  1. Open your workspace in Xcode.
  2. In the project navigator, locate the fonts folder under Resources.
  3. Delete the reference to BrightlayerUIIcons.ttf.

Migration Guide

Follow this migration guide to know more about migration

Usage

Using these icons in your application is exactly the same as using react-native-vector-icons (we use their library to build ours so the API is identical).

import BLUIIcon from '@brightlayer-ui/react-native-vector-icons';
...
<BLUIIcon name={'broccoli'} color={'green'} size={24}/>

SVG Clip-Path Slashed Icons

If you need a true clip-path slash treatment (icon content cut out behind the slash), use the SlashedBLUISvgMaskIcon export with react-native-svg paths.

import { SlashedBLUISvgMaskIcon } from '@brightlayer-ui/react-native-vector-icons';
import { Path } from 'react-native-svg';

<SlashedBLUISvgMaskIcon slashColor={'#777'} slashLength={1.1} size={24}>
    <Path d="M3 3 H21 V21 H3 Z" fill="currentColor" />
</SlashedBLUISvgMaskIcon>;

If you want to pass a BLUI icon name directly (without creating Path children), use SlashedBLUIIcon:

import { SlashedBLUIIcon } from '@brightlayer-ui/react-native-vector-icons';

<SlashedBLUIIcon name={'device'} color={'currentColor'} slashColor={'#777'} slashLength={0.9} size={24} />;

版本与发布记录

@brightlayer-ui/react-native-vector-icons 共发布 27 个版本,首次发布于 2021/11/02;过去 12 个月发布了 7 个版本。

版本发布日期距今
4.0.0latest2026/10/2712 天前
4.0.0-alpha.0alpha2026/09/181 个月前
3.3.02026/05/295 个月前
3.2.12026/04/286 个月前
3.2.1-alpha.02026/04/176 个月前
3.2.02026/03/317 个月前

其他发布通道:beta → 2.0.0-beta.0,alpha → 4.0.0-alpha.0。

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

@brightlayer-ui/react-native-vector-icons 是什么?

Brightlayer UI vector icons for use in React Native projects, based on react-native-vector-icons

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

在项目目录运行 npm install @brightlayer-ui/react-native-vector-icons,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=16.8.1)、react-native(>=0.60.0-rc.0 <1.0.x)、react-native-svg(>=12.0.0)、react-native-vector-icons(^10.2.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

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

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

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

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

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

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

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

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

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

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