// components/ui/PinPad.tsx import React from 'react'; import { View, Text, TouchableOpacity, StyleSheet, Vibration, } from 'react-native'; import { Delete } from 'lucide-react-native'; interface PinPadProps { pin: string; onPinChange: (pin: string) => void; maxLength?: number; } const KEYS = [ ['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9'], ['', '0', 'del'], ]; export default function PinPad({ pin, onPinChange, maxLength = 6, }: PinPadProps) { const handleKey = (key: string) => { if (key === 'del') { onPinChange(pin.slice(0, -1)); } else if (key !== '' && pin.length < maxLength) { Vibration.vibrate(30); onPinChange(pin + key); } }; return ( {/* PIN dots */} {Array.from({ length: maxLength }).map((_, i) => ( ))} {/* Keypad */} {KEYS.map((row, ri) => ( {row.map((key, ki) => { if (key === '') { return ; } if (key === 'del') { return ( handleKey('del')} activeOpacity={0.6} > ); } return ( handleKey(key)} activeOpacity={0.6} > {key} ); })} ))} ); } const styles = StyleSheet.create({ container: { alignItems: 'center', gap: 24, }, dotsRow: { flexDirection: 'row', gap: 16, marginBottom: 8, }, dot: { width: 16, height: 16, borderRadius: 8, borderWidth: 2, borderColor: '#9CA3AF', backgroundColor: 'transparent', }, dotFilled: { backgroundColor: '#1A6B72', borderColor: '#1A6B72', }, row: { flexDirection: 'row', gap: 20, }, key: { width: 72, height: 72, borderRadius: 36, backgroundColor: 'rgba(255,255,255,0.08)', justifyContent: 'center', alignItems: 'center', }, keyEmpty: { width: 72, height: 72, }, keyText: { fontSize: 26, fontWeight: '500', color: '#F9FAFB', }, });