Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
react-native-qr-svg
Advanced tools
Generate attractive QR codes for your React Native projects, compatible with Android, iOS, and web platforms.
A QR Code generator for React Native based on react-native-svg. Effortlessly create QR codes with a style reminiscent of modern designs.
Start by installing the necessary packages:
yarn add react-native-svg react-native-qr-svg
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.
This library allows for easy customization of QR codes, enabling developers to adjust dot color, background color, frame size, and content within the code.
Property | Description | Type | Default Value |
---|---|---|---|
value | The string to be converted into a QR code. | string | (Required) |
frameSize | The size of the frame in which the QR code will fit. | number | (Required) |
contentCells | The number of content cells in the QR code. | number | 6 |
errorCorrectionLevel | The error correction level for the QR code. | QRCodeErrorCorrectionLevel | 'M' |
backgroundColor | The background color of the QR code. | string | '#ffffff' |
dotColor | The color of the dots (circles) in the QR code. | string | '#000000' |
style | Style for the container of the QR code. | StyleProp<ViewStyle> | |
contentBackgroundRectProps | Props for the background rectangle of the QR code content. | RectProps | |
content | Additional content to be rendered within the QR code. | React.ReactNode | |
contentStyle | Style for the additional content within the QR code. | StyleProp<ViewStyle> | |
figureCircleProps | Props for the circular figures within the QR code. | CircleProps | |
figurePathProps | Props for the path figures within the QR code. | PathProps | |
renderer | Custom renderer for rendering QR code figures. | CustomRenderer | defaultRenderer |
gradientColors | Array of colors for gradient fill of the QR code. | ColorValue[] | |
gradientProps | Props for configuring the gradient of the QR code. | LinearGradientProps |
Implement QR codes easily in your React Native app:
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}>
<View style={styles.qr}>
<QrCodeSvg
value={CONTENT}
frameSize={SIZE}
contentCells={5}
content={
<View>
<Text style={styles.icon}>👋</Text>
</View>
}
contentStyle={styles.box}
/>
</View>
<View style={styles.qr}>
<QrCodeSvg
gradientColors={['#0800ff', '#ff0000']}
value={CONTENT}
frameSize={SIZE}
/>
</View>
<View style={[styles.qr, styles.secondQr]}>
<QrCodeSvg
value={CONTENT}
frameSize={SIZE}
contentCells={5}
content={
<View>
<Text style={styles.icon}>💻</Text>
</View>
}
dotColor="#ffffff"
backgroundColor="#000000"
contentStyle={styles.box}
/>
</View>
<View style={styles.qr}>
<QrCodeSvg
renderer={plainRenderer}
value={CONTENT}
frameSize={SIZE}
/>
</View>
</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,
},
secondQr: {
backgroundColor: '#000000',
},
});
Want to contribute? Check out the contributing guide to learn how you can be a part of this project's development.
This project is licensed under the MIT License.
Made with create-react-native-library
FAQs
Generate attractive QR codes for your React Native projects, compatible with Android, iOS, and web platforms.
The npm package react-native-qr-svg receives a total of 771 weekly downloads. As such, react-native-qr-svg popularity was classified as not popular.
We found that react-native-qr-svg demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.