You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior
Slide component always recreates children style object and sets its visibility field to 'hidden' / undefined.
In such situation we cannot use neither React.memo (without compare function) nor React.PureComponent, cause function shallowEquals always returns false.
Slide should try to use original style objects whenever it can.
Something like that, should be enough:
// Trying to get children style without recreating style objectconstgetChildrenStyle=(state)=>{constforwardedStyle=(()=>{if(!style){returnchildren.props.style;}if(!children.props.style){returnstyle;}return{...style, ...children.props.style};})();if(state==='exited'&&!inProp){return{visibility: "hidden", ...forwardedStyle}}returnforwardedStyle;};
Current Behavior
Slide component always recreates children
style
object and sets itsvisibility
field to'hidden'
/undefined
.In such situation we cannot use neither
React.memo
(without compare function) norReact.PureComponent
, cause functionshallowEquals
always returnsfalse
.https://github.com/mui-org/material-ui/blob/5c84559ce012e403d01773112774de56d7e74723/packages/material-ui/src/Slide/Slide.js#L212-L222
Expected Behavior
Slide should try to use original style objects whenever it can.
Something like that, should be enough:
Steps to Reproduce
https://codesandbox.io/s/serene-easley-ll4ut
Your Environment
The text was updated successfully, but these errors were encountered: