feat(modal): expose isDismissing on ionDragEnd - #31002
Conversation
|
@aeharding is attempting to deploy a commit to the Ionic Team on Vercel. A member of the Team first needs to authorize it. |
e9f92a4 to
c200d78
Compare
| deltaY: detail.deltaY, | ||
| velocityY: detail.velocityY, | ||
| progress: calculateProgress(el, detail.deltaY), | ||
| snapBreakpoint: shouldComplete ? 0 : 1, |
There was a problem hiding this comment.
snapBreakpoint is specific to sheet modals, and card modals have no breakpoint concept, so exposing a "breakpoint" here is a bit misleading. Let's call it isDismissing and return a plain boolean instead of 0/1.
| snapBreakpoint: shouldComplete ? 0 : 1, | |
| isDismissing: shouldComplete, |
This also follows the convention we use for other booleans on public event details, such as isScrolling on ion-content's ScrollDetail and isAnimating on the menu interface.
One more change to go with it: please add the field to ModalDragEventDetail in modal-interface.ts so it's part of the public type:
/**
* Whether the card modal will dismiss when the drag gesture ends.
* `true` if the gesture passed the dismiss threshold, `false` if the
* modal will remain open.
*/
isDismissing?: boolean;There was a problem hiding this comment.
Adding this variable changes the ionDragEnd detail length, so the existing assertion in modal-card.e2e.ts will fail. Please update the expected length there.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ShaneK
left a comment
There was a problem hiding this comment.
Awesome work! I did catch an issue that I believe is blocking and some others that aren't necessarily but might be nice to fix now
Issue number: resolves #31001
What is the current behavior?
The
ionDragEndevent on card modals emitscurrentY,deltaY,velocityYandprogress. None of these indicate whether the modal is about to dismiss, so consumers cannot react to the outcome of the gesture when the user lifts their finger.What is the new behavior?
ionDragEndnow includesisDismissingon card modals. It istruewhen the gesture passed the dismiss threshold and the modal will animate away, andfalsewhen the modal will settle back open.Sheet modals are unchanged and continue to report
snapBreakpoint.Does this introduce a breaking change?
Other information
Testing with Voyager and works great! aeharding/voyager#2227
Previews: