import React from 'react'; import { ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; import { Ionicons } from '@expo/vector-icons'; import { useColors } from '../constants/Colors'; type ColorsType = ReturnType; export type QuestionOption = { id: string; emoji: string; label: string; subtitle?: string }; type Props = { colors: ColorsType; isDarkMode: boolean; step: number; // 1-based totalSteps: number; title: string; subtitle: string; options: QuestionOption[]; selectedId: string | null; onSelect: (id: string) => void; onContinue: () => void; onBack?: () => void; continueLabel: string; skipLabel?: string; onSkip?: () => void; }; export function OnboardingQuestion({ colors, isDarkMode, step, totalSteps, title, subtitle, options, selectedId, onSelect, onContinue, onBack, continueLabel, skipLabel, onSkip, }: Props) { return ( {onBack ? ( ) : } {/* Scrollbar statt fixem Block: bei grosser Systemschriftgroesse wuchsen Titel und Karten frueher ueber den Footer und haben den CTA verdeckt. */} {title} {subtitle} {options.map((option) => { const active = selectedId === option.id; return ( onSelect(option.id)} activeOpacity={0.85} style={[styles.card, { backgroundColor: active ? colors.primarySoft : colors.surface, borderColor: active ? colors.primary : 'transparent', }]} > {option.emoji} {option.label} {option.subtitle ? {option.subtitle} : null} ); })} {skipLabel && onSkip ? ( {skipLabel} ) : null} {continueLabel} ); } const styles = StyleSheet.create({ safe: { flex: 1, paddingHorizontal: 22 }, topBar: { flexDirection: 'row', alignItems: 'center', gap: 14, paddingVertical: 10 }, backBtn: { width: 40, height: 40, borderRadius: 20, alignItems: 'center', justifyContent: 'center' }, progressTrack: { flex: 1, height: 6, borderRadius: 3, overflow: 'hidden' }, progressFill: { height: 6, borderRadius: 3 }, title: { fontSize: 30, lineHeight: 35, fontWeight: '900', textAlign: 'center', marginTop: 18, marginBottom: 8 }, subtitle: { fontSize: 15, lineHeight: 20, textAlign: 'center', marginBottom: 22 }, optionsScroll: { flex: 1 }, options: { gap: 12, paddingBottom: 12 }, card: { flexDirection: 'row', alignItems: 'center', gap: 14, borderRadius: 16, borderWidth: 2, paddingHorizontal: 16, paddingVertical: 18 }, emoji: { fontSize: 26 }, cardCopy: { flex: 1, gap: 2 }, cardLabel: { fontSize: 17, fontWeight: '800' }, cardSubtitle: { fontSize: 12.5, lineHeight: 16 }, footer: { gap: 8, paddingBottom: 6 }, skipBtn: { alignItems: 'center', paddingVertical: 6 }, skipText: { fontSize: 14, fontWeight: '700' }, cta: { minHeight: 56, paddingVertical: 16, borderRadius: 14, alignItems: 'center', justifyContent: 'center' }, ctaText: { fontSize: 17, fontWeight: '800' }, });