From 5a680a439271f6f48c2d5977d5d4898ac7d8b788 Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Sat, 21 Dec 2024 12:45:32 +0100 Subject: [PATCH] fix: smoother item page loading --- .../(home,libraries,search)/items/page.tsx | 57 +++++++++++-------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/app/(auth)/(tabs)/(home,libraries,search)/items/page.tsx b/app/(auth)/(tabs)/(home,libraries,search)/items/page.tsx index 8caf07c6..38b0115d 100644 --- a/app/(auth)/(tabs)/(home,libraries,search)/items/page.tsx +++ b/app/(auth)/(tabs)/(home,libraries,search)/items/page.tsx @@ -1,11 +1,7 @@ import { Text } from "@/components/common/Text"; import { ItemContent } from "@/components/ItemContent"; import { apiAtom, userAtom } from "@/providers/JellyfinProvider"; -import { getUserItemData } from "@/utils/jellyfin/user-library/getUserItemData"; -import { - getMediaInfoApi, - getUserLibraryApi, -} from "@jellyfin/sdk/lib/utils/api"; +import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api"; import { useQuery } from "@tanstack/react-query"; import { useLocalSearchParams } from "expo-router"; import { useAtom } from "jotai"; @@ -48,20 +44,25 @@ const Page: React.FC = () => { }); const fadeOut = (callback: any) => { - opacity.value = withTiming(0, { duration: 300 }, (finished) => { - if (finished) { - runOnJS(callback)(); - } - }); + setTimeout(() => { + opacity.value = withTiming(0, { duration: 500 }, (finished) => { + if (finished) { + runOnJS(callback)(); + } + }); + }, 100); }; const fadeIn = (callback: any) => { - opacity.value = withTiming(1, { duration: 300 }, (finished) => { - if (finished) { - runOnJS(callback)(); - } - }); + setTimeout(() => { + opacity.value = withTiming(1, { duration: 500 }, (finished) => { + if (finished) { + runOnJS(callback)(); + } + }); + }, 100); }; + useEffect(() => { if (item) { fadeOut(() => {}); @@ -84,14 +85,24 @@ const Page: React.FC = () => { style={[animatedStyle]} className="absolute top-0 left-0 flex flex-col items-start h-screen w-screen px-4 z-50 bg-black" > - - - - - - - - + + + + + + + + + + + + + {item && }