react-native-rectangle-doc-scanner 3.70.0 → 3.71.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -34,38 +34,15 @@ RCT_EXPORT_VIEW_PROPERTY(quality, float)
|
|
|
34
34
|
RCT_EXPORT_VIEW_PROPERTY(brightness, float)
|
|
35
35
|
RCT_EXPORT_VIEW_PROPERTY(contrast, float)
|
|
36
36
|
|
|
37
|
-
// Main capture method - returns a Promise
|
|
38
|
-
RCT_EXPORT_METHOD(capture:(
|
|
39
|
-
resolver:(RCTPromiseResolveBlock)resolve
|
|
37
|
+
// Main capture method - returns a Promise and uses the last mounted scanner view
|
|
38
|
+
RCT_EXPORT_METHOD(capture:(RCTPromiseResolveBlock)resolve
|
|
40
39
|
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
41
|
-
NSLog(@"[RNPdfScannerManager] capture
|
|
40
|
+
NSLog(@"[RNPdfScannerManager] capture requested (no reactTag)");
|
|
42
41
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
43
|
-
DocumentScannerView *targetView =
|
|
44
|
-
NSNumber *resolvedTag = ([reactTag isKindOfClass:[NSNumber class]]) ? (NSNumber *)reactTag : nil;
|
|
45
|
-
|
|
46
|
-
if (!resolvedTag && reactTag) {
|
|
47
|
-
NSLog(@"[RNPdfScannerManager] Unexpected reactTag type %@ - ignoring reactTag", NSStringFromClass([reactTag class]));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (resolvedTag) {
|
|
51
|
-
UIView *view = [self.bridge.uiManager viewForReactTag:resolvedTag];
|
|
52
|
-
if ([view isKindOfClass:[DocumentScannerView class]]) {
|
|
53
|
-
targetView = (DocumentScannerView *)view;
|
|
54
|
-
self->_scannerView = targetView;
|
|
55
|
-
} else if (view) {
|
|
56
|
-
NSLog(@"[RNPdfScannerManager] View for tag %@ is not DocumentScannerView: %@", resolvedTag, NSStringFromClass(view.class));
|
|
57
|
-
} else {
|
|
58
|
-
NSLog(@"[RNPdfScannerManager] No view found for tag %@", resolvedTag);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (!targetView && self->_scannerView) {
|
|
63
|
-
NSLog(@"[RNPdfScannerManager] Falling back to last known scanner view");
|
|
64
|
-
targetView = self->_scannerView;
|
|
65
|
-
}
|
|
42
|
+
DocumentScannerView *targetView = self->_scannerView;
|
|
66
43
|
|
|
67
44
|
if (!targetView) {
|
|
68
|
-
NSLog(@"[RNPdfScannerManager] ERROR:
|
|
45
|
+
NSLog(@"[RNPdfScannerManager] ERROR: Scanner view not yet ready for capture");
|
|
69
46
|
if (reject) {
|
|
70
47
|
reject(@"NO_VIEW", @"Document scanner view is not ready", nil);
|
|
71
48
|
}
|
|
@@ -27,18 +27,15 @@ class PdfScanner extends React.Component {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
capture() {
|
|
30
|
-
console.log('[PdfScanner/ios.js] capture called
|
|
31
|
-
const handle = findNodeHandle(this.scannerRef.current);
|
|
32
|
-
console.log('[PdfScanner/ios.js] node handle (reactTag):', handle);
|
|
30
|
+
console.log('[PdfScanner/ios.js] capture called');
|
|
33
31
|
|
|
34
|
-
if (
|
|
32
|
+
if (!this.scannerRef.current) {
|
|
35
33
|
const error = new Error('DocumentScanner native view is not ready');
|
|
36
34
|
console.error('[PdfScanner/ios.js] ERROR:', error.message);
|
|
37
35
|
return Promise.reject(error);
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
return NativeModules.RNPdfScannerManager.capture(handle);
|
|
38
|
+
return NativeModules.RNPdfScannerManager.capture();
|
|
42
39
|
}
|
|
43
40
|
|
|
44
41
|
render() {
|