MuiThemeProvider removes extra fields from theme
See original GitHub issue- This is not a v0.x issue.
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior 🤔
As with @material-ui/core@^3
the extra theme fields ( i.e. colors ) should not be removed
Current Behavior 😯
Any extra fields are removed after the created theme is passed to MuiThemeProvider and do not reach theme consumers.
Steps to Reproduce 🕹
Link:
- git clone https://github.com/mateja176/react-hot-starter
- cd react-hot-starter
- git checkout material-ui-4
- npm install
- npm start
- open console and compare
PROVIDED theme
andCONSUMED theme
values
Context 🔦
Extend theme with additional color properties, i.e. success color
for snackbar.
Your Environment 🌎
Tech | Version |
---|---|
Material-UI | v4.1.3 |
React Scripts | 3.0.1 |
Browser | Chrome |
TypeScript | 3.5.1 |
etc. |
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Change custom theme Material-UI - Stack Overflow
Wrap the child components inside a MuiThemeProvider and pass a createMuiTheme object to it as a theme property value.
Read more >Separate themes for Mui and styled components · Issue #28979
Since my old theme has fields with the same keys as the one generated ... as MuiThemeProvider, Theme } from '@mui/material/styles'; import ...
Read more >Theming - Material UI - MUI
WARNING: theme.vars is a private field used for CSS variables support. Please use another name for a custom object. responsiveFontSizes(theme, options) => theme....
Read more >Theming with React and MUI - Welcome, Developer
Learn how to create custom themes to React app using MUI. ... Go to src/App.tsx and remove everything we don't need: src/App.tsx.
Read more >Material UI Tutorial #6 - Custom Themes - YouTube
Hey gang, in this material UI tutorial we'll take a look at how to create custom themes (colours, spacing, typography, etc) for your ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mateja176 Top of your console includes
npm
included multiple versions even thoughnpm ls
resulted inIt shouldn’t install two versions. If I remove
node_modules/@material-ui/core/node_modules/@material-ui/styles
everything works as expected. Try regenerating your package-lock or tryyarn
.If this doesn’t help please ask the question on stackoverflow and link it from here so that we can continue this conversation.
@eps1lon On point, thank you so much! All that was required is:
And
@material-ui/styles@4.1.2
is now dedupedMy apologies, this was not directly related to
@material-ui
.