{"size": 1750, "ext": "js", "max_stars_repo_path": "src/components/pages/movie/comment/plusCommentList.js", "max_stars_repo_name": "gitSirzh/Zh-Career", "max_stars_repo_stars_event_min_datetime": "2019-02-22T11:36:23.000Z", "max_stars_repo_stars_event_max_datetime": "2019-03-13T13:20:32.000Z", "max_issues_repo_path": "src/components/pages/movie/comment/plusCommentList.js", "max_issues_repo_name": "gitSirzh/Zh-Career", "max_issues_repo_issues_event_min_datetime": "2021-09-01T01:16:51.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-01T01:16:51.000Z", "max_forks_repo_path": "src/components/pages/movie/comment/plusCommentList.js", "max_forks_repo_name": "gitSirzh/Zh-Career", "max_forks_repo_forks_event_min_datetime": "2019-03-13T13:18:20.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-13T13:18:20.000Z"}
{"max_stars_count": 4, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 25.7352941176, "max_line_length": 87, "alphanum_fraction": 0.536}
/**
 * Created by jszh on 2018/12/29.
 */

import React, {Component} from 'react'
import {ListView, StyleSheet} from 'react-native'
import {commonStyle} from '../../../../utils/commonStyle'
import {BaseComponent} from '../../../base/baseComponent'
import PlusCell from './plusCommentCell'

export default class PlusCommentList extends BaseComponent {

    constructor(props) {
        super(props);
        this.renderRow = this.renderRow.bind(this);
        this.state = {
            dataSource: new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2})
        }
    }

    navigationBarProps() {
        return {
            title: `${this.props.title} - 精彩影评`,
            titleStyle: {
                color: commonStyle.white
            },
            leftIcon: {
                name: 'ios-arrow-back',
                size: 20,
                color: commonStyle.white
            },
            navBarStyle: {
                backgroundColor: '#151C28',
            }
        }
    }

    componentDidMount() {
        this.props.getPlusComment({pageIndex: 1, movieId: this.props.id})
    }

    renderRow(rowData, sectionId, rowId) {
        return (
            <PlusCell key={rowId} plusData={rowData} type="list"/>
        )
    }

    _render() {
        let dataArr = this.props.plusCommetData || [];
        let dataSource = this.state.dataSource.cloneWithRows(dataArr);
        return (
            <ListView
                style={styles.container}
                dataSource={dataSource}
                renderRow={this.renderRow}
                enableEmptySections
            />
        )
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: commonStyle.white
    }
});
