ionic-team / ionic-team/ionic-framework
feat: return data from modal even when not explicitly calling dismiss method
- Dominant language
- TypeScript
- Stars
- 52.7k
- Forks
- 13.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 51
Description
# Feature Request
**Ionic version:**
[x] **5.x**
**Describe the Feature Request**
My App currently displays a list with various items. The user can click on an item and edit it in a modal. When the modal dismisses, the list should show the changes the user had made.
I can use `this.modalCtrl.dismiss(value);` only if the user clicks on the "save" button. But I also want to pass the edited object to the previous page when the user swipes down to close the modal or clicks on the backdrop.
**Describe Preferred Solution**
A good solution would be an event that will be triggered if the modal is is going to be dismissed. A good example is the calendar app: https://streamable.com/7etj0s
This event could be used to prevent the modal from closing and show some info to the user. This event could also be used to trigger `this.modalCtrl.dismiss(value);` and pass data to page by using swipe-to-close.
**Describe Alternatives**
I tried to call `this.modalCtrl.dismiss(value);` in ionViewWillLeave. But the passed object was undefined.
Contributor guide
Assessment
This issue has not been assessed yet.