pradel / react-responsive-modal

Simple responsive react modal
https://react-responsive-modal.leopradel.com/
MIT License
604 stars 95 forks source link

Propagate event object to the animationEnd callback #522

Open maybephilipp opened 4 months ago

maybephilipp commented 4 months ago

Bug report

Describe the bug

In the file: react-responsive-modal/src/index.tsx, the animationEnd handler doesn't pass original event object to the callback. What I want to solve by this is to check what caused the event and dismiss in case of wrong call. I have an issue on my website that if some animation happens inside the modal, then modal triggers this event so wrong logic is triggered. Thank you :)

    const handleAnimationEnd = () => {
      if (!open) {
        setShowPortal(false);
      }

      onAnimationEnd?.();
    };

To Reproduce

Add any finite animation inside modal. You will see that the animationEnd is triggered and no event argument is available.

Expected behavior

Original event object is passed to the callback.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

Additional context

Add any other context about the problem here.