react-native-rectangle-doc-scanner 3.11.0 → 3.13.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/DocScanner.js
CHANGED
|
@@ -109,7 +109,7 @@ exports.DocScanner = (0, react_1.forwardRef)(({ onCapture, overlayColor = DEFAUL
|
|
|
109
109
|
},
|
|
110
110
|
}), [capture]);
|
|
111
111
|
return (react_1.default.createElement(react_native_1.View, { style: styles.container },
|
|
112
|
-
react_1.default.createElement(react_native_document_scanner_1.default, { ref: scannerRef, style:
|
|
112
|
+
react_1.default.createElement(react_native_document_scanner_1.default, { ref: scannerRef, style: styles.scanner, detectionCountBeforeCapture: minStableFrames, overlayColor: overlayColor, enableTorch: enableTorch, quality: normalizedQuality, useBase64: useBase64, manualOnly: !autoCapture, onPictureTaken: handlePictureTaken, onError: handleError }),
|
|
113
113
|
!autoCapture && react_1.default.createElement(react_native_1.TouchableOpacity, { style: styles.button, onPress: handleManualCapture }),
|
|
114
114
|
children));
|
|
115
115
|
});
|
|
@@ -118,6 +118,15 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
118
118
|
flex: 1,
|
|
119
119
|
backgroundColor: '#000',
|
|
120
120
|
},
|
|
121
|
+
scanner: {
|
|
122
|
+
position: 'absolute',
|
|
123
|
+
top: 0,
|
|
124
|
+
left: 0,
|
|
125
|
+
right: 0,
|
|
126
|
+
bottom: 0,
|
|
127
|
+
width: '100%',
|
|
128
|
+
height: '100%',
|
|
129
|
+
},
|
|
121
130
|
button: {
|
|
122
131
|
position: 'absolute',
|
|
123
132
|
bottom: 40,
|
package/package.json
CHANGED
package/src/DocScanner.tsx
CHANGED
|
@@ -152,7 +152,7 @@ export const DocScanner = forwardRef<DocScannerHandle, Props>(
|
|
|
152
152
|
<View style={styles.container}>
|
|
153
153
|
<DocumentScanner
|
|
154
154
|
ref={scannerRef}
|
|
155
|
-
style={
|
|
155
|
+
style={styles.scanner}
|
|
156
156
|
detectionCountBeforeCapture={minStableFrames}
|
|
157
157
|
overlayColor={overlayColor}
|
|
158
158
|
enableTorch={enableTorch}
|
|
@@ -174,6 +174,15 @@ const styles = StyleSheet.create({
|
|
|
174
174
|
flex: 1,
|
|
175
175
|
backgroundColor: '#000',
|
|
176
176
|
},
|
|
177
|
+
scanner: {
|
|
178
|
+
position: 'absolute',
|
|
179
|
+
top: 0,
|
|
180
|
+
left: 0,
|
|
181
|
+
right: 0,
|
|
182
|
+
bottom: 0,
|
|
183
|
+
width: '100%',
|
|
184
|
+
height: '100%',
|
|
185
|
+
},
|
|
177
186
|
button: {
|
|
178
187
|
position: 'absolute',
|
|
179
188
|
bottom: 40,
|
|
@@ -16,14 +16,21 @@
|
|
|
16
16
|
return self;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
- (void)
|
|
20
|
-
[super
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
- (void)layoutSubviews {
|
|
20
|
+
[super layoutSubviews];
|
|
21
|
+
|
|
22
|
+
// Setup camera after layout is complete and bounds are valid
|
|
23
|
+
if (!_hasSetupCamera && self.window && !CGRectIsEmpty(self.bounds)) {
|
|
24
|
+
NSLog(@"[DocumentScanner] Setting up camera with bounds: %@", NSStringFromCGRect(self.bounds));
|
|
23
25
|
[self setupCameraView];
|
|
24
26
|
[self start];
|
|
25
27
|
_hasSetupCamera = YES;
|
|
26
|
-
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
- (void)didMoveToWindow {
|
|
32
|
+
[super didMoveToWindow];
|
|
33
|
+
if (!self.window && _hasSetupCamera) {
|
|
27
34
|
// Stop camera when view is removed from window
|
|
28
35
|
[self stop];
|
|
29
36
|
}
|