aboutsummaryrefslogtreecommitdiff
path: root/src/components/profile/Avatar.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/profile/Avatar.tsx')
-rw-r--r--src/components/profile/Avatar.tsx18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/components/profile/Avatar.tsx b/src/components/profile/Avatar.tsx
index aca3bf4d..903d0d18 100644
--- a/src/components/profile/Avatar.tsx
+++ b/src/components/profile/Avatar.tsx
@@ -1,16 +1,20 @@
-import React from 'react';
+import React, {useContext} from 'react';
import {Image, StyleSheet} from 'react-native';
-import {AuthContext, ProfileContext} from '../../routes/';
+import {useSelector} from 'react-redux';
+import {RootState} from '../../store/rootreducer';
+import {ScreenType} from '../../types';
const PROFILE_DIM = 100;
interface AvatarProps {
style: object;
- isProfileView: boolean;
+ userXId: string;
+ screenType: ScreenType;
}
-const Avatar: React.FC<AvatarProps> = ({style, isProfileView}) => {
- const {avatar} = isProfileView
- ? React.useContext(ProfileContext)
- : React.useContext(AuthContext);
+const Avatar: React.FC<AvatarProps> = ({style, screenType, userXId}) => {
+ const {avatar} = userXId
+ ? useSelector((state: RootState) => state.userX[screenType][userXId])
+ : useSelector((state: RootState) => state.user);
+
return (
<Image
style={[styles.image, style]}