Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
react-native-qr-code-scanner-lite
Advanced tools
Readme
Simple QR code scanner. If you only use camera in your project to scan QR codes, this package probably suits you well. There is no need to install any additional packages, like huge camera libraries.
npm install react-native-qr-code-scanner-lite
android/app/src/main/AndroidManifest.xml
:<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Add this -->
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-permission android:name="android.permission.CAMERA" />
<!-- … -->
</manifest>
<key>NSCameraUsageDescription</key>
<string>This app uses camera to scan qr codes.</string>
cd ios && pod install
Camera permission is a runtime permission. So you need to ask a user for a permission to use camera. you can import permission related utilities from useCameraPermission hook.
import { useCameraPermission } from "react-native-qr-code-scanner-lite";
const App = () => {
<!-- … -->
const { isGranted, checkPermission, requestPermission } =
useCameraPermission();
<!-- … -->
};
import { QrCodeScanner, useQrCodeScanner, useCameraPermission } from "react-native-qr-code-scanner-lite";
const App = () => {
useCameraPermission(); // or const { isGranted, checkPermission, requestPermission } =
// useCameraPermission();
const { scannerRef, resumeScan, pauseScan } = useQrCodeScanner();
const onQrCodeScanned = useCallback(({ nativeEvent }) => {
// Do something with qr code data
}, []);
const onError = useCallback(({ nativeEvent }) => {
// Handle error
}, []);
return (
<View>
<QrCodeScanner
scannerRef={scannerRef}
onQrCodeScanned={onQrCodeScanned}
onError={onError}
/>
<Button title={'resume'} onPress={resumeScan} />
<Button title={'pause'} onPress={pauseScan} />
</View>
);
};
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library
FAQs
QR code scanner
The npm package react-native-qr-code-scanner-lite receives a total of 4 weekly downloads. As such, react-native-qr-code-scanner-lite popularity was classified as not popular.
We found that react-native-qr-code-scanner-lite demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.