import React, { useState, useEffect } from 'react'; import { View, Text, FlatList, TouchableOpacity, Button, TextInput, StyleSheet } from 'react-native'; import { collection, addDoc, query, where, getDocs, deleteDoc, doc } from 'firebase/firestore'; import { db, auth } from '../config/firebase'; function ProjectsScreen({ navigation }: any) { const [projects, setProjects] = useState([]); const [name, setName] = useState(''); useEffect(() => { loadProjects(); }, []); const loadProjects = async () => { const q = query(collection(db, 'projects'), where('userId', '==', auth.currentUser!.uid)); const snapshot = await getDocs(q); setProjects(snapshot.docs.map(doc => ({ id: doc.id, ...doc.data() }))); }; const addProject = async () => { await addDoc(collection(db, 'projects'), { name, userId: auth.currentUser!.uid, status: 'aktív', }); setName(''); loadProjects(); }; const deleteProject = async (id: string) => { await deleteDoc(doc(db, 'projects', id)); loadProjects(); }; return (