react-native-rectangle-doc-scanner 3.37.0 → 3.38.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/CropEditor.js +4 -15
- package/dist/FullDocScanner.js +16 -11
- package/package.json +1 -1
- package/src/CropEditor.tsx +14 -18
- package/src/FullDocScanner.tsx +18 -10
package/dist/CropEditor.js
CHANGED
|
@@ -32,14 +32,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
36
|
exports.CropEditor = void 0;
|
|
40
37
|
const react_1 = __importStar(require("react"));
|
|
41
38
|
const react_native_1 = require("react-native");
|
|
42
|
-
const react_native_perspective_image_cropper_1 = __importDefault(require("react-native-perspective-image-cropper"));
|
|
43
39
|
const coordinate_1 = require("./utils/coordinate");
|
|
44
40
|
/**
|
|
45
41
|
* CropEditor Component
|
|
@@ -135,8 +131,7 @@ const CropEditor = ({ document, overlayColor = 'rgba(0,0,0,0.5)', overlayStrokeC
|
|
|
135
131
|
react_1.default.createElement(react_native_1.Text, { style: styles.errorPath }, imageUri))) : !imageSize || isImageLoading ? (react_1.default.createElement(react_native_1.View, { style: styles.loadingContainer },
|
|
136
132
|
react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: handlerColor }),
|
|
137
133
|
react_1.default.createElement(react_native_1.Text, { style: styles.loadingText }, "Loading image..."))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
138
|
-
react_1.default.createElement(
|
|
139
|
-
react_1.default.createElement(react_native_1.Image, { source: { uri: imageUri }, style: styles.debugImage, onLoad: () => console.log('[CropEditor] Debug image loaded'), onError: (e) => console.error('[CropEditor] Debug image error:', e.nativeEvent.error) })))));
|
|
134
|
+
react_1.default.createElement(react_native_1.Image, { source: { uri: imageUri }, style: styles.fullImage, resizeMode: "contain", onLoad: () => console.log('[CropEditor] Image loaded successfully'), onError: (e) => console.error('[CropEditor] Image load error:', e.nativeEvent.error) })))));
|
|
140
135
|
};
|
|
141
136
|
exports.CropEditor = CropEditor;
|
|
142
137
|
const styles = react_native_1.StyleSheet.create({
|
|
@@ -171,14 +166,8 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
171
166
|
fontSize: 12,
|
|
172
167
|
textAlign: 'center',
|
|
173
168
|
},
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
height: 100,
|
|
178
|
-
top: 10,
|
|
179
|
-
right: 10,
|
|
180
|
-
opacity: 0.5,
|
|
181
|
-
borderWidth: 2,
|
|
182
|
-
borderColor: 'red',
|
|
169
|
+
fullImage: {
|
|
170
|
+
width: '100%',
|
|
171
|
+
height: '100%',
|
|
183
172
|
},
|
|
184
173
|
});
|
package/dist/FullDocScanner.js
CHANGED
|
@@ -224,20 +224,25 @@ const FullDocScanner = ({ onResult, onClose, detectionConfig, overlayColor = '#3
|
|
|
224
224
|
console.log('[FullDocScanner] Already processing, skipping manual capture');
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
|
+
// Reset DocScanner state before capturing
|
|
228
|
+
docScannerRef.current?.reset();
|
|
227
229
|
console.log('[FullDocScanner] Setting manualCapturePending to true');
|
|
228
230
|
manualCapturePending.current = true;
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
// Small delay to ensure reset completes
|
|
232
|
+
setTimeout(() => {
|
|
233
|
+
const capturePromise = docScannerRef.current?.capture();
|
|
234
|
+
console.log('[FullDocScanner] capturePromise:', !!capturePromise);
|
|
235
|
+
if (capturePromise && typeof capturePromise.catch === 'function') {
|
|
236
|
+
capturePromise.catch((error) => {
|
|
237
|
+
manualCapturePending.current = false;
|
|
238
|
+
console.warn('[FullDocScanner] manual capture failed', error);
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
else if (!capturePromise) {
|
|
242
|
+
console.warn('[FullDocScanner] No capture promise returned');
|
|
233
243
|
manualCapturePending.current = false;
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
else if (!capturePromise) {
|
|
238
|
-
console.warn('[FullDocScanner] No capture promise returned');
|
|
239
|
-
manualCapturePending.current = false;
|
|
240
|
-
}
|
|
244
|
+
}
|
|
245
|
+
}, 100);
|
|
241
246
|
}, []);
|
|
242
247
|
const performCrop = (0, react_1.useCallback)(async () => {
|
|
243
248
|
if (!capturedDoc) {
|
package/package.json
CHANGED
package/src/CropEditor.tsx
CHANGED
|
@@ -151,7 +151,16 @@ export const CropEditor: React.FC<CropEditorProps> = ({
|
|
|
151
151
|
</View>
|
|
152
152
|
) : (
|
|
153
153
|
<>
|
|
154
|
-
|
|
154
|
+
{/* Full screen image */}
|
|
155
|
+
<Image
|
|
156
|
+
source={{ uri: imageUri }}
|
|
157
|
+
style={styles.fullImage}
|
|
158
|
+
resizeMode="contain"
|
|
159
|
+
onLoad={() => console.log('[CropEditor] Image loaded successfully')}
|
|
160
|
+
onError={(e) => console.error('[CropEditor] Image load error:', e.nativeEvent.error)}
|
|
161
|
+
/>
|
|
162
|
+
{/* Temporarily disabled CustomImageCropper - showing image only */}
|
|
163
|
+
{/* <CustomImageCropper
|
|
155
164
|
height={displaySize.height}
|
|
156
165
|
width={displaySize.width}
|
|
157
166
|
image={imageUri}
|
|
@@ -161,14 +170,7 @@ export const CropEditor: React.FC<CropEditorProps> = ({
|
|
|
161
170
|
handlerColor={handlerColor}
|
|
162
171
|
enablePanStrict={enablePanStrict}
|
|
163
172
|
onDragEnd={handleDragEnd}
|
|
164
|
-
/>
|
|
165
|
-
{/* Debug: Show image in background to verify it loads */}
|
|
166
|
-
<Image
|
|
167
|
-
source={{ uri: imageUri }}
|
|
168
|
-
style={styles.debugImage}
|
|
169
|
-
onLoad={() => console.log('[CropEditor] Debug image loaded')}
|
|
170
|
-
onError={(e) => console.error('[CropEditor] Debug image error:', e.nativeEvent.error)}
|
|
171
|
-
/>
|
|
173
|
+
/> */}
|
|
172
174
|
</>
|
|
173
175
|
)}
|
|
174
176
|
</View>
|
|
@@ -207,14 +209,8 @@ const styles = StyleSheet.create({
|
|
|
207
209
|
fontSize: 12,
|
|
208
210
|
textAlign: 'center',
|
|
209
211
|
},
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
height: 100,
|
|
214
|
-
top: 10,
|
|
215
|
-
right: 10,
|
|
216
|
-
opacity: 0.5,
|
|
217
|
-
borderWidth: 2,
|
|
218
|
-
borderColor: 'red',
|
|
212
|
+
fullImage: {
|
|
213
|
+
width: '100%',
|
|
214
|
+
height: '100%',
|
|
219
215
|
},
|
|
220
216
|
});
|
package/src/FullDocScanner.tsx
CHANGED
|
@@ -347,19 +347,27 @@ export const FullDocScanner: React.FC<FullDocScannerProps> = ({
|
|
|
347
347
|
console.log('[FullDocScanner] Already processing, skipping manual capture');
|
|
348
348
|
return;
|
|
349
349
|
}
|
|
350
|
+
|
|
351
|
+
// Reset DocScanner state before capturing
|
|
352
|
+
docScannerRef.current?.reset();
|
|
353
|
+
|
|
350
354
|
console.log('[FullDocScanner] Setting manualCapturePending to true');
|
|
351
355
|
manualCapturePending.current = true;
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
capturePromise.
|
|
356
|
+
|
|
357
|
+
// Small delay to ensure reset completes
|
|
358
|
+
setTimeout(() => {
|
|
359
|
+
const capturePromise = docScannerRef.current?.capture();
|
|
360
|
+
console.log('[FullDocScanner] capturePromise:', !!capturePromise);
|
|
361
|
+
if (capturePromise && typeof capturePromise.catch === 'function') {
|
|
362
|
+
capturePromise.catch((error: unknown) => {
|
|
363
|
+
manualCapturePending.current = false;
|
|
364
|
+
console.warn('[FullDocScanner] manual capture failed', error);
|
|
365
|
+
});
|
|
366
|
+
} else if (!capturePromise) {
|
|
367
|
+
console.warn('[FullDocScanner] No capture promise returned');
|
|
356
368
|
manualCapturePending.current = false;
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
} else if (!capturePromise) {
|
|
360
|
-
console.warn('[FullDocScanner] No capture promise returned');
|
|
361
|
-
manualCapturePending.current = false;
|
|
362
|
-
}
|
|
369
|
+
}
|
|
370
|
+
}, 100);
|
|
363
371
|
}, []);
|
|
364
372
|
|
|
365
373
|
const performCrop = useCallback(async (): Promise<{ base64: string; rectangle: Rectangle }> => {
|