import React, { useRef } from 'react';
import Item from "./../Item";

// File List
var List = function List(_ref) {
  var list = _ref.list,
    uploading = _ref.uploading,
    onDelete = _ref.onDelete,
    onReUpload = _ref.onReUpload,
    onPreview = _ref.onPreview;
  // 因为在click事件内改变数据的可能性, 所以更新句柄, 防止synchronization模式读取创建时的状态
  var onDeleteRef = useRef();
  var onReUploadRef = useRef();
  var onPreviewRef = useRef();
  onDeleteRef.current = onDelete;
  onReUploadRef.current = onReUpload;
  onPreviewRef.current = onPreview;
  return /*#__PURE__*/React.createElement(React.Fragment, null, list && list.length > 0 && list.map(function (item, index) {
    return /*#__PURE__*/React.createElement(Item, {
      key: index,
      item: item,
      index: index,
      uploading: uploading,
      onPreview: onPreviewRef.current,
      onDelete: onDeleteRef.current,
      onReUpload: onReUploadRef.current
    });
  }));
};
export default List;