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

Method moveToNextBreakpoint

core/src/components/modal/modal.tsx:1107–1130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1105 }
1106
1107 private async moveToNextBreakpoint() {
1108 const { breakpoints, currentBreakpoint } = this;
1109
1110 if (!breakpoints || currentBreakpoint == null) {
1111 /**
1112 * If the modal does not have breakpoints and/or the current
1113 * breakpoint is not set, we can't move to the next breakpoint.
1114 */
1115 return false;
1116 }
1117
1118 const allowedBreakpoints = breakpoints.filter((b) => b !== 0);
1119 const currentBreakpointIndex = allowedBreakpoints.indexOf(currentBreakpoint);
1120 const nextBreakpointIndex = (currentBreakpointIndex + 1) % allowedBreakpoints.length;
1121 const nextBreakpoint = allowedBreakpoints[nextBreakpointIndex];
1122
1123 /**
1124 * Sets the current breakpoint to the next available breakpoint.
1125 * If the current breakpoint is the last breakpoint, we set the current
1126 * breakpoint to the first non-zero breakpoint to avoid dismissing the sheet.
1127 */
1128 await this.setCurrentBreakpoint(nextBreakpoint);
1129 return true;
1130 }
1131
1132 private onHandleClick = () => {
1133 const { sheetTransition, handleBehavior } = this;

Callers 1

ModalClass · 0.95

Calls 1

setCurrentBreakpointMethod · 0.95

Tested by

no test coverage detected