2.0.1 • Published 3 months ago

expo-barcode-generator v2.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago

Expo Barcode Generator

code style: prettier

js-standard-style

This is a React Native component that generates barcodes using the JSBarcode library and renders them using the react-native-svg package. The component supports both Expo Web, IOS and Android .

Expo Compatibility

💡 For Expo SDK 50, use version 2

💡 For Expo SDK 49 and under, use version 1

Installation

NPM:

npm i expo-barcode-generator

YARN:

yarn add expo-barcode-generator

Usage

import React from 'react';
import { View } from 'react-native';
import { Barcode } from 'expo-barcode-generator';

export default function App() {
  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Barcode
        value="123456789999"
        options={{ format: 'UPC', background: 'lightblue' }}
        rotation={-5}
      />
    </View>
  );
}

Options

The options object allows you to customize the appearance and behavior of the barcode. The available options are as follows:

OptionDescriptionDefault Value
valueThe value to be encoded into the barcode. (required)-
widthThe width of each barcode unit.2
heightThe height of the barcode.100
displayValueA boolean indicating whether to display the value as text below the barcode.true
fontOptionsThe font options for the displayed text.'bold'
textThe text to be displayed below the barcode.''
textAlignThe alignment of the displayed text. Possible values: 'left', 'center', 'right'.'center'
textPositionThe position of the displayed text relative to the barcode. Possible values: 'top', 'bottom'.'bottom'
textMarginThe margin between the barcode and the displayed text.2
fontSizeThe font size of the displayed text.20
backgroundThe background color of the barcode.'#ffffff'
lineColorThe color of the barcode lines.'#000000'
marginTopThe top margin of the barcode.10
marginBottomThe bottom margin of the barcode.10
marginLeftThe left margin of the barcode.10
marginRightThe right margin of the barcode.10
rotationThe rotation angle of the barcode in degrees.-

Supported Barcodes

The following barcodes are supported by this library:

  • CODE128
  • CODE128 (automatic mode switching)
  • CODE128 A/B/C (force mode)
  • EAN
  • EAN-13
  • EAN-8
  • EAN-5
  • EAN-2
  • UPC (A)
  • UPC (E)
  • CODE39
  • ITF
  • ITF-14
  • MSI
  • MSI10
  • MSI11
  • MSI1010
  • MSI1110
  • Pharmacode
  • Codabar
2.0.1

3 months ago

2.0.0

3 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago