import React, { useEffect, useRef } from 'react'; import { StyleSheet, Dimensions, Text, View, StatusBar, Animated, Easing } from 'react-native'; import { useAppTheme } from '../context/ThemeContext'; import { MaterialCommunityIcons } from '@expo/vector-icons'; import { useAppConfig } from '../context/ConfigContext'; import { Image } from 'expo-image'; const { width, height } = Dimensions.get('window'); interface AnimatedSplashProps { onAnimationComplete: () => void; } export const AnimatedSplash: React.FC = ({ onAnimationComplete }) => { const { isDark, colors } = useAppTheme(); const { config } = useAppConfig(); // Using standard React Native Animated for safety const logoScale = useRef(new Animated.Value(0.5)).current; const logoOpacity = useRef(new Animated.Value(0)).current; const containerOpacity = useRef(new Animated.Value(1)).current; const textOpacity = useRef(new Animated.Value(0)).current; useEffect(() => { // 1. Entry Animation Animated.parallel([ Animated.timing(logoOpacity, { toValue: 1, duration: 1000, useNativeDriver: true }), Animated.timing(logoScale, { toValue: 1, duration: 1200, easing: Easing.out(Easing.back(1.5)), useNativeDriver: true }), Animated.timing(textOpacity, { toValue: 1, duration: 800, delay: 1000, useNativeDriver: true }) ]).start(); // 2. Clear Exit const timer = setTimeout(() => { Animated.timing(containerOpacity, { toValue: 0, duration: 600, useNativeDriver: true }).start(() => { // Delay to ensure the animation frame finishes before state change triggers unmount setTimeout(() => { onAnimationComplete(); }, 100); }); }, 3500); return () => clearTimeout(timer); }, []); return ( ); }; const styles = StyleSheet.create({ container: { ...StyleSheet.absoluteFillObject, justifyContent: 'center', alignItems: 'center', zIndex: 9999, }, centerBox: { alignItems: 'center', }, logoWrapper: { width: 150, height: 150, justifyContent: 'center', alignItems: 'center', }, brandContainer: { flexDirection: 'row', alignItems: 'baseline', marginTop: 35, }, brandAI: { fontSize: 46, fontFamily: 'Outfit_700Bold', letterSpacing: 2, }, textWrapper: { alignItems: 'center', }, taglineBox: { flexDirection: 'row', alignItems: 'center', marginTop: 15, }, line: { width: 25, height: 1, backgroundColor: '#E2E8F0', marginHorizontal: 12, }, tagline: { fontSize: 11, color: '#94A3B8', fontFamily: 'Outfit_700Bold', letterSpacing: 3, } });