Open cgraupner-bm opened 5 years ago
Hi @cgraupner-bm
Thanks for reporting this issue.
Try importing from react-dropzone-uploader
(instead of "react-dropzone-uploader/dist/Dropzone"
)like this:
import Dropzone, {
IDropzoneProps
} from "react-dropzone-uploader"
it works and you still get typescript type checking.
Let me know if that solves it.
If I try to use the library inside a create-react-app project, I get compilation error:
Steps to reproduce:
Create react-app project
install react-dropzone-uploader
Modify
src/App.tsx
to include dropzone. (It's the Standard example from your examples in Typescript) Edit thesrc/app.tsx
and include the following code beforeconst App: [...]
const Standard = () => { const getUploadParams: IDropzoneProps['getUploadParams'] = () => { return { url: 'https://httpbin.org/post' } }
const handleChangeStatus: IDropzoneProps['onChangeStatus'] = ({ meta }, status) => { console.log(status, meta) }
const handleSubmit: IDropzoneProps['onSubmit'] = (files, allFiles) => { console.log(files.map(f => f.meta)) allFiles.forEach(f => f.remove()) }
return ( <Dropzone getUploadParams={getUploadParams} onChangeStatus={handleChangeStatus} onSubmit={handleSubmit} styles={{ dropzone: { minHeight: 200, maxHeight: 250 } }} /> ) }