-
Notifications
You must be signed in to change notification settings - Fork 1
/
small-component.js
54 lines (49 loc) · 1.09 KB
/
small-component.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
import React from 'react';
import { View, Text, StyleSheet, Image } from 'react-native';
class SmallComponent extends React.PureComponent {
render() {
const {image, title, body} = this.props
return (
<View style={ styles.container }>
<View style={ { flexDirection: 'row' } }>
<Image
style={ styles.image }
source={ { uri: image } }
/>
<View style={ { padding: 16, backgroundColor: 'white', flex: 1 } }>
<Text style={ styles.title }>
{ title }
</Text>
<Text
style={styles.body}
ellipsizeMode={'tail'}
numberOfLines={5}
>
{body}
</Text>
</View>
</View>
</View>
);
}
};
const styles = StyleSheet.create({
container: {
height: 160,
borderRadius: 20,
overflow: 'hidden',
backgroundColor: 'white',
},
title: {
fontSize: 24,
},
image: {
height: 160,
width: 90,
},
body: {
flex: 1,
marginTop: 8,
},
});
export default SmallComponent;