@switchlabs/verify-ai-react-native 1.0.0 → 1.1.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.
|
@@ -16,6 +16,8 @@ export interface VerifyAIScannerProps {
|
|
|
16
16
|
showCaptureButton?: boolean;
|
|
17
17
|
/** Ref to imperatively trigger capture from parent. */
|
|
18
18
|
captureRef?: React.MutableRefObject<(() => void) | null>;
|
|
19
|
+
/** Whether to enable the camera torch/flashlight. */
|
|
20
|
+
enableTorch?: boolean;
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* Camera scanner component for capturing verification photos.
|
|
@@ -38,4 +40,4 @@ export interface VerifyAIScannerProps {
|
|
|
38
40
|
* />
|
|
39
41
|
* ```
|
|
40
42
|
*/
|
|
41
|
-
export declare function VerifyAIScanner({ onCapture, onResult, onError, overlay, style, showCaptureButton, captureRef, }: VerifyAIScannerProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export declare function VerifyAIScanner({ onCapture, onResult, onError, overlay, style, showCaptureButton, captureRef, enableTorch, }: VerifyAIScannerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -23,7 +23,7 @@ import { CameraView, useCameraPermissions, } from 'expo-camera';
|
|
|
23
23
|
* />
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
export function VerifyAIScanner({ onCapture, onResult, onError, overlay, style, showCaptureButton = true, captureRef, }) {
|
|
26
|
+
export function VerifyAIScanner({ onCapture, onResult, onError, overlay, style, showCaptureButton = true, captureRef, enableTorch, }) {
|
|
27
27
|
const cameraRef = useRef(null);
|
|
28
28
|
const [status, setStatus] = useState('idle');
|
|
29
29
|
const [result, setResult] = useState(null);
|
|
@@ -96,7 +96,7 @@ export function VerifyAIScanner({ onCapture, onResult, onError, overlay, style,
|
|
|
96
96
|
return (_jsxs(View, { style: [styles.container, styles.permissionContainer, style], children: [_jsx(Text, { style: styles.permissionText, children: "Camera access is required for photo verification" }), _jsx(TouchableOpacity, { style: styles.permissionButton, onPress: requestPermission, children: _jsx(Text, { style: styles.permissionButtonText, children: "Grant Camera Access" }) })] }));
|
|
97
97
|
}
|
|
98
98
|
const showBottomCard = status === 'success' || status === 'error';
|
|
99
|
-
return (_jsx(View, { style: [styles.container, style], children: _jsx(CameraView, { ref: cameraRef, style: styles.camera, facing: "back", children: _jsxs(View, { style: styles.overlay, children: [overlay?.title && (_jsx(View, { style: styles.topBar, children: _jsx(Text, { style: styles.titleText, children: overlay.title }) })), overlay?.showGuideFrame && (_jsx(View, { style: styles.guideContainer, children: _jsxs(View, { style: [
|
|
99
|
+
return (_jsx(View, { style: [styles.container, style], children: _jsx(CameraView, { ref: cameraRef, style: styles.camera, facing: "back", enableTorch: enableTorch, children: _jsxs(View, { style: styles.overlay, children: [overlay?.title && (_jsx(View, { style: styles.topBar, children: _jsx(Text, { style: styles.titleText, children: overlay.title }) })), overlay?.showGuideFrame && (_jsx(View, { style: styles.guideContainer, children: _jsxs(View, { style: [
|
|
100
100
|
styles.guideFrame,
|
|
101
101
|
overlay.guideFrameAspectRatio
|
|
102
102
|
? { aspectRatio: overlay.guideFrameAspectRatio }
|
package/package.json
CHANGED
|
@@ -33,6 +33,8 @@ export interface VerifyAIScannerProps {
|
|
|
33
33
|
showCaptureButton?: boolean;
|
|
34
34
|
/** Ref to imperatively trigger capture from parent. */
|
|
35
35
|
captureRef?: React.MutableRefObject<(() => void) | null>;
|
|
36
|
+
/** Whether to enable the camera torch/flashlight. */
|
|
37
|
+
enableTorch?: boolean;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
/**
|
|
@@ -64,6 +66,7 @@ export function VerifyAIScanner({
|
|
|
64
66
|
style,
|
|
65
67
|
showCaptureButton = true,
|
|
66
68
|
captureRef,
|
|
69
|
+
enableTorch,
|
|
67
70
|
}: VerifyAIScannerProps) {
|
|
68
71
|
const cameraRef = useRef<CameraView>(null);
|
|
69
72
|
const [status, setStatus] = useState<ScannerStatus>('idle');
|
|
@@ -156,7 +159,7 @@ export function VerifyAIScanner({
|
|
|
156
159
|
|
|
157
160
|
return (
|
|
158
161
|
<View style={[styles.container, style]}>
|
|
159
|
-
<CameraView ref={cameraRef} style={styles.camera} facing="back">
|
|
162
|
+
<CameraView ref={cameraRef} style={styles.camera} facing="back" enableTorch={enableTorch}>
|
|
160
163
|
{/* Overlay */}
|
|
161
164
|
<View style={styles.overlay}>
|
|
162
165
|
{overlay?.title && (
|