1
1
import _ from 'lodash' ;
2
2
import React , { Component } from 'react' ;
3
3
import { StyleSheet , ScrollView } from 'react-native' ;
4
- import { Constants , Colors , View , Card , CardProps , Button , Text , Image } from 'react-native-ui-lib' ;
4
+ import { Colors , View , Card , CardProps , Button , Text } from 'react-native-ui-lib' ;
5
5
// @ts -ignore
6
6
import posts from '../../data/posts' ;
7
7
@@ -11,7 +11,6 @@ const cardImage = require('../../assets/images/card-example.jpg');
11
11
const cardImage2 = require ( '../../assets/images/empty-state.jpg' ) ;
12
12
13
13
type CardsScreenProps = { } ;
14
-
15
14
type CardsScreenState = {
16
15
selected1 : boolean ;
17
16
selected2 : boolean ;
@@ -25,6 +24,7 @@ export default class CardsScreen extends Component<CardsScreenProps, CardsScreen
25
24
26
25
renderSelectableCards = ( ) => {
27
26
const { selected1, selected2} = this . state ;
27
+
28
28
return (
29
29
< View row marginV-10 >
30
30
< Card
@@ -35,7 +35,7 @@ export default class CardsScreen extends Component<CardsScreenProps, CardsScreen
35
35
activeOpacity = { 1 }
36
36
marginR-20
37
37
>
38
- < Card . Section source = { cardImage } imageStyle = { { height : '100%' } } />
38
+ < Card . Section imageSource = { cardImage } imageStyle = { { height : '100%' } } />
39
39
</ Card >
40
40
< Card
41
41
height = { 120 }
@@ -44,12 +44,12 @@ export default class CardsScreen extends Component<CardsScreenProps, CardsScreen
44
44
onPress = { ( ) => this . setState ( { selected2 : ! selected2 } ) }
45
45
activeOpacity = { 1 }
46
46
selectionOptions = { {
47
- color : Colors . dark10 ,
47
+ color : Colors . grey10 ,
48
48
indicatorSize : 25 ,
49
49
borderWidth : 3
50
50
} }
51
51
>
52
- < Card . Section source = { cardImage } imageStyle = { { height : '100%' } } />
52
+ < Card . Section imageSource = { cardImage } imageStyle = { { height : '100%' } } />
53
53
</ Card >
54
54
</ View >
55
55
) ;
@@ -59,13 +59,13 @@ export default class CardsScreen extends Component<CardsScreenProps, CardsScreen
59
59
return (
60
60
< Card . Section
61
61
content = { [
62
- { text : 'You’re Invited!' , text70 : true , dark10 : true } ,
62
+ { text : 'You’re Invited!' , text70 : true , grey10 : true } ,
63
63
{
64
64
text : '222 Join Old The Town Barbershop Official Store. Download the Wix app to...' ,
65
65
text80 : true ,
66
- dark10 : true
66
+ grey10 : true
67
67
} ,
68
- { text : 'wix.to/A465c' , text90 : true , dark50 : true }
68
+ { text : 'wix.to/A465c' , text90 : true , grey50 : true }
69
69
] }
70
70
style = { { padding : 20 , flex : 1 } }
71
71
/>
@@ -75,13 +75,14 @@ export default class CardsScreen extends Component<CardsScreenProps, CardsScreen
75
75
renderText = ( ) => {
76
76
return (
77
77
< View padding-20 flex >
78
- < Text text70 dark10 >
78
+ < Text text70 grey10 >
79
79
You’re Invited!
80
80
</ Text >
81
- < Text text80 dark10 >
82
- 222 Join Old The Town Barbershop Official Store. Download the Wix app to...
81
+ < Text text80 grey10 >
82
+ 222 Join Old The Town Barbershop Official Store. Download the Wix app
83
+ to...
83
84
</ Text >
84
- < Text text90 dark50 >
85
+ < Text text90 grey50 >
85
86
wix.to/A465c
86
87
</ Text >
87
88
</ View >
@@ -95,16 +96,25 @@ export default class CardsScreen extends Component<CardsScreenProps, CardsScreen
95
96
height = { 160 }
96
97
style = { { marginBottom : 15 } }
97
98
onPress = { ( ) => { } }
98
- enableBlur
99
99
borderRadius = { borderRadius }
100
100
useNative
101
101
backgroundColor = { Colors . white }
102
102
activeOpacity = { 1 }
103
103
activeScale = { isImageOnLeft ? 0.96 : 1.04 }
104
104
>
105
- { isImageOnLeft && < Card . Section source = { cardImage } imageStyle = { { width : 115 , height : '100%' } } /> }
105
+ { isImageOnLeft && (
106
+ < Card . Section
107
+ imageSource = { cardImage }
108
+ imageStyle = { { width : 115 , height : '100%' } }
109
+ />
110
+ ) }
106
111
{ useSection ? this . renderTextSection ( ) : this . renderText ( ) }
107
- { ! isImageOnLeft && < Card . Section source = { cardImage } imageStyle = { { width : 115 , height : '100%' } } /> }
112
+ { ! isImageOnLeft && (
113
+ < Card . Section
114
+ imageSource = { cardImage }
115
+ imageStyle = { { width : 115 , height : '100%' } }
116
+ />
117
+ ) }
108
118
</ Card >
109
119
) ;
110
120
} ;
@@ -113,13 +123,14 @@ export default class CardsScreen extends Component<CardsScreenProps, CardsScreen
113
123
return (
114
124
< Card style = { { marginBottom : 10 } } onPress = { ( ) => { } } >
115
125
< Card . Section
126
+ bg-white
116
127
content = { [
117
- { text : 'You’re Invited!' , text70 : true , dark10 : true } ,
118
- { text : 'join now' , text90 : true , dark50 : true }
128
+ { text : 'You’re Invited!' , text70 : true , grey10 : true } ,
129
+ { text : 'join now' , text90 : true , grey50 : true }
119
130
] }
120
131
style = { { padding : 20 } }
121
132
/>
122
- < Card . Section source = { cardImage2 } imageStyle = { { height : 120 } } />
133
+ < Card . Section imageSource = { cardImage2 } imageStyle = { { height : 120 } } />
123
134
</ Card >
124
135
) ;
125
136
} ;
@@ -138,9 +149,10 @@ export default class CardsScreen extends Component<CardsScreenProps, CardsScreen
138
149
contentStyle = { { alignItems : 'center' } }
139
150
/>
140
151
< Card . Section
152
+ bg-white
141
153
padding-20
142
154
flex
143
- content = { [ { text : 'All site' , text70 : true , dark10 : true } ] }
155
+ content = { [ { text : 'All site' , text70 : true , grey10 : true } ] }
144
156
contentStyle = { { alignItems : 'center' , margin : 0 , padding : 0 } }
145
157
/>
146
158
</ Card >
@@ -161,8 +173,9 @@ export default class CardsScreen extends Component<CardsScreenProps, CardsScreen
161
173
< Card { ...cardProps } flex marginV-10 onPress = { ( ) => { } } useNative activeOpacity = { 1 } activeScale = { 0.96 } >
162
174
{ image }
163
175
< Card . Section
176
+ bg-white
164
177
padding-20
165
- content = { [ { text : 'All site' , text70 : true , dark10 : true } ] }
178
+ content = { [ { text : 'All site' , text70 : true , grey10 : true } ] }
166
179
contentStyle = { { alignItems : 'center' } }
167
180
/>
168
181
</ Card >
@@ -178,7 +191,7 @@ export default class CardsScreen extends Component<CardsScreenProps, CardsScreen
178
191
< Card . Section
179
192
flex
180
193
backgroundColor = { Colors . blue20 }
181
- source = { featureIcon }
194
+ imageSource = { featureIcon }
182
195
imageStyle = { {
183
196
width : 25 ,
184
197
height : 25 ,
@@ -195,7 +208,7 @@ export default class CardsScreen extends Component<CardsScreenProps, CardsScreen
195
208
this . renderComplexImage ( { 'marginL-5' : true } ,
196
209
< Card . Section
197
210
flex
198
- source = { cardImage2 }
211
+ imageSource = { cardImage2 }
199
212
imageStyle = { { height : '100%' } }
200
213
content = { [
201
214
{ text : 'Special sale!' , text70 : true , blue10 : true } ,
@@ -214,12 +227,12 @@ export default class CardsScreen extends Component<CardsScreenProps, CardsScreen
214
227
215
228
renderNumbers = ( ) => {
216
229
return (
217
- < ScrollView style = { { height : 100 } } horizontal showsHorizontalScrollIndicator = { false } >
230
+ < ScrollView style = { { height : 100 , marginBottom : 20 } } horizontal showsHorizontalScrollIndicator = { false } >
218
231
{ _ . times ( 4 , i => {
219
232
return (
220
- < Card key = { i } width = { 100 } style = { { marginRight : 20 } } >
233
+ < Card key = { i } width = { 100 } style = { { marginRight : 20 } } backgroundColor = { Colors . white } >
221
234
< View padding-15 >
222
- < Text text30 dark30 >
235
+ < Text text30 grey30 >
223
236
{ i }
224
237
</ Text >
225
238
</ View >
@@ -238,44 +251,23 @@ export default class CardsScreen extends Component<CardsScreenProps, CardsScreen
238
251
) ;
239
252
} ;
240
253
241
- renderBackgroundTypes = ( ) => {
242
- return (
243
- < View row marginV-10 >
244
- { this . renderBackgroundCard ( { 'marginR-20' : true , style : { backgroundColor : Colors . dark60 } } ,
245
- < Text text80 center white >
246
- With custom background color
247
- </ Text > ) }
248
- { this . renderBackgroundCard ( {
249
- 'marginR-20' : true ,
250
- style : { backgroundColor : Colors . rgba ( Colors . dark60 , 0.75 ) }
251
- } ,
252
- < Text text70 center white >
253
- With opacity
254
- </ Text > ) }
255
- { Constants . isIOS &&
256
- this . renderBackgroundCard ( { enableBlur : true , 'marginL-20' : true } ,
257
- < >
258
- < Text text70 dark20 center >
259
- With Blur effect
260
- </ Text >
261
- < Text text80 dark20 center >
262
- (iOS only)
263
- </ Text >
264
- </ > ) }
265
- </ View >
266
- ) ;
267
- } ;
268
-
269
254
renderComplexExample = ( ) => {
270
255
return _ . map ( posts , ( post , i ) => {
271
256
const statusColor = post . status === 'Published' ? Colors . green30 : Colors . orange30 ;
272
257
273
258
return (
274
- < Card key = { i } style = { { marginBottom : 15 } } onPress = { ( ) => console . log ( 'press on a card' ) } >
275
- < Card . Section source = { post . coverImage } imageStyle = { { height : 160 } } />
259
+ < Card
260
+ key = { i }
261
+ style = { { marginBottom : 15 } }
262
+ onPress = { ( ) => console . log ( 'press on a card' ) }
263
+ >
264
+ < Card . Section
265
+ imageSource = { post . coverImage }
266
+ imageStyle = { { height : 160 } }
267
+ />
276
268
277
- < View padding-20 >
278
- < Text text40 color = { Colors . dark10 } >
269
+ < View padding-20 bg-white >
270
+ < Text text40 color = { Colors . grey10 } >
279
271
{ post . title }
280
272
</ Text >
281
273
< View row >
@@ -285,16 +277,22 @@ export default class CardsScreen extends Component<CardsScreenProps, CardsScreen
285
277
< Text text90 > | { post . timestamp } </ Text >
286
278
</ View >
287
279
288
- < Text text70 color = { Colors . dark10 } >
280
+ < Text text70 color = { Colors . grey10 } >
289
281
{ post . description }
290
282
</ Text >
291
283
292
284
< View >
293
- < Text text90 color = { Colors . dark50 } >
285
+ < Text text90 color = { Colors . grey50 } >
294
286
{ post . likes } Likes
295
287
</ Text >
296
288
< View row right >
297
- < Button style = { { marginRight : 10 } } text90 link iconSource = { featureIcon } label = "Feature" />
289
+ < Button
290
+ style = { { marginRight : 10 } }
291
+ text90
292
+ link
293
+ iconSource = { featureIcon }
294
+ label = "Feature"
295
+ />
298
296
< Button text90 link iconSource = { shareIcon } label = "Share" />
299
297
</ View >
300
298
</ View >
@@ -309,7 +307,6 @@ export default class CardsScreen extends Component<CardsScreenProps, CardsScreen
309
307
< >
310
308
{ this . renderNumbers ( ) }
311
309
{ this . renderImageOnBottom ( ) }
312
- { this . renderBackgroundTypes ( ) }
313
310
{ this . renderComplexExample ( ) }
314
311
</ >
315
312
) ;
0 commit comments