Gathering detailed insights and metrics for react-native-qrcode-svg
Gathering detailed insights and metrics for react-native-qrcode-svg
Gathering detailed insights and metrics for react-native-qrcode-svg
Gathering detailed insights and metrics for react-native-qrcode-svg
A QR Code generator for React Native based on react-native-svg and node-qrcode.
npm install react-native-qrcode-svg
Typescript
Module System
Node Version
NPM Version
64.9
Supply Chain
55.6
Quality
73.2
Maintenance
50
Vulnerability
93
License
JavaScript (48.32%)
TypeScript (17.49%)
Ruby (10.31%)
Objective-C (8.7%)
Kotlin (8.47%)
Objective-C++ (6.72%)
Total Downloads
23,183,080
Last Day
7,945
Last Week
223,857
Last Month
915,648
Last Year
8,653,558
MIT License
1,127 Stars
352 Commits
225 Forks
44 Watchers
14 Branches
186 Contributors
Updated on Aug 25, 2025
Latest Version
6.3.15
Package Id
react-native-qrcode-svg@6.3.15
Unpacked Size
935.67 kB
Size
416.91 kB
File Count
102
NPM Version
10.8.2
Node Version
20.18.2
Published on
Feb 21, 2025
Cumulative downloads
Total Downloads
Last Day
-15.9%
7,945
Compared to previous day
Last Week
3.9%
223,857
Compared to previous week
Last Month
-1.5%
915,648
Compared to previous month
Last Year
61.9%
8,653,558
Compared to previous year
3
3
A QR Code generator for React Native based on react-native-svg and javascript-qrcode.
Discussion: https://discord.gg/RvFM97v
Android | iOS |
---|---|
![]() | ![]() |
Install dependency packages
1yarn add react-native-svg react-native-qrcode-svg
Or
1npm i -S react-native-svg react-native-qrcode-svg
If you are using React Native 0.60.+
go to the folder your-project/ios and run pod install
, and you're done.
If not, use one of the following method to link.
react-native link
If you are using React Native <= 0.59.X
, link the native project:
1react-native link react-native-svg
1import QRCode from 'react-native-qrcode-svg'; 2 3// Simple usage, defaults for all but the value 4render() { 5 return ( 6 <QRCode 7 value="http://awesome.link.qr" 8 /> 9 ); 10};
1// 30px logo from base64 string with transparent background 2render() { 3 let base64Logo = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAA..'; 4 return ( 5 <QRCode 6 value="Just some string value" 7 logo={{uri: base64Logo}} 8 logoSize={30} 9 logoBackgroundColor='transparent' 10 /> 11 ); 12};
1// 20% (default) sized logo from local file string with white logo backdrop 2render() { 3 let logoFromFile = require('../assets/logo.png'); 4 return ( 5 <QRCode 6 value="Just some string value" 7 logo={logoFromFile} 8 /> 9 ); 10};
1// get base64 string encode of the qrcode (currently logo is not included) 2getDataURL() { 3 this.svg.toDataURL(this.callback); 4} 5 6callback(dataURL) { 7 console.log(dataURL); 8} 9 10render() { 11 return ( 12 <QRCode 13 value="Just some string value" 14 getRef={(c) => (this.svg = c)} 15 /> 16 ); 17}
Name | Default | Description |
---|---|---|
size | 100 | Size of rendered image in pixels |
value | 'this is a QR code' | String Value of the QR code. Can also accept an array of segments as defined in Manual mode. Ex. [{ data: 'ABCDEFG', mode: 'alphanumeric' }, { data: '0123456', mode: 'numeric' }, { data: [253,254,255], mode: 'byte' }] |
color | 'black' | Color of the QR code |
backgroundColor | 'white' | Color of the background |
enableLinearGradient | false | enables or disables linear gradient |
linearGradient | ['rgb(255,0,0)','rgb(0,255,255)'] | array of 2 rgb colors used to create the linear gradient |
gradientDirection | [170,0,0,0] | the direction of the linear gradient |
logo | null | Image source object. Ex. {uri: 'base64string'} or {require('pathToImage')} |
logoSize | 20% of size | Size of the imprinted logo. Bigger logo = less error correction in QR code |
logoBackgroundColor | backgroundColor | The logo gets a filled quadratic background with this color. Use 'transparent' if your logo already has its own backdrop. |
logoMargin | 2 | logo's distance to its wrapper |
logoBorderRadius | 0 | the border-radius of logo image (Android is not supported) |
quietZone | 0 | quiet zone around the qr in pixels (useful when saving image to gallery) |
getRef | null | Get SVG ref for further usage |
ecl | 'M' | Error correction level |
onError(error) | undefined | Callback fired when exception happened during the code generating process |
Note: Experimental only ( not tested on iOS) , uses getRef() and needs RNFS module
npm install --save react-native-fs
1import { CameraRoll , ToastAndroid } from "react-native" 2import RNFS from "react-native-fs" 3... 4 5 saveQrToDisk() { 6 this.svg.toDataURL((data) => { 7 RNFS.writeFile(RNFS.CachesDirectoryPath+"/some-name.png", data, 'base64') 8 .then((success) => { 9 return CameraRoll.saveToCameraRoll(RNFS.CachesDirectoryPath+"/some-name.png", 'photo') 10 }) 11 .then(() => { 12 this.setState({ busy: false, imageSaved: true }) 13 ToastAndroid.show('Saved to gallery !!', ToastAndroid.SHORT) 14 }) 15 }) 16 }
This library comes with an Example App. You can find it in the directory ./Example
.
Use the app to easily test your changes to react-native-qrcode-svg
and when developing new features.
Read more details in the dedicated README.
This library works seamlessly with React Native versions 0.75 and above. However, if you're using an older version of React Native (below 0.75), you might need to apply a custom transformation to your project's metro.config.js file to ensure compatibility with the TextEncoder API.
Here's how to configure the transformer for both Expo and React Native projects:
Make sure your project has a metro.config.js
file. If not, create one at the root of your project.
1const { getDefaultConfig } = require("expo/metro-config"); 2 3module.exports = (() => { 4 const config = getDefaultConfig(__dirname); 5 6 const { transformer } = config; 7 8 config.transformer = { 9 ...transformer, 10 babelTransformerPath: require.resolve("react-native-qrcode-svg/textEncodingTransformation") 11 }; 12 13 return config; 14})();
Merge the contents from your project's metro.config.js file with this config.
1const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config"); 2 3const defaultConfig = getDefaultConfig(__dirname); 4 5const config = { 6 transformer: { 7 babelTransformerPath: require.resolve("react-native-qrcode-svg/textEncodingTransformation"), 8 }, 9}; 10 11module.exports = mergeConfig(defaultConfig, config);
No vulnerabilities found.
react-native-qrcode-styled
A fully customizable QR Code generator for React Native based on react-native-svg and javascript-qrcode.
bwip-js
JavaScript barcode generator supporting over 100 types and standards.
react-native-circle-qrcode-svg
A QR Code generator for React Native based on react-native-svg and javascript-qrcode.
react-native-svg-qrcode
A minimal dependency pure JS QR Code generator for React Native