Skip to content
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

onAfterClose prop called on unmount even if modal is closed #745

Closed
gdostie opened this issue Mar 20, 2019 · 1 comment · Fixed by #755
Closed

onAfterClose prop called on unmount even if modal is closed #745

gdostie opened this issue Mar 20, 2019 · 1 comment · Fixed by #755

Comments

@gdostie
Copy link

gdostie commented Mar 20, 2019

Summary:

The onAfterClose prop is called when unmounting the ReactModal even if the modal is not opened while the unmount occurs.

Steps to reproduce:

  1. Render a ReactModal with an onAfterClose callback.
  2. Unmount the ReactModal in some way (I my example I navigate elsewhere using react-router-dom)
  3. Notice the function provided to onAfterClose prop being called each time the ReactModal unmounts.

Expected behavior:

Given the name of the prop, I would have expected the callback prop to be called only when the modal went from opened state to closed state.

Link to example of issue:

https://codesandbox.io/s/54xl6lz32n

Additional notes:

@gdostie
Copy link
Author

gdostie commented Aug 21, 2019

👋 Friendly ping for someone to take a look at the PR 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant