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

react-native-qr-code-styling

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-qr-code-styling

React Native library for generating QR codes with a logo and styling based on qr-code-styling

  • 1.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

React Native QR Code Styling

Version

React Native library for generating QR codes with a logo and styling based on qr-code-styling

If you have issues / suggestions / notes / questions, please open an issue or contact me. Let's create a cool library together.

Examples

Installation

npm install react-native-qr-code-styling

Usage

import QRGenerator from 'react-native-qr-code-styling'

const viewDataBase64 = (e: string) => {};
<QRGenerator
  width={300}
  height={300}
  type={'svg'}
  value="https://github.com/huytrinh68/react-native-qr-code-styling"
  dotOptions={{
    type: 'classy-rounded',
    color: 'green',
    gradient: {
      type: 'linear',
      rotation: 100,
      colorStops: [
        {offset: 0, color: '#845EC2'},
        {offset: 0.8, color: '#0081CF'},
        {offset: 1, color: '#008F7A'},
      ],
    },
  }}
  cornerDotOptions={{
    type: 'dots',
    gradient: {
      type: 'linear',
      rotation: 100,
      colorStops: [
        {offset: 0, color: '#845EC2'},
        {offset: 0.8, color: '#0081CF'},
        {offset: 1, color: '#008F7A'},
      ],
    },
  }}
  cornerSquareOptions={{
    type: 'extra-rounded',
    gradient: {
      type: 'linear',
      rotation: 100,
      colorStops: [
        {offset: 0, color: '#845EC2'},
        {offset: 0.8, color: '#0081CF'},
        {offset: 1, color: '#008F7A'},
      ],
    },
  }}
  backgroundOptions={{
    color: 'transparent',
  }}
  getBase64DataImage={viewDataBase64}
  image={
    'https://upload.wikimedia.org/wikipedia/commons/thumb/5/58/Instagram-Icon.png/1025px-Instagram-Icon.png'
  }
  imageOptions={{hideBackgroundDots: false, imageSize: 0.5, margin: 0}}
/>

API Documentation

This document follows the original documentation created by Denys Kozak. Please refer to the original version for further details.

PropertyTypeDefault ValueDescription
widthnumber300Size of canvas
heightnumber300Size of canvas
typestring ('canvas' 'svg')canvasThe type of the element that will be rendered
datastringThe date will be encoded to the QR code
imagestringThe image will be copied to the center of the QR code
qrOptionsobjectOptions will be passed to qrcode-generator lib
imageOptionsobjectSpecific image options, details see below
dotOptionsobjectDots styling options
cornersSquareOptionsobjectSquare in the corners styling options
cornerDotOptionsobjectDots in the corners styling options
backgroundOptionsobjectQR background styling options

qrOptions structure

PropertyTypeDefault Value
typeNumbernumber (0 - 40)0
modestring ('Numeric' 'Alphanumeric' 'Byte' 'Kanji')
errorCorrectionLevelstring ('L' 'M' 'Q' 'H')'Q'

imageOptions structure

PropertyTypeDefault ValueDescription
hideBackgroundDotsbooleantrueHide all dots covered by the image
imageSizenumber0.4Coefficient of the image size. Not recommended to use ove 0.5. Lower is better
marginnumber0Margin of the image in px
crossOriginstring('anonymous' 'use-credentials')Set "anonymous" if you want to download QR code from other origins.

dotsOptions structure

PropertyTypeDefault ValueDescription
colorstring'#000'Color of QR dots
gradientobjectGradient of QR dots
typestring ('rounded' 'dots' 'classy' 'classy-rounded' 'square' 'extra-rounded')'square'Style of QR dots

backgroundOptions structure

PropertyTypeDefault Value
colorstring'#fff'
gradientobject

cornersSquareOptions structure

PropertyTypeDefault ValueDescription
colorstringColor of Corners Square
gradientobjectGradient of Corners Square
typestring ('dot' 'square' 'extra-rounded')Style of Corners Square

cornersDotOptions structure

PropertyTypeDefault ValueDescription
colorstringColor of Corners Dot
gradientobjectGradient of Corners Dot
typestring ('dot' 'square')Style of Corners Dot

Gradient structure

dotOptions.gradient

backgroundOptions.gradient

cornersSquareOptions.gradient

cornersDotOptions.gradient

PropertyTypeDefault ValueDescription
typestring ('linear' 'radial')"linear"Type of gradient spread
rotationnumber0Rotation of gradient in radians (Math.PI === 180 degrees)
colorStopsarray of objectsGradient colors. Example [{ offset: 0, color: 'blue' }, { offset: 1, color: 'red' }]

Gradient colorStops structure

dotOptions.gradient.colorStops[]

backgroundOptions.gradient.colorStops[]

cornersSquareOptions.gradient.colorStops[]

cornersDotOptions.gradient.colorStops[]

PropertyTypeDefault ValueDescription
offsetnumber (0 - 1)Position of color in gradient range
colorstringColor of stop in gradient range
QRGenerator methods

`QRGenerator.getBase64DataImage() => string

ParamTypeDefault ValueDescription
base64stringData of QR Code as base64

License

MIT License. Copyright (c) 2023 Huy Trinh

Keywords

FAQs

Package last updated on 26 May 2023

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