npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-qrcode-composer

v0.2.0

Published

<p align="center"> <img height="160" src="docs/static/assets/logo.png" /> </p>

Downloads

99,315

Readme

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.

| Android | iOS | | -- | -- | |||

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

| Property | Type | Optional | Default | Description | |---|---|---|---|---| | value | string | Yes | 'QR code message' | The content to be encoded in the QR code | | size | number | Yes | 100 | The size of the QR code in pixels | | logo | LogoProp | Yes | undefined | A custom logo to be displayed at the center of the QR code | | logoStyle | LogoStyle | Yes | undefined | The style of the logo | | style | QRCodeStyle | Yes | undefined | The style of the QR code container | | getRef | React.Ref<Svg> | Yes | undefined | A ref to the QR code SVG element for direct access | | onError | (error: Error) => void | Yes | undefined | Callback function triggered if an error occurs during rendering | | testID | string | Yes | 'react-native-qrcode-composer' | Identification prefix for the internal parts of the component |

LogoStyle

| Property | Type | Optional | Default | Description | |---|---|---|---|---| | size | number | Yes | 20% of the QR code size | The size of the logo in pixels | | backgroundColor | string | Yes | transparent | The background color of the logo | | margin | number | Yes | 0 | The margin around the logo in pixels | | borderRadius | number | Yes | 0 | The border radius of the logo's corners |

QRCodeStyle

| Property | Type | Optional | Default | Description | | --- | --- | --- | --- | --- | | color | string | Yes | black | The color of the QR code pattern | | backgroundColor | string | Yes | white | The background color of the entire QR code | | quietZone | number | Yes | 0 | The margin around the QR code | | cornerRadius | number | Yes | 0 | The corner radius applied the QR code's quiet zone | | errorCorrectionLevel | ErrorCorrectionLevel | Yes | M | The error correction level, enhancing robustness | | linearGradient | [ColorValue, ColorValue] | Yes | undefined | The colors for a linear gradient effect | | gradientDirection | [NumberProp, NumberProp, NumberProp, NumberProp] | Yes | ['0%', '0%', '100%', '100%'] | The directions for gradient application | | detectionMarkerOptions | DetectionMarkerOptions | Yes | undefined | Options for styling the detection markers | | patternOptions | PatternOptions | Yes | undefined | Options for modifying the QR pattern |

DetectionMarkerOptions

| Property | Type | Optional | Default | Description | | --- | --- | --- | --- | --- | | connected | boolean | Yes | true | Indicates if the blocks that make up the marker are connected | | cornerRadius | number | Yes | 0 | Corner radius applied to the detection markers. Note: This does not take precedence over outerCornerRadius or innerCornerRadius | | outerCornerRadius | number | Yes | 0 | Specific corner radius for the outer part of the markers | | innerCornerRadius | number | Yes | 0 | Specific corner radius for the inner part of the markers |

PatternOptions

| Property | Type | Optional | Default | Description | | --- | --- | --- | --- | --- | | connected | boolean | Yes | false | Indicates if the blocks in the QR code pattern are connected | | cornerRadius | number | Yes | 0 | Corner 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.