-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Accordion] TransitionProps
isn't merged with theme defaultProps
#34978
Comments
TransitionProps
isn't merged with theme defaultProps
The topic is similar to #34214 |
Looks like you linked back to here @flaviendelangle |
Indeed, updated 👍 |
I'm not sure to understand how the "expected behavior" is correct. In the example, import * as React from "react";
import {
Accordion,
AccordionDetails,
AccordionSummary,
createTheme,
ThemeProvider,
Typography
} from "@mui/material";
const theme = createTheme({
components: {
MuiAccordion: {
defaultProps: {
TransitionProps: {
// Console log to demonstrate the bug
onEnter: (el) => console.log("accordion el has expanded", el)
}
}
}
}
});
/**
* how you used the components
*/
export default function App() {
return (
<ThemeProvider theme={theme}>
<Accordion
// Opening this accordion will console log as expected
TransitionProps={undefined}
>
<AccordionSummary aria-controls="panel1a-content" id="panel1a-header">
<Typography>Accordion 1</Typography>
</AccordionSummary>
<AccordionDetails>
<Typography>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
malesuada lacus ex, sit amet blandit leo lobortis eget.
</Typography>
</AccordionDetails>
</Accordion>
<Accordion
// BUG: There will be no console log when opening this accordion.
TransitionProps={{}}
> If I set For the same reason why when overriding Fade's |
Duplicates
Latest version
Steps to reproduce 🕹
Link to live example: https://codesandbox.io/s/twilight-sun-nn4m8m?file=/src/App.tsx
Steps:
console.log
messageconsole.log
Current behavior 😯
TransitionProps
objects aren't merged withdefaultProps
provided by the theme.Expected behavior 🤔
TransitionProps
objects are merged withdefaultProps
provided by the theme.Context 🔦
I'm trying to provide transition defaults for the
Accordion
such as settingunmountOnExit
ormountOnEnter
globally, while allowing component level props such astimeout
etc to be provided as well.Your environment 🌎
npx @mui/envinfo
The text was updated successfully, but these errors were encountered: