import { useState, useEffect, createContext, useRef } from 'react' import { StyleSheet, Animated } from 'react-native' import { Palette, Style } from '../styles' import { Image } from 'expo-image' export const SplashAnimationContext = createContext() const SplashAnimationProvider = ({ children }) => { const [isFullyLoaded, setIsFullyLoaded] = useState(false) const [showOverlay, setShowOverlay] = useState(true) const fadeAnim = useRef(new Animated.Value(1)).current useEffect(() => { if (isFullyLoaded) { Animated.timing(fadeAnim, { toValue: 0, duration: 500, useNativeDriver: true, }).start(() => { setShowOverlay(false) }) } }, [isFullyLoaded]) return ( {children} {showOverlay && ( )} ) } export default SplashAnimationProvider