1
1
import React , { Component } from 'react' ;
2
2
import { ScrollView , StyleSheet , Alert , Image } from 'react-native' ;
3
- import { Text , View , Assets , Constants , Button , Colors , Typography } from 'react-native-ui-lib' ; //eslint-disable-line
3
+ import {
4
+ Text ,
5
+ View ,
6
+ Assets ,
7
+ Constants ,
8
+ Button ,
9
+ Colors ,
10
+ Typography
11
+ } from 'react-native-ui-lib' ; //eslint-disable-line
4
12
5
13
const ButtonSpace = 20 ;
6
14
const plusIcon = require ( '../../assets/icons/plus.png' ) ;
@@ -35,7 +43,9 @@ export default class ButtonsScreen extends Component {
35
43
36
44
return (
37
45
< View useSafeArea >
38
- { ! ! snippet && < SnippetBlock snippet = { snippet } onClose = { ( ) => this . hideSnippet ( ) } /> }
46
+ { ! ! snippet && (
47
+ < SnippetBlock snippet = { snippet } onClose = { ( ) => this . hideSnippet ( ) } />
48
+ ) }
39
49
< ScrollView showsVerticalScrollIndicator = { false } >
40
50
< View centerH >
41
51
< Text style = { styles . title } > Buttons</ Text >
@@ -60,7 +70,7 @@ export default class ButtonsScreen extends Component {
60
70
outlineColor = { Colors . black }
61
71
label = "SHOP HOLIDAY"
62
72
borderRadius = { 0 }
63
- size = " medium"
73
+ size = { Button . sizes . medium }
64
74
text60
65
75
labelStyle = { { fontWeight : '700' , letterSpacing : 4 } }
66
76
style = { { borderWidth : 3 , marginBottom : ButtonSpace } }
@@ -69,7 +79,7 @@ export default class ButtonsScreen extends Component {
69
79
< Button
70
80
backgroundColor = "#439F4F"
71
81
label = "MOVE TO BAG"
72
- size = " small"
82
+ size = { Button . sizes . small }
73
83
borderRadius = { 0 }
74
84
text90
75
85
labelStyle = { { fontWeight : '500' , letterSpacing : - 0.5 } }
@@ -78,33 +88,83 @@ export default class ButtonsScreen extends Component {
78
88
< Button
79
89
backgroundColor = "#3C9BF0"
80
90
label = "Follow"
81
- size = " small"
91
+ size = { Button . sizes . small }
82
92
borderRadius = { 3 }
83
93
text90
84
94
labelStyle = { { fontWeight : '500' } }
85
95
style = { { marginBottom : ButtonSpace } }
86
96
/>
87
97
88
98
< Text style = { styles . header } > Do you have it in small?</ Text >
89
- < Button label = { 'Default' } style = { { marginBottom : ButtonSpace } } />
90
- < Button label = { 'Medium' } size = { Button . sizes . medium } style = { { marginBottom : ButtonSpace } } />
91
- < Button label = { 'Small' } size = { Button . sizes . small } style = { { marginBottom : ButtonSpace } } />
92
- < Button label = { 'xSmall' } size = { Button . sizes . xSmall } style = { { marginBottom : ButtonSpace } } />
93
- < Button label = { 'This is a button with long text' } style = { { marginBottom : ButtonSpace } } />
99
+ < Button label = { 'Default' } style = { { marginBottom : ButtonSpace } } />
100
+ < Button
101
+ label = { 'Medium' }
102
+ size = { Button . sizes . medium }
103
+ style = { { marginBottom : ButtonSpace } }
104
+ />
105
+ < Button
106
+ label = { 'Small' }
107
+ size = { Button . sizes . small }
108
+ style = { { marginBottom : ButtonSpace } }
109
+ />
110
+ < Button
111
+ label = { 'xSmall' }
112
+ size = { Button . sizes . xSmall }
113
+ style = { { marginBottom : ButtonSpace } }
114
+ />
115
+ < Button
116
+ label = { 'This is a button with long text' }
117
+ style = { { marginBottom : ButtonSpace } }
118
+ />
94
119
95
- < Button label = { 'Disabled' } disabled style = { { marginBottom : ButtonSpace } } />
120
+ < Button
121
+ label = { 'Disabled' }
122
+ disabled
123
+ style = { { marginBottom : ButtonSpace } }
124
+ />
96
125
97
126
< Text style = { styles . header } > Do you have it in red?</ Text >
98
- < Button label = { 'Bold!' } labelStyle = { { fontWeight : '800' } } style = { { marginBottom : ButtonSpace } } />
99
- < Button label = { 'Red Button' } backgroundColor = { Colors . red30 } style = { { marginBottom : ButtonSpace } } />
100
- < Button label = { 'Dark Label' } red10 backgroundColor = { Colors . red50 } style = { { marginBottom : ButtonSpace } } />
101
- < Button label = { 'With Shadow' } enableShadow style = { { marginBottom : ButtonSpace } } />
127
+ < Button
128
+ label = { 'Bold!' }
129
+ labelStyle = { { fontWeight : '800' } }
130
+ style = { { marginBottom : ButtonSpace } }
131
+ />
132
+ < Button
133
+ label = { 'Red Button' }
134
+ backgroundColor = { Colors . red30 }
135
+ style = { { marginBottom : ButtonSpace } }
136
+ />
137
+ < Button
138
+ label = { 'Dark Label' }
139
+ red10
140
+ backgroundColor = { Colors . red50 }
141
+ style = { { marginBottom : ButtonSpace } }
142
+ />
143
+ < Button
144
+ label = { 'With Shadow' }
145
+ enableShadow
146
+ style = { { marginBottom : ButtonSpace } }
147
+ />
102
148
103
149
< Text style = { styles . header } > Inside Out</ Text >
104
- < Button label = "Outline" outline style = { { marginBottom : ButtonSpace } } />
105
- < Button label = "Outline M" size = { Button . sizes . medium } outline style = { { marginBottom : ButtonSpace } } />
150
+ < Button
151
+ label = "Outline"
152
+ outline
153
+ style = { { marginBottom : ButtonSpace } }
154
+ />
155
+ < Button
156
+ label = "Outline M"
157
+ size = { Button . sizes . medium }
158
+ outline
159
+ style = { { marginBottom : ButtonSpace } }
160
+ />
106
161
107
- < Button label = "Outline S" size = { Button . sizes . small } outline style = { { marginBottom : ButtonSpace } } />
162
+ < Button
163
+ label = "Outline S"
164
+ size = { Button . sizes . small }
165
+ outline
166
+ style = { { marginBottom : ButtonSpace } }
167
+ />
108
168
< Button
109
169
label = "Red Outline"
110
170
outline
@@ -120,7 +180,12 @@ export default class ButtonsScreen extends Component {
120
180
style = { { marginBottom : ButtonSpace } }
121
181
/>
122
182
123
- < Button label = "Disabled Outline" outline disabled style = { { marginBottom : ButtonSpace } } />
183
+ < Button
184
+ label = "Disabled Outline"
185
+ outline
186
+ disabled
187
+ style = { { marginBottom : ButtonSpace } }
188
+ />
124
189
125
190
< Button
126
191
label = "disabled outline + icon"
@@ -138,23 +203,23 @@ export default class ButtonsScreen extends Component {
138
203
style = { { margin : ButtonSpace } }
139
204
iconSource = { settingsIcon }
140
205
iconStyle = { { tintColor : Colors . white } }
141
- size = { ' xSmall' }
206
+ size = { Button . sizes . xSmall }
142
207
/>
143
208
< Button
144
209
round
145
210
backgroundColor = "#ff4fa7"
146
211
style = { { margin : ButtonSpace } }
147
212
iconSource = { settingsIcon }
148
213
iconStyle = { { tintColor : Colors . white } }
149
- size = { ' small' }
214
+ size = { Button . sizes . small }
150
215
/>
151
216
< Button
152
217
round
153
218
backgroundColor = "#ff369b"
154
219
style = { { margin : ButtonSpace } }
155
220
iconSource = { settingsIcon }
156
221
iconStyle = { { tintColor : Colors . white } }
157
- size = { ' medium' }
222
+ size = { Button . sizes . medium }
158
223
/>
159
224
< Button
160
225
round
@@ -198,40 +263,85 @@ export default class ButtonsScreen extends Component {
198
263
199
264
< Text style = { styles . header } > Let your curves show</ Text >
200
265
{ Constants . isIOS ? (
201
- < Button label = { 'Squarish' } borderRadius = { 2 } style = { { marginBottom : ButtonSpace } } />
266
+ < Button
267
+ label = { 'Squarish' }
268
+ borderRadius = { 2 }
269
+ style = { { marginBottom : ButtonSpace } }
270
+ />
202
271
) : (
203
- < Button label = { 'Roundish' } borderRadius = { 15 } style = { { marginBottom : ButtonSpace } } />
272
+ < Button
273
+ label = { 'Roundish' }
274
+ borderRadius = { 15 }
275
+ style = { { marginBottom : ButtonSpace } }
276
+ />
204
277
) }
205
- < Button label = { 'Custom' } borderRadius = { 22 } style = { { marginBottom : ButtonSpace } } />
206
- < Button label = { 'No Radius' } borderRadius = { 0 } style = { { marginBottom : ButtonSpace } } />
278
+ < Button
279
+ label = { 'Custom' }
280
+ borderRadius = { 22 }
281
+ style = { { marginBottom : ButtonSpace } }
282
+ />
283
+ < Button
284
+ label = { 'No Radius' }
285
+ borderRadius = { 0 }
286
+ style = { { marginBottom : ButtonSpace } }
287
+ />
207
288
< Text style = { styles . header } > Special Cases</ Text >
208
289
209
290
< View marginB-20 row >
210
- < Button iconSource = { plusIcon } style = { { width : 44 , height : 44 } } color = { Colors . white } />
291
+ < Button
292
+ iconSource = { plusIcon }
293
+ style = { { width : 44 , height : 44 } }
294
+ color = { Colors . white }
295
+ />
211
296
212
- < Button iconSource = { plusIcon } style = { { width : 44 , height : 44 } } link />
297
+ < Button
298
+ iconSource = { plusIcon }
299
+ style = { { width : 44 , height : 44 } }
300
+ link
301
+ />
213
302
214
- < Button iconSource = { plusIcon } outline style = { { width : 44 , height : 44 } } outlineColor = { Colors . red50 } />
303
+ < Button
304
+ iconSource = { plusIcon }
305
+ outline
306
+ style = { { width : 44 , height : 44 } }
307
+ outlineColor = { Colors . red50 }
308
+ />
215
309
</ View >
216
310
217
311
< Button
218
312
style = { { marginBottom : ButtonSpace } }
219
- size = " small"
313
+ size = { Button . sizes . small }
220
314
iconSource = { plusIcon }
221
315
iconStyle = { { tintColor : 'white' } }
222
316
label = "Icon"
223
317
/>
224
318
225
- < Button style = { { marginBottom : ButtonSpace } } blue30 outline iconSource = { plusIcon } label = "Icon" />
319
+ < Button
320
+ style = { { marginBottom : ButtonSpace } }
321
+ blue30
322
+ outline
323
+ iconSource = { plusIcon }
324
+ label = "Icon"
325
+ />
226
326
227
- < Button onPress = { ( ) => Alert . alert ( 'Button #3' ) } style = { { marginBottom : ButtonSpace } } >
327
+ < Button
328
+ onPress = { ( ) => Alert . alert ( 'Button #3' ) }
329
+ style = { { marginBottom : ButtonSpace } }
330
+ >
228
331
< Text >
229
- { Assets . emojis . cloud } { Assets . emojis . airplane } { Assets . emojis . sunny }
332
+ { Assets . emojis . cloud } { Assets . emojis . airplane } { ' ' }
333
+ { Assets . emojis . sunny }
230
334
</ Text >
231
335
</ Button >
232
- < Button outline onPress = { ( ) => Alert . alert ( 'Button #3' ) } style = { { marginBottom : ButtonSpace } } >
233
- < Image source = { plusIcon } />
234
- < Text style = { { marginLeft : 10 , color : Colors . blue30 } } > Custom Icon</ Text >
336
+ < Button
337
+ outline
338
+ onPress = { ( ) => Alert . alert ( 'Button #3' ) }
339
+ style = { { marginBottom : ButtonSpace } }
340
+ >
341
+ < Image source = { plusIcon } />
342
+ < Text style = { { marginLeft : 10 , color : Colors . blue30 } } >
343
+ Custom Icon
344
+ </ Text >
235
345
</ Button >
236
346
< Button
237
347
label = { 'Custom Icon Renderer' }
@@ -250,7 +360,13 @@ export default class ButtonsScreen extends Component {
250
360
/>
251
361
) }
252
362
/>
253
- < Button text90 link style = { { marginBottom : ButtonSpace } } iconSource = { plusIcon } label = "link icon" />
363
+ < Button
364
+ text90
365
+ link
366
+ style = { { marginBottom : ButtonSpace } }
367
+ iconSource = { plusIcon }
368
+ label = "link icon"
369
+ />
254
370
255
371
< Button
256
372
text90
@@ -261,9 +377,13 @@ export default class ButtonsScreen extends Component {
261
377
label = "disabled link"
262
378
/>
263
379
264
- < Button label = "link button" link style = { { marginBottom : ButtonSpace } } />
380
+ < Button
381
+ label = "link button"
382
+ link
383
+ style = { { marginBottom : ButtonSpace } }
384
+ />
265
385
266
- < Button label = "Icon on right" iconSource = { plusIcon } iconOnRight />
386
+ < Button label = "Icon on right" iconSource = { plusIcon } iconOnRight />
267
387
</ View >
268
388
269
389
< View marginT-20 >
@@ -272,10 +392,23 @@ export default class ButtonsScreen extends Component {
272
392
Full Width Buttons
273
393
</ Text >
274
394
</ View >
275
- < Button fullWidth label = "Full Width" marginB-10 />
395
+ < Button fullWidth label = "Full Width" marginB-10 />
276
396
277
- < Button fullWidth size = "medium" bg-red70 dark10 label = "Medium Size Full Width" marginB-10 />
278
- < Button fullWidth size = "small" bg-green70 green10 label = "Small Size Full Width" />
397
+ < Button
398
+ fullWidth
399
+ size = "medium"
400
+ bg-red70
401
+ dark10
402
+ label = "Medium Size Full Width"
403
+ marginB-10
404
+ />
405
+ < Button
406
+ fullWidth
407
+ size = "small"
408
+ bg-green70
409
+ green10
410
+ label = "Small Size Full Width"
411
+ />
279
412
</ View >
280
413
</ ScrollView >
281
414
</ View >
@@ -285,7 +418,13 @@ export default class ButtonsScreen extends Component {
285
418
286
419
const SnippetBlock = ( { snippet, onClose} ) => {
287
420
return (
288
- < View flex spread bg-dark10 padding-15 style = { { ...StyleSheet . absoluteFillObject , zIndex : 1 } } >
421
+ < View
422
+ flex
423
+ spread
424
+ bg-dark10
425
+ padding-15
426
+ style = { { ...StyleSheet . absoluteFillObject , zIndex : 1 } }
427
+ >
289
428
< View >
290
429
< Text white text40 marginB-20 >
291
430
Snippet Code
@@ -296,7 +435,14 @@ const SnippetBlock = ({snippet, onClose}) => {
296
435
</ View >
297
436
< View row centerH >
298
437
{ /* <Button marginR-10 white outline outlineColor={Colors.white} size='small' label='copy'/> */ }
299
- < Button white outline outlineColor = { Colors . white } size = "small" label = "close" onPress = { onClose } />
438
+ < Button
439
+ white
440
+ outline
441
+ outlineColor = { Colors . white }
442
+ size = { Button . sizes . small }
443
+ label = "close"
444
+ onPress = { onClose }
445
+ />
300
446
</ View >
301
447
</ View >
302
448
) ;
0 commit comments