Using Ionic 5's new ModalController, in addition to the backdropDismiss parameter, it is also now possible to set a new parameter which enables the user to swipe a modal down to close it like so:
const modal = await this.modalController.create({
component: ModalPage,
backdropDismiss: true, // <-- enable backdrop dismiss
swipeToClose: true, // <-- enable swipe to close
presentingElement: await this.modalController.getTop()
});
return await modal.present();
Specific to when a user triggers a swipeToClose
or backdropDismiss
, Is it possible to pass data back to the onWillDismiss()
or onDidDismiss()
events?
I am aware of the dismiss()
method which allows us to pass data back to the origin component programmatically. That method does not address how to pass data back when the swipeToClose
or backdropDismiss
events are fired.
It may be the case that this is simply not possible, to which i can come up with a workaround, but thought id propose the question here first.