import React, { useRef, useEffect } from 'react'; import { View, Text, StyleSheet, Animated } from 'react-native'; import Button from '../Button'; import { colors, fonts, spacing, borderRadius } from '../../utils/theme'; import { getResultMessage, getStatLabel } from '../../services/gameService'; export default function GameResult({ gameType, score, details, onSave, onRetry, saving }) { const fadeIn = useRef(new Animated.Value(0)).current; const scaleScore = useRef(new Animated.Value(0)).current; useEffect(() => { Animated.sequence([ Animated.timing(fadeIn, { toValue: 1, duration: 400, useNativeDriver: true }), Animated.spring(scaleScore, { toValue: 1, useNativeDriver: true, speed: 10, bounciness: 12 }), ]).start(); }, []); const message = getResultMessage(gameType, score); const statLabel = getStatLabel(gameType); return ( Challenge Complete Score {score} +{statLabel} {message} {details && ( {details.avgReaction && ( )} {details.rounds && ( )} {details.successes !== undefined && ( )} {details.perfects !== undefined && ( <> )} {details.correct !== undefined && ( )} )}