react-native-modalfy: Closing modal doesn't animate out, closes instantly after duration
When calling closeModal(), the closing animation never happens. It waits the amount of time of the duration, then instantly closes. I’ve tested this by setting the duration to 3 seconds… there is no visible transition happening when closing.
This problem however doesn’t exist on openModal(), which works fine.
const defaultOptions: ModalOptions = {
backdropOpacity: 0.9,
disableFlingGesture: true,
animateInConfig: {
easing: Easing.inOut(Easing.exp),
duration: 3000,
},
animateOutConfig: {
easing: Easing.inOut(Easing.exp),
duration: 3000,
}
}
Any ideas?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (7 by maintainers)
Hi @tp26610! Please simply update your project to
v3.2.0, that issue has already been fixed there:https://user-images.githubusercontent.com/8975443/165439754-a31eec74-003d-47a4-9cba-103425be7e3d.mov
Hi, @CharlesMangwa
I’ve reproduced the issue while calling
closeModal.The video is showing that animation doesn’t work while calling
closeModaland the animation works while user clicks background to dismiss the modal.The code is here: https://snack.expo.dev/@tp26610/react-native-modalfy
https://user-images.githubusercontent.com/9457401/162485480-6b794759-87a2-43c5-bdbe-2467a0cdc6fc.mov
Hey @Omelyan, thanks for the feedback: that sounds quite annoying indeed!
So about the animations, I’d suggest double-checking how you’ve set up your different animations inside the root modal stack config. As you may know, by default: Modalfy does not provide any animation because you might just not want any. So if there’s an error on your end on that side, no animation will occur.
Regarding the exception you got, at first glance, it seems that you’re calling
openModal()orcloseModal()and providing anobjectinstead of astringas the initial argument. If this is however coming from the library, feel free to provide a reproducible demo if you have time and I’ll be more than happy to look into it and release a patch that’d address the issues you’ve been facing.Overall, however, all of the issues you’ve mentioned seem to be on your side as none of them are reproducible in the updated Expo demo. But please, do correct me if I missed anything!
As well: thanks a lot for taking the time to check out Modalfy v3 so quickly right after its release!
@CharlesMangwa Cool, but no visible changes)) still no animation on closing modal, no animation on physical Back press, but now it throws an exception on pressing background: “[object object] is not a valid modal name. Did you mean any of these…” version number 3 and still unusable…
Hey everyone! First things first, thank you all for your patience regarding this (really) long-standing issue. I’m pleased to announce that all the bugs you’ve mentioned in this issue have been addressed (ce6040f2170a6a9c106392ef98f3e101fedcfc6c • 091c9afc030364db94e6eadbe1a31ba8f0071d7c • 3bdc9df52edce52d9e54b94f6873ebff758860d9). These fixes are available in the freshly released Modalfy v3 🥳 If you’re still using Modalfy, please give it a try and let us know!
@facuescobar Thank you for pointing us in the right direction for the fix! It actually helped us uncover some other bugs 🙌
@fermmm Glad to know that you were able to find an easier way to handle modals that worked for you! At the end of the day, using libraries is sometimes a tradeoff that’s not worth taking indeed.
@Omelyan Thanks for the feedback, there were quite some annoying bugs indeed. Now I’m especially happy to read that you were also able to pick onto so other bugs that were still going under the radar. I can’t wait to review your pull requests addressing all the primitives bugs you’ve found!