Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/src/components/modal/gestures/swipe-to-close.ts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ export const createSwipeToCloseGesture = (
deltaY: detail.deltaY,
velocityY: detail.velocityY,
progress: calculateProgress(el, detail.deltaY),
snapBreakpoint: shouldComplete ? 0 : 1,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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;

};

onDragEnd(eventDetail);
Expand Down