diff --git a/components/CreateScrn.tsx b/components/CreateScrn.tsx index c1b9d51..7fb2e5c 100644 --- a/components/CreateScrn.tsx +++ b/components/CreateScrn.tsx @@ -6,8 +6,9 @@ import { KeyboardAvoidingView, Alert, useColorScheme, + View, } from "react-native"; -import React, { useState } from "react"; +import React, { useState, useCallback } from "react"; import { Entypo } from "@expo/vector-icons"; import AsyncStorage from "@react-native-async-storage/async-storage"; @@ -19,10 +20,13 @@ import { import FONT from "../constants/FONT"; import { createScreenProp, listProp } from "../types/type"; import { light, dark } from "../constants/Colors"; +import Icon from "./Icon"; +import Icons from "../constants/Icons"; const CreateScrn = ({ create, showCreate, setTaskItem }: createScreenProp) => { const [name, setName] = useState(""); const [subject, setSubject] = useState(""); + const [icon, setIcon] = useState("note"); const { date, time } = getCurrentDateAndTime(); const key = getRandomLetter() + getRandomNumber(); const DarkMode = useColorScheme() === "dark"; @@ -44,19 +48,28 @@ const CreateScrn = ({ create, showCreate, setTaskItem }: createScreenProp) => { if (!name || !subject || !date || !time) { Alert.alert("Enter A Task"); } else { - const newItem = { key, name, subject, date, time }; + const newItem = { key, name, subject, date, time, icon }; setData(newItem); showCreate(false); setName(""); setSubject(""); + setIcon("note"); } }; + const handleIconPress = useCallback((icon: string) => { + setIcon(icon); + }, []); + if (create) { return ( { onChangeText={(text) => setSubject(text)} placeholderTextColor={DarkMode ? dark.text3 : light.text3} /> + + {Icons.map(({ name }) => { + const opacity = name === icon ? 1 : 0.5; + return ( + + ); + })} + { }; return ( - { contentContainerStyle={{ borderRadius: 20, paddingHorizontal: 20, - flex: 1, }} /> ) : ( )} - + ); }; @@ -95,7 +88,7 @@ export default List; const styles = StyleSheet.create({ list: { - backgroundColor: "white", + backgroundColor: light.background1, borderTopLeftRadius: 40, borderTopRightRadius: 40, paddingBottom: 5,