Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using a material ui theme where a default prop is overwritten with a component #29

Closed
danhorvath opened this issue Jul 30, 2021 · 1 comment

Comments

@danhorvath
Copy link

Defining components as default props in a material ui theme throws the following error:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
    at createFiberFromTypeAndProps (http://localhost:9009/vendors~main.e20e507f310929fd7c90.bundle.js:253875:21)
    at createFiberFromElement (http://localhost:9009/vendors~main.e20e507f310929fd7c90.bundle.js:253898:15)
    at createChild (http://localhost:9009/vendors~main.e20e507f310929fd7c90.bundle.js:243538:28)
    at reconcileChildrenArray (http://localhost:9009/vendors~main.e20e507f310929fd7c90.bundle.js:243810:25)
    at reconcileChildFibers (http://localhost:9009/vendors~main.e20e507f310929fd7c90.bundle.js:244215:14)
    at reconcileChildren (http://localhost:9009/vendors~main.e20e507f310929fd7c90.bundle.js:246672:28)
    at updateHostComponent (http://localhost:9009/vendors~main.e20e507f310929fd7c90.bundle.js:247212:3)
    at beginWork (http://localhost:9009/vendors~main.e20e507f310929fd7c90.bundle.js:248537:14)
    at HTMLUnknownElement.callCallback (http://localhost:9009/vendors~main.e20e507f310929fd7c90.bundle.js:230098:14)
    at Object.invokeGuardedCallbackDev (http://localhost:9009/vendors~main.e20e507f310929fd7c90.bundle.js:230147:16)

This error can be reproduced in the demo app (https://github.com/react-theming/theming-material-ui) by extending the example theme like this:

export const theme1 = createMuiTheme({
  // ...
  props:{
    MuiCheckbox:{
      icon:<CheckCircle/>
    }
  }
});

This error happens both with material ui v4 and v5.

@usulpro
Copy link
Member

usulpro commented Nov 14, 2021

Hey @danhorvath passing React components to the addon panel isn't supported. But as I see it's already solved in the neighbor issue

@usulpro usulpro closed this as completed Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants