2.0.0 • Published 5 years ago

react-native-custom-qr-codes v2.0.0

Weekly downloads
112
License
MIT
Repository
github
Last release
5 years ago

react-native-custom-qr-codes

Installation

npm install react-native-custom-qr-codes

If you are not using Expo, you will also have to manually link the react-native-svg library.
Follow the instructions here to do this.

Usage

import { QRCode } from 'react-native-custom-qr-codes';

<QRCode content='https://reactnative.com'/>

Properties

PropDescriptionDefault
contentThe String to be encoded in the QR code.'No Content'
codeStyleThe style of the centre QR Code pieces.square
outerEyeStyleThe style of the outside of the QR Code's eyes.square
innerEyeStyleThe style of the inside of the QR Code's eyes.square
sizeThe width & height of the component.250
colorThe color of the QR Code.black
backgroundColorThe background color of the component.white
paddingThe padding between the edge of the component and the QR Code itself (In terms of QR code piece sizes).1
logoThe image to be put in the centre of the QR Code.Must use a higher ecl for QR Code to work with a logo. (L->M->Q->H)none
logoSizeThe size of the logo in the QR Code.none
linearGradientThe two colors to be used for the linear gradient for the foreground.none
gradientDirectionThe numbers that define the orientation of the linear gradient.[0,0,170,0]
backgroundImageThe image to be used as the filling of the QR Code pieces.The Eyes can not be styled if a background image is used.none
eclThe error correction level of the QR Code.L

Examples

codeStyle

<QRCode codeStyle='square' />
<QRCode codeStyle='circle' />
<QRCode codeStyle='dot' />
<QRCode codeStyle='diamond' />
<QRCode codeStyle='sharp' />

outerEyeStyle

<QRCode outerEyeStyle='square' />
<QRCode outerEyeStyle='circle' />
<QRCode outerEyeStyle='diamond' />

innerEyeStyle

<QRCode innerEyeStyle='square' />
<QRCode innerEyeStyle='circle' />
<QRCode innerEyeStyle='diamond' />

logo

<QRCode logo={require('./dab.png')} />

linearGradient

<QRCode linearGradient={['rgb(255,0,0)','rgb(0,255,255)']} />
<QRCode linearGradient={['rgb(255,0,0)','rgb(0,255,255)']} gradientDirection={[0,170,0,0]} />

backgroundImage

<QRCode backgroundImage={require('./galaxy.png')} />

Contributing

Take a look at CONTRIBUTING.md 😁

License

MIT License. © Geoffrey Natin 2017