diff options
author | Ivan Chen <ivan@tagg.id> | 2021-03-25 15:00:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-25 15:00:48 -0400 |
commit | 99de9c8402f470ead242a81510dc2764ae7d9e66 (patch) | |
tree | 7bf2feb0f1a57f1c695ddea51afb9e95abf03f0a /src/components | |
parent | 75c08439fe04666a63431bf56e4b2fa7fb05cbbe (diff) | |
parent | 54de628b27647099170bc6d5eea7110c8dd5e8f0 (diff) |
Merge pull request #323 from IvanIFChen/tma698-api-profile
[TMA-698] api/profile
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/profile/Avatar.tsx | 7 | ||||
-rw-r--r-- | src/components/profile/Cover.tsx | 11 | ||||
-rw-r--r-- | src/components/search/SearchCategories.tsx | 18 |
3 files changed, 6 insertions, 30 deletions
diff --git a/src/components/profile/Avatar.tsx b/src/components/profile/Avatar.tsx index ba4ec36c..5d677983 100644 --- a/src/components/profile/Avatar.tsx +++ b/src/components/profile/Avatar.tsx @@ -19,11 +19,8 @@ const Avatar: React.FC<AvatarProps> = ({style, screenType, userXId}) => { return ( <Image style={[styles.image, style]} - source={ - avatar - ? {uri: avatar} - : require('../../assets/images/avatar-placeholder.png') - } + defaultSource={require('../../assets/images/avatar-placeholder.png')} + source={{uri: avatar}} /> ); }; diff --git a/src/components/profile/Cover.tsx b/src/components/profile/Cover.tsx index a03ef123..b7502cff 100644 --- a/src/components/profile/Cover.tsx +++ b/src/components/profile/Cover.tsx @@ -1,7 +1,7 @@ import React from 'react'; import {Image, StyleSheet, View} from 'react-native'; -import {IMAGE_WIDTH, COVER_HEIGHT, IMAGE_HEIGHT} from '../../constants'; import {useSelector} from 'react-redux'; +import {COVER_HEIGHT, IMAGE_WIDTH} from '../../constants'; import {RootState} from '../../store/rootreducer'; import {ScreenType} from '../../types'; @@ -10,7 +10,7 @@ interface CoverProps { screenType: ScreenType; } const Cover: React.FC<CoverProps> = ({userXId, screenType}) => { - const {cover = ''} = userXId + const {cover} = userXId ? useSelector((state: RootState) => state.userX[screenType][userXId]) : useSelector((state: RootState) => state.user); @@ -18,11 +18,8 @@ const Cover: React.FC<CoverProps> = ({userXId, screenType}) => { <View style={[styles.container]}> <Image style={styles.image} - source={ - cover - ? {uri: cover} - : require('../../assets/images/cover-placeholder.png') - } + defaultSource={require('../../assets/images/cover-placeholder.png')} + source={{uri: cover}} /> </View> ); diff --git a/src/components/search/SearchCategories.tsx b/src/components/search/SearchCategories.tsx index 4bae27c2..c747b34f 100644 --- a/src/components/search/SearchCategories.tsx +++ b/src/components/search/SearchCategories.tsx @@ -73,23 +73,5 @@ const styles = StyleSheet.create({ flexWrap: 'wrap', justifyContent: 'space-evenly', }, - buttonContainer: { - backgroundColor: 'transparent', - width: 158, - height: 37, - borderRadius: 20, - borderColor: 'transparent', - borderWidth: 1, - flexDirection: 'row', - alignContent: 'center', - justifyContent: 'center', - }, - buttonText: { - fontWeight: '400', - fontSize: 15, - lineHeight: 17.9, - alignSelf: 'center', - color: 'white', - }, }); export default SearchCategories; |