Skip to content

Commit 10b70c2

Browse files
committed
feat: Hide the splash screen after the navigation is rendered.
1 parent 487022b commit 10b70c2

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

.changeset/five-cows-talk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"xlog": patch
3+
---
4+
5+
Hide the splash screen after the navigation is rendered.

src/navigation/root.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import React from "react";
1+
import React, { useEffect } from "react";
22
import { useTranslation } from "react-i18next";
33
import { useSafeAreaInsets } from "react-native-safe-area-context";
44

55
import { HeaderBackButton } from "@react-navigation/elements";
66
import { createNativeStackNavigator } from "@react-navigation/native-stack";
7+
import * as SplashScreen from "expo-splash-screen";
78

89
import { CharacterListPage } from "@/pages/CharacterList";
910
import { ClaimCSBPage } from "@/pages/ClaimCSB";
@@ -34,6 +35,10 @@ export const RootNavigator = () => {
3435
const { bottom } = useSafeAreaInsets();
3536
const i18n = useTranslation("common");
3637

38+
useEffect(() => {
39+
SplashScreen.hideAsync();
40+
}, []);
41+
3742
return (
3843
<RootStack.Navigator initialRouteName="Home">
3944
{/* Without header */}

src/providers/preload-provider.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { type FC, type PropsWithChildren, useEffect } from "react";
22

33
import { useFonts } from "expo-font";
4-
import * as SplashScreen from "expo-splash-screen";
54

65
export const PreloadProvider: FC<PropsWithChildren<{}>> = ({ children }) => {
76
const [fontsLoadingReady] = useFonts({
@@ -13,12 +12,6 @@ export const PreloadProvider: FC<PropsWithChildren<{}>> = ({ children }) => {
1312

1413
const allReady = fontsLoadingReady;
1514

16-
useEffect(() => {
17-
if (allReady) {
18-
SplashScreen.hideAsync();
19-
}
20-
}, [allReady]);
21-
2215
if (!allReady)
2316
return null;
2417

0 commit comments

Comments
 (0)