chore(modal): typo for variable / undefined check (#24929)

This commit is contained in:
Sean Perkins
2022-03-11 16:11:27 -05:00
committed by GitHub
parent d6d7c0576b
commit bc4cad3e7b

View File

@ -165,21 +165,21 @@ export const createSheetGesture = (
const initialStep = 1 - currentBreakpoint; const initialStep = 1 - currentBreakpoint;
const secondToLastBreakpoint = breakpoints.length > 1 ? 1 - breakpoints[1] : undefined; const secondToLastBreakpoint = breakpoints.length > 1 ? 1 - breakpoints[1] : undefined;
const step = initialStep + (detail.deltaY / height); 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, * If we are blocking the gesture from dismissing,
* set the max step value so that the sheet cannot be * set the max step value so that the sheet cannot be
* completely hidden. * completely hidden.
*/ */
const maxStep = isAttempingDismissWithCanDismiss ? canDismissMaxStep : 0.9999; const maxStep = isAttemptingDismissWithCanDismiss ? canDismissMaxStep : 0.9999;
/** /**
* If we are blocking the gesture from * If we are blocking the gesture from
* dismissing, calculate the spring modifier value * dismissing, calculate the spring modifier value
* this will be added to the starting breakpoint * this will be added to the starting breakpoint
* value to give the gesture a spring-like feeling. * 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 * the modifier is always added to the breakpoint that
* appears right after the 0 breakpoint. * appears right after the 0 breakpoint.
* *
@ -188,7 +188,7 @@ export const createSheetGesture = (
* why we subtract secondToLastBreakpoint. This lets us get * why we subtract secondToLastBreakpoint. This lets us get
* the result as a value from 0 to 1. * 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); offset = clamp(0.0001, processedStep, maxStep);
animation.progressStep(offset); animation.progressStep(offset);