-
Notifications
You must be signed in to change notification settings - Fork 319
Expand file tree
/
Copy pathPostList.js
More file actions
62 lines (51 loc) · 1.21 KB
/
PostList.js
File metadata and controls
62 lines (51 loc) · 1.21 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
55
56
57
58
59
60
61
62
var React = require('react-native');
var ListHelper = require('../Mixins/ListHelper');
var PostListStore = require('../Stores/PostListStore');
var PostActions = require('../Actions/PostActions');
var PostList = React.createClass({
mixins: [ListHelper],
getDefaultProps: function() {
return {
store: PostListStore,
listProps: {
noTap: true,
parse: true,
},
segment: {
items: [
{
title: 'Posts',
replacePath: 'posts',
selected: true
},
{
title: 'Follows',
replacePath: 'follows'
}
]
}
};
},
getListItems: function() {
return PostListStore.get(this.getUsername());
},
isListChange: function(username) {
return this.getUsername() == username;
},
getItemProps: function(post) {
return {
key: post.data.id,
title: post.data.content
}
},
reloadList: function() {
console.log("reloading posts: " + this.getUsername());
PostActions.fetchList(this.getUsername(), function(error) {
// TODO: handle error
if (error) {
console.log(error.message);
}
});
}
});
module.exports = PostList;