Skip to content

Commit 6b907ce

Browse files
committed
Merge branch 'master' into typescript/tab-controller-move-to-function-component-2
* master: export Button enums fix typings Fix lint issues Fix Switch color based props to use ColorValue typing Fix manual placeholderTextColor typing for ChipsInput Fix manualy typing of ChipsInput for selectionColor prop fix @types/react-native version to 0.63.4 Fix rn63 typings (#1100) Revert "fix for tabbar types for scrollbar" fix for tabbar types for scrollbar ScrollBar - TS migration (#1078) TabBar refactor (#1076) Update reanimated and gesture-handler to their latest version cleanup Cards example screen upgraded expo demo app to expo v40 (#1096) Update RNN version # Conflicts: # src/components/tabController/TabBar.tsx
2 parents 2377b58 + 4454cb5 commit 6b907ce

File tree

66 files changed

+2185
-1077
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2185
-1077
lines changed

demo/src/screens/componentScreens/CardsScreen.tsx

Lines changed: 46 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
import _ from 'lodash';
22
import React, {Component} from 'react';
33
import {StyleSheet, ScrollView} from 'react-native';
4-
import {
5-
Constants,
6-
Colors,
7-
View,
8-
Card,
9-
CardProps,
10-
Button,
11-
Text,
12-
Image
13-
} from 'react-native-ui-lib';
4+
import {Constants, Colors, View, Card, CardProps, Button, Text, Image} from 'react-native-ui-lib';
145
// @ts-ignore
156
import posts from '../../data/posts';
167

@@ -26,10 +17,7 @@ type CardsScreenState = {
2617
selected2: boolean;
2718
};
2819

29-
export default class CardsScreen extends Component<
30-
CardsScreenProps,
31-
CardsScreenState
32-
> {
20+
export default class CardsScreen extends Component<CardsScreenProps, CardsScreenState> {
3321
state = {
3422
selected1: true,
3523
selected2: true
@@ -47,7 +35,7 @@ export default class CardsScreen extends Component<
4735
activeOpacity={1}
4836
marginR-20
4937
>
50-
<Card.Section source={cardImage} imageStyle={{height: '100%'}} />
38+
<Card.Section source={cardImage} imageStyle={{height: '100%'}}/>
5139
</Card>
5240
<Card
5341
height={120}
@@ -61,7 +49,7 @@ export default class CardsScreen extends Component<
6149
borderWidth: 3
6250
}}
6351
>
64-
<Card.Section source={cardImage} imageStyle={{height: '100%'}} />
52+
<Card.Section source={cardImage} imageStyle={{height: '100%'}}/>
6553
</Card>
6654
</View>
6755
);
@@ -73,8 +61,7 @@ export default class CardsScreen extends Component<
7361
content={[
7462
{text: 'You’re Invited!', text70: true, dark10: true},
7563
{
76-
text:
77-
'222 Join Old The Town Barbershop Official Store. Download the Wix app to...',
64+
text: '222 Join Old The Town Barbershop Official Store. Download the Wix app to...',
7865
text80: true,
7966
dark10: true
8067
},
@@ -92,8 +79,7 @@ export default class CardsScreen extends Component<
9279
You’re Invited!
9380
</Text>
9481
<Text text80 dark10>
95-
222 Join Old The Town Barbershop Official Store. Download the Wix app
96-
to...
82+
222 Join Old The Town Barbershop Official Store. Download the Wix app to...
9783
</Text>
9884
<Text text90 dark50>
9985
wix.to/A465c
@@ -102,11 +88,7 @@ export default class CardsScreen extends Component<
10288
);
10389
};
10490

105-
renderHorizontalCard = (
106-
isImageOnLeft: boolean,
107-
borderRadius: number,
108-
useSection: boolean
109-
) => {
91+
renderHorizontalCard = (isImageOnLeft: boolean, borderRadius: number, useSection: boolean) => {
11092
return (
11193
<Card
11294
row
@@ -120,19 +102,9 @@ export default class CardsScreen extends Component<
120102
activeOpacity={1}
121103
activeScale={isImageOnLeft ? 0.96 : 1.04}
122104
>
123-
{isImageOnLeft && (
124-
<Card.Section
125-
source={cardImage}
126-
imageStyle={{width: 115, height: '100%'}}
127-
/>
128-
)}
105+
{isImageOnLeft && <Card.Section source={cardImage} imageStyle={{width: 115, height: '100%'}}/>}
129106
{useSection ? this.renderTextSection() : this.renderText()}
130-
{!isImageOnLeft && (
131-
<Card.Section
132-
source={cardImage}
133-
imageStyle={{width: 115, height: '100%'}}
134-
/>
135-
)}
107+
{!isImageOnLeft && <Card.Section source={cardImage} imageStyle={{width: 115, height: '100%'}}/>}
136108
</Card>
137109
);
138110
};
@@ -147,22 +119,14 @@ export default class CardsScreen extends Component<
147119
]}
148120
style={{padding: 20}}
149121
/>
150-
<Card.Section source={cardImage2} imageStyle={{height: 120}} />
122+
<Card.Section source={cardImage2} imageStyle={{height: 120}}/>
151123
</Card>
152124
);
153125
};
154126

155127
renderCoupon = (cardProps: CardProps) => {
156128
return (
157-
<Card
158-
{...cardProps}
159-
flex
160-
height={160}
161-
onPress={() => {}}
162-
useNative
163-
activeOpacity={1}
164-
activeScale={0.96}
165-
>
129+
<Card {...cardProps} flex height={160} onPress={() => {}} useNative activeOpacity={1} activeScale={0.96}>
166130
<Card.Section
167131
bg-red30
168132
padding-20
@@ -194,15 +158,7 @@ export default class CardsScreen extends Component<
194158

195159
renderComplexImage = (cardProps: CardProps, image: React.ReactNode) => {
196160
return (
197-
<Card
198-
{...cardProps}
199-
flex
200-
marginV-10
201-
onPress={() => {}}
202-
useNative
203-
activeOpacity={1}
204-
activeScale={0.96}
205-
>
161+
<Card {...cardProps} flex marginV-10 onPress={() => {}} useNative activeOpacity={1} activeScale={0.96}>
206162
{image}
207163
<Card.Section
208164
padding-20
@@ -218,8 +174,7 @@ export default class CardsScreen extends Component<
218174
<View row spread height={160}>
219175
{
220176
// Icon
221-
this.renderComplexImage(
222-
{'marginR-5': true},
177+
this.renderComplexImage({'marginR-5': true},
223178
<Card.Section
224179
flex
225180
backgroundColor={Colors.blue20}
@@ -233,13 +188,11 @@ export default class CardsScreen extends Component<
233188
style={{
234189
justifyContent: 'center'
235190
}}
236-
/>
237-
)
191+
/>)
238192
}
239193
{
240194
// Image with overlay content
241-
this.renderComplexImage(
242-
{'marginL-5': true},
195+
this.renderComplexImage({'marginL-5': true},
243196
<Card.Section
244197
flex
245198
source={cardImage2}
@@ -253,21 +206,16 @@ export default class CardsScreen extends Component<
253206
alignItems: 'center',
254207
justifyContent: 'center'
255208
}}
256-
/>
257-
)
209+
/>)
258210
}
259211
</View>
260212
);
261213
};
262214

263215
renderNumbers = () => {
264216
return (
265-
<ScrollView
266-
style={{height: 100}}
267-
horizontal
268-
showsHorizontalScrollIndicator={false}
269-
>
270-
{_.times(4, (i) => {
217+
<ScrollView style={{height: 100}} horizontal showsHorizontalScrollIndicator={false}>
218+
{_.times(4, i => {
271219
return (
272220
<Card key={i} width={100} style={{marginRight: 20}}>
273221
<View padding-15>
@@ -293,52 +241,38 @@ export default class CardsScreen extends Component<
293241
renderBackgroundTypes = () => {
294242
return (
295243
<View row marginV-10>
296-
{this.renderBackgroundCard(
297-
{'marginR-20': true, style: {backgroundColor: Colors.dark60}},
244+
{this.renderBackgroundCard({'marginR-20': true, style: {backgroundColor: Colors.dark60}},
298245
<Text text80 center white>
299246
With custom background color
300-
</Text>
301-
)}
302-
{this.renderBackgroundCard(
303-
{
304-
'marginR-20': true,
305-
style: {backgroundColor: Colors.rgba(Colors.dark60, 0.75)}
306-
},
307-
<Text text70 center white>
247+
</Text>)}
248+
{this.renderBackgroundCard({
249+
'marginR-20': true,
250+
style: {backgroundColor: Colors.rgba(Colors.dark60, 0.75)}
251+
},
252+
<Text text70 center white>
308253
With opacity
309-
</Text>
310-
)}
254+
</Text>)}
311255
{Constants.isIOS &&
312-
this.renderBackgroundCard(
313-
{enableBlur: true, 'marginL-20': true},
256+
this.renderBackgroundCard({enableBlur: true, 'marginL-20': true},
314257
<>
315258
<Text text70 dark20 center>
316259
With Blur effect
317260
</Text>
318261
<Text text80 dark20 center>
319262
(iOS only)
320263
</Text>
321-
</>
322-
)}
264+
</>)}
323265
</View>
324266
);
325267
};
326268

327269
renderComplexExample = () => {
328270
return _.map(posts, (post, i) => {
329-
const statusColor =
330-
post.status === 'Published' ? Colors.green30 : Colors.orange30;
271+
const statusColor = post.status === 'Published' ? Colors.green30 : Colors.orange30;
331272

332273
return (
333-
<Card
334-
key={i}
335-
style={{marginBottom: 15}}
336-
onPress={() => console.log('press on a card')}
337-
>
338-
<Card.Section
339-
source={post.coverImage}
340-
imageStyle={{height: 160}}
341-
/>
274+
<Card key={i} style={{marginBottom: 15}} onPress={() => console.log('press on a card')}>
275+
<Card.Section source={post.coverImage} imageStyle={{height: 160}}/>
342276

343277
<View padding-20>
344278
<Text text40 color={Colors.dark10}>
@@ -360,14 +294,8 @@ export default class CardsScreen extends Component<
360294
{post.likes} Likes
361295
</Text>
362296
<View row right>
363-
<Button
364-
style={{marginRight: 10}}
365-
text90
366-
link
367-
iconSource={featureIcon}
368-
label="Feature"
369-
/>
370-
<Button text90 link iconSource={shareIcon} label="Share" />
297+
<Button style={{marginRight: 10}} text90 link iconSource={featureIcon} label="Feature"/>
298+
<Button text90 link iconSource={shareIcon} label="Share"/>
371299
</View>
372300
</View>
373301
</View>
@@ -380,6 +308,7 @@ export default class CardsScreen extends Component<
380308
return (
381309
<>
382310
{this.renderNumbers()}
311+
{this.renderImageOnBottom()}
383312
{this.renderBackgroundTypes()}
384313
{this.renderComplexExample()}
385314
</>
@@ -388,25 +317,27 @@ export default class CardsScreen extends Component<
388317

389318
render() {
390319
return (
391-
<View>
392-
<Image
393-
style={StyleSheet.absoluteFillObject}
394-
source={{
395-
uri:
396-
'https://images.pexels.com/photos/1005644/pexels-photo-1005644.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260'
397-
}}
398-
/>
399-
320+
<View bg-grey70>
400321
<ScrollView>
401322
<View flex padding-20>
323+
<Text h1 marginB-s4>Cards</Text>
324+
<Text h3>Selectable Cards</Text>
402325
{this.renderSelectableCards()}
326+
<Text h3 marginB-s4>
327+
Horizontal Cards
328+
</Text>
403329
{this.renderHorizontalCard(true, 0, true)}
404330
{this.renderHorizontalCard(true, 20, false)}
405331
{this.renderHorizontalCard(false, 0, false)}
406332
{this.renderHorizontalCard(false, 20, true)}
407-
{this.renderImageOnBottom()}
333+
<Text h3 marginB-s4>
334+
Card Sections
335+
</Text>
408336
{this.renderCoupons()}
409337
{this.renderComplexImages()}
338+
<Text h3 marginB-s4>
339+
Others
340+
</Text>
410341
{this.renderCustomContent()}
411342
</View>
412343
</ScrollView>

0 commit comments

Comments
 (0)