import { Colors } from '@/constants/Colors'; import { useColorScheme } from '@/hooks/useColorScheme'; import React, { useRef } from 'react'; import { Dimensions, ScrollView, StyleSheet, Text, View } from 'react-native'; import { TodoCard, TodoItem } from './TodoCard'; interface TodoCarouselProps { todos: TodoItem[]; onTodoPress?: (item: TodoItem) => void; onToggleComplete?: (item: TodoItem) => void; } const { width: screenWidth } = Dimensions.get('window'); export function TodoCarousel({ todos, onTodoPress, onToggleComplete }: TodoCarouselProps) { const theme = useColorScheme() ?? 'light'; const colorTokens = Colors[theme]; const scrollViewRef = useRef(null); if (!todos || todos.length === 0) { return ( 今天暂无待办事项 ); } return ( {todos.map((item, index) => ( ))} {/* 占位符,确保最后一张卡片有足够的滑动空间 */} {/* 底部指示器 */} {/* {todos.map((_, index) => ( ))} */} ); } const styles = StyleSheet.create({ container: { }, scrollView: { }, scrollContent: { paddingHorizontal: 20, alignItems: 'center', }, emptyContainer: { height: 140, justifyContent: 'center', alignItems: 'center', marginHorizontal: 20, borderRadius: 20, borderWidth: 1, borderColor: '#E5E7EB', borderStyle: 'dashed', }, emptyText: { fontSize: 14, fontWeight: '500', }, indicatorContainer: { flexDirection: 'row', justifyContent: 'center', alignItems: 'center', gap: 6, }, indicator: { width: 6, height: 6, borderRadius: 3, }, });