MCPcopy Create free account
hub / github.com/ionic-team/ionic-framework / setCurrentBreakpoint

Method setCurrentBreakpoint

core/src/components/modal/modal.tsx:1069–1097  ·  view source on GitHub ↗
(breakpoint: number)

Source from the content-addressed store, hash-verified

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

Callers 7

moveToNextBreakpointMethod · 0.95
expandInlineSheetMethod · 0.80
expandInlineSheetMethod · 0.80
modal.spec.tsFile · 0.80
modal.e2e.tsFile · 0.80
modal.e2e.tsFile · 0.80
modal.e2e.tsFile · 0.80

Calls 2

printIonWarningFunction · 0.90
moveSheetToBreakpointFunction · 0.85

Tested by

no test coverage detected