Skip to main content

Document Scanner

Getting Started

This is an expo module that lets you use the MLKit Document Scanner library in your Expo app.

Installation

Install like any other npm package:

#yarn
yarn add react-native-mlkit-document-scanner

#npm
npm install react-native-mlkit-document-scanner

Basic Usage

1. Launch the document scanner from a button press

Use the launchDocumentScannerAsync method to initiate the document scanner modal.

// App.tsx
import { View, Button } from "react-native";
import { launchDocumentScannerAsync } from "react-native-mlkit-document-scanner";

function App() {
return (
<View>
<Button
onPress={async () => {
// result will contain an object with the result information
const result = await launchDocumentScannerAsync({
pageLimit: 1,
galleryImportAllowed: false,
resultFormats: ResultFormatOptions.ALL,
});
}}
title="Scan Document"
/>
</View>
);
}