-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
47 lines (39 loc) · 1.1 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { useEffect, useState } from "react";
import { View, Image } from "react-native";
import * as Fonts from "expo-font";
import { StatusBar } from "expo-status-bar";
import * as SplashScreen from "expo-splash-screen";
import { BackgroundColor, Font, Images } from "./src/common/Const";
import GameScreen from "./src/screens/GameScreen";
import Utils from "./src/common/Utils";
const App = () => {
const [isFontLoaded, setIsFontLoaded] = useState(false);
useEffect(() => {
(async () => {
await SplashScreen.preventAutoHideAsync();
await Fonts.loadAsync({
[Font.FontName]: Font.FontFile,
});
await Utils.Sleep(2);
setIsFontLoaded(true);
await SplashScreen.hideAsync();
})();
}, []);
if (!isFontLoaded)
return (
<View style={{ flex: 1, backgroundColor: BackgroundColor }}>
<Image
source={Images.Splash}
style={{ height: "100%", width: "100%" }}
resizeMode={"contain"}
/>
</View>
);
return (
<>
<GameScreen />
<StatusBar style="light" />
</>
);
};
export default App;