import * as React from 'react'; import { View } from 'react-native'; import type { ZestUIComponentProps } from '../../types'; import type { ToastObject } from '../useToastManager'; export type ToastSwipeDirection = 'up' | 'down' | 'left' | 'right'; /** * Groups all parts of an individual toast. * Renders a `` wrapped in a `GestureDetector`. * * Follows the animation contract: it never moves itself. It publishes * `transitionStatus`, its stacking `offsetY`/`index`, and how far a swipe has * travelled, and the consumer turns those into a transform. * * **Enter:** `transitionStatus` starts as `'starting'` (auto-clears to * `undefined` after one frame). Key off `state.transitionStatus === 'starting'` * to trigger a slide-in or fade-in animation. * * **Exit:** `removeOnClose` (on by default) drops the toast the moment it * closes — the right default for a consumer who does not animate. To animate * the exit, set `removeOnClose={false}`, drive the exit from * `state.transitionStatus === 'ending'` using `state.measuredHeight` as the * starting value (the animation target is `0`), and call * `useToastManager().remove(id)` when the animation finishes. * This is the same lever as `Collapsible.Panel`'s `keepMounted`. */ export declare function ToastRoot(componentProps: ToastRoot.Props): React.JSX.Element; export interface ToastRootState { /** * The toast's transition status: `'starting'` as it arrives (auto-clears to * `undefined` after one frame for enter animation), `'ending'` once it is * closing. */ transitionStatus: 'starting' | 'ending' | undefined; /** * Whether a toast is being pressed or focused, which pauses the timers. */ expanded: boolean; /** * Whether the toast is beyond the provider's `limit`. Limited toasts stay in * the list so they can be hidden or animated out rather than vanishing. */ limited: boolean; /** * The toast's type, as passed to `add()`. */ type: string | undefined; /** * The toast's index in the list, newest first. */ index: number; /** * The toast's index among the toasts that are not closing, or `-1` when it is. */ visibleIndex: number; /** * How far down the stack the toast sits, in pixels: the total height of every * toast before it. This is the RN counterpart of upstream's * `--toast-offset-y` CSS variable. */ offsetY: number; /** * The toast's measured height. */ height: number; /** * The last measured height before the toast closed, preserved for the * consumer to use as the starting value for an exit animation. * Falls back to `height` when no close has occurred yet. */ measuredHeight: number; /** * Whether a swipe is currently in progress. */ swiping: boolean; /** * How far the current swipe has travelled towards `swipeDirection`, in pixels. */ swipeMovement: number; /** * The direction a swipe must travel to dismiss the toast. */ swipeDirection: ToastSwipeDirection; } export interface ToastRootProps extends ZestUIComponentProps { /** * The toast to render, from `useToastManager().toasts`. */ toast: ToastObject; /** * Whether to remove the toast from the list as soon as it closes. * * Set it to `false` to animate the exit: drive the animation from * `state.transitionStatus === 'ending'` and call `useToastManager().remove(id)` * when it finishes. Nothing in React Native can report that for you. * @default true */ removeOnClose?: boolean | undefined; /** * The swipe direction used to dismiss the toast. * @default 'right' */ swipeDirection?: ToastSwipeDirection | undefined; /** * How far a swipe must travel, in pixels, before it dismisses the toast. * @default 40 */ swipeThreshold?: number | undefined; } export declare namespace ToastRoot { type State = ToastRootState; type Props = ToastRootProps; type SwipeDirection = ToastSwipeDirection; } //# sourceMappingURL=ToastRoot.d.ts.map