react-native-nitro-barcode
v1.0.2
Published
High-performance CODE128 barcode generator via Nitro C++
Maintainers
Readme
react-native-nitro-barcode
Native CODE128 barcode rasterization for React Native, implemented in C++ via Nitro Modules.
Features
- CODE128 set B encoding (same symbology as
react-native-barcode-svg/ JsBarcode) - Rasterizes to RGBA8888 on a background thread (C++)
- Zero SVG / JS barcode layout work at runtime
- Typed Nitro Hybrid Object API
Install
npm install react-native-nitro-barcode react-native-nitro-modules @shopify/react-native-skiaor:
yarn add react-native-nitro-barcode react-native-nitro-modules @shopify/react-native-skiaThen install iOS pods:
cd ios && pod installreact-native-nitro-modules and @shopify/react-native-skia are peer dependencies and must be installed in the host app.
Usage
import {
getBarcodeGenerator,
NitroBarcodeImage,
} from 'react-native-nitro-barcode';
const gen = getBarcodeGenerator();
const bitmap = gen.generateCode128('1234567890', {
moduleWidth: 2,
height: 60,
lineColor: 0xff000000,
backgroundColor: 0xffffffff,
});
// bitmap: { width, height, data: ArrayBuffer }
<NitroBarcodeImage
value={value}
options={{ moduleWidth: 2, height: 60, lineColor: 0xff000000 }}
/>;Regenerate Nitro bindings
After editing src/specs/*.nitro.ts, regenerate the Nitro bindings:
npx nitrogen
npm run build