UNPKG

@attio/react-native-bottom-sheet-toolbox

Version:
48 lines (40 loc) 1.57 kB
import type {SharedValue} from "react-native-reanimated" // The sheet position equivalent to it being closed. export const CLOSED_SNAP_POINT = 0 // The sheet position equivalent to it being at its content height. export const CONTENT_HEIGHT_SNAP_POINT = "CONTENT_HEIGHT" export const CONTENT_HEIGHT_WITH_OVERLAY_FOOTER_SNAP_POINT = "CONTENT_HEIGHT_WITH_OVERLAY_FOOTER" // The sheet position equivalent to it being fully open. export const FULLY_OPEN_SNAP_POINT = "100%" /** * A flexible representation for the position of a bottom sheet. * It can be a number, a percentage, or the special 'CONTENT_HEIGHT' which * is equivalent to a layout height check of the sheet's contents. */ export type SheetPositionValue = | number | `${number}%` | typeof CLOSED_SNAP_POINT | typeof CONTENT_HEIGHT_SNAP_POINT | typeof CONTENT_HEIGHT_WITH_OVERLAY_FOOTER_SNAP_POINT | typeof FULLY_OPEN_SNAP_POINT | null export type SheetPosition = SharedValue<SheetPositionValue> | SheetPositionValue /** * A small data-structure to describe a lock on the bottom sheet's position. * Lower priority locks can be overridden by higher priority locks. */ export interface BottomSheetLock { id: string priority: number } /** * An enum that all the provided bottom sheet utilities make use of. * This helps keep behavior consistent (both internally to the package, and externally for consumers). */ export enum BottomSheetPositionBuiltInLockPriority { SNAP_WHEN_IDLE = 100, GESTURE = 200, ACTIONS_SNAP = 400, ACTIONS_CLOSE = 500, }