Material-ui: Default theme overwriting custom theme when inserting material components into dom tree directly

Created on 3 Oct 2019  路  5Comments  路  Source: mui-org/material-ui

  • [x] The issue is present in the latest release.
  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 馃槸

When rendering Material components with ReactDOM.unstable_renderSubtreeIntoContainer(), custom theme is not being carried forward and it's propagating the default theme instead.

We are using a couple third party libraries that are not using React and we have to step outside of React ecosystem to pass in components that we wanted to render. Before, we didn't have any issues getting Material components to style correctly in these. After upgrading to v4.4.3, whenever we open up such a hybrid component, it injects the default theme into the dom tree and overrides our customized theme.

This is what we see in the console when logging the children components that we passed in.

Screen Shot 2019-10-03 at 11 27 32 AM

Expected Behavior 馃

Custom theme info should be forwarded with Material components when using unstable_renderSubtreeIntoContainer or a similar function.

Steps to Reproduce 馃暪

https://codesandbox.io/s/practical-pine-ytx5z

| Tech | Version |
| ----------- | ------- |
| Material-UI | v4.4.3 |
| React | v16.9.0 |

wontfix

Most helpful comment

ok, not an issue with createPortal.

All 5 comments

I propose we close the issue as "won't fix" per https://github.com/facebook/react/issues/10143.

We are using a couple third party libraries that are not using React and we have to step outside of React ecosystem to pass in components that we wanted to render.

Can we learn more about them? :)

let me see if i can replicate it with createPortal which is supposed to be what we need to migrate to for unstable_renderSubtreeIntoContainer.

ok, not an issue with createPortal.

Thanks for double-checking, the context propagation might work with Material-UI v3 as using the legacy context API.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iceafish picture iceafish  路  62Comments

tleunen picture tleunen  路  59Comments

sjstebbins picture sjstebbins  路  71Comments

amcasey picture amcasey  路  70Comments

gndplayground picture gndplayground  路  54Comments