diff --git a/app/containers/Avatar/index.tsx b/app/containers/Avatar/index.tsx index 965639185..4215fbd13 100644 --- a/app/containers/Avatar/index.tsx +++ b/app/containers/Avatar/index.tsx @@ -13,6 +13,8 @@ import I18n from '../../i18n'; import { useTheme } from '../../theme'; import styles from './styles'; +type IAvatarContainer = IAvatar & { isUserProfile?: boolean; handleEdit?: () => void }; + const AvatarContainer = ({ style, text = '', @@ -28,7 +30,7 @@ const AvatarContainer = ({ rid, handleEdit, isUserProfile -}: IAvatar & { isUserProfile?: boolean; handleEdit?: () => void }): React.ReactElement => { +}: IAvatarContainer): React.ReactElement => { const subscription = useRef(); const [avatarETag, setAvatarETag] = useState(''); const previousAvatarEtag = useRef(''); @@ -128,6 +130,7 @@ const AvatarContainer = ({ onPress={handleEdit} testID='avatar-edit-button' style={styles.editAvatarButton} + color={colors.titleText} /> ) : null} diff --git a/app/containers/Avatar/styles.ts b/app/containers/Avatar/styles.ts index 81e1cf415..5a43fd029 100644 --- a/app/containers/Avatar/styles.ts +++ b/app/containers/Avatar/styles.ts @@ -2,7 +2,7 @@ import { StyleSheet } from 'react-native'; export default StyleSheet.create({ editAvatarButton: { - marginTop: 8, + marginTop: 16, paddingVertical: 8, paddingHorizontal: 12, marginBottom: 0 diff --git a/app/stacks/InsideStack.tsx b/app/stacks/InsideStack.tsx index ba1f5b3fe..9cfb4be82 100644 --- a/app/stacks/InsideStack.tsx +++ b/app/stacks/InsideStack.tsx @@ -97,7 +97,7 @@ const ChatsStackNavigator = () => { - + void; - text?: string; -}) => { +const Item = ({ item, onPress, text, testID }: { item?: IAvatar; testID?: string; onPress: Function; text?: string }) => { const { colors } = useTheme(); return ( - onPress(item)} style={[styles.avatarButton, { backgroundColor: colors.borderColor }]} > - + ); }; const AvatarSuggestion = ({ @@ -37,14 +28,14 @@ const AvatarSuggestion = ({ user, resetAvatar }: { - onPress: (value?: IAvatar) => void; + onPress: (value: IAvatar | null) => void; user?: IUser; resetAvatar?: () => void; }) => { const [avatarSuggestions, setAvatarSuggestions] = useState([]); - + const { colors } = useTheme(); - + const getAvatarSuggestion = async () => { const result = await Services.getAvatarSuggestion(); const suggestions = Object.keys(result).map(service => { diff --git a/app/views/ChangeAvatarView/index.tsx b/app/views/ChangeAvatarView/index.tsx index 62312cb79..892e97172 100644 --- a/app/views/ChangeAvatarView/index.tsx +++ b/app/views/ChangeAvatarView/index.tsx @@ -27,7 +27,7 @@ import AvatarSuggestion from './AvatarSuggestion'; import log from '../../lib/methods/helpers/log'; const ChangeAvatarView = () => { - const [avatar, setAvatarState] = useState(); + const [avatar, setAvatarState] = useState(null); const [textAvatar, setTextAvatar] = useState(''); const [saving, setSaving] = useState(false); @@ -68,7 +68,7 @@ const ChangeAvatarView = () => { }); }, [navigation]); - const setAvatar = (value?: IAvatar) => { + const setAvatar = (value: IAvatar | null) => { avatarUrl.current = value?.url; setAvatarState(value); }; @@ -103,7 +103,7 @@ const ChangeAvatarView = () => { }; const resetAvatar = () => { - setAvatar(undefined); + setAvatar(null); setTextAvatar(`@${user.username}`); avatarUrl.current = `@${user.username}`; }; diff --git a/app/views/NewMessageView/index.tsx b/app/views/NewMessageView/index.tsx index c4dc74afc..6033ad58b 100644 --- a/app/views/NewMessageView/index.tsx +++ b/app/views/NewMessageView/index.tsx @@ -93,7 +93,7 @@ const NewMessageView = () => { return ( goRoom(itemModel)}