-
Notifications
You must be signed in to change notification settings - Fork 63
/
StoriesList.js
63 lines (52 loc) · 1.23 KB
/
StoriesList.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
import React, { Component } from 'react';
import { Text, TextInput, Dimensions, View, ScrollView, StyleSheet } from 'react-native';
import StoriesDetail from './StoriesDetail';
import axios from 'axios';
import Colors from '../../constants/Colors';
import storyData from '../../constants/data';
class StoriesList extends Component {
constructor(props) {
super(props);
}
componentWillMount(){
//axios.get("http://api.duckduckgo.com/?q=googl&format=json")
// .then(response => this.setState({ stories: response.data}));
}
getStoryData(story) {
return (
<StoriesDetail key={story.title}
StoryImage={story.urlToImage}
StoryAbstractURL={story.url}
StoryHeading={story.title}
/>
);
}
renderStories() {
return (storyData.map(this.getStoryData));
}
render () {
return (
<ScrollView>
{this.renderStories()}
</ScrollView>
);
}
}
const styles = StyleSheet.create({
viewStyle: {
backgroundColor: '#eeeeee',
justifyContent: 'center',
alignItems: 'center',
height: 60,
paddingTop: 15,
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
elevation: 2,
position: 'relative'
},
textStyle: {
fontSize: 20
}
});
export default StoriesList;