-
Notifications
You must be signed in to change notification settings - Fork 613
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
onModalHide
is never called if the Modal
is unmounted while still visible
#770
Labels
Comments
6 tasks
I'm happy to contribute a fix if the maintainers agree that this is a valid bug. |
The maintainers havent done anything in a couple of years. What is your fix? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
Platforms
Android, iOS and Web
Versions
Description
When the
Modal
is hidden becauseisVisible
changes fromtrue
tofalse
, theonModalHide
will be called.But when the
Modal
is hidden because it's unmounted (isVisible
is stilltrue
), theonModalHide
is never called. This leads to problems because we often useonModalHide
to perform some clean-up, or show a different UX when the modal is hidden.Reproducible Demo
Here's the repository that contains the minimal reproducible example: https://github.com/tienifr/react-native-modal-bug-reproducible-example.
This is a new React Native project, bootstrapped using @react-native-community/cli.
react-native-modal
was added and some minor code was added to showcase the error (via this commit). The steps to run it are in the README.After running it, we can see:
Modal
with textI am the modal content!
will show (due to this code)Modal
with textI am the modal content!
will disappear (due to this code)onModalHide
, which should log this, is never called.Video showing the logs in
onModalHide
never happenedhttps://github.com/react-native-modal/react-native-modal/assets/113963320/25b87f23-7872-4619-a28a-926106a4f377
The text was updated successfully, but these errors were encountered: