diff --git a/client/src/components/_common/Form/FileInputDropZone.jsx b/client/src/components/_common/Form/FileInputDropZone.jsx index 567e13b78..d69c440dd 100644 --- a/client/src/components/_common/Form/FileInputDropZone.jsx +++ b/client/src/components/_common/Form/FileInputDropZone.jsx @@ -1,5 +1,5 @@ /* FP-993: Allow use by DataFilesUploadModal */ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { useDropzone } from 'react-dropzone'; import { Button, InlineMessage } from '_common'; import PropTypes from 'prop-types'; @@ -45,9 +45,28 @@ function FileInputDropZone({ } }; + const handleClick = (index) => { + // rejectedFiles.splice(index, 1); + // setRejectedFiles(rejectedFiles); + // useState(setRejectedFiles(rejectedFiles)); + setRejectedFiles(rejectedFiles.splice(index, 1)); + setRejectedFiles(rejectedFiles); + }; + + // useEffect(() => { + // setRejectedFiles(rejectedFiles); + // console.log('useEffect'); + // }, [rejectedFiles]); + const refreshRejectedFiles = () => { - setRejectedFiles(previous => rejectedFiles); + setRejectedFiles(rejectedFiles); } + // useEffect(refreshRejectedFiles, [rejectedFiles]); + + const removeRejectedFile = (index) => { + rejectedFiles.splice(index, 1); + // setRejectedFiles(rejectedFiles); + }; const showFileList = (files && files.length > 0) || rejectedFiles.length > 0; @@ -81,14 +100,16 @@ function FileInputDropZone({