2022-06-21 23:50:49 +02:00
|
|
|
import GracefullyImage from '@components/GracefullyImage'
|
2022-12-28 23:41:36 +01:00
|
|
|
import navigationRef from '@utils/navigation/navigationRef'
|
2023-01-02 02:08:12 +01:00
|
|
|
import React, { useContext } from 'react'
|
2022-12-20 10:47:33 +01:00
|
|
|
import { Dimensions, Image } from 'react-native'
|
2021-01-16 00:00:31 +01:00
|
|
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
2023-01-02 02:08:12 +01:00
|
|
|
import AccountContext from './Context'
|
2020-11-22 00:46:23 +01:00
|
|
|
|
2023-01-02 02:08:12 +01:00
|
|
|
const AccountHeader: React.FC = () => {
|
|
|
|
const { account } = useContext(AccountContext)
|
2020-11-22 00:46:23 +01:00
|
|
|
|
2022-12-18 20:55:33 +01:00
|
|
|
const topInset = useSafeAreaInsets().top
|
2020-12-17 09:44:03 +01:00
|
|
|
|
2022-12-18 20:55:33 +01:00
|
|
|
return (
|
2022-12-20 10:47:33 +01:00
|
|
|
<GracefullyImage
|
2023-02-08 01:10:59 +01:00
|
|
|
sources={{ default: { uri: account?.header }, static: { uri: account?.header_static } }}
|
2022-12-20 10:47:33 +01:00
|
|
|
style={{ height: Dimensions.get('window').width / 3 + topInset }}
|
2022-12-18 20:55:33 +01:00
|
|
|
onPress={() => {
|
|
|
|
if (account) {
|
|
|
|
Image.getSize(account.header, (width, height) =>
|
|
|
|
navigationRef.navigate('Screen-ImagesViewer', {
|
|
|
|
imageUrls: [{ id: 'avatar', url: account.header, width, height }],
|
|
|
|
id: 'avatar',
|
|
|
|
hideCounter: true
|
|
|
|
})
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}}
|
2023-01-29 17:28:49 +01:00
|
|
|
dim
|
2022-12-20 10:47:33 +01:00
|
|
|
/>
|
2022-12-18 20:55:33 +01:00
|
|
|
)
|
|
|
|
}
|
2021-05-09 21:59:03 +02:00
|
|
|
|
|
|
|
export default AccountHeader
|