Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-qrcode-composer

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-qrcode-composer

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

React Native QR Code Composer

Build Status Version MIT License All Contributors PRs Welcome Conventional Commits gitmoji Keep a Changelog v1.1.0 badge Contributor Covenant

React Native QR Code Composer is an advanced, highly customizable library designed to seamlessly integrate QR codes into your React Native applications. Leveraging the robustness of qrcode and the versatility of react-native-svg, this library offers unparalleled flexibility and ease of use, ensuring your QR code implementations are both beautiful and functional.

AndroidiOS

Getting Started

To install the library, you can use npm or yarn:

npm install react-native-qrcode-composer

or

yarn add react-native-qrcode-composer

Peer Dependencies

React Native QR Code Composer is designed to work seamlessly within the React Native ecosystem. However, it relies on several peer dependencies that need to be installed in your project. Ensure you have the following packages installed:

Usage

Here's a basic example of how to use the library:

import QRCode from 'react-native-qrcode-composer';
import Logo from 'assets/logo.svg';
import logo from 'assets/logo.png';

// ...

// Basic QR Code Example
<QRCode value="https://github.com/afonsograca/react-native-qrcode-composer" />

// Advanced Usage with SVG and PNG logos
<QRCode value="QR code with SVG logo" logo={Logo} />
<QRCode value="QR code with PNG logo" logo={logo} />

Props

The react-native-qrcode-composer library provides several props that you can use to customize the QR code and its appearance. These props allow you to specify the content of the QR code, its size, and the logo that appears in the center of the QR code, among other things. You can also specify a function that is called when an error occurs.

The following sections provide more details about these props and how to use them.

QRCodeProps

PropertyTypeOptionalDefaultDescription
valuestringYes'QR code message'The content to be encoded in the QR code
sizenumberYes100The size of the QR code in pixels
logoLogoPropYesundefinedA custom logo to be displayed at the center of the QR code
logoStyleLogoStyleYesundefinedThe style of the logo
styleQRCodeStyleYesundefinedThe style of the QR code container
getRefReact.Ref<Svg>YesundefinedA ref to the QR code SVG element for direct access
onError(error: Error) => voidYesundefinedCallback function triggered if an error occurs during rendering
testIDstringYes'react-native-qrcode-composer'Identification prefix for the internal parts of the component

LogoStyle

PropertyTypeOptionalDefaultDescription
sizenumberYes20% of the QR code sizeThe size of the logo in pixels
backgroundColorstringYestransparentThe background color of the logo
marginnumberYes0The margin around the logo in pixels
borderRadiusnumberYes0The border radius of the logo's corners

QRCodeStyle

PropertyTypeOptionalDefaultDescription
colorstringYesblackThe color of the QR code pattern
backgroundColorstringYeswhiteThe background color of the entire QR code
quietZonenumberYes0The margin around the QR code
cornerRadiusnumberYes0The corner radius applied the QR code's quiet zone
errorCorrectionLevelErrorCorrectionLevelYesMThe error correction level, enhancing robustness
linearGradient[ColorValue, ColorValue]YesundefinedThe colors for a linear gradient effect
gradientDirection[NumberProp, NumberProp, NumberProp, NumberProp]Yes['0%', '0%', '100%', '100%']The directions for gradient application
detectionMarkerOptionsDetectionMarkerOptionsYesundefinedOptions for styling the detection markers
patternOptionsPatternOptionsYesundefinedOptions for modifying the QR pattern

DetectionMarkerOptions

PropertyTypeOptionalDefaultDescription
connectedbooleanYestrueIndicates if the blocks that make up the marker are connected
cornerRadiusnumberYes0Corner radius applied to the detection markers. Note: This does not take precedence over outerCornerRadius or innerCornerRadius
outerCornerRadiusnumberYes0Specific corner radius for the outer part of the markers
innerCornerRadiusnumberYes0Specific corner radius for the inner part of the markers

PatternOptions

PropertyTypeOptionalDefaultDescription
connectedbooleanYesfalseIndicates if the blocks in the QR code pattern are connected
cornerRadiusnumberYes0Corner radius for each block in the QR code pattern

Try it out

We have provided an example app for you to try out the library. You can find it in the /example directory of the repository. To run the example app, navigate to its directory and run:

yarn
yarn start

Contributing

Interested in contributing? Check out how you can make a difference in our contributing guide.

Please note that this project is adheres to a Contributor Code of Conduct. By participating in it you agree to abide by its terms.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

This project owes its gratitude to:

  • The developers of qrcode and react-native-svg for creating such robust foundations.
  • react-native-qrcode-svg for initial inspiration.
  • All the contributors who have helped extend and maintain this library.
  • The community testers who provided valuable feedback.

Keywords

FAQs

Package last updated on 21 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc