# @config-plugins/react-native-ble-plx 中文文档

规范地址：https://npmcn.com/package/%40config-plugins/react-native-ble-plx/

版本：7\.0\.0
npm 元数据更新时间：2026-09-23T11:26:00.824Z
中文译文更新时间：2026-11-10T15:29:17.972Z
软件包许可：未声明

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40config-plugins/react-native-ble-plx
原文对照：https://npmcn.com/package/%40config-plugins/react-native-ble-plx/?lang=original
项目主页：https://github.com/expo/config-plugins#readme
源码仓库：https://github.com/expo/config-plugins

弃用说明：react-native-ble-plx@\>=3\.1\.1 now ships with an Expo config plugin\.

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：15.1 kB，11 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- peer 依赖：expo ^49
- 首次发布：2021-06-25T02:00:17.228Z
- 最新版本发布：2023-07-14T21:51:15.565Z
- 近 30 天下载量：8312（2026-10-11 至 2026-11-09，npm 官方下载统计）
- 已发布版本数：13（近 12 个月 0 个）

## 中文简介

预建时用于自动配置反应- 内生- ble- plx 的配置插件

## 安装

```sh
npm install @config-plugins/react-native-ble-plx
```

也可以使用：`pnpm add @config-plugins/react-native-ble-plx`、`yarn add @config-plugins/react-native-ble-plx`、`bun add @config-plugins/react-native-ble-plx`

## README

# 配置- 插件/ 反应- 本地化- ble- 插件

自动配置的配置插件 `react-native-ble-plx` 当本地代码生成时( w)`npx expo prebuild`) (中文(简体) ). [上游 PR](https://github.com/Polidea/react-native-ble-plx/pull/842)。 。 。 .

## 博览会安装

> 已测试反对世博会SDK 49

> 此软件包不能用于“ Expo Go” 应用程序, 因为 [它需要自定义本地代码](https://docs.expo.io/workflow/customizing/)。 。 。 . 首先用纱线、 npm 或 [`npx expo install`](https://docs.expo.io/workflow/expo-cli/#expo-install)。 。 。 .

```sh
npx expo install react-native-ble-plx @config-plugins/react-native-ble-plx
```

安装此 npm 软件包后, 添加 [配置插件](https://docs.expo.io/guides/config-plugins/) 页:1 [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) 您的数组 `app.json` 或者说 `app.config.js`数字 :

```json
{
  "expo": {
    "plugins": ["@config-plugins/react-native-ble-plx"]
  }
}
```

接下来,重建您的应用程序,如 ["添加风俗本土代码"](https://docs.expo.io/workflow/customizing/) 向导.

## API 密码

该插件为额外的定制提供了道具. 每次更换道具或插件,都需要重建(并 `prebuild`(原始内容存档于2018-10-10). ). 本地应用. 如果没有添加额外的属性,则使用默认值.

-   `isBackgroundEnabled` (单位:千美元)_布尔_: 在Android上启用背景BLE支持. 添加数 `<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>` 页:1 `AndroidManifest.xml`默认 `false`。 。 。 .
-   `neverForLocation` (单位:千美元)_布尔_: 只有当您能够强烈断言您的应用程序从不从蓝牙扫描结果中获得物理位置时,才设定为真实. 更古老的Android设备仍需要定位许可. 注意,一些BLE信标是从扫描结果中过滤出来的. Android SDK 31+ (英语). 默认 `false`。 。 。 . _警告:这个参数是实验性的,BLE可能行不通. 保证在释放到生产前进行测试._
-   `modes` (单位:千美元)_字符串 \[\]_: 添加iOS `UIBackgroundModes` 页:1 `Info.plist`选项如下: `peripheral`,以及 `central`。默认为未定义.
-   `bluetoothAlwaysPermission` (单位:千美元)_字符串 qq 错误_: 设置iOS `NSBluetoothAlwaysUsageDescription` 权限消息到 `Info.plist`设置 `false` 将跳过添加权限。 默认为 `Allow $(PRODUCT_NAME) to connect to bluetooth devices`。 。 。 .

> Expo SDK 48支持iOS 13+,这意味着 `NSBluetoothPeripheralUsageDescription` 完全贬值。 已经不在了 `@config-plugins/react-native-ble-plx@5.0.0` 更伟大.

#### 示例

```json
{
  "expo": {
    "plugins": [
      [
        "@config-plugins/react-native-ble-plx",
        {
          "isBackgroundEnabled": true,
          "modes": ["peripheral", "central"],
          "bluetoothAlwaysPermission": "Allow $(PRODUCT_NAME) to connect to bluetooth devices"
        }
      ]
    ]
  }
}
```

## 常见问题

### @config-plugins/react-native-ble-plx 是什么？

预建时用于自动配置反应- 内生- ble- plx 的配置插件注意：该包已被作者标记为弃用——react-native-ble-plx@\>=3\.1\.1 now ships with an Expo config plugin\.

### 如何安装 @config-plugins/react-native-ble-plx？

在项目目录运行 npm install @config-plugins/react-native-ble-plx，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：expo（^49）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @config-plugins/react-native-ble-plx 支持 TypeScript 吗？

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

### @config-plugins/react-native-ble-plx 支持 ESM 还是 CommonJS？

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

### @config-plugins/react-native-ble-plx 可以商用吗？

@config-plugins/react-native-ble-plx 使用 未声明 许可。package\.json 没有声明许可证。没有许可证的代码默认保留全部权利，商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括，不构成法律意见，请以许可原文为准。

### @config-plugins/react-native-ble-plx 的下载量有多少？

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

### @config-plugins/react-native-ble-plx 还在维护吗？

最新版本 7\.0\.0 发布于 2023/07/15（3 年前）；至今共发布 13 个版本，其中过去 12 个月发布了 0 个；首次发布于 2021/06/25。作者已将其标记为弃用，新项目建议寻找替代方案。

