-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathListItems.js
123 lines (119 loc) · 3.63 KB
/
ListItems.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import * as React from 'react'
import { ListItem, Text, Overlay, PricingCard } from 'react-native-elements'
import TouchableScale from 'react-native-touchable-scale'
export default function ListItems() {
const listAvatars = [
{
name: 'Amy Farha',
avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/ladylexy/128.jpg',
subtitle: 'Vice President'
},
{
name: 'Chris Jackson',
avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/adhamdannaway/128.jpg',
subtitle: 'Vice Chairman'
},
]
const listIcons = [
{
title: 'Appointments',
icon: 'av-timer'
},
{
title: 'Trips',
icon: 'flight-takeoff'
},
]
const [overlayVisible, setOverlayVisible] = React.useState(false)
const toggleOverlay = () => setOverlayVisible(!overlayVisible)
return (
<>
<Text h3>ListItems</Text>
<Text h4>Implementation with Avatar</Text>
{
listAvatars.map((item, index) => (
<ListItem
key={index}
leftAvatar={{ source: { uri: item.avatar_url } }}
title={item.name}
subtitle={item.subtitle}
bottomDivider
/>
))
}
<Text h4>Implementation with Icons</Text>
{
listIcons.map((item, index) => (
<ListItem
key={index}
leftIcon={ {name: item.icon} }
title={item.title}
bottomDivider
chevron
/>
))
}
<Text h4>Using RN FlatList & Custom Avatar</Text>
{
listAvatars.map((item, index) => (
<ListItem
key={index}
leftAvatar={{
source: item.avatar_url && { uri: item.avatar_url },
title: item.name[0]
}}
badge={ {value: 3, textStyle: {color: 'orange' }, containerStyle: { marginTop: -20 }}}
title={item.name}
bottomDivider
chevron
/>
))
}
<Text h4>Linear Gradient + Scale Feedback</Text>
{
listAvatars.map((item, index) => (
<ListItem
key={index}
Component={TouchableScale}
leftAvatar={{rounded: true, source: {uri: item.avatar_url}}}
linearGradientProps={{
colors: ['#FF9800', '#F44336'],
start: { x: 1, y: 0 },
end: { x: 0.2, y: 0 },
}}
friction={90}
tension={100}
activeScale={0.95}
title={item.name}
titleStyle={{ color: 'white', fontWeight: 'bold' }}
subtitle={item.subtitle}
subtitleStyle={{ color: 'white' }}
chevron={{ color: 'white' }}
containerStyle={{borderRadius: 20, margin: 10}}
// contentContainerStyle={{borderWidth: 3}}
checkmark={{color: '#fff'}}
// rightTitle="RightTitle"
// rightSubtitle="RightSubtitle"
rightTitleStyle={{color: '#fff'}}
switch
badge
onPress={() => toggleOverlay()}
/>
))
}
<Text h4>React Native Touchable Scale</Text>
<TouchableScale style={{marginVertical: 4}} activeScale={0.7}>
<Text>This is a Touchable Scale.This is a Touchable Scale.</Text>
</TouchableScale>
<Overlay isVisible={overlayVisible} onBackdropPress={toggleOverlay}>
<PricingCard
title="Free"
price="$0"
info={['1 User', 'Basic Support', 'All Core Features']}
button={{ title: 'GET STARTED', icon: 'flight-takeoff' }}
color="steelblue"
/>
</Overlay>
</>
)
}