tooot/src/components/Timelines/Timeline/Shared/Avatar.tsx

43 lines
879 B
TypeScript
Raw Normal View History

2020-10-25 01:35:41 +02:00
import React from 'react'
2020-10-28 00:02:37 +01:00
import { Image, Pressable, StyleSheet } from 'react-native'
import { useNavigation } from '@react-navigation/native'
2020-10-25 01:35:41 +02:00
2020-11-23 00:07:32 +01:00
import constants from 'src/utils/styles/constants'
2020-10-31 21:04:46 +01:00
export interface Props {
uri: string
id: string
}
const Avatar: React.FC<Props> = ({ uri, id }) => {
2020-10-28 00:02:37 +01:00
const navigation = useNavigation()
2020-10-30 00:49:05 +01:00
// Need to fix go back root
2020-10-28 00:02:37 +01:00
return (
<Pressable
style={styles.avatar}
onPress={() => {
2020-11-22 00:46:23 +01:00
navigation.navigate('Screen-Shared-Account', {
2020-10-28 00:02:37 +01:00
id: id
})
}}
>
<Image source={{ uri: uri }} style={styles.image} />
</Pressable>
)
2020-10-25 01:35:41 +02:00
}
const styles = StyleSheet.create({
avatar: {
2020-11-23 00:07:32 +01:00
width: constants.AVATAR_S,
height: constants.AVATAR_S,
marginRight: constants.SPACING_S
2020-10-28 00:02:37 +01:00
},
image: {
width: '100%',
2020-11-23 00:07:32 +01:00
height: '100%',
borderRadius: 8
2020-10-25 01:35:41 +02:00
}
})
2020-10-31 21:04:46 +01:00
export default Avatar