All Projects → awesomejerry → React Native Qrcode Svg

awesomejerry / React Native Qrcode Svg

Licence: mit
A QR Code generator for React Native based on react-native-svg and node-qrcode.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Qrcode Svg

React Qr Svg
React component for rendering SVG QR codes
Stars: ✭ 134 (-80.66%)
Mutual labels:  svg, qrcode
Php Qrcode
A QR Code generator for PHP7.4+
Stars: ✭ 685 (-1.15%)
Mutual labels:  svg, qrcode
Quick Media
media(audio/image/qrcode/markdown/html/svg) support web service (多媒体编辑服务, 酷炫二维码, 音频, 图片, svg, markdown, html渲染服务支持)
Stars: ✭ 612 (-11.69%)
Mutual labels:  svg, qrcode
Optimizt
CLI image optimization tool
Stars: ✭ 594 (-14.29%)
Mutual labels:  svg
Icons
All SVG icons available on http://game-icons.net
Stars: ✭ 598 (-13.71%)
Mutual labels:  svg
Url Encoder
🛸 Url-encoder, useful for SVG
Stars: ✭ 650 (-6.2%)
Mutual labels:  svg
Svg
Fork of the ms svg library (http://svg.codeplex.com/)
Stars: ✭ 676 (-2.45%)
Mutual labels:  svg
Svgi
🔎 The SVG inspection tool
Stars: ✭ 579 (-16.45%)
Mutual labels:  svg
Payment Icons
💳 Payment / Ecommerce related svg icon packs
Stars: ✭ 671 (-3.17%)
Mutual labels:  svg
Browser Logos
🗂 High resolution web browser logos
Stars: ✭ 5,538 (+699.13%)
Mutual labels:  svg
Tesseract Ocr Scanner
基于Tesseract-OCR实现自动扫描识别手机号
Stars: ✭ 622 (-10.25%)
Mutual labels:  qrcode
Libvips
A fast image processing library with low memory needs.
Stars: ✭ 6,094 (+779.37%)
Mutual labels:  svg
Macaw
Powerful and easy-to-use vector graphics Swift library with SVG support
Stars: ✭ 5,756 (+730.59%)
Mutual labels:  svg
Html To Image
✂️ Generates an image from a DOM node using HTML5 canvas and SVG.
Stars: ✭ 595 (-14.14%)
Mutual labels:  svg
Cssfx
✨ Beautifully simple click-to-copy CSS effects
Stars: ✭ 5,758 (+730.88%)
Mutual labels:  svg
Reanimate
Haskell library for building declarative animations based on SVG graphics
Stars: ✭ 581 (-16.16%)
Mutual labels:  svg
Linuxtimeline
Linux Distributions Timeline
Stars: ✭ 662 (-4.47%)
Mutual labels:  svg
Zxinggenerator
花式二维码生成,提供了6种样式
Stars: ✭ 618 (-10.82%)
Mutual labels:  qrcode
Alphatab
alphaTab is a cross platform music notation and guitar tablature rendering library.
Stars: ✭ 647 (-6.64%)
Mutual labels:  svg
Animateplus
A+ animation module for the modern web
Stars: ✭ 5,839 (+742.57%)
Mutual labels:  svg

NPM circleci

react-native-qrcode-svg

A QR Code generator for React Native based on react-native-svg and javascript-qrcode.

Discussion: https://discord.gg/RvFM97v

Features

  • Easily render QR code images
  • Optionally embed a logotype
Android iOS

Installation

Install dependency packages

yarn add react-native-svg react-native-qrcode-svg

Or

npm 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.

Link with react-native link

If you are using React Native <= 0.59.X, link the native project:

react-native link react-native-svg

Examples

import QRCode from 'react-native-qrcode-svg';

// Simple usage, defaults for all but the value
render() {
  return (
    <QRCode
      value="http://awesome.link.qr"
    />
  );
};
// 30px logo from base64 string with transparent background
render() {
  let base64Logo = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAA..';
  return (
    <QRCode
      value="Just some string value"
      logo={{uri: base64Logo}}
      logoSize={30}
      logoBackgroundColor='transparent'
    />
  );
};
// 20% (default) sized logo from local file string with white logo backdrop
render() {
  let logoFromFile = require('../assets/logo.png');
  return (
    <QRCode
      value="Just some string value"
      logo={logoFromFile}
    />
  );
};
// get base64 string encode of the qrcode (currently logo is not included)
getDataURL() {
  this.svg.toDataURL(this.callback);
}

callback(dataURL) {
  console.log(dataURL);
}

render() {
  return (
    <QRCode
      value="Just some string value"
      getRef={(c) => (this.svg = c)}
    />
  );
}

Props

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

Saving generated code to gallery

Note: Experimental only ( not tested on iOS) , uses getRef() and needs RNFS module

npm install --save react-native-fs

Example for Android:

import { CameraRoll , ToastAndroid } from "react-native"
import RNFS from "react-native-fs"
...

  saveQrToDisk() {
   	this.svg.toDataURL((data) => {
   		RNFS.writeFile(RNFS.CachesDirectoryPath+"/some-name.png", data, 'base64')
   		  .then((success) => {
   			  return CameraRoll.saveToCameraRoll(RNFS.CachesDirectoryPath+"/some-name.png", 'photo')
   		  })
   		  .then(() => {
   			  this.setState({ busy: false, imageSaved: true  })
   			  ToastAndroid.show('Saved to gallery !!', ToastAndroid.SHORT)
   		  })
   	})
  }

Dependencies

PeerDependencies

Dependencies


If you like this project, please consider buy me a coffee :)

https://www.buymeacoffee.com/LquC7mid5

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].