import { Steps } from '@/app/(tabs)/user-message'; import { ThemedText } from '@/components/ThemedText'; import { useState } from 'react'; import { TouchableOpacity, View } from 'react-native'; interface Props { setSteps: (steps: Steps) => void; } type ChoiceOption = { id: string; emoji: string; label: string; description: string; }; export default function Choice({ setSteps }: Props) { const [selectedOption, setSelectedOption] = useState([]); const [isLoading, setIsLoading] = useState(false); const handleContinue = () => { if (!selectedOption) return; setIsLoading(true); // Simulate API call setTimeout(() => { setIsLoading(false); setSteps('done'); }, 500); }; const options: ChoiceOption[] = [ { id: 'wakeup', emoji: '⏰', label: 'Wake Up', description: 'Start your day right with a gentle wake-up' }, { id: 'sleep', emoji: '😴', label: 'Sleep', description: 'Drift off with calming sounds' }, { id: 'focus', emoji: '🎯', label: 'Focus', description: 'Enhance your concentration' }, { id: 'relax', emoji: '🧘', label: 'Relax', description: 'Unwind and de-stress' }, { id: 'relax1', emoji: '🧘', label: 'Relax1', description: 'Unwind and de-stress' }, { id: 'relax11', emoji: '🧘', label: 'Relax11', description: 'Unwind and de-stress' }, ]; return ( {/* Fixed Header */} Every memory matters. Select a few to help Memo create better video capsules for you {/* Scrollable Content */} {options.map((option) => ( { // 如果存在则删除,没有则添加,多选 if (selectedOption.includes(option.id)) { // 剔除 setSelectedOption((prev) => prev.filter((id) => id !== option.id)); } else { // 添加 setSelectedOption((prev) => ([...prev, option.id])); } }} > {option.label} ))} {/* Next Button */} Next ); }