
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
expo-barcode
Advanced tools
Library to generate barcodes and qr codes natively using Kotlin and Swift, integrated with expo.
Library to generate barcodes and qr codes natively using Kotlin and Swift, integrated with expo.
npm install expo-barcode
yarn add expo-barcode
Run npx pod-install
after installing the npm package.
import {
BarcodeView,
QRCodeView,
generateBarcode,
generateQRCode,
} from "expo-barcode";
import { QRCodeView } from "expo-barcode";
export default function App() {
return (
<View style={styles.container}>
<QRCodeView value={"Hello World!"} width={250} height={250} />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
},
});
import { BarcodeView, QRCodeView } from "expo-barcode";
import { useState } from "react";
import { StyleSheet, View, Text, TextInput, Button } from "react-native";
export default function App() {
const [value, setValue] = useState("");
const [barcodeValue, setBarcodeValue] = useState("");
const [toggleGenCode, setToggleGenCode] = useState("QR");
return (
<View style={styles.container}>
<Text>Result: </Text>
{barcodeValue &&
(toggleGenCode === "QR" ? (
<QRCodeView value={barcodeValue} width={250} height={250} />
) : (
<BarcodeView value={barcodeValue} width={300} height={100} />
))}
<TextInput
value={value}
onChangeText={setValue}
placeholder="Type Here"
/>
<Button title="Generate QR Code" onPress={() => setBarcodeValue(value)} />
<Button
title="Toggle QR/Barcode"
onPress={() =>
setToggleGenCode(toggleGenCode === "QR" ? "Barcode" : "QR")
}
/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
},
});
import { generateBarcode, generateQRCode } from "expo-barcode";
async function waitForIt() {
const qrCodeGenerated = await generateQRCode("Hello", 200, 200);
console.log(qrCodeGenerated);
const barCodeGenerated = await generateBarcode("Hello", 300, 200);
console.log(barCodeGenerated);
}
waitForIt();
MIT
For managed Expo projects, please follow the installation instructions in the API documentation for the latest stable release. If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.
For bare React Native projects, you must ensure that you have installed and configured the expo
package before continuing.
Contributions are very welcome! Please refer to guidelines described in the contributing guide.
FAQs
Library to generate barcodes and qr codes natively using Kotlin and Swift, integrated with expo.
We found that expo-barcode 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.