import React, { useEffect } from 'react'; import { StyleSheet, View, Text } from 'react-native'; import Animated, { useAnimatedStyle, useSharedValue, withTiming, withSpring, Easing, runOnJS, withDelay, } from 'react-native-reanimated'; import { Colors } from '@/constants/theme'; import { LinearGradient } from 'expo-linear-gradient'; interface Props { isAppReady: boolean; onAnimationComplete: () => void; } export function AnimatedSplashScreen({ isAppReady, onAnimationComplete }: Props) { const opacity = useSharedValue(1); const scale = useSharedValue(1); const textOpacity = useSharedValue(0); const textTranslateY = useSharedValue(20); const logoScale = useSharedValue(0.8); useEffect(() => { textOpacity.value = withTiming(1, { duration: 1000 }); textTranslateY.value = withSpring(0, { damping: 14, stiffness: 100 }); logoScale.value = withSpring(1, { damping: 10, stiffness: 100 }); }, []); useEffect(() => { if (isAppReady) { opacity.value = withDelay( 600, withTiming(0, { duration: 700, easing: Easing.inOut(Easing.ease) }, (finished) => { if (finished) { runOnJS(onAnimationComplete)(); } }) ); scale.value = withDelay( 600, withTiming(1.3, { duration: 700, easing: Easing.inOut(Easing.ease) }) ); } }, [isAppReady]); const animatedContainerStyle = useAnimatedStyle(() => ({ opacity: opacity.value, transform: [{ scale: scale.value }], })); const animatedTextStyle = useAnimatedStyle(() => ({ opacity: textOpacity.value, transform: [ { translateY: textTranslateY.value }, { scale: logoScale.value } ], })); return ( YABA Finanças Pessoais ); } const styles = StyleSheet.create({ container: { ...StyleSheet.absoluteFill, justifyContent: 'center', alignItems: 'center', zIndex: 9999, }, logoText: { fontFamily: 'Outfit_700Bold', fontSize: 72, color: Colors.white, letterSpacing: -2, textAlign: 'center', }, subText: { fontFamily: 'DMSans_500Medium', fontSize: 16, color: Colors.primaryLight, letterSpacing: 2, textTransform: 'uppercase', textAlign: 'center', marginTop: 8, } });