This commit is contained in:
Philip Cesar Garay
2025-07-31 21:25:33 +08:00
parent 5cfbc81e3a
commit 84fc719a10
307 changed files with 46470 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
import { useState, useEffect, createContext, useRef } from "react";
import { StyleSheet, Text, Animated } from "react-native";
import { Fonts, Palette, Style } from "../styles";
import { isWeb } from "../hooks/useLayoutType";
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 (
<SplashAnimationContext.Provider
value={{ isFullyLoaded, setIsFullyLoaded }}
>
{children}
{showOverlay && (
<Animated.View
style={{
...StyleSheet.absoluteFillObject,
flex: 1,
...Style.containerCenter,
backgroundColor: Palette.darkPurple,
opacity: fadeAnim,
}}
>
{isWeb && <Text style={Fonts({ type: "megaTitle" })}>m</Text>}
</Animated.View>
)}
</SplashAnimationContext.Provider>
);
};
export default SplashAnimationProvider;