-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProfile.js
141 lines (123 loc) · 2.78 KB
/
Profile.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
'use strict';
var React = require('react-native');
var Square = require('./itemSquare');
var ItemProfile = require('./itemProfile');
var config = require('./config');
var {
PixelRatio,
NavigatorIOS,
Image,
Platform,
StyleSheet,
Text,
TouchableHighlight,
TouchableNativeFeedback,
View,
} = React;
var ratio = PixelRatio.get()
var Seperator = React.createClass({
render: function() {
return (
<View style={styles.rowSeparator}/>
);
}
});
var Profile = React.createClass({
getInitialState: function() {
return {
data: null,
};
},
componentDidMount() {
// this._loadInitialState().done();
this.fetch();
},
async _loadInitialState() {
try {
var value = await AsyncStorage.getItem('TOKEN');
if (value !== null){
// this.setState({selectedValue: value});
} else {
}
} catch (error) {
}
},
fetch: function () {
let USER_URL = config.baseUrl + '/users/me';
fetch(USER_URL)
.then((response) => response.json())
.then((responseData) => {
this.setState({
data: responseData,
});
})
.done();
},
renderProfile: function () {
},
renderLogin: function () {
},
render: function() {
return (
<View style={styles.container}>
<View style={{marginTop: 30}}/>
<Seperator/>
{this.state.data == null ? <View/> :
<View>
<ItemProfile data={this.state.data}/>
<Seperator/>
<View style={{marginTop: 40}}/>
<Square data={{name: 'Email:', description: this.state.data.email}}/>
<Square data={{name: 'Skype:', description: this.state.data.skype}}/>
<Square data={{name: 'Linkedin:', description: this.state.data.linkedin}}/>
<Square data={{name: 'Twitter:', description: this.state.data.twitter}}/>
<Square data={{name: 'Website:', description: this.state.data.website_url}}/>
<Seperator/>
</View>
}
</View>
);
}
});
var styles = StyleSheet.create({
container: {
marginTop: 60,
backgroundColor: '#eeeeee',
flex: 1,
},
profile: {
flexDirection: 'row',
alignItems: 'center',
padding: 5 * ratio,
backgroundColor: 'white',
},
thumbnail: {
width: 25 * ratio,
height: 25 * ratio,
borderRadius: 12.5 * ratio,
marginLeft: 5 * ratio,
marginRight: 5 * ratio,
},
name: {
flex: 1,
fontSize: 8 * ratio,
fontWeight: 'bold',
paddingBottom: 1.5 * ratio,
},
description: {
flex: 1,
fontSize: 6 * ratio,
color: '#666666',
paddingTop: 1.5 * ratio,
},
right: {
flex: 1,
marginLeft: 30,
},
rowSeparator: {
backgroundColor: 'rgba(0, 0, 0, 0.1)',
height: 1,
marginLeft: 4,
},
});
module.exports = Profile;