import React, { useEffect, useState } from "react"; import { Dialog, Button, Text, View, TextField } from "react-native-ui-lib"; import { StyleSheet } from "react-native"; import { Feather } from "@expo/vector-icons"; interface ConfirmationDialogProps { visible: boolean; onDismiss: () => void; onFirstYes: () => void; onConfirm: () => void; isDeleteFamily?: boolean; householdName: string; } const DeleteProfileDialogs: React.FC = ({ visible, onDismiss, onFirstYes, onConfirm, isDeleteFamily, householdName, }) => { const [confirmationDialog, setConfirmationDialog] = useState(false); const [input, setInput] = useState(""); const [isCorrect, setIsCorrect] = useState(false); useEffect(() => { setInput(""); }, [onDismiss, onConfirm]) useEffect(() => { setIsCorrect(input !== "" && input === householdName); }, [input]) return ( <> Are you sure? {isDeleteFamily ? ( This action will permanently delete all your family profiles and data, you won't be able to recover it! ) : ( This action will permanently delete all your data, you won't be able to recover it! )} setConfirmationDialog(false)} containerStyle={styles.dialog} > {isDeleteFamily ? ( Deleting family Deleting the family will remove all profiles and data. This cannot be undone. Type the name of your household to confirm. { setInput(value); }} style={[styles.txtBox, { marginTop: 5 }]} /> ) : ( We're sorry to see you go, are you really sure you want to delete everything? )} ); }; const styles = StyleSheet.create({ confirmBtn: { backgroundColor: "#ff1637", }, cancelBtn: { backgroundColor: "white", }, confirmDisabled: { backgroundColor: "#999999" }, dialog: { backgroundColor: "white", paddingHorizontal: 25, paddingTop: 25, paddingBottom: 17, borderRadius: 20, }, title: { fontFamily: "Manrope_600SemiBold", fontSize: 22, marginBottom: 5, }, text: { fontFamily: "PlusJakartaSans_400Regular", fontSize: 16, marginBottom: 0, }, subText: { fontFamily: "PlusJakartaSans_400Regular", fontSize: 12, marginBottom: 0, color: "#999999", marginTop: 15, }, txtBox: { backgroundColor: "#fafafa", borderRadius: 10, borderWidth: 2, borderColor: "#cecece", padding: 15, height: 45, fontFamily: "PlusJakartaSans_500Medium", fontSize: 13, }, }); export default DeleteProfileDialogs;