import React from 'react'; import { View, StyleSheet, TouchableOpacity, ScrollView, Dimensions } from 'react-native'; import { OnboardingColors } from '@/constants/OnboardingTheme'; import { SerifText } from './SerifText'; import SelectedIcon from '@/assets/images/icon/selected_icon.svg'; import BtnNotClicked from '@/assets/images/icon/btn_Notclicked.svg'; import BtnClicked from '@/assets/images/icon/btn_clicked.svg'; const { height } = Dimensions.get('window'); interface Option { id: string; label: string; } interface SelectionStepProps { options: Option[]; selectedIds: string[]; onToggle: (id: string) => void; onNext: () => void; } export function SelectionStep({ options, selectedIds, onToggle, onNext }: SelectionStepProps) { const hasSelection = selectedIds.length > 0; return ( {options.map((option) => { const isSelected = selectedIds.includes(option.id); return ( onToggle(option.id)} activeOpacity={0.7} > {option.label} {isSelected && ( )} ); })} {/* 底部按钮:距离底部 12% 高度 */} {hasSelection ? : } ); } const styles = StyleSheet.create({ container: { flex: 1, paddingTop: 20, }, optionsList: { paddingBottom: 150, // 为底部按钮留出空间 }, optionCard: { width: '100%', height: 75, backgroundColor: OnboardingColors.cardBackground, borderRadius: 20, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 24, marginBottom: 12, shadowColor: '#000', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.05, shadowRadius: 10, elevation: 2, }, optionText: { fontSize: 18, color: OnboardingColors.textPrimary, fontWeight: '500', flex: 1, }, iconWrapper: { marginLeft: 10, }, footer: { position: 'absolute', bottom: height * 0.12, left: 0, right: 0, alignItems: 'center', } });