Skip to main content
Version: 1.3.x

API Lifecycle and Enums

Platform support (current): iOS and Android only. Web is not officially supported yet and may be added in future releases.

Lifecycle callbacks, close reasons, unions/enums, and public type-export index.

Callback Context Contracts

Callback Context Object

FieldTypeDescription
idToastIdToast id.
hostIdstringHost id owning toast.
reasonCloseReason | undefinedReason when relevant to callback phase.
state{ mounted: boolean; visible: boolean; isClosing: boolean }Lifecycle flags snapshot.
toastobjectToast snapshot payload at callback time.

Action Context Object

FieldTypeDescription
idToastIdToast id.
hostIdstringHost id owning toast.
actionToastActionAction metadata.
actionIndexnumberIndex in action list.
dismiss(reason?: CloseReason) => booleanProgrammatic dismiss helper for current toast.
update(options: ToastUpdateOptions) => booleanProgrammatic update helper for current toast.

Close Reasons and Lifecycle Timing

Close Reasons

ValueMeaning
timeoutAuto-dismiss timer elapsed.
swipeGesture-based dismissal.
pressBody press dismissal (dismissOnPress: true).
actionDismiss triggered by toast action.
dismissExplicit dismiss path (dismiss, dismiss button, dismiss-all defaults).
programmaticInternal/imperative close path (config change, force removal, etc.).

Callback Timing Order

Show/update phases:

  1. onMount
  2. onOpen
  3. onUpdate (whenever update succeeds)

Close phase (single-fire guarded):

  1. onClosingStart
  2. onClose
  3. onClosingEnd
  4. onDismiss

Interaction callbacks:

  • onPress on body press
  • onActionPress on action press

Union and Enum Allowed Values

TypeAllowed values
ToastVariantdefault, success, error, warning, info, loading
ToastTemplatecompact, banner
ToastPositiontop, bottom
ToastAnimationPresetsubtle, spring, snappy
ToastDedupeModereset, replace, ignore, bump
ToastGroupBehaviorreplace-in-group, update-in-group, stack-in-group
ToastPriorityModesoft, strict
ToastHostPresetdefault, minimal, status, banner-heavy
ToastInteractionModeclassic, deck
ToastThemeauto, light, dark
ToastDirectionauto, ltr, rtl
ToastResolvedThemelight, dark
ToastStackOverflowModefade, compact, clip
ToastDismissAllConfirmationKindnone, default, custom
ToastDismissAllConfirmationnone, default, (context) => boolean | Promise<boolean>
ToastExpandedAutoCollapsePolicynumber, false
CloseReasontimeout, swipe, press, action, dismiss, programmatic

Type Exports

Public root type exports include:

  • CloseReason
  • ToastAction
  • ToastAnimationConfig
  • ToastAnimationPreset
  • ToastController
  • ToastDedupeMode
  • ToastExpandedAutoCollapsePolicy
  • ToastCollapseHandleStyle
  • ToastClassicGestureConfig
  • ToastDeckGestureConfig
  • ToastGestureConfig
  • ToastGroupBehavior
  • ToastHostConfig
  • ToastHostConfigChangeContext
  • ToastInteractionMode
  • ToastHostProps
  • ToastHostPreset
  • ToastResolvedTheme
  • ToastTheme
  • ToastDirection
  • ToastId
  • ToastOptions
  • ToastPriorityMode
  • ToastDismissAllConfirmation
  • ToastDismissAllConfirmationKind
  • ToastDismissAllAttemptContext
  • ToastDismissAllCompleteContext
  • ToastStackStateContext
  • ToastPromiseOptions
  • ToastPosition
  • ToastProviderProps
  • ToastStackOverflowMode
  • ToastTemplate
  • ToastTemplateProps
  • ToastTemplateRenderer
  • ToastTemplateRegistry
  • ToastUpdateOptions
  • ToastVariant
  • ToastViewportProps
  • ToastNativeSurfaceBoundaryProps
  • ToastTemplateMap
  • ToastTemplateNameFromMap
  • TypedToastOptions
  • TypedToastUpdateOptions
  • TypedToastPromiseOptions
  • TypedToastController
  • TypedToastGlobal
  • TypedToastHostConfig
  • TypedToastProviderProps
  • TypedToastHostProps
  • TypedToastViewportProps

Use src/index.ts as source-of-truth export index for contract verification.