Skip to content

feat: expose Android ML Kit scanner mode - #180

Open
BhavyaJain711 wants to merge 2 commits into
WebsiteBeaver:masterfrom
BhavyaJain711:feat/expose-scanner-mode
Open

feat: expose Android ML Kit scanner mode#180
BhavyaJain711 wants to merge 2 commits into
WebsiteBeaver:masterfrom
BhavyaJain711:feat/expose-scanner-mode

Conversation

@BhavyaJain711

@BhavyaJain711 BhavyaJain711 commented Aug 20, 2026

Copy link
Copy Markdown

Summary

Expose Google ML Kit document scanner modes to JavaScript on Android.

Changes

  • Added ScannerMode constants:

    • ScannerMode.BASE
    • ScannerMode.BASE_WITH_FILTER
    • ScannerMode.FULL
  • Added optional scannerMode to ScanDocumentOptions.

  • Explicitly mapped supported scanner modes in the Android native module.

  • Preserved FULL as the default for backwards compatibility.

  • Added a safe fallback to FULL for invalid native input.

  • Updated the README with API documentation and usage examples.

  • Added a scanner-mode selector to the Android example app for manual testing.

  • Added tests for the exported scanner-mode constants.

Example

import DocumentScanner, {
  ScannerMode,
} from 'react-native-document-scanner-plugin';

const { scannedImages } = await DocumentScanner.scanDocument({
  scannerMode: ScannerMode.BASE,
});

Testing

  • TypeScript typecheck: passed
  • Jest tests: passed
  • Lint: passed with one existing unrelated warning
  • Package build: passed
  • Pre-commit hooks: passed
  • Android emulator/device testing: passed

FULL remains the default, and iOS behavior is unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant