@@ -2,6 +2,7 @@ import React, { Component } from 'react';
2
2
import {
3
3
Text ,
4
4
View ,
5
+ Image ,
5
6
Animated ,
6
7
ScrollView ,
7
8
Dimensions ,
@@ -10,7 +11,7 @@ import {
10
11
11
12
import { Icon , List , ListItem } from 'react-native-elements' ;
12
13
13
- import { COLORS , LIST , SCREEN_WIDTH , SCREEN_HEIGHT } from './constants'
14
+ import { COLORS , FACEBOOK_LIST , SLACK_LIST , GENERIC_LIST , SCREEN_WIDTH , SCREEN_HEIGHT } from './constants'
14
15
15
16
const SCREEN = Dimensions . get ( 'window' ) ;
16
17
const ScrollViewPropTypes = ScrollView . propTypes ;
@@ -100,7 +101,7 @@ export default class ParallaxScrollView extends Component {
100
101
position : 'relative' ,
101
102
height : newWindowHeight ,
102
103
opacity : scrollY . interpolate ( {
103
- inputRange : [ - windowHeight , 0 , windowHeight / 2 ] ,
104
+ inputRange : [ - windowHeight , 0 , windowHeight / 0.5 ] ,
104
105
outputRange : [ 1 , 1 , 0 ]
105
106
} )
106
107
} }
@@ -109,10 +110,22 @@ export default class ParallaxScrollView extends Component {
109
110
this . props . header :
110
111
< View style = { styles . headerView } >
111
112
< View style = { styles . headerTextView } >
112
- < Text style = { styles . headerTextViewTitle } > My Day</ Text >
113
- < Text style = { styles . headerTextViewSubtitle } >
114
- Wednesday, May 17
115
- </ Text >
113
+ < Animated . View
114
+ style = { [ styles . avatarView ,
115
+ {
116
+ opacity : scrollY . interpolate ( {
117
+ inputRange : [ - windowHeight , 0 , windowHeight * 0.42 ] ,
118
+ outputRange : [ 1 , 1 , 0 ]
119
+ } )
120
+ }
121
+ ] }
122
+ >
123
+ < Image source = { { uri : 'https://s3.amazonaws.com/uifaces/faces/twitter/kfriedson/128.jpg' } } style = { { height : 120 , width : 120 , borderRadius : 60 } } />
124
+ </ Animated . View >
125
+ < View style = { { paddingBottom : 20 } } >
126
+ < Text style = { { textAlign : 'center' , fontSize : 22 , color : 'white' , paddingBottom : 5 } } > Katy Friedson</ Text >
127
+ < Text style = { { textAlign : 'center' , fontSize : 17 , color : 'rgba(247,247, 250, 1)' , paddingBottom : 5 } } > Engineering Manager</ Text >
128
+ </ View >
116
129
</ View >
117
130
</ View >
118
131
}
@@ -133,13 +146,13 @@ export default class ParallaxScrollView extends Component {
133
146
< Animated . View
134
147
style = { {
135
148
opacity : scrollY . interpolate ( {
136
- inputRange : [ - windowHeight , 0 , windowHeight / 1.3 ] ,
149
+ inputRange : [ - windowHeight , windowHeight * 0.42 , windowHeight * 0.8 ] ,
137
150
outputRange : [ 0 , 0 , 1 ]
138
151
} )
139
152
} }
140
153
>
141
154
< Text style = { { fontSize : 22 , fontWeight : '600' , color : 'white' } } >
142
- My Day
155
+ Katy Friedson
143
156
</ Text >
144
157
</ Animated . View >
145
158
) ;
@@ -153,7 +166,7 @@ export default class ParallaxScrollView extends Component {
153
166
}
154
167
155
168
var backgroundColor = scrollY . interpolate ( {
156
- inputRange : [ - windowHeight , 0 , windowHeight / 1.3 ] ,
169
+ inputRange : [ - windowHeight , windowHeight * 0.42 , windowHeight * 0.8 ] ,
157
170
outputRange : [ 'transparent' , 'transparent' , 'rgba(0, 0, 0, 1.0)' ]
158
171
} ) ;
159
172
@@ -207,33 +220,50 @@ export default class ParallaxScrollView extends Component {
207
220
208
221
renderTodoListContent ( ) {
209
222
return (
210
- < List containerStyle = { styles . listContainerView } >
211
- { LIST . map ( ( item , index ) => (
223
+ < View >
224
+ < List >
225
+ {
226
+ FACEBOOK_LIST . map ( ( item , index ) => (
227
+ < ListItem
228
+ key = { index }
229
+ onPress = { ( ) => console . log ( "List item pressed" ) }
230
+ title = { item . title }
231
+ leftIcon = { { name : item . icon } } />
232
+ ) )
233
+ }
234
+ </ List >
235
+ < List >
236
+ {
237
+ SLACK_LIST . map ( ( item , index ) => (
238
+ < ListItem
239
+ key = { index }
240
+ onPress = { ( ) => console . log ( "List item pressed" ) }
241
+ title = { item . title }
242
+ leftIcon = { { name : item . icon } } />
243
+ ) )
244
+ }
245
+ </ List >
246
+ < List >
247
+ {
248
+ GENERIC_LIST . map ( ( item , index ) => (
249
+ < ListItem
250
+ key = { index }
251
+ onPress = { ( ) => console . log ( "List item pressed" ) }
252
+ title = { item . title }
253
+ leftIcon = { { name : item . icon } } />
254
+ ) )
255
+ }
256
+ </ List >
257
+ < List containerStyle = { { marginBottom : 15 } } >
212
258
< ListItem
213
- key = { index }
214
- hideChevron
215
- title = { item . description }
216
- titleStyle = {
217
- item . checked
218
- ? styles . itemCompleteTitle
219
- : styles . itemInCompleteTitle
220
- }
221
- subtitle = { item . category }
222
- subtitleStyle = {
223
- item . checked
224
- ? styles . itemCompleteSubtitle
225
- : styles . itemInCompleteSubtitle
226
- }
227
- leftIcon = {
228
- item . checked
229
- ? this . itemCompleteIconStyle ( )
230
- : this . itemInCompleteIconStyle ( )
231
- }
232
- leftIconOnPress = { ( ) => console . log ( "Icon pressed" ) }
233
- onPress = { ( ) => console . log ( "List Item pressed" ) }
234
- />
235
- ) ) }
236
- </ List >
259
+ key = { 1 }
260
+ hideChevron = { true }
261
+ onPress = { ( ) => console . log ( 'Logout Pressed' ) }
262
+ title = 'LOGOUT'
263
+ titleStyle = { styles . logoutText }
264
+ icon = { { name : '' } } />
265
+ </ List >
266
+ </ View >
237
267
) ;
238
268
}
239
269
@@ -300,19 +330,20 @@ var styles = StyleSheet.create({
300
330
flexDirection : 'column'
301
331
} ,
302
332
headerView : {
303
- flex : 5
333
+ flex : 5 ,
334
+ justifyContent : 'center' ,
335
+ alignItems : 'center'
304
336
} ,
305
- headerTextView : {
306
- position : 'absolute ' ,
307
- left : 25 ,
308
- bottom : 25 ,
309
- backgroundColor : 'transparent'
337
+ avatarView : {
338
+ justifyContent : 'center ' ,
339
+ alignItems : 'center' ,
340
+ alignSelf : 'center' ,
341
+ paddingBottom : 10 ,
310
342
} ,
311
343
headerTextViewTitle : {
312
344
fontSize : 35 ,
313
345
color : 'white' ,
314
346
fontWeight : '300' ,
315
- paddingBottom : 10
316
347
} ,
317
348
headerTextViewSubtitle : {
318
349
fontSize : 20 ,
@@ -375,12 +406,17 @@ var styles = StyleSheet.create({
375
406
justifyContent : 'center' ,
376
407
alignItems : 'center' ,
377
408
paddingRight : 15
409
+ } ,
410
+ logoutText : {
411
+ color : 'red' ,
412
+ textAlign : 'center' ,
413
+ fontWeight : 'bold'
378
414
}
379
415
} ) ;
380
416
381
417
ParallaxScrollView . defaultProps = {
382
- backgroundSource : { uri : 'http://i.imgur.com/ytzr6ff .png' } ,
383
- windowHeight : SCREEN . height * 0.38 ,
418
+ backgroundSource : { uri : 'http://i.imgur.com/6Iej2c3 .png' } ,
419
+ windowHeight : SCREEN . height * 0.42 ,
384
420
contentInset : {
385
421
top : SCREEN . scale
386
422
} ,
0 commit comments