Skip to main content

computeDetentHeights

The visible height of each detent for a viewport, in whole pixels.

This is a function exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import { computeDetentHeights } from "@mapcairn/core";

function computeDetentHeights(input: {
viewportHeight: number;
insetBottom: number;
}): DetentHeights;

Parameters​

  • input ({ viewportHeight: number; insetBottom: number; }): The fields, by name:
    • viewportHeight: Height of the visual viewport.
    • insetBottom: Bottom safe-area inset. It is added to the peek so the peek's content is not hidden behind a home indicator.

Returns​

DetentHeights

Remarks​

The result is always ordered peek <= half <= full, even on a very short viewport, so snapping never has to deal with crossed detents.

See also​

Source: packages/core/src/sheet/sheet.ts:48