UNPKG

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

Version:
76 lines 3.21 kB
import * as React from "react"; import { type SharedValue } from "react-native-reanimated"; import type { BottomSheetLock } from "../utils"; /** * The context that describes the current position and state of the bottom-sheet. * * Note: you probably shouldn't write to any of these values directly, instead * refer to the appropriate hook counterparts. */ interface BottomSheetToolboxInternalContextShape { /** * The current position of the bottom-sheet, defined as distance from the bottom. */ currentPositionSharedValue: SharedValue<number>; /** * The position the bottom-sheet was last known to be moving towards. * This is only different from currentPositionSharedValue when the sheet * is animating to a new destination. */ currentPositionDestinationSharedValue: SharedValue<number>; /** * The last known velocity of the bottom-sheet. */ currentPositionLastVelocitySharedValue: SharedValue<number>; /** * The current write lock held on the sheet's position. */ currentPositionLockSharedValue: SharedValue<BottomSheetLock | null>; /** * An array of positions the bottom-sheet is allowed to snap to. */ normalizedSnapPointsSharedValue: SharedValue<number[] | null>; /** * The maximum height available to the bottom-sheet. */ wrapperHeightSharedValue: SharedValue<number | null>; /** * The current internally calculated height of the bottom-sheet's content. */ childrenHeightSharedValue: SharedValue<number | null>; /** * The current internally calculated height of the bottom-sheet's footer. */ footerHeightSharedValue: SharedValue<number | null>; /** * A flag used to indicate whether the bottom-sheet is ready to be displayed. * This lets us wait for layout calculations, etc.. */ isReadySharedValue: SharedValue<boolean>; /** * The debug ID used to identify this sheet in the DevTools and elsewhere. */ debugId: string; } /** * Retrieve the bottom sheet internal context, and throw if unavailable. */ export declare function useBottomSheetToolboxInternalContext(): BottomSheetToolboxInternalContextShape; export interface BottomSheetToolboxInternalProviderProps { children: React.ReactNode; /** * When provided, the reset will discard the inherited context, * and create a new one. */ reset?: boolean; } /** * Provides a context for managing the position state of a bottom-sheet. * By default, this provider will do nothing if a context is already provided. * * If you wish to reset the context, you can pass the 'reset' prop. * This is useful when nesting bottom-sheets. */ export declare function BottomSheetToolboxInternalProvider({ children, reset, }: BottomSheetToolboxInternalProviderProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined; export {}; //# sourceMappingURL=bottom-sheet-toolbox-internal-context.d.ts.map