Gathering detailed insights and metrics for react-native-qrcode-styled
Gathering detailed insights and metrics for react-native-qrcode-styled
Gathering detailed insights and metrics for react-native-qrcode-styled
Gathering detailed insights and metrics for react-native-qrcode-styled
react-native-qrcode-svg
A QR Code generator for React Native based on react-native-svg and javascript-qrcode.
qrcode
QRCode / 2d Barcode api with both server side and client side support using canvas
react-native-qrcode-composer
<p align="center"> <img height="160" src="docs/static/assets/logo.png" /> </p>
react-native-qrcode-scanner
A QR code scanner for React Native.
Fully customizable QR Codes generator for React Native
npm install react-native-qrcode-styled
59.2
Supply Chain
63.6
Quality
71.9
Maintenance
50
Vulnerability
94.6
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
156 Stars
42 Commits
7 Forks
1 Watching
2 Branches
1 Contributors
Updated on 12 Nov 2024
Minified
Minified + Gzipped
TypeScript (95.81%)
JavaScript (4.19%)
Cumulative downloads
Total Downloads
Last day
-18%
1,349
Compared to previous day
Last week
11.4%
8,386
Compared to previous week
Last month
5.2%
31,148
Compared to previous month
Last year
338.6%
183,954
Compared to previous year
2
3
22
Fully customizable QR Codes generator for React Native using react-native-svg
1npm i react-native-svg react-native-qrcode-styled
or with yarn
1yarn add react-native-svg react-native-qrcode-styled
If you use typescript, run:
1yarn add -D @types/qrcode
Simple usage is:
1import QRCodeStyled from 'react-native-qrcode-styled'; 2 3<QRCodeStyled 4 data={'Simple QR Code'} 5 style={{backgroundColor: 'white'}} 6 padding={20} 7 pieceSize={8} 8/>
For more examples check out the Example app
Name | Default | Type | Description |
---|---|---|---|
data | "I'm QR Code!" | string | Message for encoding. Can also be an array. More info HERE. |
pieceSize | 5 | number | Size of each piece of the QR code |
pieceScale | undefined | SvgProps['scale'] | Scale of each piece of the QR code |
pieceRotation | undefined | SvgProps['rotation'] | Angle of rotation of each piece of the QR code (in degrees) |
pieceCornerType | 'rounded' | 'rounded' | 'cut' | Type of piece corner |
pieceBorderRadius | 0 | number | number[] | Border radius of all corners of each piece. Can also be an array to define different border radius for each corner (start from top-left corner) |
pieceStroke | undefined | ColorValue | Border color of each piece |
pieceStrokeWidth | undefined | number | Border with of each piece |
pieceLiquidRadius | undefined | number | Level of liquid effect between pieces. If you have pieceBorderRadius set isPiecesGlued to true |
isPiecesGlued | false | boolean | If true between pieces will be glue effect. You will see this if you have pieceBorderRadius > 0 |
outerEyesOptions | undefined | EyeOptions | AllEyesOptions | Configurations for outer eyes of QR code. If they defined, previous piece configurations won't be work |
innerEyesOptions | undefined | EyeOptions | AllEyesOptions | The same as outerEyesOptions prop but for inner eyes |
color | 'black' | ColorValue | Color of QR code |
gradient | undefined | GradientProps | Gradient of QR code. Can be two types: 'linear' | 'radial'. By default 'linear' |
padding | undefined | number | Padding inside <Svg/> component from QR code |
logo | undefined | LogoOptions | Configurations for logo. Support svg's <Image/> props |
backgroundImage | undefined | svg's <Image/> props type | Background image for QR code |
version | undefined | number | Description |
maskPattern | undefined | number | Description |
toSJISFunc | undefined | function | Description |
errorCorrectionLevel | 'M' | 'L' | 'M' | 'Q' | 'H' | Description |
renderCustomPieceItem | undefined | RenderCustomPieceItem | Render custom piece of QR code. It must return svg component. If it defined, previous piece and eyes configurations won't be work |
renderBackground | undefined | (pieceSize: number, bitMatrix: number[][]) => SvgProps['children'] | Ability to add any additional svg components behind qr code |
children | undefined | (pieceSize: number, bitMatrix: number[][]) => SvgProps['children'] | Ability to add any additional svg components as children |
...rest <Svg/> props |
1type GradientType = 'linear' | 'radial'; 2 3type LinearGradientProps = { 4 colors?: ColorValue[]; 5 start?: [number, number]; // start point [x, y] (0 -> 0%, 1 -> 100%) 6 end?: [number, number]; // end point [x, y] (0 -> 0%, 1 -> 100%) 7 locations?: number[]; // list of colors positions (0 -> 0%, 1 -> 100%) 8}; 9 10type RadialGradientProps = { 11 colors?: ColorValue[]; 12 center?: [number, number]; // center point [x, y] (0 -> 0%, 1 -> 100%) 13 radius?: [number, number]; // radiusXY [x, y] (0 -> 0%, 1 -> 100%) 14 locations?: number[]; // list of colors positions (0 -> 0%, 1 -> 100%) 15}; 16 17type GradientProps = { 18 type?: GradientType; 19 options?: LinearGradientProps | RadialGradientProps; 20};
1type EyeOptions = { 2 scale?: PathProps['scale']; // scaleXY | [scaleX, scaleY] 3 rotation?: string | number; 4 borderRadius?: number | number[]; 5 color?: ColorValue; 6 gradient?: GradientProps; 7 stroke?: ColorValue; 8 strokeWidth?: number; 9}
1type EyePosition = 'topLeft' | 'topRight' | 'bottomLeft'; 2 3type AllEyesOptions = { [K in EyePosition]?: EyeOptions }
1type RenderCustomPieceItem = ({x, y, pieceSize, qrSize, bitMatrix}: { 2 x: number; 3 y: number; 4 pieceSize: number; 5 qrSize: number; 6 bitMatrix: number[][]; 7}) => React.ReactElement | null;
1export type LogoArea = { 2 x: number; 3 y: number; 4 width: number; 5 height: number; 6}; 7 8export type LogoOptions = { 9 hidePieces?: boolean; 10 padding?: number; 11 scale?: number; 12 onChange?: (logoArea?: LogoArea) => void; 13} & SVGImageProps;
If you'll see that gaps between pieces on Android, just scale pieces up a little bit:
1<QRCodeStyled 2 ... 3 pieceScale={1.02} // or any between of 1.01 - 1.04 4/>
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library
No vulnerabilities found.
No security vulnerabilities found.