forked from anchetaWern/react-native-practical-animations
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathNewsItem.js
48 lines (41 loc) · 789 Bytes
/
NewsItem.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
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
} from 'react-native';
import Button from './Button';
const NewsItem = ({ news, index }) => {
function onPress(news) {
//do anything you want
}
return (
<Button
key={index}
noDefaultStyles={true}
onPress={onPress.bind(this, news)}
>
<View style={styles.news_item}>
<Text style={styles.title}>{news.title}</Text>
<Text>{news.website}</Text>
</View>
</Button>
);
}
const styles = StyleSheet.create({
news_item: {
flex: 1,
flexDirection: 'column',
paddingRight: 20,
paddingLeft: 20,
paddingTop: 30,
paddingBottom: 30,
borderBottomWidth: 1,
borderBottomColor: '#E4E4E4'
},
title: {
fontSize: 20,
fontWeight: 'bold'
}
});
export default NewsItem;