From bc4cad3e7b6b0652df3956a8bd85cbaf015c36f1 Mon Sep 17 00:00:00 2001 From: Sean Perkins Date: Fri, 11 Mar 2022 16:11:27 -0500 Subject: [PATCH] chore(modal): typo for variable / undefined check (#24929) --- core/src/components/modal/gestures/sheet.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/components/modal/gestures/sheet.ts b/core/src/components/modal/gestures/sheet.ts index 7e27abfb7f..65d164543e 100644 --- a/core/src/components/modal/gestures/sheet.ts +++ b/core/src/components/modal/gestures/sheet.ts @@ -165,21 +165,21 @@ export const createSheetGesture = ( const initialStep = 1 - currentBreakpoint; const secondToLastBreakpoint = breakpoints.length > 1 ? 1 - breakpoints[1] : undefined; const step = initialStep + (detail.deltaY / height); - const isAttempingDismissWithCanDismiss = secondToLastBreakpoint !== undefined && step >= secondToLastBreakpoint && canDismissBlocksGesture; + const isAttemptingDismissWithCanDismiss = secondToLastBreakpoint !== undefined && step >= secondToLastBreakpoint && canDismissBlocksGesture; /** * If we are blocking the gesture from dismissing, * set the max step value so that the sheet cannot be * completely hidden. */ - const maxStep = isAttempingDismissWithCanDismiss ? canDismissMaxStep : 0.9999; + const maxStep = isAttemptingDismissWithCanDismiss ? canDismissMaxStep : 0.9999; /** * If we are blocking the gesture from * dismissing, calculate the spring modifier value * this will be added to the starting breakpoint * value to give the gesture a spring-like feeling. - * Note that when isAttempingDismissWithCanDismiss is true, + * Note that when isAttemptingDismissWithCanDismiss is true, * the modifier is always added to the breakpoint that * appears right after the 0 breakpoint. * @@ -188,7 +188,7 @@ export const createSheetGesture = ( * why we subtract secondToLastBreakpoint. This lets us get * the result as a value from 0 to 1. */ - const processedStep = isAttempingDismissWithCanDismiss ? secondToLastBreakpoint + calculateSpringStep((step - secondToLastBreakpoint) / (maxStep - secondToLastBreakpoint)) : step; + const processedStep = isAttemptingDismissWithCanDismiss && secondToLastBreakpoint !== undefined ? secondToLastBreakpoint + calculateSpringStep((step - secondToLastBreakpoint) / (maxStep - secondToLastBreakpoint)) : step; offset = clamp(0.0001, processedStep, maxStep); animation.progressStep(offset);