| 26 | } |
| 27 | |
| 28 | function AnimatedAppLoader({ children, image }) { |
| 29 | const [isSplashReady, setSplashReady] = useState(false); |
| 30 | |
| 31 | useEffect(() => { |
| 32 | async function prepare() { |
| 33 | await Asset.fromURI(image.uri).downloadAsync(); |
| 34 | setSplashReady(true); |
| 35 | } |
| 36 | |
| 37 | prepare(); |
| 38 | }, [image]); |
| 39 | |
| 40 | if (!isSplashReady) { |
| 41 | return null; |
| 42 | } |
| 43 | |
| 44 | return <AnimatedSplashScreen image={image}>{children}</AnimatedSplashScreen>; |
| 45 | } |
| 46 | |
| 47 | function AnimatedSplashScreen({ children, image }) { |
| 48 | const animation = useMemo(() => new Animated.Value(1), []); |