I have two drawers (left and bottom). When the left drawer opens, I want to increase marginLeft and reduce the width of bottom drawer with transition/animation.
I try to add inline transition style to the paper of drawer. But the style will then replaced by element.style {transition: transform 225ms cubic-bezier(0, 0, 0.2, 1) 0ms;}
Sample in codesandbox
  <Drawer 
    ...
    classes={{
      paper: classes.transitionIn,
    }}
    ...
    PaperProps = {{
      style:{
        ...
        transition: 'transform 990ms cubic-bezier(0, 0, 0.2, 1) 0ms',
      }
    }}
  >
    {children}
  </Drawer>
Is there any way to add animation to the bottom drawer?
I just find a way to override the root node's transition style by adding a callback function (onEntering) to Drawer's SlideProps.
  <Drawer 
    ...
    classes={{
      paper: classes.transitionIn,
    }}
    ...
    SlideProps = {{
      onEntering: (node, isAppearing)=>{
        node.style.webkitTransition  = theme.transitions.create(['-webkit-transform', 'margin', 'height', 'width', 'top', 'left'], {
          easing: theme.transitions.easing.easeOut,
          duration: transitionTime,
        });
        node.style.transition   = theme.transitions.create(['transform', 'margin', 'height', 'width', 'top', 'left'], {
          easing: theme.transitions.easing.easeOut,
          duration: transitionTime,
        });
      },
    }}
    PaperProps = {{
      style:{
        ...
      }
    }}
  >
    {children}
  </Drawer>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With