Installations
npm install rn-qr-generator
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
20.10.0
NPM Version
10.2.3
Score
53.8
Supply Chain
49.3
Quality
73.1
Maintenance
50
Vulnerability
94.1
License
Releases
Contributors
Unable to fetch Contributors
Languages
Java (46.59%)
Objective-C (32.45%)
JavaScript (14.31%)
Starlark (3.81%)
Ruby (2.84%)
Developer
gevgasparyan
Download Statistics
Total Downloads
783,139
Last Day
1,478
Last Week
6,835
Last Month
35,541
Last Year
355,845
GitHub Statistics
144 Stars
53 Commits
20 Forks
5 Watching
4 Branches
5 Contributors
Package Meta Information
Latest Version
1.4.3
Package Id
rn-qr-generator@1.4.3
Unpacked Size
110.88 kB
Size
66.84 kB
File Count
20
NPM Version
10.2.3
Node Version
20.10.0
Publised On
19 Dec 2024
Total Downloads
Cumulative downloads
Total Downloads
783,139
Last day
-18.2%
1,478
Compared to previous day
Last week
-31%
6,835
Compared to previous week
Last month
0.9%
35,541
Compared to previous month
Last year
51.9%
355,845
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
1
rn-qr-generator
https://www.npmjs.com/package/rn-qr-generator
Getting started
$ npm install rn-qr-generator --save
Mostly automatic installation
$ react-native link rn-qr-generator
Important:
Linking is not needed anymore. react-native@0.60.0+
supports dependencies auto linking.
For iOS you also need additional step to install auto linked Pods (Cocoapods should be installed):
cd ios && pod install && cd ../
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
âžœAdd Files to [your project's name]
- Go to
node_modules
âžœrn-qr-generator
and addRNQrGenerator.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNQrGenerator.a
to your project'sBuild Phases
âžœLink Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.gevorg.reactlibrary.RNQrGeneratorPackage;
to the imports at the top of the file - Add
new RNQrGeneratorPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:1rootProject.name = 'MyApp' 2include ':app' 3 4+ include ':rn-qr-generator' 5+ project(':rn-qr-generator').projectDir = new File(rootProject.projectDir, '../node_modules/rn-qr-generator/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:1dependencies { 2+ compile project(':rn-qr-generator') 3}
Usage
1import RNQRGenerator from 'rn-qr-generator'; 2 3RNQRGenerator.generate({ 4 value: 'https://github.com/gevgasparyan/rn-qr-generator', 5 height: 100, 6 width: 100, 7}) 8 .then(response => { 9 const { uri, width, height, base64 } = response; 10 this.setState({ imageUri: uri }); 11 }) 12 .catch(error => console.log('Cannot create QR code', error)); 13 14// Detect QR code in image 15RNQRGenerator.detect({ 16 uri: PATH_TO_IMAGE 17}) 18 .then(response => { 19 const { values } = response; // Array of detected QR code values. Empty if nothing found. 20 }) 21 .catch(error => console.log('Cannot detect QR code in image', error));
generate
input properties
Property | Type | Description |
---|---|---|
value | string | Text value to be converted into QR image. (required) |
width | number | Width of the QR image to be generated. (required) |
height | number | Height of the QR image to be generated. (required) |
backgroundColor | string | Background color of the image. (white by default) |
color | string | Color of the image. (black by default) |
fileName | string | Name of the image file to store in FileSystem. (optional) |
correctionLevel | string | Data restoration rate for total codewords. Available values are 'L', 'M', 'Q' and 'H'. ('H' by default) |
base64 | boolean | If true will return base64 representation of the image. (optional, false by default) |
padding | Object | Padding params for the image to be generated: {top: number, left: number, bottom: number, right: number}. (default no padding) |
payload
Property | Type | Description |
---|---|---|
uri | string | Path of the generated image. |
width | number | Width of the generated image. |
height | number | Height of the generated image. |
base64 | boolean | Base64 encoded string of the image. |
detect
input properties
Property | Type | Description |
---|---|---|
uri | string | Local path of the image. Can be skipped if base64 is passed. |
base64 | string | Base64 representation of the image to be scanned. If uri is passed this option will be skipped. |
payload
Property | Type | Description |
---|---|---|
values | string[] | Array of detected QR code values. Empty if nothing found. |
type | string | Type of detected code. |
The following barcode types are currently supported for decoding:
- UPC-A and UPC-E
- EAN-8 and EAN-13
- Code 39
- Code 93
- Code 128
- ITF
- Codabar
- RSS-14 (all variants)
- QR Code
- Data Matrix
- Maxicode
- Aztec ('beta' quality)
- PDF 417 ('beta' quality)
Example of 2FA QR code with Time Based (TOTP) or Counter Based (HOTP)
RNQRGenerator.generate({
...
value: 'otpauth://totp/Example:google@google.com?secret=HKSWY3RNEHPK3PXP&issuer=Issuer',
})
More information about totp can be found here.
This module uses Zxing
library for encoding and decoding codes ( ios, Android).
Note
Some simulators may not generate qr code properly. Use real device if you get an error.
No vulnerabilities found.
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
binaries present in source code
Details
- Warn: binary detected: android/gradle/wrapper/gradle-wrapper.jar:1
- Warn: binary detected: example/QRGeneratorExample/android/gradle/wrapper/gradle-wrapper.jar:1
Reason
7 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-mpg4-rc92-vx8v
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Reason
1 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 1
Reason
Found 3/20 approved changesets -- score normalized to 1
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 14 are checked with a SAST tool
Score
2.1
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to rn-qr-generator
react-native-qrcode-styled
A fully customizable QR Code generator for React Native based on react-native-svg and javascript-qrcode.
rn-qrcode-generator
generating qrcode
react-native-qrcode-rounded
A fully customizable QR Code generator for React Native based on react-native-svg and javascript-qrcode.