as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support

react-native-qrcode-svg

The @amazon-devices/@amazon-devices/react-native-qrcode-svg library provides support on Vega for react-native-qrcode-svg, which is a QR Code generator based on react-native-svg and javascript-qrcode.

This library is system-deployed and available to React Native for Vega apps without a separate installation process. The library is deployed as an autolinking library, which your app links to at runtime. The library is guaranteed to be compatible only with the version of React Native for Vega for which it's built.

When you uplevel your app's version of React Native for Vega, consider the best practice of upleveling its library dependencies.

For more information about this library and its API, see the README.md in the official GitHub repo.

Installation

  1. Add the JavaScript library dependency in the package.json file:

    Copied to clipboard.

    "dependencies": {
       ...
       "@amazon-devices/react-native-qrcode-svg": "~2.0.0"
    }
    
  2. Due to a known issue with React Native dependencies, you must apply the following workaround:

    a. Open your .npmrc file in the same directory as your app's package.json file. If the .npmrc file doesn't exist, you can add one.

    b. Add the following line: <p> Copied to clipboard.</p>

    <div id="p6pPiO1P" markdown="block">
    
    ```
    legacy-peer-deps=true
    ```
    </div>
    
  3. Reinstall the dependencies using the npm install command.

Examples

The following code is an example of creating a QRcode using the default settings:

Copied to clipboard.


import QRCode from '@amazon-devices/react-native-qrcode-svg';

// Simple usage, defaults for all but the value
render() {
  return (
    <QRCode
      value="http://awesome.link.qr"
    />
  );
};

The following code is an example of creating a QR code and applying some formatting:

Copied to clipboard.


import QRCode from '@amazon-devices/react-native-qrcode-svg';

render() {
    return (
        <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center',backgroundColor: 'white'}}>
            <QRCode value="http://amazon.com/code?cbl-code=FTV123&client=FireTvQR" ecl="L" size={300} />
        </View>
    );
};

API support

Component API

Prop Description Default
size Size of rendered image in pixels. 100
value String value of the QR code. Can also accept an array of segments as defined in Manual mode. For example, [{ data: 'ABCDEFG', mode: 'alphanumeric' }, { data: '0123456', mode: 'numeric' }, { data: [253,254,255], mode: 'byte' }]. 'this is a QR code'
logoMargin The logo's distance to its wrapper. 2
logoBorderRadius The border-radius of the logo image. 0
ecl The error correction level. 'M'

Implementation details

Known issues

Your app might crash if you use the react-native-qrcode-svg library and try to import the TextEncoder property. To work around this issue, add a dependency on fast-text-encoding to your app.

In your app's package.json file, add the following code to the dependencies section:

Copied to clipboard.

"dependencies": {
   ...
   "fast-text-encoding": "^1.0.6"
}

In the place where you imported the react-native-qrcode-svg library, import fast-text-encoding.

Copied to clipboard.

import React, {useState} from 'react';
import {StyleSheet, Text, ImageBackground, View, Image} from 'react-native';
import QRCode from '@amazon-devices/react-native-qrcode-svg';
import "fast-text-encoding" // Add fast text encoding

Supported versions

Package Version Based On @amazon-devices/react-native-kepler version
2.0.x 6.2.0 2.0.x

Additional Resources

For information on other libraries, see Supported Third-Party Libraries and Services.


Last updated: Sep 30, 2025