npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-documentscanner-android

v2.0.2

Published

React native package to auto scan documents

Downloads

495

Readme

react-native-documentscanner-android

React Native module to auto scan documents (Android only)

Live document detection library. Returns either a URI of the captured image, allowing you to easily store it or use it as you wish !

Features:

  • Live detection
  • Perspective correction and image crop
  • Flash

enter image description
here

Installation

npm

npm install react-native-documentscanner-android

yarn

yarn add react-native-documentscanner-android

Observation

In android/app/src/main/AndroidManifest.xml

Change manifest header to avoid "Manifest merger error". After you add xmlns:tools="http://schemas.android.com/tools" should look like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.<yourAppName>" xmlns:tools="http://schemas.android.com/tools">

Add tools:replace="android:allowBackup" in <application tag. It should look like this:

<application tools:replace="android:allowBackup" android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:allowBackup="false" android:theme="@style/AppTheme">

Add permissions:

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Usage

import DocumentScannerAndroid from "react-native-documentscanner-android";

// ...

<DocumentScannerAndroid 
    style={{flex: 1}}
    onPictureTaken={(document) => console.log(document.path)}
    onProcessing={(data) => console.log(data.processing)}
    enableTorch={false}
    detectionCountBeforeCapture={5}
/>

Properties

| Props | Default | Type | Description | | --------------------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------ | | manualOnly | false | bool | if true, auto-detect is disabled | | enableTorch | false | bool | Allows to active or deactivate flash during document detection | | detectionCountBeforeCapture | 15 | number | Number of correct rectangle to detect before capture document | | brightness | 10 | number | This property only work to enhance document at the save moment | | contrast | 1 | number | This property only work to enhance document at the save moment | | noGrayScale | false | bool | Currently this module saves pictures only in gray scale, this property adds the option to disable gray scale |

Manual capture

  • Get the component ref
import { capture } from 'react-native-documentscanner-android';
  • Then
scanner.capture();

Returned Image

| Prop | Params | Type | Description | | -------------- | ------ | ------ | -------------------------------------------------------------------------------------- | | onPictureTaken | data | object | Returns an image in a object { path: ('imageUri')} | | onProcessing | data | object | Returns an object {processing: (true | false)} to show is an image is processing yet |

The images are saved in Documents folder.

Todo

  • Pass overlay color dynamically
  • Pass contrast and brightness to preview
  • Use front cam
  • Use base64

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT