(breakpoint: number)
| 1067 | */ |
| 1068 | @Method() |
| 1069 | async setCurrentBreakpoint(breakpoint: number): Promise<void> { |
| 1070 | if (!this.isSheetModal) { |
| 1071 | printIonWarning('[ion-modal] - setCurrentBreakpoint is only supported on sheet modals.'); |
| 1072 | return; |
| 1073 | } |
| 1074 | if (!this.breakpoints!.includes(breakpoint)) { |
| 1075 | printIonWarning( |
| 1076 | `[ion-modal] - Attempted to set invalid breakpoint value ${breakpoint}. Please double check that the breakpoint value is part of your defined breakpoints.` |
| 1077 | ); |
| 1078 | return; |
| 1079 | } |
| 1080 | |
| 1081 | const { currentBreakpoint, moveSheetToBreakpoint, canDismiss, breakpoints, animated } = this; |
| 1082 | |
| 1083 | if (currentBreakpoint === breakpoint) { |
| 1084 | return; |
| 1085 | } |
| 1086 | |
| 1087 | if (moveSheetToBreakpoint) { |
| 1088 | this.sheetTransition = moveSheetToBreakpoint({ |
| 1089 | breakpoint, |
| 1090 | breakpointOffset: 1 - currentBreakpoint!, |
| 1091 | canDismiss: canDismiss !== undefined && canDismiss !== true && breakpoints![0] === 0, |
| 1092 | animated, |
| 1093 | }); |
| 1094 | await this.sheetTransition; |
| 1095 | this.sheetTransition = undefined; |
| 1096 | } |
| 1097 | } |
| 1098 | |
| 1099 | /** |
| 1100 | * Returns the current breakpoint of a sheet style modal |
no test coverage detected