npx expo install expo-splash-screen
SplashScreen.preventAutoHideAsync(); // splashscreen 실행시키는 함수
useEffect(() => {
setTimeout(() => {
SplashScreen.hideAsync(); // 제거하는 함수
}, 2000);
}, []);
const [isLoaded, setIsLoaded] = useState(false);
useEffect(() => {
if (locale !== null && cookieKey !== "") {
setIsLoaded(true);
}
}, []);
useEffect(() => {
if (isLoaded) {
SplashScreen.hideAsync();
}
}, [isLoaded]);
const LoadingView = () => {
return (
<View style={{ flex: 1, backgroundColor: "lightblue" }}>
<LottieView
// ref={ref}
autoPlay
style={{ width: 150 }}
source={require("../assets/loading.json")} // https://lottiefiles.com/97111-loading-spinner-dots
/>
</View>
);
};
export default LoadingView;
npm install react-string-format
import { format } from "react-string-format";
const y = new Date().getFullYear();
const m = new Date().getMonth() + 1;
const d = new Date().getDate();
const todayText = format(t("today_is"), y, m, d);
<LottieView
autoPlay={true}
source={require("./assets/background.json")}
resizeMode="cover"
style={{
width: 850,
height: 850,
position: "absolute",
zIndex: -1,
}}
/>
import { useFonts } from "expo-font";
const [fontsLoaded] = useFonts({
RIDIBatang: require("./assets/fonts/RIDIBatang.otf"),
});
fontFamily: "RIDIBatang",