/* eslint-disable prettier/prettier */ import React, { useContext, useMemo } from 'react'; import { StyleSheet, View } from 'react-native'; import Svg, { Path, G } from 'react-native-svg'; import LottieView from 'lottie-react-native'; import { GetIDContext } from '../../contexts/getid-context'; export type FaceOverlayProps = { isLoading?: boolean; status?: 'neutral' | 'success' | string; rect: { width: number; left: number; right: number; top: number; bottom: number; height: number; centerW: number; centerH: number; }; }; export type RectangleProps = { width: number; height: number; right: number; left: number; top: number; bottom: number; status: 'error' | 'success'; }; export const FaceOverlay = (props: FaceOverlayProps) => { const { width, height, top, bottom, left, right, centerW, centerH } = props.rect; const context = useContext(GetIDContext); const overlayColor = context?.theme.cameraOverlayBackgroundColor const strokeColor = useMemo(() => { switch (props.status) { case 'success': return context?.theme.successColor; case 'neutral': default: return context?.theme.cameraFrameColor; } // eslint-disable-next-line react-hooks/exhaustive-deps }, [props.status]); const bzWidth = width * 2 / 8; const bzHeight = height * 3 / 8; const curve = height / 8; return ( {props.isLoading && ( )} ); }; const styles = StyleSheet.create({ container: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, display: 'flex', zIndex: 2, }, frameWrapper: { position: 'absolute', top: 0, bottom: 0, display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', width: '100%', height: '100%', margin: 'auto', }, frame: { justifyContent: 'center', borderStyle: 'solid', borderWidth: 3, borderRadius: 22, alignItems: 'center', aspectRatio: 259 / 152, }, scanningAnimationWrapper: { position: 'absolute', right: 0, bottom: 0, display: 'flex', borderRadius: 120, overflow: 'hidden', }, scanningAnimation: { flex: 1, }, logo: { width: 400, height: 400, }, });