import React, { useEffect, useState } from 'react'; import { View, Text, Modal, StyleSheet, TouchableOpacity, Animated, } from 'react-native'; import { LinearGradient } from 'expo-linear-gradient'; import { Ionicons, MaterialCommunityIcons } from '@expo/vector-icons'; import { colors, borderRadius, spacing, typography, shadows } from '../../theme/colors'; interface BiometricModalProps { visible: boolean; onSuccess: () => void; onCancel: () => void; title?: string; message?: string; isDark?: boolean; } export default function BiometricModal({ visible, onSuccess, onCancel, title = 'Captain\'s Verification', message = 'Verify your identity to continue', isDark = false, }: BiometricModalProps) { const [scanAnimation] = useState(new Animated.Value(0)); const [pulseAnimation] = useState(new Animated.Value(1)); const [isScanning, setIsScanning] = useState(false); useEffect(() => { if (visible) { setIsScanning(false); scanAnimation.setValue(0); // Pulse animation Animated.loop( Animated.sequence([ Animated.timing(pulseAnimation, { toValue: 1.08, duration: 1000, useNativeDriver: true, }), Animated.timing(pulseAnimation, { toValue: 1, duration: 1000, useNativeDriver: true, }), ]) ).start(); } }, [visible]); const handleScan = () => { setIsScanning(true); Animated.loop( Animated.sequence([ Animated.timing(scanAnimation, { toValue: 1, duration: 400, useNativeDriver: true, }), Animated.timing(scanAnimation, { toValue: 0, duration: 400, useNativeDriver: true, }), ]), { iterations: 1 } ).start(() => { onSuccess(); }); }; const backgroundColor = isDark ? colors.vault.cardBackground : colors.white; const textColor = isDark ? colors.vault.text : colors.nautical.navy; const accentColor = isDark ? colors.vault.primary : colors.nautical.teal; const accentGradient: [string, string] = isDark ? [colors.vault.primary, colors.vault.secondary] : [colors.nautical.teal, colors.nautical.seafoam]; return ( {/* Ship wheel watermark */} {title} {message} {isScanning ? 'Verifying...' : 'Tap to Verify'} Cancel ); } const styles = StyleSheet.create({ overlay: { flex: 1, backgroundColor: 'rgba(26, 58, 74, 0.7)', justifyContent: 'center', alignItems: 'center', padding: spacing.lg, }, container: { width: '100%', borderRadius: borderRadius.xxl, padding: spacing.xl, alignItems: 'center', overflow: 'hidden', }, watermark: { position: 'absolute', top: -30, right: -30, }, title: { fontSize: typography.fontSize.lg, fontWeight: '600', marginBottom: spacing.sm, textAlign: 'center', fontFamily: typography.fontFamily.serif, }, message: { fontSize: typography.fontSize.base, textAlign: 'center', marginBottom: spacing.xl, lineHeight: typography.fontSize.base * 1.5, }, fingerprintButton: { alignItems: 'center', marginBottom: spacing.lg, }, fingerprintOuter: { position: 'absolute', width: 150, height: 150, borderRadius: 75, }, fingerprintContainer: { marginBottom: spacing.md, }, fingerprintGradient: { width: 110, height: 110, borderRadius: 55, justifyContent: 'center', alignItems: 'center', }, scanText: { fontSize: typography.fontSize.base, fontWeight: '600', }, cancelButton: { paddingVertical: spacing.md, paddingHorizontal: spacing.xl, }, cancelText: { fontSize: typography.fontSize.base, fontWeight: '500', }, });