import { useState } from "react"; import { StyleSheet } from "react-native"; import { Button, Card, Checkbox, Text, View } from "react-native-ui-lib"; import AddReminderModal from "./addReminderModal"; import ButtonOutlined from "@/components/ui/ButtonOutlined"; import AntDesign from "@expo/vector-icons/AntDesign"; import Feather from "@expo/vector-icons/Feather"; import { ScrollView } from "react-native-gesture-handler"; interface Reminder { title: string; date: Date; done: boolean; isAutoRepeat: boolean; remindIn: string; } const dateTimeDisplay = (date: Date) => { const day = String(date.getDate()).padStart(2, "0"); const month = String(date.getMonth() + 1).padStart(2, "0"); const year = date.getFullYear(); const hours = String(date.getHours()).padStart(2, "0"); const minutes = String(date.getMinutes()).padStart(2, "0"); return ( {`${day}/${month}/${year}`}{" "} {" "} {`${hours}:${minutes}`} ); }; const RemindersList = () => { const [isModalVisible, setIsModalVisible] = useState(false); const [reminders, setReminders] = useState([ { title: "Shaving Time", date: new Date(2023, 1, 30, 9, 30), done: true, isAutoRepeat: true, remindIn: "just-in-time", }, { title: "Gonna get a food order", date: new Date(2023, 1, 27), done: false, isAutoRepeat: true, remindIn: "just-in-time", }, ]); const handleModalClose = () => { setIsModalVisible(false); }; const addReminder = (newReminder: Reminder) => { setReminders([...reminders, newReminder]); }; return ( Reminders setIsModalVisible(true)} /> {reminders.map((reminder, index) => ( {reminder.title} {dateTimeDisplay(reminder.date)} { const updatedReminders = reminders.map((item, i) => i === index ? { ...item, done: !item.done } : item ); setReminders(updatedReminders); }} /> ))} ); }; const styles = StyleSheet.create({ header: { flex: 1, flexDirection: "row", }, listContainer: { marginLeft: "8%", marginTop: "4%", marginRight: "4%", maxHeight: '71%' }, button: { backgroundColor: "white", color: "black", borderColor: "lightgray", borderWidth: 1, borderRadius: 5, }, buttonText: { margin: 0, }, card: { display: "flex", justifyContent: "space-between", }, cardList: { marginTop: 10, }, icon: { borderRadius: 50, height: 45, width: 45, backgroundColor: "#fcf4eb", alignItems: "center", justifyContent: "center", marginRight: 10, }, }); export default RemindersList;