react-native-rectangle-doc-scanner 3.74.0 → 3.76.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/dist/FullDocScanner.js
CHANGED
|
@@ -246,7 +246,7 @@ const FullDocScanner = ({ onResult, onClose, detectionConfig, overlayColor = '#3
|
|
|
246
246
|
console.log('[FullDocScanner] Gallery image selected:', imageUri);
|
|
247
247
|
// Defer cropper presentation until picker dismissal finishes to avoid hierarchy errors
|
|
248
248
|
await new Promise((resolve) => react_native_1.InteractionManager.runAfterInteractions(() => resolve()));
|
|
249
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
249
|
+
await new Promise((resolve) => setTimeout(resolve, 350));
|
|
250
250
|
await openCropper(imageUri);
|
|
251
251
|
}
|
|
252
252
|
catch (error) {
|
package/package.json
CHANGED
package/src/FullDocScanner.tsx
CHANGED
|
@@ -331,7 +331,7 @@ export const FullDocScanner: React.FC<FullDocScannerProps> = ({
|
|
|
331
331
|
await new Promise<void>((resolve) =>
|
|
332
332
|
InteractionManager.runAfterInteractions(() => resolve()),
|
|
333
333
|
);
|
|
334
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
334
|
+
await new Promise((resolve) => setTimeout(resolve, 350));
|
|
335
335
|
|
|
336
336
|
await openCropper(imageUri);
|
|
337
337
|
} catch (error) {
|
|
@@ -20,6 +20,8 @@ class PdfScanner extends React.Component {
|
|
|
20
20
|
permissionsAuthorized: Platform.OS === 'ios',
|
|
21
21
|
};
|
|
22
22
|
this.eventsSubscribed = false;
|
|
23
|
+
this.nativeRef = null;
|
|
24
|
+
this.nativeTag = null;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
onPermissionsDenied = () => {
|
|
@@ -130,7 +132,7 @@ class PdfScanner extends React.Component {
|
|
|
130
132
|
return Promise.reject(new Error('capture_not_supported'));
|
|
131
133
|
}
|
|
132
134
|
|
|
133
|
-
const nodeHandle = findNodeHandle(this);
|
|
135
|
+
const nodeHandle = this.nativeTag ?? findNodeHandle(this.nativeRef);
|
|
134
136
|
|
|
135
137
|
if (!nodeHandle) {
|
|
136
138
|
return Promise.reject(new Error('scanner_view_not_ready'));
|
|
@@ -143,8 +145,7 @@ class PdfScanner extends React.Component {
|
|
|
143
145
|
return result;
|
|
144
146
|
}
|
|
145
147
|
|
|
146
|
-
|
|
147
|
-
return Promise.resolve(result);
|
|
148
|
+
return result;
|
|
148
149
|
} catch (error) {
|
|
149
150
|
return Promise.reject(error);
|
|
150
151
|
}
|
|
@@ -154,9 +155,20 @@ class PdfScanner extends React.Component {
|
|
|
154
155
|
if (!this.state.permissionsAuthorized) {
|
|
155
156
|
return null;
|
|
156
157
|
}
|
|
158
|
+
const { onLayout, ...restProps } = this.props;
|
|
157
159
|
return (
|
|
158
160
|
<RNPdfScanner
|
|
159
|
-
{
|
|
161
|
+
ref={(ref) => {
|
|
162
|
+
this.nativeRef = ref;
|
|
163
|
+
this.nativeTag = ref ? findNodeHandle(ref) : null;
|
|
164
|
+
}}
|
|
165
|
+
onLayout={(event) => {
|
|
166
|
+
this.nativeTag = event?.nativeEvent?.target ?? this.nativeTag;
|
|
167
|
+
if (onLayout) {
|
|
168
|
+
onLayout(event);
|
|
169
|
+
}
|
|
170
|
+
}}
|
|
171
|
+
{...restProps}
|
|
160
172
|
onPictureTaken={this.sendOnPictureTakenEvent.bind(this)}
|
|
161
173
|
onRectangleDetect={this.sendOnRectanleDetectEvent.bind(this)}
|
|
162
174
|
useFrontCam={this.props.useFrontCam || false}
|
|
@@ -58,8 +58,10 @@ RCT_EXPORT_METHOD(capture:(nullable id)reactTag
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
if (!targetView && self->_scannerView) {
|
|
61
|
-
NSLog(@"[RNPdfScannerManager] Falling back to last known scanner view");
|
|
61
|
+
NSLog(@"[RNPdfScannerManager] Falling back to last known scanner view: %@", self->_scannerView);
|
|
62
62
|
targetView = self->_scannerView;
|
|
63
|
+
} else if (!targetView) {
|
|
64
|
+
NSLog(@"[RNPdfScannerManager] No cached scanner view available");
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
if (!targetView) {
|