From 8288682e6813a5616e84f05f013dbaacb8a34bbd Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Sun, 5 Jan 2025 23:28:24 +0100 Subject: [PATCH] feat: intro screen --- app/(auth)/(tabs)/(home)/intro/page.tsx | 5 ++--- app/(auth)/(tabs)/(home)/settings.tsx | 7 +++++++ app/(auth)/(tabs)/_layout.tsx | 10 +++------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/(auth)/(tabs)/(home)/intro/page.tsx b/app/(auth)/(tabs)/(home)/intro/page.tsx index 9dbf5dc3..cef9db31 100644 --- a/app/(auth)/(tabs)/(home)/intro/page.tsx +++ b/app/(auth)/(tabs)/(home)/intro/page.tsx @@ -30,9 +30,8 @@ export default function page() { Features - Streamyfin has a bunch of features and integrates with a - wide array of software which you can find in the settings menu, these - include: + Streamyfin has a bunch of features and integrates with a wide array of + software which you can find in the settings menu, these include: + { + storage.set("hasShownIntro", false); + }} + title={"Reset intro"} + /> diff --git a/app/(auth)/(tabs)/_layout.tsx b/app/(auth)/(tabs)/_layout.tsx index 1b0e0617..be8f24b0 100644 --- a/app/(auth)/(tabs)/_layout.tsx +++ b/app/(auth)/(tabs)/_layout.tsx @@ -13,14 +13,13 @@ const { Navigator } = createNativeBottomTabNavigator(); import { BottomTabNavigationOptions } from "@react-navigation/bottom-tabs"; import { Colors } from "@/constants/Colors"; +import { useSettings } from "@/utils/atoms/settings"; +import { storage } from "@/utils/mmkv"; import type { ParamListBase, TabNavigationState, } from "@react-navigation/native"; import { SystemBars } from "react-native-edge-to-edge"; -import { useSettings } from "@/utils/atoms/settings"; -import { useAtom, useAtomValue } from "jotai"; -import { storage } from "@/utils/mmkv"; export const NativeTabs = withLayoutContext< BottomTabNavigationOptions, @@ -32,16 +31,13 @@ export const NativeTabs = withLayoutContext< export default function TabLayout() { const [settings] = useSettings(); const router = useRouter(); - const hasNavigated = useRef(false); useFocusEffect( useCallback(() => { const hasShownIntro = storage.getBoolean("hasShownIntro"); - if (hasShownIntro === false && !hasNavigated.current) { + if (!hasShownIntro) { const timer = setTimeout(() => { - hasNavigated.current = true; router.push("/intro/page"); - storage.set("hasShownIntro", true); }, 1000); return () => {