1.5.0 • Published 5 months ago

react-native-qr-svg v1.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

react-native-qr-svg 📱

A QR Code generator for React Native based on react-native-svg. Effortlessly create QR codes with a style reminiscent of modern designs.

Version NPM

Installation 🚀

Start by installing the necessary packages:

yarn add react-native-svg react-native-qr-svg

Overview 🌟

This library provides a straightforward way to generate QR codes within React Native applications. The QR codes produced have a modern aesthetic, perfect for various design contexts.

Customization 🎨

This library allows for easy customization of QR codes, enabling developers to adjust dot color, background color, frame size, and content within the code.

Example 🖼️

Props

PropertyDescriptionTypeDefault Value
valueThe string to be converted into a QR code.string(Required)
frameSizeThe size of the frame in which the QR code will fit.number(Required)
contentCellsThe number of content cells in the QR code.number6
errorCorrectionLevelThe error correction level for the QR code.low, medium, quartile, high, L, M, Q, H, MM
backgroundColorThe background color of the QR code.string'#ffffff'
dotColorThe color of the dots (circles) in the QR code.string'#000000'
styleStyle for the container of the QR code.StyleProp<ViewStyle>
contentBackgroundRectPropsProps for the background rectangle of the QR code content.RectProps
contentAdditional content to be rendered within the QR code.React.ReactNode
contentStyleStyle for the additional content within the QR code.StyleProp<ViewStyle>
figureCirclePropsProps for the circular figures within the QR code.CircleProps
figurePathPropsProps for the path figures within the QR code.PathProps
rendererCustom renderer for rendering QR code figures.CustomRendererdefaultRenderer
gradientColorsArray of colors for gradient fill of the QR code.ColorValue[]
gradientPropsProps for configuring the gradient of the QR code.LinearGradientProps

Example 🛠️

Implement QR codes easily in your React Native app:

Full example use can find here.

import React from 'react';

import { StyleSheet, View, Text } from 'react-native';
import {
  QrCodeSvg,
  plainRenderer,
} from 'react-native-qr-svg';

const SIZE = 170;
const CONTENT = 'Hello world!';

export default function App() {
  return (
    <View style={styles.root}>
      <View style={styles.content}>
        <QrCodeSvg
          style={styles.qr}
          value={CONTENT}
          frameSize={SIZE}
          contentCells={5}
          content={<Text style={styles.icon}>👋</Text>}
          contentStyle={styles.box}
        />
        <QrCodeSvg
          style={styles.qr}
          gradientColors={['#0800ff', '#ff0000']}
          value={CONTENT}
          frameSize={SIZE}
        />
        <QrCodeSvg
          style={styles.qr}
          value={CONTENT}
          frameSize={SIZE}
          contentCells={5}
          content={<Text style={styles.icon}>💻</Text>}
          dotColor="#ffffff"
          backgroundColor="#000000"
          contentStyle={styles.box}
        />
        <QrCodeSvg
          style={styles.qr}
          renderer={plainRenderer}
          value={CONTENT}
          frameSize={SIZE}
        />
        <QrCodeSvg
          style={styles.qr}
          renderer={customRenderer}
          value={CONTENT}
          frameSize={SIZE}
        />
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  root: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  content: {
    flexDirection: 'row',
    flexWrap: 'wrap',
    alignItems: 'center',
    justifyContent: 'center',
  },
  box: {
    alignItems: 'center',
    justifyContent: 'center',
  },
  icon: {
    fontSize: 20,
  },
  qr: {
    padding: 15,
  },
});

Contributing 🤝

Want to contribute? Check out the contributing guide to learn how you can be a part of this project's development.

License

This project is licensed under the MIT License.


Made with create-react-native-library

1.5.0

5 months ago

1.4.2

10 months ago

1.3.3

10 months ago

1.4.1

10 months ago

1.4.0

10 months ago

1.2.5

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.0.1

2 years ago

1.0.0

2 years ago