[@mui/styles] Regression accessing theme
See original GitHub issueDuplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
Hello.
I found a regression on the latest versions of @mui/styles
.
https://codesandbox.io/s/mui-styles-regression-peisqv
In the above sandbox, you can see the text has the same color as the Button.
If I increase @mui/styles
from 5.2.3, the text is not the same color anymore because the theme is not passed to my components. You can see the console.log in the console.
I also needed to decrease the version of @mui/material
to 5.2.8.
Expected behavior 🤔
The Theme should be passed to my components with the latest versions of @mui/styles
and @mui/material
.
Steps to reproduce 🕹
Steps:
- Go to the sandbox https://codesandbox.io/s/mui-styles-regression-peisqv
- Increase
@mui/styles
or@mui/material
version - See the text in red
Context 🔦
I’m migrating an old project to @mui
v5 but it’s not possible to update all my components to styled components.
So I have to keep makeStyles
.
Following the documentation, the makeStyles is not working in recent versions.
Thanks
Your environment 🌎
No response
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
@mnajdova it seems to work if I fix all my versions.
Thank you.
@FlorianBurgevin looks a lot like a mismatch in the versions. Both @mui/styles and @mui/material depend on @mui/private-theming which is a package providing the react context for the theme. If the versions end up using different version of this package, they basically depend on different react context, which would result on something similar as what you’ve pointed out.