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
|
import React from 'react';
import {
View,
ScrollView,
} from 'react-native';
import {
RkText,
RkButton, RkStyleSheet,
} from 'react-native-ui-kitten';
import { Avatar } from '../../components/avatar';
import { Gallery } from '../../components/gallery';
import { data } from '../../data/';
import formatNumber from '../../utils/textUtils';
import NavigationType from '../../config/navigation/propTypes';
export class ProfileV1 extends React.Component {
static propTypes = {
navigation: NavigationType.isRequired,
};
static navigationOptions = {
title: 'User Profile'.toUpperCase(),
};
state = {
data: undefined,
};
constructor(props) {
super(props);
const id = this.props.navigation.getParam('id', 1);
this.state.data = data.getUser(id);
}
render = () => (
<ScrollView style={styles.root}>
<View style={[styles.header, styles.bordered]}>
<Avatar img={this.state.data.photo} rkType='big' />
<RkText rkType='header2'>{`${this.state.data.firstName} ${this.state.data.lastName}`}</RkText>
</View>
<View style={[styles.userInfo, styles.bordered]}>
<View style={styles.section}>
<RkText rkType='header3' style={styles.space}>{this.state.data.postCount}</RkText>
<RkText rkType='secondary1 hintColor'>Posts</RkText>
</View>
<View style={styles.section}>
<RkText rkType='header3' style={styles.space}>{formatNumber(this.state.data.followersCount)}</RkText>
<RkText rkType='secondary1 hintColor'>Followers</RkText>
</View>
<View style={styles.section}>
<RkText rkType='header3' style={styles.space}>{this.state.data.followingCount}</RkText>
<RkText rkType='secondary1 hintColor'>Following</RkText>
</View>
</View>
<View style={styles.buttons}>
<RkButton style={styles.button} rkType='clear link'>FOLLOW</RkButton>
<View style={styles.separator} />
<RkButton style={styles.button} rkType='clear link'>MESSAGE</RkButton>
</View>
<Gallery items={this.state.data.images} />
</ScrollView>
);
}
const styles = RkStyleSheet.create(theme => ({
root: {
backgroundColor: theme.colors.screen.base,
},
header: {
alignItems: 'center',
paddingTop: 25,
paddingBottom: 17,
},
userInfo: {
flexDirection: 'row',
paddingVertical: 18,
},
bordered: {
borderBottomWidth: 1,
borderColor: theme.colors.border.base,
},
section: {
flex: 1,
alignItems: 'center',
},
space: {
marginBottom: 3,
},
separator: {
backgroundColor: theme.colors.border.base,
alignSelf: 'center',
flexDirection: 'row',
flex: 0,
width: 1,
height: 42,
},
buttons: {
flexDirection: 'row',
paddingVertical: 8,
},
button: {
flex: 1,
alignSelf: 'center',
},
}));
|