diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/search/SearchResultCell.tsx | 4 | ||||
-rw-r--r-- | src/components/search/SearchResults.tsx | 34 |
2 files changed, 22 insertions, 16 deletions
diff --git a/src/components/search/SearchResultCell.tsx b/src/components/search/SearchResultCell.tsx index 5cba6d2f..f274bfb9 100644 --- a/src/components/search/SearchResultCell.tsx +++ b/src/components/search/SearchResultCell.tsx @@ -14,11 +14,11 @@ import { } from '../../types'; import {normalize, SCREEN_WIDTH} from '../../utils'; import { - addUserToRecentlyViewed, checkIfUserIsBlocked, defaultUserProfile, fetchUserX, userXInStore, + addUserToRecentlySearched, addCategoryToRecentlySearched, } from '../../utils/users'; @@ -74,7 +74,7 @@ const SearchResultsCell: React.FC<SearchResults> = ({ return; } - addUserToRecentlyViewed({ + addUserToRecentlySearched({ id, first_name, last_name, diff --git a/src/components/search/SearchResults.tsx b/src/components/search/SearchResults.tsx index 277b3454..ef518d8b 100644 --- a/src/components/search/SearchResults.tsx +++ b/src/components/search/SearchResults.tsx @@ -23,20 +23,26 @@ const SearchResults: React.FC<SearchResultsProps> = ({results, categories}) => { const {user: loggedInUser} = useSelector((state: RootState) => state.user); return ( <View> - {categories.map((category: CategoryPreviewType) => ( - <SearchResultsCell - key={category.name} - profileData={category} - {...{loggedInUser}} - /> - ))} - {results.map((profile: ProfilePreviewType) => ( - <SearchResultsCell - key={profile.id} - profileData={profile} - {...{loggedInUser}} - /> - ))} + {categories + .slice(0) + .reverse() + .map((category: CategoryPreviewType) => ( + <SearchResultsCell + key={category.name} + profileData={category} + {...{loggedInUser}} + /> + ))} + {results + .slice(0) + .reverse() + .map((profile: ProfilePreviewType) => ( + <SearchResultsCell + key={profile.id} + profileData={profile} + {...{loggedInUser}} + /> + ))} </View> ); }; |