import React, { useState, useEffect } from 'react'; import { StyleSheet } from 'react-native'; import { Video, ResizeMode } from 'expo-av'; import * as SplashScreen from 'expo-splash-screen'; import Animated, { FadeOut } from 'react-native-reanimated'; import { useApp } from '../context/AppContext'; import { useColors } from '../constants/Colors'; interface Props { isAppReady: boolean; onAnimationComplete: () => void; } export function AnimatedSplashScreen({ isAppReady, onAnimationComplete }: Props) { const [hasPlayedEnough, setHasPlayedEnough] = useState(false); useEffect(() => { // Ensure the video plays for at least 2 seconds before we allow it to finish, // so it doesn't flash too fast and provides a premium feel. const timer = setTimeout(() => { setHasPlayedEnough(true); }, 2000); return () => clearTimeout(timer); }, []); useEffect(() => { if (isAppReady && hasPlayedEnough) { onAnimationComplete(); } }, [isAppReady, hasPlayedEnough, onAnimationComplete]); // Determine the background color to blend perfectly const { isDarkMode, colorPalette } = useApp(); const colors = useColors(isDarkMode, colorPalette); return ( ); }