4
4
Text ,
5
5
Image ,
6
6
FlatList ,
7
+ LayoutAnimation ,
7
8
TouchableOpacity ,
8
9
ActivityIndicator ,
9
10
} from 'react-native' ;
@@ -27,8 +28,8 @@ import style, { AVATAR_SIZE, STICKY_HEADER_HEIGHT, DOT_MARGIN, PARALLAX_HEADER_H
27
28
const PHONE_NUMBER = 0
28
29
const ADDRESS = 1
29
30
const EMAIL = 2
30
- const DEPARTMENT = 3
31
- const DOB = 4
31
+ const DOB = 3
32
+ const GITHUB = 4
32
33
const SKYPE = 5
33
34
34
35
const CANCEL_INDEX = 0
@@ -40,6 +41,10 @@ class ProfileScreen extends Component {
40
41
super ( props ) ;
41
42
}
42
43
44
+ componentDidMount ( ) {
45
+ LayoutAnimation . configureNext ( LayoutAnimation . Presets . spring ) ;
46
+ }
47
+
43
48
_logout = ( ) => {
44
49
// TODO: Clear all data
45
50
this . props . logout ( ) ;
@@ -83,10 +88,10 @@ class ProfileScreen extends Component {
83
88
< View key = "parallax-header" style = { style . parallaxHeader } >
84
89
< Image style = { style . avatar } source = { { uri : 'https://pbs.twimg.com/profile_images/2694242404/5b0619220a92d391534b0cd89bf5adc1_400x400.jpeg' } } />
85
90
< Text style = { style . sectionSpeakerText } >
86
- { this . data . department . name || '' }
91
+ { this . data . firstName } { this . data . lastName }
87
92
</ Text >
88
93
< Text style = { style . sectionTitleText } >
89
- { this . data . department . name || '' }
94
+ { this . data . department . name }
90
95
</ Text >
91
96
</ View >
92
97
) }
@@ -98,38 +103,41 @@ class ProfileScreen extends Component {
98
103
_renderItems = ( item , index ) => {
99
104
switch ( index ) {
100
105
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 || '- ') ;
106
111
case LOGOUT : return this . _renderLougoutCell ( ) ;
107
112
}
108
113
}
109
114
110
115
_renderPhoneCell = ( ) => {
111
116
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 >
123
121
</ 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
+ }
124
132
</ View >
125
133
) ;
126
134
}
127
135
128
136
_renderTextCell = ( text , data ) => {
129
137
return (
130
- < View style = { style . simpleTextCell } >
131
- < Text style = { style . titleText } > { text } </ Text >
138
+ < View style = { [ style . simpleTextCell , style . cell ] } >
132
139
< Text style = { style . dataText } > { data } </ Text >
140
+ < Text style = { style . titleText } > { text } </ Text >
133
141
</ View >
134
142
) ;
135
143
}
0 commit comments