<commit_before>/**
 * @Author: <EMAIL>
 * @Date: 2017.4.6 上午 10:29
 * @Desc: 公共组件 - FlatListContainer
 * @Name: FlatListContainer.js
 * @LifeCycle：https://github.com/kinshasa/react-native-qatest
 */

import React, {Component, PropTypes} from "react";
import {StyleSheet, Text, View, Image, InteractionManager} from "react-native";
import FlatList from "../../../components/listview/flatList/FlatList";
import icon from '../../../assets/NavLogo.png'
import LoadingView from '../../../components/view/LoadingView'
import TitleBar from "../../../components/bar/TitleBar"

export default class FlatListContainer extends Component {

    static propTypes = {
        style: View.propTypes.style,
        account: PropTypes.number,
        name: PropTypes.string,
        isTrue: PropTypes.bool,
        callback: PropTypes.func,
    };

    static defaultProps = {
        data: {}
    };

    constructor(props, context) {
        console.log("FlatListContainer constructor() context:", context);
        super(props, context);
        this.state = {data: []};
    }

    simple = {
        "id": 1647,
        "name": "<NAME>",
        "image": "",
        "desc": null,
        "carBrandId": 93,
        "carLevelId": null,
        "idDeleted": 0,
        "salesModel": "1",
        "ceilingPrice": 89800,
        "floorPrice": 89800,
        "hot": 0,
        "salesVolume": null,
        "merchantId": 1,
        "merchantName": "大圣科技股份有限公司",
    };

    /**
     * 当前组件渲染次数
     * @type {number}
     */
    count = 0;

    /**
     * 当前组件是否已经移除，如果移除，则不需要setState更新组件
     * @type {boolean}
     */
    unMount = false;

    async getData2() {
        try {
            let url = 'https://app.ds.cn/ncar-main-mapp/car-search-mapi/ncar/search?pageNumber=1&pageSize=10&salesModel=1&sortType=2';
            let response = await fetch(url);
            let json = await response.json();
            let data = [...json.data.list/*, ...json.data.list, ...json.data.list, ...json.data.list*/];
            console.log('FlatListContainer getData()', json.data.list.length);
            !this.unMount && this.setState({data});
        } catch (e) {

        }
    }

    getData() {
        try {
            let url = 'https://app.ds.cn/ncar-main-mapp/car-search-mapi/ncar/search?pageNumber=1&pageSize=100&salesModel=1&sortType=2';
            fetch(url)
                .then((response) => {
                    return response.json()
                })
                .then((json) => {
                    let data = [...json.data.list, ...json.data.list, ...json.data.list, ...json.data.list];
                    console.log('FlatListContainer getData()', json.data.list.length);
                    !this.unMount && this.setState({data});
                });<commit_msg>modify files.@<EMAIL><commit_after>/**
 * @Author: <EMAIL>
 * @Date: 2017.4.6 上午 10:29
 * @Desc: 公共组件 - FlatListContainer
 * @Name: FlatListContainer.js
 * @LifeCycle：https://github.com/kinshasa/react-native-qatest
 */

import React, {Component, PropTypes} from "react";
import {StyleSheet, Text, View, Image, InteractionManager} from "react-native";
import FlatList from "../../../components/listview/flatList/FlatList";
import icon from '../../../assets/NavLogo.png'
import LoadingView from '../../../components/view/LoadingView'
import TitleBar from "../../../components/bar/TitleBar"

export default class FlatListContainer extends Component {

    static propTypes = {
        style: View.propTypes.style,
        account: PropTypes.number,
        name: PropTypes.string,
        isTrue: PropTypes.bool,
        callback: PropTypes.func,
    };

    static defaultProps = {
        data: {}
    };

    constructor(props, context) {
        console.log("FlatListContainer constructor() context:", context);
        super(props, context);
        this.state = {data: []};
    }

    simple = {
        "id": 1647,
        "name": "<NAME>",
        "image": "",
        "desc": null,
        "carBrandId": 93,
        "carLevelId": null,
        "idDeleted": 0,
        "salesModel": "1",
        "ceilingPrice": 89800,
        "floorPrice": 89800,
        "hot": 0,
        "salesVolume": null,
        "merchantId": 1,
        "merchantName": "大圣科技<EMAIL>公司",
    };

    /**
     * 当前组件渲染次数
     * @type {number}
     */
    count = 0;

    /**
     * 当前组件是否已经移除，如果移除，则不需要setState更新组件
     * @type {boolean}
     */
    unMount = false;

    async getData2() {
        try {
            let url = 'https://app.ds.cn/ncar-main-mapp/car-search-mapi/ncar/search?pageNumber=1&pageSize=10&salesModel=1&sortType=2';
            let response = await fetch(url);
            let json = await response.json();
            let data = [...json.data.list/*, ...json.data.list, ...json.data.list, ...json.data.list*/];
            console.log('FlatListContainer getData()', json.data.list.length);
            //异步请求刷新需要判断当前组件是否已经Unmount了。
            !this.unMount && this.setState({data});
        } catch (e) {

        }
    }

    getData() {
        try {
            let url = 'https://app.ds.cn/ncar-main-mapp/car-search-mapi/ncar/search?pageNumber=1&pageSize=100&salesModel=1&sortType=2';
            fetch(url)
                .then((response) => {
                    return response.json()
                })
                .then((json) => {
                    let data = [...json.data.list, ...json.data.list, ...json.data.list, ...json.data.list];
                    console.log('FlatListContainer getData()', json.data.list.length);
                    !this.unMount && this.setState({data});
                });
{'fraction_non_alphanumeric': 0.16568364611260053, 'fraction_numerical': 0.015370866845397676, 'mean_word_length': 1.979765708200213, 'pattern_counts': {'":': 28, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6806692', 'n_tokens_mistral': 1871, 'n_tokens_neox': 1821, 'n_words': 322}