mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
feat(toast): add swipe to dismiss functionality (#28442)
Issue number: resolves #21769 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Toast does not support swipe gestures to dismiss. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Added a `swipeGesture` property that allows users to swipe toasts closed. Note: This is a combination of previous PRs https://github.com/ionic-team/ionic-framework/pull/28380 and https://github.com/ionic-team/ionic-framework/pull/28402 ⚠️ There is a visual glitch on iOS where dragging and having the toast animate back to its opened position causes a flicker. This is an iOS 17 regression and is being tracked in https://github.com/ionic-team/ionic-framework/issues/28467. This bug has been reported to and confirmed by Apple. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> ⚠️ Give co-author credit to author in https://github.com/ionic-team/ionic-framework/pull/23124 --------- Co-authored-by: evgeniy-skakun <evgeniy-skakun@users.noreply.github.com>
This commit is contained in:
@ -2,6 +2,7 @@ import { getTimeGivenProgression } from '@utils/animation/cubic-bezier';
|
||||
import { isIonContent, findClosestIonContent, disableContentScrollY, resetContentScrollY } from '@utils/content';
|
||||
import { createGesture } from '@utils/gesture';
|
||||
import { clamp, getElementRoot } from '@utils/helpers';
|
||||
import { OVERLAY_GESTURE_PRIORITY } from '@utils/overlays';
|
||||
|
||||
import type { Animation } from '../../../interface';
|
||||
import type { GestureDetail } from '../../../utils/gesture';
|
||||
@ -292,7 +293,7 @@ export const createSwipeToCloseGesture = (
|
||||
const gesture = createGesture({
|
||||
el,
|
||||
gestureName: 'modalSwipeToClose',
|
||||
gesturePriority: 39,
|
||||
gesturePriority: OVERLAY_GESTURE_PRIORITY,
|
||||
direction: 'y',
|
||||
threshold: 10,
|
||||
canStart,
|
||||
|
||||
Reference in New Issue
Block a user