(detail: GestureDetail)
| 299 | }; |
| 300 | |
| 301 | const onStart = (detail: GestureDetail) => { |
| 302 | /** |
| 303 | * If canDismiss is anything other than `true` |
| 304 | * then users should be able to swipe down |
| 305 | * until a threshold is hit. At that point, |
| 306 | * the card modal should not proceed any further. |
| 307 | * |
| 308 | * canDismiss is never fired via gesture if there is |
| 309 | * no 0 breakpoint. However, it can be fired if the user |
| 310 | * presses Esc or the hardware back button. |
| 311 | * TODO (FW-937) |
| 312 | * Remove undefined check |
| 313 | */ |
| 314 | canDismissBlocksGesture = baseEl.canDismiss !== undefined && baseEl.canDismiss !== true && minBreakpoint === 0; |
| 315 | |
| 316 | /** |
| 317 | * Cache the scroll element reference when the gesture starts, |
| 318 | * this allows us to avoid querying the DOM for the target in onMove, |
| 319 | * which would impact performance significantly. |
| 320 | */ |
| 321 | if (!expandToScroll) { |
| 322 | const targetEl = findClosestIonContent(detail.event.target! as HTMLElement); |
| 323 | cachedScrollEl = |
| 324 | targetEl && isIonContent(targetEl) ? getElementRoot(targetEl).querySelector('.inner-scroll') : targetEl; |
| 325 | } |
| 326 | |
| 327 | /** |
| 328 | * If expandToScroll is disabled, we need to swap |
| 329 | * the footer position to moving so that it doesn't shake |
| 330 | * while the sheet is being dragged. |
| 331 | */ |
| 332 | if (!expandToScroll) { |
| 333 | swapFooterPosition('moving'); |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * If we are pulling down, then it is possible we are pulling on the content. |
| 338 | * We do not want scrolling to happen at the same time as the gesture. |
| 339 | */ |
| 340 | if (detail.deltaY > 0 && contentEl) { |
| 341 | contentEl.scrollY = false; |
| 342 | } |
| 343 | |
| 344 | raf(() => { |
| 345 | /** |
| 346 | * Dismisses the open keyboard when the sheet drag gesture is started. |
| 347 | * Sets the focus onto the modal element. |
| 348 | */ |
| 349 | baseEl.focus(); |
| 350 | }); |
| 351 | |
| 352 | animation.progressStart(true, 1 - currentBreakpoint); |
| 353 | |
| 354 | onDragStart(); |
| 355 | }; |
| 356 | |
| 357 | const onMove = (detail: GestureDetail) => { |
| 358 | /** |
no test coverage detected