Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expo-barcode-generator

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-barcode-generator

A React Native barcode generator compatible with Expo

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
975
increased by33.2%
Maintainers
0
Weekly downloads
 
Created
Source

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 51, use version 3

💡 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

Keywords

FAQs

Package last updated on 01 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc