import {View, Image, Pressable, Text} from 'react-native';
import React from 'react';
import {styles} from './styles';
import {ImgUrlsType} from '../../provider/verification.context';
import {globalStyles} from '../../../globalStyles';
import overlayImage from '../../assets/faceki-overlay-camera-L2.png';
import Icon from 'react-native-vector-icons/Ionicons';
import {Platform} from 'react-native';
import { getBranding } from '../../branding';
import {useMyStepsVerification} from '../../provider/verification.context';
const IDCARD = '../../assets/idwhite.png';
const DLCARD = '../../assets/dlwhite.png';
const Passport = '../../assets/passportwhite.png';
type props = {
imgUrls: ImgUrlsType;
selectedOption: string;
routeOfHandler: () => void;
goBackUserSteps: (index?: number) => void;
userStep: number;
skipGuidanceScreens?: boolean;
findOutStepContent: () => {
step: number;
heading: string;
subHeading: string;
};
};
/**
* A component for displaying an image captured by the user and allowing the user to confirm or retake the photo.
*
* @param {Object} props - The component props.
* @param {Object} props.imgUrls - An object containing the image URLs for the front and back of the ID card and the user's selfie.
* @param {string} props.selectedOption - The currently selected option for the ID card type.
* @param {Function} props.routeOfHandler - A function that handles the user's confirmation of the photo.
* @param {Function} props.goBackUserSteps - A function that allows the user to go back to the previous verification step.
* @param {number} props.userStep - The current step in the user verification process.
* @returns {JSX.Element} - The rendered component as a JSX element.
*/
const ClarityCheck = ({
imgUrls,
selectedOption,
routeOfHandler,
goBackUserSteps,
userStep,
skipGuidanceScreens,
findOutStepContent,
}: props) => {
const { t } = useMyStepsVerification();
let userImage =
userStep === 8
? imgUrls[selectedOption].backImage
: imgUrls[selectedOption].frontImage;
// when i need to test selfie image only
if (userStep === 10) {
userImage = imgUrls[selectedOption].selfie;
}
return (
<>
{
goBackUserSteps();
}}
style={({pressed}) => pressed && styles.opacity}>
{findOutStepContent()?.heading}
{findOutStepContent()?.subHeading}
{userStep === 8 ? t.backSide : t.frontSide}
pressed && styles.opacity}>
pressed ? [styles.cta, styles.opacity] : styles.cta
}
onPress={routeOfHandler}>
{t.looksGood}
pressed ? [styles.retake, styles.opacity] : styles.retake
}
onPress={() => {
goBackUserSteps();
}}>
{t.retakePhoto}
>
);
};
export default ClarityCheck;