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

@connect(({ QSInfoDetail }) => ({ QSInfoDetail }))
class QuanshuDetailScreen extends React.Component {
  componentDidMount() {
    const { id } = this.props.navigation.state.params;
    this.props.dispatch(createAction('QSInfoDetail/getDSRInfoDetail')(id));
  }
  validateNoNull = (rule, value, callback) => {
    if (value) {
      callback();
    } else {
      callback(new Error('At least four charactors for account'));
    }
  };
  render() {
    const { singularData, metas } = this.props.QSInfoDetail;
    return (
      <ScrollView>
        <WhiteSpace />
        <WingBlank>
          <List>
            {
              metas.map((m) => {
                return (
                  <List.Item
                    key={m.key}
                    extra={singularData[m.key]}
                    wrap
                  >
                    {m.label}
                  </List.Item>
                );
              })
            }
          </List>
        </WingBlank>
      </ScrollView>
    );
  }
}

export default QuanshuDetailScreen;
