tooot/src/components/Toot/Avatar.tsx

40 lines
742 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-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={() => {
navigation.navigate('Account', {
id: id
})
}}
>
<Image source={{ uri: uri }} style={styles.image} />
</Pressable>
)
2020-10-25 01:35:41 +02:00
}
const styles = StyleSheet.create({
avatar: {
width: 50,
height: 50,
marginRight: 8
2020-10-28 00:02:37 +01:00
},
image: {
width: '100%',
height: '100%'
2020-10-25 01:35:41 +02:00
}
})
2020-10-31 21:04:46 +01:00
export default Avatar