-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProfile.tsx
More file actions
52 lines (50 loc) · 1.45 KB
/
Profile.tsx
File metadata and controls
52 lines (50 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import React from "react";
import { Image, Linking, StyleSheet, Text, TouchableHighlight, View } from "react-native";
import { NavigationProps } from "../navigation";
export const Profile = ({route}: NavigationProps<'Profile'>) => {
const profile = route.params;
return (
<View style={styles.profileContainer}>
<View style={styles.profileHeadingContainer}>
<Image source={{uri: profile.avatar_url}} width={120} height={120}/>
<View style={styles.profileDataContainer}>
<Text style={styles.dataText}>{profile.name}</Text>
<Text style={styles.dataText}>{profile.bio}</Text>
</View>
</View>
<Text style={styles.dataText}>
{`Visit my profile: ${profile.login} and check out some of my ${profile.public_repos} repos!`}
</Text>
<TouchableHighlight onPress={() => {
!!profile.html_url && Linking.openURL(profile.html_url);
}} disabled={!profile.html_url}>
<Text>{profile.login}</Text>
</TouchableHighlight>
</View>
);
};
const styles = StyleSheet.create({
profileContainer: {
flex: 1,
flexDirection: 'column',
alignContent: 'center',
alignItems: 'center',
padding: 10,
},
profileHeadingContainer: {
flexDirection: 'row',
padding: 5,
},
profileDataContainer: {
flex: 1,
flexDirection: 'column',
padding: 10,
},
dataText: {
padding: 5
},
profileVisitButton: {
height: 40,
width: 200,
},
});