tooot/src/screens/Tabs/Shared/Account/Information/Avatar.tsx

43 lines
1.4 KiB
TypeScript
Raw Normal View History

2021-01-16 00:00:31 +01:00
import GracefullyImage from '@components/GracefullyImage'
2021-01-24 02:25:43 +01:00
import { useNavigation } from '@react-navigation/native'
import { StackNavigationProp } from '@react-navigation/stack'
import navigationRef from '@utils/navigation/navigationRef'
2021-08-29 15:25:38 +02:00
import { TabLocalStackParamList } from '@utils/navigation/navigators'
2021-01-16 00:00:31 +01:00
import { StyleConstants } from '@utils/styles/constants'
2023-01-02 02:08:12 +01:00
import React, { useContext } from 'react'
import AccountContext from '../Context'
2020-12-27 16:25:29 +01:00
2023-01-02 02:08:12 +01:00
const AccountInformationAvatar: React.FC = () => {
const { account, pageMe } = useContext(AccountContext)
2020-12-27 16:25:29 +01:00
2022-12-12 20:43:45 +01:00
const navigation = useNavigation<StackNavigationProp<TabLocalStackParamList>>()
2021-01-23 02:41:50 +01:00
return (
<GracefullyImage
2023-02-08 01:10:59 +01:00
style={{ borderRadius: 8, overflow: 'hidden' }}
dimension={{ width: StyleConstants.Avatar.L, height: StyleConstants.Avatar.L }}
sources={{
default: { uri: account?.avatar },
static: { uri: account?.avatar_static }
2023-01-17 15:35:36 +01:00
}}
2021-01-24 02:25:43 +01:00
onPress={() => {
2022-12-18 20:55:33 +01:00
if (account) {
2023-01-02 02:08:12 +01:00
if (pageMe) {
2022-12-18 20:55:33 +01:00
navigation.push('Tab-Shared-Account', { account })
return
} else {
navigationRef.navigate('Screen-ImagesViewer', {
imageUrls: [{ id: 'avatar', url: account.avatar }],
id: 'avatar',
hideCounter: true
})
}
}
2021-01-24 02:25:43 +01:00
}}
2023-01-29 17:28:49 +01:00
dim
/>
2021-01-23 02:41:50 +01:00
)
}
2020-12-27 16:25:29 +01:00
export default AccountInformationAvatar