-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
147 lines (138 loc) · 3.69 KB
/
App.js
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import React, { useEffect, useState } from 'react';
import { ActivityIndicator, Button, FlatList, Modal, SafeAreaView, StyleSheet, Text, TouchableHighlight, TouchableOpacity, View } from 'react-native';
import { useGet } from '@brightleaf/react-hooks';
import { Ionicons } from '@expo/vector-icons';
import { Header, ListItem, Overlay } from 'react-native-elements';
import Hyperlink from 'react-native-hyperlink'
const Item = ({ title, }) => {
return (
<View style={styles.item}>
<Text style={styles.linkTitle}>{title}</Text>
</View>
);
}
const renderItem = ({ item }) => (
<ListItem
title={item.name}
subtitle={item.subtitle}
leftAvatar={{
source: item.avatar_url && { uri: item.avatar_url },
title: item.name[0]
}}
bottomDivider
chevron
/>
)
export default function App() {
const { data, loading, getUrl } = useGet('https://kev-pi.herokuapp.com/api/me')
useEffect(() => {
getUrl()
}, [])
const [url, setUrl] = useState('')
return (
<View style={styles.container}>
<Header
placement="center"
centerComponent={{ text: 'Kevin Isom', style: { color: '#fff', fontSize: 32,
padding: 5,
marginBottom: 5,} }}
rightComponent={{ icon: 'ios-flash', color: '#fff' ,type:'ionicon'}}
/>
<Overlay
onBackdropPress={() => setUrl('')}
isVisible={url !== ''}
windowBackgroundColor="rgba(255, 255, 255, .5)"
overlayBackgroundColor="white"
width="auto"
height="auto"
>
<View>
<View style={{ marginTop: 50 }}>
<Hyperlink linkDefault={true}>{url}</Hyperlink>
<Button
title="Close"
onPress={() => {
setUrl('')
}}
/>
</View>
</View>
</Overlay>
{loading && <ActivityIndicator size="large" />}
<View style={styles.social}>
<ListItem
key={'twitter'}
leftAvatar={<Ionicons name="logo-twitter" size={32} color="#1ba9f8" />}
title={data.twitter && data.twitter.user}
subtitle="Twitter"
bottomDivider
onPress={() => {
setUrl(data.twitter.url)
}}
/>
<ListItem
key={'linkedin'}
leftAvatar={<Ionicons name="logo-linkedin" size={32} color="#0077ba" />}
title={data.linkedin && data.linkedin.user}
subtitle="LinkedIn"
bottomDivider
onPress={() => {
setUrl(data.linkedin.url)
}}
/>
<ListItem
key={'github'}
leftAvatar={<Ionicons name="logo-github" size={32} color="#000000" />}
title={data.github && data.github.user}
subtitle="GitHub"
bottomDivider
onPress={() => {
setUrl(data.linkedin.url)
}}
/>
</View>
<FlatList
style={styles.list}
data={data.links || []}
renderItem={({ item }) => <ListItem style={styles.item} title={item.name} subtitle={item.details} bottomDivider chevron/>}
keyExtractor={item => item.url}
/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
title: {
fontSize: 32,
padding: 5,
margin: 5,
},
linkTitle: {
fontSize: 22,
},
list: {
width: '100%',
},
social: {
padding: 10,
marginVertical: 8,
marginHorizontal: 16,
width: '100%',
},
item: {
padding: 20,
marginVertical: 8,
marginHorizontal: 16,
width: '100%',
},
button: {
alignItems: 'center',
backgroundColor: '#DDDDDD',
padding: 10
},
});