import React from 'react'; import { View, StyleSheet, FlatList } from 'react-native'; import { useNavigation } from '@react-navigation/native'; import { StackNavigationProp } from '@react-navigation/stack'; import { useTasks } from '../context/TasksContext'; import TaskCard from '../components/TaskCard'; type RootStackParamList = { TaskList: undefined; TaskEdit: { taskId: string }; }; type TaskListNavigationProp = StackNavigationProp< RootStackParamList, 'TaskList' >; export default function TaskListScreen() { const { tasks } = useTasks(); const navigation = useNavigation(); const handlePressTask = (id: string) => { navigation.navigate('TaskEdit', { taskId: id }); }; const renderItem = ({ item }: { item: (typeof tasks)[0] }) => ( ); return ( item.id} ItemSeparatorComponent={() => } /> ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#1a1a1a', // 深色背景 }, separator: { height: 1, backgroundColor: '#333', // 分隔线颜色 marginLeft: 16, }, });