ionic-team / ionic-team/ionic-framework
feat: need a way of knowing when swipe to go back is aborted
- Dominant language
- TypeScript
- Stars
- 52.7k
- Forks
- 13.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 51
Description
### Prerequisites
- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already include this feature request, without success.
### Describe the Feature Request
Currently we have four primary `ionView[Did/Will][Enter/Leave] events to observe during navigation & animation. However, there are scenarios where these events may be fired, but the user cancels the action and stays on the current screen. There does not seem to be a way to detect this scenario, unless I am missing something.
Existing events: https://ionicframework.com/docs/angular/lifecycle
I would like to be able to observe `ionViewDidNotEnter` and `ionViewDidNotLeave` events (or something to that effect), so that we can understand when users started to leave the page, but did not.
### Describe the Use Case
On iOS, as an example, a user swipes right to go back to the previous page, then decides to stay on the page they're looking at. However, `ionViewWillLeave` has been called, and the current page has taken some action that needs to be rolled back when the animation finishes. For the sake of this use case, it is not possible to use the `ionViewDidLeave` event for what the page needs to do.
Unless I've missed a feature or event to observe, we need supplemental events to know when this situation occurs.
### Describe Preferred Solution
Publish `ionViewDidNotEnter` and `ionViewDidNotLeave` events to supplement the existing ones we already have.
### Describe Alternatives
Not sure.
### Related Code
_No response_
### Additional Information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.