react native scan-1

Barcode/QR Code Scanner (React Native)

Share this post on:

What is a Barcode & QR code?

A barcode holds information horizontally, while a QR code (Quick Response) holds information both vertically and horizontally.

To implement a barcode scanner in React Native, you’ll need react-native-vision-camera and react-native-worklets-core. These dependencies utilize MLKit Vision on Android and Apple Vision on iOS.

Install dependencies:

command 1: npm install react-native-vision-camera@3.3.0

command 2: npm install react-native-worklets-core@0.2.2

Add the worklet plugin to your babel.config.js:

module.exports = {
   plugins: [
        ['react-native-worklets-core/plugin']
   ],
}

Configure Permissions

Android: Add the following lines to your AndroidManifest.xml:

iOS: Add the following lines to your Info.plist:

Additional Android Setup:

Ensure your build.gradle includes the following configurations:

  • Set buildToolsVersion to 33.0.0 or higher
  • Set compileSdkVersion to 33 or higher
  • Set targetSdkVersion to 33 or higher
  • Set minSdkVersion to 26 or higher
  • Set ndkVersion to “23.1.7779620” or higher
  • Update the Gradle Build-Tools version

In Android Make sure your Gradle Wrapper version is 7.5.1 or higher in gradle-wrapper.properties:

Troubleshoot

Use the useCameraDevice hook to access the camera:

Get Device

By using useCameraDevice hook, by passing ‘back’ as a parameter we are able to get the device which is required by camera component.

Getting/Requesting Permission

Use the useCameraPermission hook to request camera permissions:

Frame Processors:

Frame processors are functions that process frames the camera “sees”. Use them to call high-performance native functions for specific use cases:

CodeScanner

Use the useCodeScanner hook to detect codes in a camera stream:

Scanner Example

Refer to the demo app for a comprehensive example. Check out the sample barcode code-128 and QR code. BarcodeQRScanCode.

Barcode code-128

QR code

Please check out the demo app for better understanding qrcode_scanner_recording.mp4.

Piyush Solanki

PHP Tech Lead & Backend Architect

10+ years experience
UK market specialist
Global brands & SMEs
Full-stack expertise

Core Technologies

PHP 95%
MySQL 90%
WordPress 92%
AWS 88%
  • Backend: PHP, MySQL, CodeIgniter, Laravel
  • CMS: WordPress customization & plugin development
  • APIs: RESTful design, microservices architecture
  • Frontend: React, TypeScript, modern admin panels
  • Cloud: AWS S3, Linux deployments
  • Integrations: Stripe, SMS/OTP gateways
  • Finance: Secure payment systems & compliance
  • Hospitality: Booking & reservation systems
  • Retail: E-commerce platforms & inventory
  • Consulting: Custom business solutions
  • Food Services: Delivery & ordering systems
  • Modernizing legacy systems for scalability
  • Building secure, high-performance products
  • Mobile-first API development
  • Agile collaboration with cross-functional teams
  • Focus on operational efficiency & innovation

Piyush is a seasoned PHP Tech Lead with 10+ years of experience architecting and delivering scalable web and mobile backend solutions for global brands and fast-growing SMEs.

He specializes in PHP, MySQL, CodeIgniter, WordPress, and custom API development, helping businesses modernize legacy systems and launch secure, high-performance digital products.

He collaborates closely with mobile teams building Android & iOS apps, developing RESTful APIs, cloud integrations, and secure payment systems. With extensive experience in the UK market and across multiple sectors, Piyush is passionate about helping SMEs scale technology teams and accelerate innovation through backend excellence.