Skip to content

Commit 06d8608

Browse files
Merge pull request #20 from leapfrogtechnology/LFG-183
Lfg 183: Detail screen view populated
2 parents 6bcf7e2 + 81300b5 commit 06d8608

File tree

5 files changed

+1811
-132
lines changed

5 files changed

+1811
-132
lines changed

app/screens/contact/contact.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
ActivityIndicator,
88
LayoutAnimation,
99
} from 'react-native';
10+
1011
import Swiper from 'react-native-swiper';
1112
import Search from 'react-native-search-box';
1213
import ParallaxScrollView from 'react-native-parallax-scroll-view';

app/screens/contact/contactCell/contactCell.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ import placeHolderImage from './../../../../assets/images/default.png';
9494
<View style={ style.mainContainer }>
9595
<View style={style.imageContainer}>
9696
<ProgressiveImage source={{uri: this.props.avatarUrl}} thumbnail={placeHolderImage} style={style.contactImage} />
97-
{/* <Image source={placeHolderImage} style={style.contactImage}/> */}
97+
{/* <Image source={{uri: this.props.avatarUrl}} style={style.contactImage}/> */}
9898
</View>
9999
<View style={style.titleContainer}>
100100
<View style={style.titleSubContainer}>

app/screens/profile/profile.js

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
Text,
55
Image,
66
FlatList,
7+
LayoutAnimation,
78
TouchableOpacity,
89
ActivityIndicator,
910
} from 'react-native';
@@ -27,8 +28,8 @@ import style, { AVATAR_SIZE, STICKY_HEADER_HEIGHT, DOT_MARGIN, PARALLAX_HEADER_H
2728
const PHONE_NUMBER = 0
2829
const ADDRESS = 1
2930
const EMAIL = 2
30-
const DEPARTMENT = 3
31-
const DOB = 4
31+
const DOB = 3
32+
const GITHUB = 4
3233
const SKYPE = 5
3334

3435
const CANCEL_INDEX = 0
@@ -40,6 +41,10 @@ class ProfileScreen extends Component {
4041
super(props);
4142
}
4243

44+
componentDidMount() {
45+
LayoutAnimation.configureNext(LayoutAnimation.Presets.spring);
46+
}
47+
4348
_logout = () => {
4449
// TODO: Clear all data
4550
this.props.logout();
@@ -83,10 +88,10 @@ class ProfileScreen extends Component {
8388
<View key="parallax-header" style={ style.parallaxHeader }>
8489
<Image style={ style.avatar } source={{uri: 'https://pbs.twimg.com/profile_images/2694242404/5b0619220a92d391534b0cd89bf5adc1_400x400.jpeg'}}/>
8590
<Text style={ style.sectionSpeakerText }>
86-
{ this.data.department.name || '' }
91+
{ this.data.firstName } { this.data.lastName }
8792
</Text>
8893
<Text style={ style.sectionTitleText }>
89-
{ this.data.department.name || '' }
94+
{ this.data.department.name }
9095
</Text>
9196
</View>
9297
)}
@@ -98,38 +103,41 @@ class ProfileScreen extends Component {
98103
_renderItems = (item, index) => {
99104
switch (index) {
100105
case PHONE_NUMBER: return this._renderPhoneCell();
101-
case ADDRESS: return this._renderTextCell('Address', '');
102-
case EMAIL: return this._renderTextCell('Email', this.data.username || '');
103-
case DEPARTMENT: return this._renderTextCell('Department', '');
104-
case DOB: return this._renderTextCell('Dob', '');
105-
case SKYPE: return this._renderTextCell('Skype ID', '');
106+
case ADDRESS: return this._renderTextCell('Address', this.data.address.temporaryAddress || '-');
107+
case EMAIL: return this._renderTextCell('E-mail', this.data.username || '-');
108+
case DOB: return this._renderTextCell('DOB', this.data.dateofBirth || '-');
109+
case GITHUB: return this._renderTextCell('Github ID', this.data.contact.githubId || '-');
110+
case SKYPE: return this._renderTextCell('Skype ID', this.data.contact.skypeId || '-');
106111
case LOGOUT: return this._renderLougoutCell();
107112
}
108113
}
109114

110115
_renderPhoneCell = () => {
111116
return (
112-
<View style={style.phoneCell}>
113-
<View style={style.nameTextContainer}>
114-
<Text style={style.titleText}>{ this.data.firstName || '' } {this.data.lastName || ''}</Text>
115-
</View>
116-
<View style={style.phoneMessageContainer}>
117-
<TouchableOpacity style={style.phoneButton} onPress={() => Communications.phonecall('0123456789', true)}>
118-
<Image source={callImage} style={style.phoneAndMessageButtonImage}/>
119-
</TouchableOpacity>
120-
<TouchableOpacity style={style.messageButton} onPress={() => Communications.text('0123456789')}>
121-
<Image source={messageImage} style={style.phoneAndMessageButtonImage}/>
122-
</TouchableOpacity>
117+
<View style={[style.phoneCell, style.cell]}>
118+
<View style={style.numberTextContainer}>
119+
<Text style={style.dataText}>{ this.data.contact.mobilePhone }</Text>
120+
<Text style={style.titleText}>Phone Number</Text>
123121
</View>
122+
{ !this.props.data.fromProfileTab &&
123+
<View style={style.phoneMessageContainer}>
124+
<TouchableOpacity style={style.phoneButton} onPress={() => Communications.phonecall(this.data.contact.mobilePhone, true)}>
125+
<Image source={callImage} style={style.phoneAndMessageButtonImage}/>
126+
</TouchableOpacity>
127+
<TouchableOpacity style={style.messageButton} onPress={() => Communications.text(this.data.contact.mobilePhone)}>
128+
<Image source={messageImage} style={style.phoneAndMessageButtonImage}/>
129+
</TouchableOpacity>
130+
</View>
131+
}
124132
</View>
125133
);
126134
}
127135

128136
_renderTextCell = (text, data) => {
129137
return (
130-
<View style={style.simpleTextCell}>
131-
<Text style={style.titleText}>{text}</Text>
138+
<View style={[style.simpleTextCell, style.cell]}>
132139
<Text style={style.dataText}>{data}</Text>
140+
<Text style={style.titleText}>{text}</Text>
133141
</View>
134142
);
135143
}

app/screens/profile/styles.js

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ const style = StyleSheet.create({
7070
parallaxHeader: {
7171
flex: 1,
7272
paddingTop: 80,
73-
alignItems: 'center',
73+
paddingHorizontal: 16,
74+
alignItems: 'flex-start',
7475
flexDirection: 'column',
7576
},
7677
avatar: {
@@ -92,31 +93,36 @@ const style = StyleSheet.create({
9293
listView: {
9394
// paddingHorizontal: 16,
9495
},
96+
cell: {
97+
flex: 1,
98+
height: 60,
99+
paddingHorizontal: 16,
100+
paddingTop: 8,
101+
},
95102
phoneCell: {
96-
flex: 1,
103+
marginTop: 8,
97104
flexDirection: 'row',
98-
paddingHorizontal: 16,
99-
paddingTop: 8,
100105
},
101-
nameTextContainer: {
106+
numberTextContainer: {
102107
flex: 0.9,
103-
justifyContent: 'center',
108+
flexDirection: 'column',
109+
justifyContent: 'space-between',
104110
},
105111
titleText: {
106-
flex: 0.5,
107-
fontSize: 18,
112+
flex: 1,
113+
marginVertical: 4,
108114
},
109115
dataText: {
110-
flex: 0.5,
111-
textAlign: 'right',
116+
flex: 1,
117+
height: 40,
118+
fontSize: 18,
112119
},
113120
phoneMessageContainer: {
114121
flex: 0.1,
115122
flexDirection: 'row',
116-
alignSelf: 'flex-end',
123+
alignSelf: 'center',
117124
justifyContent: 'flex-end',
118125
},
119-
120126
phoneAndMessageButtonImage: {
121127
width: 35,
122128
height: 35,
@@ -132,11 +138,8 @@ const style = StyleSheet.create({
132138
resizeMode: 'contain',
133139
},
134140
simpleTextCell: {
135-
height: 44,
136-
flex: 1,
137-
flexDirection: 'row',
138-
alignItems: 'center',
139-
paddingHorizontal: 16,
141+
flexDirection: 'column',
142+
alignItems: 'flex-start',
140143
},
141144
logoutButtonContainer: {
142145
flex: 1,

0 commit comments

Comments
 (0)