Socket
Book a DemoInstallSign in
Socket

react-native-ocr-package

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-ocr-package

A React component for scanning National Identity cards using a device's camera. This package integrates OCR technology to extract the text data from scanned cards by making API calls.

1.0.46
npmnpm
Version published
Weekly downloads
5
-92.31%
Maintainers
1
Weekly downloads
 
Created
Source

React Native OCR Component

A React component for scanning National Identity cards using a device's camera. This package integrates OCR technology to extract the text data from scanned cards by making API calls.

Features

  • Opens the camera directly in your React application.
  • Scans National Identity cards in real-time.
  • Calls a backend API for OCR processing.
  • Returns parsed data for further use.

Installation

Install the package via npm:

npm install react-native-ocr-package

Additionally, install the required dependency:

npm install react-native-document-scanner-plugin

Usage

Here is how to use the component in your React application:

Basic Example

import React, {useState} from 'react';
import { View } from 'react-native';
import {CameraComponent} from 'react-native-ocr-package';

const App = () => {

  const handleOCRResult = ocrResult => {
    console.log('OCR Result:', ocrResult);
  };

  return (
    <View style={{flex: 1}}>
        <CameraComponent
          ocrApiUrl="https://your-api-endpoint.com/"
          onScanComplete={handleOCRResult}
        />
    </View>
  );
};

export default App;

Props

The CameraComponent accepts the following props:

Prop NameTypeRequiredDescription
ocrApiUrlstringYesThe API endpoint to call for OCR processing of the scanned image.
onScanCompletefuncYesCallback function invoked with the scanned OCR result.

Sample Output

Here is an example of the JSON output returned by the API when the scan is successful:

{
  "Code": 200,
  "Message": "Success",
  "Data": {
    "OCR": {
      "Code": 100,
      "Message": "Success",
      "CNIC_MATCHED": true,
      "DOI": "10.06.2014",
      "DOB": "12.03.2000",
      "DOE": "10.06.2024",
      "CNum": "12345-1234567-1",
      "Name": "ABC",
      "FName": "XYZ"
    },
    "Image_Comparison": {
      "Code": 100,
      "Message": "Selfie and CNIC Matched",
      "confidence_score": 100.0
    }
  }
}


FAQs

Package last updated on 03 Apr 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.