ionic-team / ionic-team/ionic-framework

feat: return data from modal even when not explicitly calling dismiss method

Ouverte
#21,979 3 commentaires 9 réactions 0 personnes assignées Voir sur GitHub
package: core type: feature request
Langage dominant
TypeScript
Étoiles
52.7k
Forks
13.3k
Merge moyen
1 j 15 h
PR mergées (30 j)
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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.