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.

[Dialog] Looking for a function `onAnimationEnd`

See original GitHub issue

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

I am using Material-ui Dialog for Modal. It’s work perfectly. I am facing one problem when I am trying to add scrollBarWidth as padding-right to my fixed header component.

When I close the Dialog then it should be set padding-reigh to 0px. But it done before closing the dialog. That’s why I need a onTransitionEnd/onAnimationEnd Or any transition props for detecting animation is finished. Anyone can help me.

This is the trigger function

const handleClickOpen = () => {
        setOpen(true);
        const header = document.querySelector('header');
        const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
        header.style.paddingRight = `${scrollBarWidth}px`;
    };

    const handleClose = () => {
        setOpen(false);
        const header = document.querySelector('header');
        header.style.paddingRight = "0px";
        // Here problem is padding-right set 0px before fulfill closing of dialog. That's Why my site is flickering?
    };
<Dialog
     open={open}
     onClose={handleClose}
     scroll="paper"
     keepMounted
     aria-labelledby="scroll-dialog-title"
     aria-describedby="scroll-dialog-description"
     >
         Hello World
</Dialog>

https://mui.com/api/dialog/

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
hbjORbjcommented, Jan 21, 2022

Hi.

You can pass the following to Dialog:

TransitionProps={{
    onExited: () => {
    handleClose();
    }
 }}

Here is a working sandbox: https://codesandbox.io/s/laughing-moore-v3diq?file=/Component/Dialog.js:1243-1347

More APIs are described in here. This doc has been already linked next to TransitionProps in our Dialog API docs, so please look more thoroughly before creating a issue.

0reactions
siamahnaf198commented, Jan 21, 2022

Sorry, I didn’t understand it. Thank you very much

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Dialog] Looking for a function onAnimationEnd #30692 - GitHub
I am using Material-ui Dialog for Modal. It's work perfectly. I am facing one problem when I am trying to add scrollBarWidth as...
Read more >
Change animation of material-ui dialog show - Stack Overflow
Is it possible to change show animation of dialog in material-ui for react using css? I'm not advanced in css but I know...
Read more >
animationend Event - W3Schools
The animationend event occurs when a CSS animation has completed. For more information about CSS Animations, see our tutorial on CSS3 Animations. When...
Read more >
Custom Dialog with Circular Reveal Animation | AndroidPub
This is a quick tutorial on how to make a full screen Custom Dialog with Circular Reveal Animation ... public void onAnimationEnd(Animator animation)...
Read more >
Animation.setAnimationListener - Java - Tabnine
Create "animation chain" for selected view from list of animation objects * * @param animationList collection with animations * @param animationObject view ...
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