question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested theme not working

See original GitHub issue
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

I have a main Theme and a secondary Theme that I need to use it only on few pages, so I followed the nested themes pattern as described in the docs, wrapping only few components into the secondary theme, but only the primary theme is applied

Expected Behavior 🤔

I expect the secondary theme to be applied where necessary

Steps to Reproduce 🕹

https://codesandbox.io/s/friendly-shaw-kpcfe?file=/src/Demo.js

Steps:

  1. open the live example
  2. the theme is light instead of dark

Context 🔦

I’d like my main app to use a light/standard theme, while the landing page should always use a dark theme, I use react-router for the routing

Your Environment 🌎

Tech Version
Material-UI v4.11.0
React v16.13.1
Browser Chrome 86
TypeScript v3.9
etc.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, Oct 16, 2020
Capture d’écran 2020-10-16 à 13 17 17
    <ThemeProvider theme={theme}>
      <Container>
        <Paper>
          Foo
          <ThemeProvider theme={landingPageTheme}>
            <Paper>Bar</Paper>
          </ThemeProvider>
        </Paper>
      </Container>
    </ThemeProvider>

https://codesandbox.io/s/goofy-star-xrjc9?file=/src/Demo.js:567-814

0reactions
lucafaggianellicommented, Oct 16, 2020

thank you @oliviertassinari , I managed to have a nested theme!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nested theme not working #23086 - mui/material-ui - GitHub
The issue is present in the latest release. I have searched the issues of this repository and believe that this is not a...
Read more >
MUI v5 Nested ThemeProvider Problem - StackBlitz
const theme = createTheme({. palette: {. primary: {. main: '#FF0000',. },. },. }); const theme2 = createTheme({. direction: 'rtl',. palette: {. primary: {....
Read more >
Issues- grid theme with nested repeats Connect v 3.13
This limits how repeats are able to be used within the survey. I have several surveys that incorporate nested group and repeats. Is...
Read more >
Breaking changes in v5, part one: styles and themes - MUI
Although your style overrides defined in the theme may partially work, there is an important difference regarding how the nested elements are styled....
Read more >
Material Design 2 in Compose - Jetpack - Android Developers
The first screenshot shows an app that does not configure MaterialTheme ... This approach makes it possible to easily support dark theme and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found