import { IconSymbol } from '@/components/ui/icon-symbol'; import { StatusBar } from 'expo-status-bar'; import { useMemo, useState } from 'react'; import { Dimensions, KeyboardAvoidingView, Platform, ScrollView, StyleSheet, Text, TextInput, TouchableOpacity, View } from 'react-native'; const { width } = Dimensions.get('window'); export default function ChangePasswordScreen() { const [currentPassword, setCurrentPassword] = useState(''); const [newPassword, setNewPassword] = useState(''); const [confirmPassword, setConfirmPassword] = useState(''); const [showCurrent, setShowCurrent] = useState(false); const [showNew, setShowNew] = useState(false); const [showConfirm, setShowConfirm] = useState(false); // Validasi sederhana kekuatan password const passwordChecks = useMemo(() => { return { length: newPassword.length >= 8, upper: /[A-Z]/.test(newPassword), number: /[0-9]/.test(newPassword), match: newPassword.length > 0 && newPassword === confirmPassword, }; }, [newPassword, confirmPassword]); const isFormValid = currentPassword.length > 0 && passwordChecks.length && passwordChecks.upper && passwordChecks.number && passwordChecks.match; const handleChangePassword = () => { if (!isFormValid) return; // Handle change password logic console.log('Change password pressed'); }; return ( {/* Header */} Buat Password Baru Ini adalah login pertama Anda.{'\n'}Silakan ganti password default dari admin. {/* Form Card */} {/* Current / Default Password */} PASSWORD SAAT INI (DEFAULT) setShowCurrent(!showCurrent)} style={styles.eyeIcon} > {/* New Password */} PASSWORD BARU setShowNew(!showNew)} style={styles.eyeIcon} > {/* Confirm New Password */} KONFIRMASI PASSWORD BARU setShowConfirm(!showConfirm)} style={styles.eyeIcon} > {/* Password Requirements Checklist */} {/* Submit Button */} Simpan & Lanjutkan {/* Info note */} Anda tidak dapat melanjutkan ke aplikasi sebelum mengganti password default ini. ); } function ChecklistItem({ label, checked }: { label: string; checked: boolean }) { return ( {checked && } {label} ); } const itemStyles = StyleSheet.create({ row: { flexDirection: 'row', alignItems: 'center', marginBottom: 8, }, dot: { width: 16, height: 16, borderRadius: 8, borderWidth: 1.5, borderColor: '#CBD5E1', marginRight: 8, justifyContent: 'center', alignItems: 'center', }, dotActive: { backgroundColor: '#3B82F6', borderColor: '#3B82F6', }, label: { fontSize: 12.5, color: '#94A3B8', }, labelActive: { color: '#1E3A8A', fontWeight: '600', }, }); const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#EFF6FF', }, scrollContent: { flexGrow: 1, paddingBottom: 40, }, headerContainer: { alignItems: 'center', paddingTop: 70, paddingBottom: 32, paddingHorizontal: 30, }, logoCircle: { width: 72, height: 72, borderRadius: 36, backgroundColor: '#fff', justifyContent: 'center', alignItems: 'center', marginBottom: 20, shadowColor: '#3B82F6', shadowOffset: { width: 0, height: 4 }, shadowOpacity: 0.15, shadowRadius: 12, elevation: 4, }, welcomeText: { fontSize: 24, fontWeight: '700', color: '#1E3A8A', marginBottom: 8, textAlign: 'center', }, subtitleText: { fontSize: 13.5, color: '#60A5FA', fontWeight: '400', textAlign: 'center', lineHeight: 20, }, formCard: { backgroundColor: '#fff', marginHorizontal: 24, borderRadius: 24, padding: 28, shadowColor: '#3B82F6', shadowOffset: { width: 0, height: 8 }, shadowOpacity: 0.08, shadowRadius: 20, elevation: 3, }, inputWrapper: { marginBottom: 18, }, inputLabel: { fontSize: 11, color: '#60A5FA', fontWeight: '700', marginBottom: 8, letterSpacing: 0.5, }, inputContainer: { flexDirection: 'row', alignItems: 'center', borderWidth: 1.5, borderColor: '#DBEAFE', borderRadius: 14, backgroundColor: '#F8FAFF', paddingHorizontal: 14, height: 52, }, inputIcon: { marginRight: 10, }, input: { flex: 1, fontSize: 15, color: '#1E293B', height: '100%', }, eyeIcon: { padding: 4, }, checklistContainer: { backgroundColor: '#F8FAFF', borderRadius: 14, padding: 16, marginTop: 4, marginBottom: 24, }, submitButton: { backgroundColor: '#3B82F6', height: 54, borderRadius: 16, justifyContent: 'center', alignItems: 'center', shadowColor: '#3B82F6', shadowOffset: { width: 0, height: 6 }, shadowOpacity: 0.35, shadowRadius: 12, elevation: 5, marginBottom: 20, }, submitButtonDisabled: { backgroundColor: '#BFDBFE', shadowOpacity: 0, elevation: 0, }, submitButtonText: { color: '#fff', fontSize: 16, fontWeight: '700', letterSpacing: 0.3, }, infoBox: { flexDirection: 'row', alignItems: 'flex-start', backgroundColor: '#EFF6FF', borderRadius: 12, padding: 12, gap: 8, }, infoText: { flex: 1, fontSize: 12, color: '#3B82F6', lineHeight: 17, }, });