From f3c2366f37b8261d211543fbd43185b8451479c9 Mon Sep 17 00:00:00 2001 From: Master Date: Thu, 18 Jan 2024 20:06:59 +0500 Subject: [PATCH 1/5] fix: virtualized list error on profile --- .../app/components/feed/FeedSearchFilter.tsx | 13 +- packages/app/components/pack/PackDetails.tsx | 8 +- .../app/components/user/UserDataContainer.tsx | 14 +- .../app/screens/user/ProfileContainer.tsx | 141 +++++++++--------- 4 files changed, 92 insertions(+), 84 deletions(-) diff --git a/packages/app/components/feed/FeedSearchFilter.tsx b/packages/app/components/feed/FeedSearchFilter.tsx index 284a25882..60a130983 100644 --- a/packages/app/components/feed/FeedSearchFilter.tsx +++ b/packages/app/components/feed/FeedSearchFilter.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import useTheme from '../../hooks/useTheme'; import useCustomStyles from 'app/hooks/useCustomStyles'; import { Switch } from 'tamagui'; @@ -38,7 +38,7 @@ const FeedSearchFilter = ({ }) => { const { currentTheme } = useTheme(); const styles = useCustomStyles(loadStyles); - const debouncedSearch = debounce((query) => setSearchQuery(query), 500); + const [search, setSearch] = useState("") return ( @@ -49,8 +49,13 @@ const FeedSearchFilter = ({ { + setSearch(value) + debounce(() => { + setSearchQuery(value) + }, 500) + }} + value={search} /> - + {differentUser ? // ? `${userId}'s ${typeUppercase}` - `${typeUppercase}` + `${typeUppercase}` : `Your ${typeUppercase}`} // )) // ) - data.length} + nestedScrollEnabled={true} data={data} + getItem={(item, index) => ({...item, key: index})} renderItem={({ item, index }) => ( item._id} maxToRenderPerBatch={2} - // Other FlatList props like onEndReached for infinite scrolling + // Other FlatList props like onEndReached for infinite scrolling /> ) : currentUser?._id === userId ? ( diff --git a/packages/app/screens/user/ProfileContainer.tsx b/packages/app/screens/user/ProfileContainer.tsx index 3ad0c4bf1..6802efd99 100644 --- a/packages/app/screens/user/ProfileContainer.tsx +++ b/packages/app/screens/user/ProfileContainer.tsx @@ -1,6 +1,7 @@ import React, { useEffect, useState } from 'react'; -import { Platform, StyleSheet, ScrollView, View } from 'react-native'; +import { Platform, View } from 'react-native'; import { RIconButton, RStack, RText, RSkeleton } from '@packrat/ui'; +import { ScrollView } from 'react-native-gesture-handler'; import UserDataContainer from '../../components/user/UserDataContainer'; import useTheme from '../../hooks/useTheme'; import { MaterialCommunityIcons } from '@expo/vector-icons'; @@ -56,7 +57,7 @@ const Header = ({ : `@${userEmailSplitFirstHalf}`; return ( - + @@ -187,74 +188,78 @@ export default function ProfileContainer({ id = null }) { } = useProfile(id); return ( - - -
- - - {isLoading && ( - - )} - + + + + +
+ + + {isLoading && ( + + )} + - - {favoritesList.length > 0 ? ( - - ) : ( - - No favorites yet - - )} - - {packsList.length > 0 && ( - - + + {favoritesList.length > 0 ? ( + + ) : ( + + No favorites yet + + )} + + {packsList.length > 0 && ( + + + + )} + {tripsList.length > 0 && ( + + + + )} - )} - {tripsList.length > 0 && ( - - - - )} - - - + + + + ); } From 283df490078d3d566f0997e87c37aed07214852b Mon Sep 17 00:00:00 2001 From: Andrew Bierman <94939237+andrew-bierman@users.noreply.github.com> Date: Sat, 10 Feb 2024 17:24:14 -0500 Subject: [PATCH 2/5] quick fix on pack details error --- packages/app/components/pack/PackDetails.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/app/components/pack/PackDetails.tsx b/packages/app/components/pack/PackDetails.tsx index ad992eacc..c242bb643 100644 --- a/packages/app/components/pack/PackDetails.tsx +++ b/packages/app/components/pack/PackDetails.tsx @@ -20,7 +20,7 @@ import { useUserPacks } from 'app/hooks/packs/useUserPacks'; import { useFetchSinglePack } from '../../hooks/packs'; import { useAuthUser } from 'app/auth/hooks'; -const { useParam, useParams } = createParam() +const { useParam } = createParam(); export function PackDetails() { const searchParams = new URLSearchParams(this.location.search); @@ -79,7 +79,7 @@ export function PackDetails() { error={error} additionalComps={ <> - + Date: Sat, 10 Feb 2024 17:48:27 -0500 Subject: [PATCH 3/5] removing commented code --- packages/app/components/pack/PackDetails.tsx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/app/components/pack/PackDetails.tsx b/packages/app/components/pack/PackDetails.tsx index c242bb643..3943d6ebb 100644 --- a/packages/app/components/pack/PackDetails.tsx +++ b/packages/app/components/pack/PackDetails.tsx @@ -43,14 +43,6 @@ export function PackDetails() { refetch: refetchQuery, } = useFetchSinglePack(packId); - // useEffect(() => { - // if (!packId) return; - // dispatch(fetchSinglePack(packId)); - - // // if (userId) dispatch(fetchUserPacks({ ownerId: userId })); - // setFirstLoad(false); - // }, [dispatch, packId, updated]); // TODO updated is a temporary fix to re-render when pack is update, due to bug in store - const styles = useCustomStyles(loadStyles); const currentPackId = currentPack && currentPack._id; @@ -59,7 +51,7 @@ export function PackDetails() { const isError = error !== null; - if (isLoading && firstLoad) return Loading...; + if (isLoading) return Loading...; return ( Date: Sat, 10 Feb 2024 18:07:13 -0500 Subject: [PATCH 4/5] setting next js port to not conflict with node server --- apps/next/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/next/package.json b/apps/next/package.json index ee358c16a..e9c990161 100644 --- a/apps/next/package.json +++ b/apps/next/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev", + "dev": "next dev -p 4000", "build": "next build", "start": "next start", "lint": "next lint", From fa3f46dfa3c9f2e2f6ff0bdd2b439c372d8c8764 Mon Sep 17 00:00:00 2001 From: Andrew Bierman <94939237+andrew-bierman@users.noreply.github.com> Date: Sat, 10 Feb 2024 18:07:25 -0500 Subject: [PATCH 5/5] linting --- packages/app/components/feed/FeedSearchFilter.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/app/components/feed/FeedSearchFilter.tsx b/packages/app/components/feed/FeedSearchFilter.tsx index 60a130983..93394f0e2 100644 --- a/packages/app/components/feed/FeedSearchFilter.tsx +++ b/packages/app/components/feed/FeedSearchFilter.tsx @@ -38,7 +38,7 @@ const FeedSearchFilter = ({ }) => { const { currentTheme } = useTheme(); const styles = useCustomStyles(loadStyles); - const [search, setSearch] = useState("") + const [search, setSearch] = useState(''); return ( @@ -50,10 +50,10 @@ const FeedSearchFilter = ({ size="$30" placeholder={`Search ${feedType || 'Feed'}`} onChangeText={(value) => { - setSearch(value) + setSearch(value); debounce(() => { - setSearchQuery(value) - }, 500) + setSearchQuery(value); + }, 500); }} value={search} /> @@ -139,7 +139,12 @@ const FeedSearchFilter = ({ Create )} - + ); };