diff --git a/src/view/com/util/UserAvatar.tsx b/src/view/com/util/UserAvatar.tsx index f668c69ed0..406654e4df 100644 --- a/src/view/com/util/UserAvatar.tsx +++ b/src/view/com/util/UserAvatar.tsx @@ -1,4 +1,4 @@ -import React, {useCallback} from 'react' +import React, {useCallback, useState} from 'react' import {StyleSheet, View, TouchableOpacity, Alert, Image} from 'react-native' import Svg, {Circle, Text, Defs, LinearGradient, Stop} from 'react-native-svg' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' @@ -24,6 +24,8 @@ export function UserAvatar({ const initials = getInitials(displayName || handle) const gradient = getGradient(handle) + const [uploadedImage, setUploadedImage] = useState(null) + const handleEditAvatar = useCallback(() => { Alert.alert('Select upload method', '', [ { @@ -36,8 +38,7 @@ export function UserAvatar({ height: 80, cropperCircleOverlay: true, }).then(item => { - // setLocalAvatarPicture(item.path) - console.log(item) + setUploadedImage(item.path) }) }, }, @@ -54,7 +55,7 @@ export function UserAvatar({ height: 80, cropperCircleOverlay: true, }).then(croppedItem => { - // setLocalAvatarPicture(croppedItem.path) + setUploadedImage(croppedItem.path) console.log(croppedItem) }) }) @@ -86,12 +87,12 @@ export function UserAvatar({ return isEditable ? ( - {/* {localAvatarPicture != null ? ( - + {/* Added a react state temporary photo white the protocol does not support imagery */} + {uploadedImage != null ? ( + ) : ( renderSvg(size, initials) - )} */} - {renderSvg(size, initials)} + )} (null) + const handleEditBanner = useCallback(() => { Alert.alert('Select upload method', '', [ { @@ -30,7 +32,7 @@ export function UserBanner({ width: 1500, height: 500, }).then(item => { - // setLocalBannerPicture(item.path) + setUploadedImage(item.path) console.log(item) }) }, @@ -47,7 +49,7 @@ export function UserBanner({ width: 1500, height: 500, }).then(croppedItem => { - // setLocalBannerPicture(croppedItem.path) + setUploadedImage(croppedItem.path) console.log(croppedItem) }) }) @@ -75,12 +77,16 @@ export function UserBanner({ return isEditable ? ( - {/* {localBannerPicture != null ? ( - + {/* Added a react state temporary photo white the protocol does not support imagery */} + {uploadedImage != null ? ( + ) : ( renderSvg() - )} */} - {renderSvg()} + )}