material-ui-dropzone icon indicating copy to clipboard operation
material-ui-dropzone copied to clipboard

ReactElement for Icon={<CustomIcon />} not working. [Check the render method of `Dropzone`.]

Open aleksander351 opened this issue 3 years ago • 3 comments

Bug Report

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of Dropzone.

Describe the bug

I have a custom svg icon as a functional react component... export default function UploadIcon () { ... } ... etc

But I got the above mentioned error, if I try to set it in the dropzone component: <DropzoneArea Icon={<UploadIcon />} >

Versions

  • OS: [e.g. iOS]
  • Browser: chrome
  • material-ui-dropzone version: 3.5.0

aleksander351 avatar Feb 22 '21 11:02 aleksander351

This is explained a bit stupid in the documentation, because it says elementType. Actually Icon expects a function that returns an element.

Use:

<DropzoneArea Icon={() => <UploadIcon />} >

See: #267

wolflu05 avatar Mar 10 '21 07:03 wolflu05

import { ReactComponent as IconPlaceholder } from './assets/site_icon/user_icon.svg'; This works then you can pass as Icon={IconPlaceholder}

anuj-developer avatar Mar 31 '21 05:03 anuj-developer

This is explained a bit stupid in the documentation, because it says elementType. Actually Icon expects a function that returns an element.

Use:

<DropzoneArea Icon={() => <UploadIcon />} >

See: #267

thank you ! you save my life ! just thinking about to do a position absolute to overlap the dropzone !

callmejm avatar Jun 15 '21 12:06 callmejm