@adrianso/ 反应本地化- 条码创建器
反应原生组件生成条码.
用途 Js 条码 用于数据编码.
用途 @ react-native-community/ react-native-svg (英语) 改为 @ react-native-community/art (英语)。 。 。 .
开始
步骤1
安装 @adrianso/react-native-barcode-builder 和依附关系:
npm install @adrianso/react-native-barcode-builder react-native-svg
或者说
yarn add @adrianso/react-native-barcode-builder react-native-svg
步骤2
开始使用组件
import Barcode from '@adrianso/react-native-barcode-builder';
<Barcode value="Hello World" format="CODE128" />;
或者可以引用条码ToSvg函数将任何条码转换为和SVG字符串
import { barcodeToSvg } from '@adrianso/react-native-barcode-builder';
const svg = barcodeToSvg({
value: 'Hello world!',
});
/* svg will now have the following value
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 167 100" preserveAspectRatio="xMinYMin slice">
<path d="M0,0h2v100h-2z M3,0h1v100h-1z M6,0h1v100h-1z M11,0h2v100h-2z M16,0h1v100h-1z M18,0h1v100h-1z M22,0h1v100h-1z M24,0h2v100h-2z M28,0h1v100h-1z M33,0h2v100h-2z M37,0h1v100h-1z M39,0h1v100h-1z M44,0h2v100h-2z M48,0h1v100h-1z M50,0h1v100h-1z M55,0h1v100h-1z M59,0h4v100h-4z M64,0h1v100h-1z M66,0h2v100h-2z M69,0h2v100h-2z M73,0h2v100h-2z M77,0h3v100h-3z M81,0h1v100h-1z M85,0h2v100h-2z M88,0h1v100h-1z M92,0h4v100h-4z M97,0h1v100h-1z M99,0h1v100h-1z M102,0h1v100h-1z M105,0h4v100h-4z M110,0h2v100h-2z M114,0h1v100h-1z M116,0h1v100h-1z M121,0h1v100h-1z M126,0h1v100h-1z M129,0h2v100h-2z M132,0h2v100h-2z M136,0h2v100h-2z M139,0h2v100h-2z M143,0h3v100h-3z M147,0h1v100h-1z M151,0h2v100h-2z M154,0h2v100h-2z M159,0h3v100h-3z M163,0h1v100h-1z M165,0h2v100h-2z" fill="#000000"/>
</svg>
*/
您可以在 JsBarcode 读取器。 。 。 .

属性
| 财产 | 说明 |
|---|---|
value |
条码代表什么(需要). |
format |
要使用的条码类型( 默认: CODE128) . |
width |
单行宽度( 默认: 2) |
height |
条码高度( 默认: 100) |
text |
覆盖显示的文本. |
lineColor |
条和文字的颜色( 默认 : # 000000) |
background |
条码的背景颜色( 默认: #ffffff) |
onError |
处理所选格式的无效条码 |