mirror of https://github.com/tooot-app/app
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import GracefullyImage from '@components/GracefullyImage'
|
|
import { useNavigation } from '@react-navigation/native'
|
|
import { StackNavigationProp } from '@react-navigation/stack'
|
|
import navigationRef from '@utils/navigation/navigationRef'
|
|
import { TabLocalStackParamList } from '@utils/navigation/navigators'
|
|
import { StyleConstants } from '@utils/styles/constants'
|
|
import React, { useContext } from 'react'
|
|
import AccountContext from '../Context'
|
|
|
|
const AccountInformationAvatar: React.FC = () => {
|
|
const { account, pageMe } = useContext(AccountContext)
|
|
|
|
const navigation = useNavigation<StackNavigationProp<TabLocalStackParamList>>()
|
|
|
|
return (
|
|
<GracefullyImage
|
|
style={{ borderRadius: 8, overflow: 'hidden' }}
|
|
dimension={{ width: StyleConstants.Avatar.L, height: StyleConstants.Avatar.L }}
|
|
sources={{
|
|
default: { uri: account?.avatar },
|
|
static: { uri: account?.avatar_static }
|
|
}}
|
|
onPress={() => {
|
|
if (account) {
|
|
if (pageMe) {
|
|
navigation.push('Tab-Shared-Account', { account })
|
|
return
|
|
} else {
|
|
navigationRef.navigate('Screen-ImagesViewer', {
|
|
imageUrls: [{ id: 'avatar', url: account.avatar }],
|
|
id: 'avatar',
|
|
hideCounter: true
|
|
})
|
|
}
|
|
}
|
|
}}
|
|
dim
|
|
/>
|
|
)
|
|
}
|
|
|
|
export default AccountInformationAvatar
|