/
ListItem.js
47 lines (46 loc) · 1.29 KB
/
ListItem.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
import React, { PureComponent } from 'react'
import { TouchableOpacity, Image } from 'react-native'
import { colors } from '../../constants'
import { Flex, Text } from '.'
import { marginLeft, padding } from '../../styles'
export default class ListItem extends PureComponent {
render () {
const { id, title, subtitle, onPress } = this.props
return (
<TouchableOpacity
onPress={onPress}
style={[
{
backgroundColor: colors.white,
height: 72,
},
padding,
]}
>
<Flex.Cols align='center'>
<Flex.Rows size={1} align='center'>
<Image
style={{ width: 40, height: 40, borderRadius: 20, margin: 4 }}
source={{
uri: 'https://api.adorable.io/avatars/285/' + id + '.png',
}}
/>
</Flex.Rows>
<Flex.Rows
size={7}
align='stretch'
justify='center'
style={[marginLeft]}
>
<Text color={colors.black} left middle>
{title}
</Text>
<Text color={colors.subtleGrey} tiny middle left>
{subtitle}
</Text>
</Flex.Rows>
</Flex.Cols>
</TouchableOpacity>
)
}
}