From 92be7d0b8585d7f1e966cbc8df783e04f2d87a22 Mon Sep 17 00:00:00 2001 From: Aditya Pawar Date: Wed, 17 Apr 2024 21:58:52 -0700 Subject: [PATCH] Implement flatlist --- src/app/(tabs)/library/index.tsx | 112 ++++++++++++++++--------------- 1 file changed, 58 insertions(+), 54 deletions(-) diff --git a/src/app/(tabs)/library/index.tsx b/src/app/(tabs)/library/index.tsx index d456fc6..e8bc738 100644 --- a/src/app/(tabs)/library/index.tsx +++ b/src/app/(tabs)/library/index.tsx @@ -12,6 +12,7 @@ import { fetchUserStoriesFavorites, fetchUserStoriesReadingList, } from '../../../queries/savedStories'; +import { FlatList } from 'react-native-gesture-handler'; function LibraryScreen() { const { user } = useSession(); @@ -83,61 +84,64 @@ function LibraryScreen() { - - - {useMemo(() => { - return ( - favoriteStories.map(story => ( - - router.push({ - pathname: '/story', - params: { storyId: story.id.toString() }, - }) - } - /> - ))) - }, [favoriteStories])} - + + {favoritesSelected && + { + return ( + + + router.push({ + pathname: '/story', + params: { storyId: item.id.toString() }, + }) + } + /> + + ) + }} + /> + } - - {useMemo(() => { - return ( - readingListStories.map(story => ( - - router.push({ - pathname: '/story', - params: { storyId: story.id.toString() }, - }) - } - /> - ))) - }, [favoriteStories])} - - - + {readingSelected && + { + return ( + + + router.push({ + pathname: '/story', + params: { storyId: item.id.toString() }, + }) + } + /> + + ) + }} + /> + } + + ); }