expo-vision-image-scanner
v0.1.6
Published
Use Vision Camera to Scan Documents
Downloads
9
Maintainers
Readme
expo-vision-image-scanner
Use Vision Camera to Scan Documents
IOS Only - Android Coming Soon
Usage
import { VisionView } from 'expo-vision-image-scanner';
export default function App() {
return (
<VisionView
style={{
width: '100%',
height: '100%'
}}
onScan={(event) => {
console.log('Scanned document:', event.data);
}}
onError={(error) => {
console.error('Scan error:', error);
}}
onCancel={() => {
console.log('Scan cancelled');
}}
/>
);
}Props
style
Accepts standard View style props plus the following specific styles:
width: number - Width of the scanner viewheight: number - Height of the scanner viewtop: number - Distance from the top of the parent viewleft: number - Distance from the left of the parent viewright: number - Distance from the right of the parent viewbottom: number - Distance from the bottom of the parent viewbackgroundColor: string - Background color of the scanner view
Events
onScan
Callback that fires when a document is successfully scanned. Receives an event object with:
data: string - Base64 encoded string of the scanned image
type ScanResult = {
data: string; // Base64 encoded image data
}onError
Callback that fires when an error occurs during scanning. Receives the error object.
onCancel
Callback that fires when the user cancels the scanning process.
Installation in managed Expo projects
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.
Installation in bare React Native projects
For bare React Native projects, you must ensure that you have installed and configured the expo package before continuing.
Add the package to your npm dependencies
npm install expo-vision-image-scannerConfigure for Android
Configure for iOS
Run npx pod-install after installing the npm package.
Contributing
Contributions are very welcome! Please refer to guidelines described in the contributing guide.
