@aramir/react-native-barcode

中文文档
1.1.2发布于 2026/07/26MITTypeScriptCommonJS近 30 天下载 1919

Uses jsbarcode to generate barcode binary data with native svg rendering via react-native-svg.

原始使用文档
文档目录4 节
  1. Installation
  2. Usage
  3. Properties
  4. Supported barcode formats

React Native Barcode Generator

Uses jsbarcode to generate barcode binary data with native svg rendering via react-native-svg.

Installation

npm install react-native-svg @aramir/react-native-barcode

Usage

<Barcode format="CODE128" value={"HelloWorld"} />

Properties

PropTypeDefaultDescription
valuestring""the text to be encoded
widthnumber2the width of a single bar
maxWidthnumber-the max width of the barcode
heightnumber100the height of the barcode
formatFormatCODE128barcode format (typed enum of the supported formats below)
lineColorstring#000000set the color of a single bar
backgroundstring#ffffffcontainer background (rgba(0,0,0,0) for transparent)
textReact.ReactNode-an optional text that will be rendered under the barcode
textStyleTextStyle-styles to be applied on the text component
styleViewStyle-styles to be applied on the container
onError(error: Error) => void-an optional error handler

Supported barcode formats

  • CODE128 - high-density linear barcode symbology defined in ISO/IEC 15417:2007. Supports all 128 ASCII characters and encodes numbers efficiently.
    • CODE128 (automatic mode switching)
    • CODE128 A/B/C (force mode)
  • EAN - European Article Number is a global standard that defines a barcode format and a unique numbering system used in retail and trade.
    • EAN-13
    • EAN-8
    • EAN-5
    • EAN-2
    • UPC (A)
    • UPC (E)
  • CODE39 - discrete barcode symbology defined in ISO/IEC 16388:2023. Specification defines 43 characters, consisting of uppercase letters, numeric digits and a number of special characters.
  • ITF - Interleaved 2 of 5 is a continuous two-width barcode symbology encoding digits. Used commercially on 135 film, for ITF-14 barcodes and on cartons of some products, while the products inside are labeled with UPC or EAN.
    • ITF
    • ITF-14
  • MSI - Modified Plessey is a barcode symbology developed by the MSI Data Corporation, based on the original Plessey Code symbology. It is a continuous symbology that is not self-checking. Used primarily for inventory control, marking storage containers and shelves in warehouse environments.
    • MSI10
    • MSI11
    • MSI1010
    • MSI1110
  • Pharmacode - Pharmaceutical Binary Code, is a barcode standard, used in the pharmaceutical industry as a packing control system. Designed to be readable despite printing errors.
  • Codabar - Linear barcode symbology designed to be accurately read even when printed on dot matrix printers for multipart forms such as FedEx airbills and blood bank forms.
  • CODE93 - alphanumeric, variable length symbology designed in 1982 by Intermec to provide a higher density and data security enhancement to Code 39.

版本与发布记录

@aramir/react-native-barcode 共发布 6 个版本,首次发布于 2025/07/20;过去 12 个月发布了 3 个版本。

版本发布日期距今
1.1.2latest2026/07/263 个月前
1.1.12026/07/263 个月前
1.0.32025/12/2010 个月前
1.0.22025/09/231.1 年前
1.0.12025/07/211.3 年前
1.0.02025/07/201.3 年前

关于 @aramir/react-native-barcode 的常见问题

@aramir/react-native-barcode 是什么?

Uses jsbarcode to generate barcode binary data with native svg rendering via react-native-svg.

如何安装 @aramir/react-native-barcode?

在项目目录运行 npm install @aramir/react-native-barcode,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=19)、react-native(>=0.81)、react-native-svg(>=15)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@aramir/react-native-barcode 支持 TypeScript 吗?

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

@aramir/react-native-barcode 支持 ESM 还是 CommonJS?

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

@aramir/react-native-barcode 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.19.4。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@aramir/react-native-barcode 可以商用吗?

@aramir/react-native-barcode 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@aramir/react-native-barcode 的下载量有多少?

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

@aramir/react-native-barcode 还在维护吗?

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