diff options
| author | Ivan Chen <ivan@tagg.id> | 2021-05-04 13:31:17 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-04 13:31:17 -0400 |
| commit | 1441ef007549f24a292317f1e67c0de63cacbd2b (patch) | |
| tree | 1b1fe4a21f257c468c321d49804f124c98a6e6b6 /src/components/search | |
| parent | 5a8d92bcd869ada1079bc36b6598c899a8a9246d (diff) | |
| parent | 64dedc2bc0c65fae604ba771ae4c17d1927ff1c2 (diff) | |
Merge pull request #392 from IvanIFChen/tma791-remove-profile-photo-requirement
[TMA-791] Removed profile photo requirement
Diffstat (limited to 'src/components/search')
| -rw-r--r-- | src/components/search/ExploreSectionUser.tsx | 16 | ||||
| -rw-r--r-- | src/components/search/SearchResultCell.tsx | 8 |
2 files changed, 7 insertions, 17 deletions
diff --git a/src/components/search/ExploreSectionUser.tsx b/src/components/search/ExploreSectionUser.tsx index d8c92be2..c949acd4 100644 --- a/src/components/search/ExploreSectionUser.tsx +++ b/src/components/search/ExploreSectionUser.tsx @@ -1,13 +1,13 @@ import {useNavigation} from '@react-navigation/native'; import React, {useEffect, useState} from 'react'; -import {TextStyle, ViewStyle} from 'react-native'; import { - Image, StyleProp, StyleSheet, Text, + TextStyle, TouchableOpacity, ViewProps, + ViewStyle, } from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; import {useDispatch, useSelector, useStore} from 'react-redux'; @@ -15,6 +15,7 @@ import {loadImageFromURL} from '../../services'; import {RootState} from '../../store/rootReducer'; import {ProfilePreviewType, ScreenType} from '../../types'; import {fetchUserX, normalize, userXInStore} from '../../utils'; +import {Avatar} from '../common'; /** * Search Screen for user recommendations and a search @@ -30,7 +31,7 @@ const ExploreSectionUser: React.FC<ExploreSectionUserProps> = ({ externalStyles, }) => { const {id, username, first_name, last_name} = user; - const [avatar, setAvatar] = useState<string | null>(null); + const [avatar, setAvatar] = useState<string>(); const navigation = useNavigation(); const {user: loggedInUser} = useSelector((state: RootState) => state.user); const state: RootState = useStore().getState(); @@ -71,14 +72,7 @@ const ExploreSectionUser: React.FC<ExploreSectionUserProps> = ({ angle={90} angleCenter={{x: 0.5, y: 0.5}} style={styles.gradient}> - <Image - source={ - avatar - ? {uri: avatar} - : require('../../assets/images/avatar-placeholder.png') - } - style={styles.profile} - /> + <Avatar style={styles.profile} uri={avatar} /> </LinearGradient> <Text style={[styles.name, externalStyles?.name]} numberOfLines={2}> {first_name} {last_name} diff --git a/src/components/search/SearchResultCell.tsx b/src/components/search/SearchResultCell.tsx index 5a6ea110..16e62a53 100644 --- a/src/components/search/SearchResultCell.tsx +++ b/src/components/search/SearchResultCell.tsx @@ -22,10 +22,10 @@ import { } from '../../utils'; import { checkIfUserIsBlocked, - defaultUserProfile, fetchUserX, userXInStore, } from '../../utils/users'; +import {Avatar} from '../common'; interface SearchResults { profileData: ProfilePreviewType; @@ -129,11 +129,7 @@ const SearchResultsCell: React.FC<SearchResults> = ({ <TouchableOpacity onPress={addToRecentlyStoredAndNavigateToProfile} style={styles.cellContainer}> - <Image - defaultSource={defaultUserProfile()} - source={{uri: avatar}} - style={styles.imageContainer} - /> + <Avatar style={styles.imageContainer} uri={avatar} /> <View style={[styles.initialTextContainer, styles.multiText]}> <Text style={styles.initialTextStyle}>{`@${username}`}</Text> <Text style={styles.secondaryTextStyle}> |
