...
|
...
|
@@ -71,10 +71,12 @@ export default class Home extends React.Component { |
|
|
like: React.PropTypes.string.isRequired,
|
|
|
}),
|
|
|
hot: ImmutablePropTypes.contains({
|
|
|
postId: React.PropTypes.number,
|
|
|
avatar: React.PropTypes.string,
|
|
|
content: React.PropTypes.string.isRequired,
|
|
|
}),
|
|
|
new: ImmutablePropTypes.contains({
|
|
|
postId: React.PropTypes.number,
|
|
|
avatar: React.PropTypes.string,
|
|
|
content: React.PropTypes.string.isRequired,
|
|
|
}),
|
...
|
...
|
@@ -200,12 +202,24 @@ export default class Home extends React.Component { |
|
|
style={styles.carouselSection}
|
|
|
items={rowData.toJS()}
|
|
|
onClick={(info) => {
|
|
|
let type = info.type;
|
|
|
let item = rowData.get(info.index);
|
|
|
let section = {
|
|
|
id: item.get('header').get('id'),
|
|
|
name: item.get('header').get('title'),
|
|
|
if (type == 0) {
|
|
|
// section
|
|
|
let section = {
|
|
|
id: item.get('header').get('id'),
|
|
|
name: item.get('header').get('title'),
|
|
|
}
|
|
|
this.props.onPressSection && this.props.onPressSection(section);
|
|
|
} else if (type == 1) {
|
|
|
// hot
|
|
|
let postId = item.get('hot').get('postId')
|
|
|
this.props.onPressPost && this.props.onPressPost(postId);
|
|
|
} else if (type == 2) {
|
|
|
// new
|
|
|
let postId = item.get('new').get('postId')
|
|
|
this.props.onPressPost && this.props.onPressPost(postId);
|
|
|
}
|
|
|
this.props.onPressSection && this.props.onPressSection(section);
|
|
|
}}
|
|
|
/>
|
|
|
);
|
...
|
...
|
|