@@ -7,119 +7,124 @@ import products from '../../data/products';
7
7
8
8
class GridViewScreen extends Component {
9
9
state = {
10
- contacts : _ . flow ( conversations => _ . take ( conversations , 15 ) ,
11
- ( contacts : any [ ] ) =>
12
- _ . map ( contacts , contact => ( {
13
- imageProps : { source : { uri : contact . thumbnail } , borderRadius : 999 , style : { backgroundColor : Colors . grey60 } } ,
14
- title : _ . split ( contact . name , ' ' ) [ 0 ] ,
15
- onPress : ( ) => Alert . alert ( 'My name is ' + contact . name )
16
- } ) ) ) ( conversations ) ,
17
- products : _ . flow ( products => _ . take ( products , 8 ) ,
18
- ( products : any [ ] ) =>
19
- _ . map ( products , ( product , index ) => ( {
20
- imageProps : {
21
- source : { uri : product . mediaUrl } ,
22
- borderRadius : 4 ,
23
- style : { backgroundColor : Colors . grey60 , borderWidth : 1 , borderColor : Colors . grey50 }
24
- } ,
25
- title : product . name ,
26
- titleTypography : 'subtextBold' ,
27
- onPress : ( ) => Alert . alert ( 'My price is ' + product . formattedPrice ) ,
28
- renderOverlay : ( ) => {
29
- if ( index < 7 ) {
30
- return < Text text = { product . price } style = { { alignSelf : 'center' , marginTop : 3 } } /> ;
31
- }
10
+ contacts : _ . chain ( conversations )
11
+ . take ( 15 )
12
+ . map ( contact => ( {
13
+ imageProps : { source : { uri : contact . thumbnail } , borderRadius : 999 , style : { backgroundColor : Colors . grey60 } } ,
14
+ title : _ . split ( contact . name , ' ' ) [ 0 ] ,
15
+ onPress : ( ) => Alert . alert ( 'My name is ' + contact . name )
16
+ } ) )
17
+ . value ( ) ,
18
+ products : _ . chain ( products )
19
+ . take ( 8 )
20
+ . map ( ( product , index ) => ( {
21
+ imageProps : {
22
+ source : { uri : product . mediaUrl } ,
23
+ borderRadius : 4 ,
24
+ style : { backgroundColor : Colors . grey60 , borderWidth : 1 , borderColor : Colors . grey50 }
25
+ } ,
26
+ title : product . name ,
27
+ titleTypography : 'subtextBold' ,
28
+ onPress : ( ) => Alert . alert ( 'My price is ' + product . formattedPrice ) ,
29
+ renderOverlay : ( ) => {
30
+ if ( index < 7 ) {
31
+ return < Text text = { product . price } style = { { alignSelf : 'center' , marginTop : 3 } } /> ;
32
32
}
33
- } ) ) ) ( products ) ,
34
- pairs : _ . flow ( products => _ . take ( products , 2 ) ,
35
- ( products : any [ ] ) =>
36
- _ . map ( products , product => ( {
37
- containerProps : { useNative : true , activeScale : 0.97 , activeOpacity : 1 } ,
38
- renderCustomItem : ( ) => {
39
- return (
40
- < Card height = { 150 } activeOpacity = { 1 } >
41
- < Card . Image style = { { flex : 1 } } source = { { uri : product . mediaUrl } } />
42
- </ Card >
43
- ) ;
44
- } ,
45
- title : product . name ,
46
- subtitle : (
47
- < Text >
48
- < Text style = { { textDecorationLine : 'line-through' , color : Colors . grey30 } } > { product . formattedPrice } </ Text >
49
- < Text style = { { textDecorationLine : 'none' } } > $50</ Text >
50
- </ Text >
51
- ) ,
52
- description : product . inventory . status ,
53
- descriptionLines : 2 ,
54
- alignToStart : true ,
55
- onPress : ( ) => Alert . alert ( 'My price was ' + product . formattedPrice + ', now it is $50' )
56
- } ) ) ) ( products ) ,
57
- dynamicLayout : _ . flow ( products => _ . take ( products , 3 ) ,
58
- ( products : any [ ] ) =>
59
- _ . map ( products , product => ( {
60
- imageProps : {
61
- source : {
62
- uri : product . mediaUrl
63
- }
64
- } ,
65
- itemSize : { height : 90 } ,
66
- title : 'Title' ,
67
- subtitle : 'subtitle' ,
68
- description : product . name ,
69
- descriptionLines : 2 ,
70
- alignToStart : true ,
71
- onPress : ( ) => Alert . alert ( 'Click!' )
72
- } ) ) ) ( products ) ,
73
- overlayText : _ . flow ( products => _ . take ( products , 2 ) ,
74
- ( products : any [ ] ) =>
75
- _ . map ( products , ( product , index ) => ( {
76
- imageProps : {
77
- source : {
78
- uri : product . mediaUrl
79
- } ,
80
- overlayType : Image . overlayTypes . VERTICAL ,
81
- overlayColor : Colors . white
82
- } ,
83
- itemSize : { height : 240 } ,
84
- overlayText : true ,
85
- title : product . name ,
86
- subtitle : (
87
- < Text >
88
- < Text style = { { textDecorationLine : 'line-through' , color : Colors . grey30 } } > { product . formattedPrice } </ Text >
89
- < Text style = { { textDecorationLine : 'none' } } > { product . formattedPrice } </ Text >
90
- </ Text >
91
- ) ,
92
- description : '4 items' ,
93
- descriptionLines : 2 ,
94
- alignToStart : true ,
95
- onPress : ( ) => Alert . alert ( 'My price was ' + product . formattedPrice + ', now it is $50' ) ,
96
- renderOverlay : ( ) => {
97
- if ( index === 0 ) {
98
- return (
99
- < Text margin-10 text80BO style = { { alignSelf : 'flex-start' , marginTop : 12 , marginLeft : 12 } } >
100
- { product . formattedPrice }
101
- </ Text >
102
- ) ;
103
- }
33
+ }
34
+ } ) )
35
+ . value ( ) ,
36
+ pairs : _ . chain ( products )
37
+ . take ( 2 )
38
+ . map ( product => ( {
39
+ containerProps : { useNative : true , activeScale : 0.97 , activeOpacity : 1 } ,
40
+ renderCustomItem : ( ) => {
41
+ return (
42
+ < Card height = { 150 } activeOpacity = { 1 } >
43
+ < Card . Image style = { { flex : 1 } } source = { { uri : product . mediaUrl } } />
44
+ </ Card >
45
+ ) ;
46
+ } ,
47
+ title : product . name ,
48
+ subtitle : (
49
+ < Text >
50
+ < Text style = { { textDecorationLine : 'line-through' , color : Colors . grey30 } } > { product . formattedPrice } </ Text >
51
+ < Text style = { { textDecorationLine : 'none' } } > $50</ Text >
52
+ </ Text >
53
+ ) ,
54
+ description : product . inventory . status ,
55
+ descriptionLines : 2 ,
56
+ alignToStart : true ,
57
+ onPress : ( ) => Alert . alert ( 'My price was ' + product . formattedPrice + ', now it is $50' )
58
+ } ) )
59
+ . value ( ) ,
60
+ dynamicLayout : _ . chain ( products )
61
+ . take ( 3 )
62
+ . map ( product => ( {
63
+ imageProps : {
64
+ source : {
65
+ uri : product . mediaUrl
104
66
}
105
- } ) ) ) ( products ) ,
106
-
107
- avatars : _ . flow ( products => _ . take ( products , 9 ) ,
108
- ( products : any [ ] ) =>
109
- _ . map ( products , item => ( {
110
- renderCustomItem : ( ) => {
111
- const imageElementElement = item . thumbnail ;
67
+ } ,
68
+ itemSize : { height : 90 } ,
69
+ title : 'Title' ,
70
+ subtitle : 'subtitle' ,
71
+ description : product . name ,
72
+ descriptionLines : 2 ,
73
+ alignToStart : true ,
74
+ onPress : ( ) => Alert . alert ( 'Click!' )
75
+ } ) )
76
+ . value ( ) ,
77
+ overlayText : _ . chain ( products )
78
+ . take ( 2 )
79
+ . map ( ( product , index ) => ( {
80
+ imageProps : {
81
+ source : {
82
+ uri : product . mediaUrl
83
+ } ,
84
+ overlayType : Image . overlayTypes . VERTICAL ,
85
+ overlayColor : Colors . white
86
+ } ,
87
+ itemSize : { height : 240 } ,
88
+ overlayText : true ,
89
+ title : product . name ,
90
+ subtitle : (
91
+ < Text >
92
+ < Text style = { { textDecorationLine : 'line-through' , color : Colors . grey30 } } > { product . formattedPrice } </ Text >
93
+ < Text style = { { textDecorationLine : 'none' } } > { product . formattedPrice } </ Text >
94
+ </ Text >
95
+ ) ,
96
+ description : '4 items' ,
97
+ descriptionLines : 2 ,
98
+ alignToStart : true ,
99
+ onPress : ( ) => Alert . alert ( 'My price was ' + product . formattedPrice + ', now it is $50' ) ,
100
+ renderOverlay : ( ) => {
101
+ if ( index === 0 ) {
112
102
return (
113
- < View flex center marginB-10 >
114
- < Avatar size = { 100 } source = { { uri : imageElementElement } } />
115
- </ View >
103
+ < Text margin-10 text80BO style = { { alignSelf : 'flex-start' , marginTop : 12 , marginLeft : 12 } } >
104
+ { product . formattedPrice }
105
+ </ Text >
116
106
) ;
117
- } ,
118
- onPress : ( ) => Alert . alert ( 'Your choose is ' + item . name ) ,
119
- title : item . name ,
120
- titleLines : 2 ,
121
- titleTypography : 'bodySmall'
122
- } ) ) ) ( products ) ,
107
+ }
108
+ }
109
+ } ) )
110
+ . value ( ) ,
111
+ avatars : _ . chain ( conversations )
112
+ . take ( 9 )
113
+ . map ( item => ( {
114
+ renderCustomItem : ( ) => {
115
+ const imageElementElement = item . thumbnail ;
116
+ return (
117
+ < View flex center marginB-10 >
118
+ < Avatar size = { 100 } source = { { uri : imageElementElement } } />
119
+ </ View >
120
+ ) ;
121
+ } ,
122
+ onPress : ( ) => Alert . alert ( 'Your choose is ' + item . name ) ,
123
+ title : item . name ,
124
+ titleLines : 2 ,
125
+ titleTypography : 'bodySmall'
126
+ } ) )
127
+ . value ( ) ,
123
128
squares : [ Colors . red30 , Colors . yellow30 , Colors . blue30 , Colors . violet30 , Colors . green30 ] . map ( color => ( {
124
129
renderCustomItem : ( ) => < View height = { 50 } backgroundColor = { color } />
125
130
} ) ) ,
@@ -174,7 +179,9 @@ class GridViewScreen extends Component {
174
179
< GridView items = { pairs } numColumns = { 2 } />
175
180
< Text marginV-s5 text60BO >
176
181
Dynamic itemSize
177
- < Text text90 > (Using maxItemWidth)</ Text >
182
+ < Text text90 >
183
+ { ' ' } (Using maxItemWidth)
184
+ </ Text >
178
185
</ Text >
179
186
< GridView items = { dynamicLayout } maxItemWidth = { 120 } />
180
187
< Text marginV-s5 text60BO >
0 commit comments