diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/search/SearchResultCell.tsx | 3 | ||||
-rw-r--r-- | src/components/search/SearchResultList.tsx | 20 |
2 files changed, 17 insertions, 6 deletions
diff --git a/src/components/search/SearchResultCell.tsx b/src/components/search/SearchResultCell.tsx index 0f6f5b7d..b6ce55d0 100644 --- a/src/components/search/SearchResultCell.tsx +++ b/src/components/search/SearchResultCell.tsx @@ -17,11 +17,13 @@ import { } from '../../utils/users'; interface SearchResults { + type: 'badges' | 'categories' | 'users'; profileData: ProfilePreviewType; loggedInUser: UserType; } const SearchResultsCell: React.FC<SearchResults> = ({ + type, profileData: { id, name, @@ -133,6 +135,7 @@ const SearchResultsCell: React.FC<SearchResults> = ({ style={styles.cellContainer} onPress={() => navigation.navigate('DiscoverUsers', { + type, searchCategory: {id, name}, }) }> diff --git a/src/components/search/SearchResultList.tsx b/src/components/search/SearchResultList.tsx index 14d5de6d..32caa764 100644 --- a/src/components/search/SearchResultList.tsx +++ b/src/components/search/SearchResultList.tsx @@ -53,14 +53,22 @@ const SearchResultList: React.FC<SearchResultsProps> = ({ contentContainerStyle={{paddingBottom: SCREEN_HEIGHT * 0.1}} sections={results} keyExtractor={(item, index) => item.id + index} - renderItem={({item}) => ( - <SearchResultsCell profileData={item} loggedInUser={loggedInUser} /> - )} + renderItem={({section, item}) => { + return ( + <SearchResultsCell + type={section.title} + profileData={item} + loggedInUser={loggedInUser} + /> + ); + }} renderSectionHeader={({section: {title, data}}) => { - if (title === 'categories' && data.length === 0) { + if (['categories', 'badges'].includes(title) && data.length === 0) { setShowSection(false); } - return sectionHeader(title !== 'categories' && showSection); + return sectionHeader( + ['users', 'categories'].includes(title) && showSection, + ); }} /> )} @@ -71,7 +79,7 @@ const SearchResultList: React.FC<SearchResultsProps> = ({ const styles = StyleSheet.create({ container: { marginTop: SCREEN_HEIGHT * 0.02, - height: SCREEN_HEIGHT, + height: SCREEN_HEIGHT * 0.9, }, sectionHeaderStyle: { width: '100%', |