Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,16 @@ class DocumentScannerModule(reactContext: ReactApplicationContext) :
val currentActivity = reactApplicationContext.getCurrentActivity()
val response: WritableMap = WritableNativeMap()

val galleryImportAllowed: Boolean = if (options.hasKey("galleryImportAllowed")) {
options.getBoolean("galleryImportAllowed")
} else {
false
}

val documentScannerOptionsBuilder = GmsDocumentScannerOptions.Builder()
.setResultFormats(GmsDocumentScannerOptions.RESULT_FORMAT_JPEG)
.setScannerMode(GmsDocumentScannerOptions.SCANNER_MODE_FULL)
.setGalleryImportAllowed(galleryImportAllowed)

if (options.hasKey("maxNumDocuments")) {
documentScannerOptionsBuilder.setPageLimit(
Expand Down
7 changes: 7 additions & 0 deletions src/NativeDocumentScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ export interface ScanDocumentOptions {
*/
maxNumDocuments?: number;

/**
* Android only: Whether to allow the user to import images from the gallery
* in addition to capturing with the camera.
* @default: false
*/
galleryImportAllowed?: boolean;

/**
* The response comes back in this format on success. It can be the document
* scan image file paths or base64 images.
Expand Down