diff --git a/front/apps/mobile/app/(app)/(tabs)/_layout.tsx b/front/apps/mobile/app/(app)/(tabs)/_layout.tsx
index 64fe9587..641fdf67 100644
--- a/front/apps/mobile/app/(app)/(tabs)/_layout.tsx
+++ b/front/apps/mobile/app/(app)/(tabs)/_layout.tsx
@@ -20,7 +20,6 @@
import { Icon } from "@kyoo/primitives";
import { Tabs } from "expo-router";
-import { useTheme } from "yoshiki/native";
import Home from "@material-symbols/svg-400/rounded/home-fill.svg";
import Browse from "@material-symbols/svg-400/rounded/browse-fill.svg";
diff --git a/front/apps/mobile/app/(app)/_layout.tsx b/front/apps/mobile/app/(app)/_layout.tsx
index 9505499b..d0c5690f 100644
--- a/front/apps/mobile/app/(app)/_layout.tsx
+++ b/front/apps/mobile/app/(app)/_layout.tsx
@@ -19,10 +19,10 @@
*/
import { ConnectionErrorContext, useAccount } from "@kyoo/models";
+import { CircularProgress } from "@kyoo/primitives";
import { NavbarRight, NavbarTitle } from "@kyoo/ui";
-import { LoadingIndicator } from "@kyoo/ui/src/player/components/hover";
-import { Redirect, Stack } from "expo-router";
-import { useContext, useRef } from "react";
+import { Redirect, SplashScreen, Stack } from "expo-router";
+import { useContext, useEffect } from "react";
import { useTheme } from "yoshiki/native";
export default function SignGuard() {
@@ -30,12 +30,12 @@ export default function SignGuard() {
// TODO: support guest accounts on mobile too.
const account = useAccount();
const { loading, error } = useContext(ConnectionErrorContext);
- const wasRendered = useRef(false);
- // While loading, keep the splashcreen if possible. if not, display a spinner.
- if (loading) return wasRendered.current ? : null;
- wasRendered.current = true;
+ useEffect(() => {
+ if (!loading) SplashScreen.hideAsync();
+ }, [loading]);
+ if (loading) return ;
if (error) return ;
if (!account) return ;
return (
diff --git a/front/apps/mobile/app/_layout.tsx b/front/apps/mobile/app/_layout.tsx
index c9c5bcad..29a177d9 100644
--- a/front/apps/mobile/app/_layout.tsx
+++ b/front/apps/mobile/app/_layout.tsx
@@ -34,7 +34,7 @@ import {
Poppins_400Regular,
Poppins_900Black,
} from "@expo-google-fonts/poppins";
-import { ReactNode, useEffect, useState } from "react";
+import { ReactNode, useState } from "react";
import { useColorScheme } from "react-native";
import { initReactI18next } from "react-i18next";
import { ThemeProvider as RNThemeProvider } from "@react-navigation/native";
@@ -61,8 +61,6 @@ i18next.use(initReactI18next).init({
},
});
-SplashScreen.preventAutoHideAsync();
-
const NavigationThemeProvider = ({ children }: { children: ReactNode }) => {
const theme = useTheme();
return (
@@ -84,15 +82,13 @@ const NavigationThemeProvider = ({ children }: { children: ReactNode }) => {
);
};
+SplashScreen.preventAutoHideAsync();
+
export default function Root() {
const [queryClient] = useState(() => createQueryClient());
const theme = useColorScheme();
const [fontsLoaded] = useFonts({ Poppins_300Light, Poppins_400Regular, Poppins_900Black });
- useEffect(() => {
- if (fontsLoaded) SplashScreen.hideAsync();
- }, [fontsLoaded]);
-
if (!fontsLoaded) return null;
return (