tooot/src/screens/Tabs/Shared/Account/Header.tsx

34 lines
1.0 KiB
TypeScript
Raw Normal View History

2022-06-21 23:50:49 +02:00
import GracefullyImage from '@components/GracefullyImage'
import navigationRef from '@utils/navigation/navigationRef'
2023-01-02 02:08:12 +01:00
import React, { useContext } from 'react'
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
2022-12-18 20:55:33 +01:00
return (
<GracefullyImage
2023-02-08 01:10:59 +01:00
sources={{ default: { uri: account?.header }, static: { uri: account?.header_static } }}
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-18 20:55:33 +01:00
)
}
2021-05-09 21:59:03 +02:00
export default AccountHeader