import React, { Component } from "react";
import Text from "react-native-text";
import { StyleSheet, View, FlatList, ActivityIndicator } from "react-native";
import Size from "../../config/size";
import { observer, inject } from "mobx-react/native";
import { width, height } from "../../config/screen";
import OrderListItems from "./orderListItems";
@inject(["menuStore"], ["userStore"])
@observer
export default class OrderFlatList extends Component {
  constructor(props) {
    super(props);
    this.store = this.props.menuStore;
    this.userStore = this.props.userStore;
  }

  render() {
    console.log(this.store.passOrder);
    return (
      <FlatList
        data={this.props.data}
        renderItem={({ item }) => (
          <OrderListItems
            items={item}
            navigation={this.props.navigation}
            screenWidth={width}
            whichOrder = {this.props.whichOrder}
          />
        )}
        //refreshing={this.store.loading}
        // onRefresh = {()=>{console.log('reload'); this.store.getMenuItem(this);}}
        // ListFooterComponent={this._renderFooter.bind(this)}
        // onEndReached= {this._onEndReached.bind(this)}
        //  onEndReachedThreshold={10}//执行上啦的时候10%执行
      />
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    flexDirection: "row",
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: "#F5FCFF"
  },
  title: {
    fontSize: 15,
    color: "blue"
  },
  footer: {
    flexDirection: "row",
    height: 24,
    justifyContent: "center",
    alignItems: "center",
    marginBottom: 10
  },
  content: {
    fontSize: 15,
    color: "black"
  }
});
