From fdc53eee79fdb5033b9ab46e6969917f6cd59bb0 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sun, 1 Feb 2026 15:59:11 +0000 Subject: fix(mobile): fix some mobile warning after expo 54 upgrade --- apps/mobile/app/_layout.tsx | 13 ++++++++++--- apps/mobile/app/dashboard/(tabs)/highlights.tsx | 2 +- apps/mobile/app/dashboard/(tabs)/index.tsx | 2 +- apps/mobile/app/dashboard/(tabs)/lists.tsx | 2 +- apps/mobile/app/dashboard/(tabs)/settings.tsx | 2 +- apps/mobile/app/dashboard/(tabs)/tags.tsx | 2 +- apps/mobile/components/SplashScreenController.tsx | 14 ++++++++++++++ apps/mobile/components/navigation/stack.tsx | 7 +++++-- apps/mobile/components/ui/CustomSafeAreaView.tsx | 17 ++++++----------- apps/mobile/lib/settings.ts | 7 +++++++ apps/mobile/lib/useColorScheme.tsx | 12 +++--------- 11 files changed, 50 insertions(+), 30 deletions(-) create mode 100644 apps/mobile/components/SplashScreenController.tsx (limited to 'apps/mobile') diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsx index 3f9e5575..ab0f9c52 100644 --- a/apps/mobile/app/_layout.tsx +++ b/apps/mobile/app/_layout.tsx @@ -2,13 +2,16 @@ import "@/globals.css"; import "expo-dev-client"; import { useEffect } from "react"; +import { Platform } from "react-native"; import { GestureHandlerRootView } from "react-native-gesture-handler"; import { KeyboardProvider } from "react-native-keyboard-controller"; +import { SafeAreaProvider } from "react-native-safe-area-context"; import { useRouter } from "expo-router"; import { Stack } from "expo-router/stack"; import { ShareIntentProvider, useShareIntent } from "expo-share-intent"; import { StatusBar } from "expo-status-bar"; import { StyledStack } from "@/components/navigation/stack"; +import SplashScreenController from "@/components/SplashScreenController"; import { Providers } from "@/lib/providers"; import { useColorScheme, useInitialAndroidBarSync } from "@/lib/useColorScheme"; import { cn } from "@/lib/utils"; @@ -30,9 +33,13 @@ export default function RootLayout() { }, [hasShareIntent]); return ( - <> - + + + { return ( @@ -86,6 +93,6 @@ export default function RootLayout() { key={`root-status-bar-${isDarkColorScheme ? "light" : "dark"}`} style={isDarkColorScheme ? "light" : "dark"} /> - + ); } diff --git a/apps/mobile/app/dashboard/(tabs)/highlights.tsx b/apps/mobile/app/dashboard/(tabs)/highlights.tsx index 8a0a8ae3..8d6e37a4 100644 --- a/apps/mobile/app/dashboard/(tabs)/highlights.tsx +++ b/apps/mobile/app/dashboard/(tabs)/highlights.tsx @@ -42,7 +42,7 @@ export default function Highlights() { }; return ( - + p.highlights)} header={ diff --git a/apps/mobile/app/dashboard/(tabs)/index.tsx b/apps/mobile/app/dashboard/(tabs)/index.tsx index 0a51b817..3e49e6f2 100644 --- a/apps/mobile/app/dashboard/(tabs)/index.tsx +++ b/apps/mobile/app/dashboard/(tabs)/index.tsx @@ -76,7 +76,7 @@ function HeaderRight({ export default function Home() { return ( - + + + + ; diff --git a/apps/mobile/components/ui/CustomSafeAreaView.tsx b/apps/mobile/components/ui/CustomSafeAreaView.tsx index 840ea058..33c9a765 100644 --- a/apps/mobile/components/ui/CustomSafeAreaView.tsx +++ b/apps/mobile/components/ui/CustomSafeAreaView.tsx @@ -1,5 +1,4 @@ -import { Platform, SafeAreaView } from "react-native"; -import { useSafeAreaInsets } from "react-native-safe-area-context"; +import { SafeAreaView } from "react-native-safe-area-context"; import { useHeaderHeight } from "@react-navigation/elements"; export default function CustomSafeAreaView({ @@ -9,21 +8,17 @@ export default function CustomSafeAreaView({ children: React.ReactNode; edges?: ("top" | "bottom")[]; }) { - const insets = useSafeAreaInsets(); const headerHeight = useHeaderHeight(); return ( 0 - ? headerHeight - : insets.top - : undefined, - paddingBottom: edges.includes("bottom") ? insets.bottom : undefined, + paddingTop: edges.includes("top") + ? headerHeight > 0 + ? headerHeight + : undefined + : undefined, }} > {children} diff --git a/apps/mobile/lib/settings.ts b/apps/mobile/lib/settings.ts index 745c778d..8da1d33d 100644 --- a/apps/mobile/lib/settings.ts +++ b/apps/mobile/lib/settings.ts @@ -1,3 +1,4 @@ +import { useEffect } from "react"; import * as SecureStore from "expo-secure-store"; import { z } from "zod"; import { create } from "zustand"; @@ -77,6 +78,12 @@ const useSettings = create((set, get) => ({ export default function useAppSettings() { const { settings, setSettings, load } = useSettings(); + useEffect(() => { + if (settings.isLoading) { + load(); + } + }, [load, settings.isLoading]); + return { ...settings, setSettings, load }; } diff --git a/apps/mobile/lib/useColorScheme.tsx b/apps/mobile/lib/useColorScheme.tsx index a00a445d..40e7ad53 100644 --- a/apps/mobile/lib/useColorScheme.tsx +++ b/apps/mobile/lib/useColorScheme.tsx @@ -46,13 +46,7 @@ function useInitialAndroidBarSync() { export { useColorScheme, useInitialAndroidBarSync }; function setNavigationBar(colorScheme: "light" | "dark") { - return Promise.all([ - NavigationBar.setButtonStyleAsync( - colorScheme === "dark" ? "light" : "dark", - ), - NavigationBar.setPositionAsync("absolute"), - NavigationBar.setBackgroundColorAsync( - colorScheme === "dark" ? "#00000030" : "#ffffff80", - ), - ]); + return NavigationBar.setButtonStyleAsync( + colorScheme === "dark" ? "light" : "dark", + ); } -- cgit v1.2.3-70-g09d2