/**
 * Created by zhouhuan on 2017/10/30.
 */
import React from 'react';
import { ScrollView } from 'react-native';
import { List } from 'antd-mobile';
import { connect } from 'react-redux';
import { createAction } from '../../../utils';

@connect(({ FWQuanShu, ListHouse, loading }) => ({ FWQuanShu, ListHouse, loading: !!loading.effects['FWQuanShu/getFWQuanShuDetail'] }))
class FWQuanShuScreen extends React.Component {
  componentDidMount() {
    const { houseID } = this.props.ListHouse;
    this.props.dispatch(createAction('FWQuanShu/getFWQuanShuDetail')(houseID));
  }
  // onPress = () => {
  //   const ID = this.props.obligeeInfo.sourceData.id;
  //   this.props.dispatch(createAction('obligeeInfo/getObligeeDetail')(ID));
  // };
  // onEdit =() => {
  //   this.props.dispatch(createAction('obligeeInfo/setStatus')(true));
  // };
  // onSubmit = () => {
  //   this.props.form.validateFields({ force: true }, (error, value) => {
  //     if (!error) {
  //       this.props.dispatch(createAction('obligeeInfo/updateDSRDetail')({ id: this.props.obligeeInfo.sourceData.id, singularData: value }));
  //     } else {
  //       console.log('Validation failed');
  //     }
  //   });
  // };
  // onEditBack = () => {
  //   const { houseID } = this.props.ListHouse;
  //   this.props.dispatch(createAction('obligeeInfo/onEBack')(houseID));
  // };
  // onEndReached = () => {
  //   // 以下是制造新数据
  //   if (!this.props.loading) {
  //     const { houseID } = this.props.ListHouse;
  //     this.props.dispatch(createAction('obligeeInfo/getObligeeInfo')({ id: houseID }));
  //   }
  // };
  // keyExtractor = item => `${item.id}`;
  // // 下拉刷新
  // renderRefresh = () => {
  //   if (!this.props.loading) {
  //     const { houseID } = this.props.ListHouse;
  //     this.props.dispatch(createAction('obligeeInfo/getObligeeInfo')({ id: houseID, type: 'clear' }));
  //   }
  // };
  // renderItem =({ item }) => {
  //   // console.log(item);
  //   return (
  //     <WingBlank size="lg">
  //       <WhiteSpace size="lg" />
  //       <Card>
  //         <Card.Header
  //           title={item.dangShiRenXingMing}
  //           extra={<Text style={Styles.cardText} onPress={this.onPress}>&gt;&gt;详情</Text>}
  //         />
  //         <Card.Body>
  //           <Text style={Styles.cardBodyText}>当事人编号:<Text style={Styles.cardBodyText2}>{item.dangShiRenBianHao}</Text></Text>
  //           <Text style={Styles.cardBodyText}>证件号码:<Text style={Styles.cardBodyText2}>{item.dangShiRenIdentityCard}</Text></Text>
  //         </Card.Body>
  //       </Card>
  //       <WhiteSpace size="lg" />
  //     </WingBlank>
  //   );
  // };
  render() {
    const { detailData, metas } = this.props.FWQuanShu;
    return (
      <ScrollView>
        <List>
          {
            metas.map((m) => {
              return (
                <List.Item
                  key={m.key}
                  extra={detailData[m.key]}
                  wrap
                >
                  {m.label}
                </List.Item>
              );
            })
          }
        </List>
      </ScrollView>
    );
  }
}
export default FWQuanShuScreen;
