-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathevent-list.js
More file actions
54 lines (49 loc) · 1.46 KB
/
event-list.js
File metadata and controls
54 lines (49 loc) · 1.46 KB
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
import React, { Component } from 'react'
import { View, Text, SectionList, StyleSheet} from 'react-native'
import Card from './common/card'
class EventList extends Component {
static propTypes = {
};
render() {
return <SectionList
renderItem={({ item, index }) => (
<Card event={item} key={index}>
<Text>{item.title}</Text>
<Text>{item.when}</Text>
<Text>{item.where}</Text>
</Card>
)}
keyExtractor={(item, index) => item + index}
sections={this.props.events}
renderSectionHeader={({ section }) => {
// debugger
return (
<View style={styles.header}>
<Text style={styles.title}>{section.title}</Text>
<Text style={styles.count}>{`Number of Events: ${section.data.length}`}</Text>
</View>
)
}}
/>
}
}
const styles = StyleSheet.create({
header: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
backgroundColor: 'white',
padding: 10,
borderBottomColor: 'black',
borderBottomWidth: 2
},
title: {
fontWeight: 'bold',
backgroundColor: 'white'
},
count: {
fontWeight: 'bold',
backgroundColor: 'white'
}
})
export default EventList