-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUserProfile.jsx
92 lines (85 loc) · 2.2 KB
/
UserProfile.jsx
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
// @flow
import React, { Component } from 'react';
import { View, ScrollView } from 'react-native';
import { observer, inject } from 'mobx-react/native';
import UserConfigBlock from './components/userConfigBlock';
import AccountInfoItem from './components/accountInfoItem';
import HeaderContentBlock from './components/headerContentBlock';
import type { _t_sdk_instance } from './common/flow.types';
import type { _t_parsed_user } from './common/user.parse';
import type { _t_state, _t_props } from './flow.types';
import { parseUser } from './common/user.parse';
import styles from './styles';
@inject((allStores) => ({
auth: allStores.auth
}))
@observer
export default class UserProfile extends Component {
state: _t_state;
instance: _t_sdk_instance;
constructor(props: _t_props) {
super(props);
this.state = {
user: {}
};
this.instance = props.screenProps.sdk;
}
componentWillMount() {
this.instance.user.getUser(`user-${this.props.auth.uid}`, (user) => {
this.setState({ user });
});
}
render() {
const data: _t_parsed_user = parseUser(this.state.user);
const accountInfoList = [
{
label: "City",
title: data.city
},
{
label: "Birhtday",
title: data.birthday
},
{
label: "Gender",
title: data.gender
},
{
label: "ZIP",
title: data.zip
},
{
label: "Type",
title: "Owner",
},
{
label: "Email",
title: data.email
},
];
return (
<View style={styles.mainPageContainer}>
<ScrollView>
<View style={styles.pageContent}>
<UserConfigBlock
isShowLeftBtn={false}
isShowRightBtn={false}
accountPhotoUrl={data.avatar}
/>
<View style={styles.accountInfoList}>
{
accountInfoList.map((item, index) =>
<AccountInfoItem
key={index}
title={item.title}
label={item.label}
/>
)
}
</View>
</View>
</ScrollView>
</View>
);
}
}