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";
import { IReminder, useRemindersContext } from "@/contexts/RemindersContext";
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 {reminders, addReminder, updateReminder} = useRemindersContext();
const [isModalVisible, setIsModalVisible] = useState(false);
const handleModalClose = () => {
setIsModalVisible(false);
};
return (
Reminders
setIsModalVisible(true)}
/>
{reminders.map((reminder, index) => (
{reminder.title}
{dateTimeDisplay(reminder.date)}
{
updateReminder(reminder.id, {done: !reminder.done})
}}
/>
))}
);
};
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;