You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A zero-dependency, headless toast notification system for React Native (Expo) with an imperative API, animated SVG icons, stack mode, swipe dismiss, custom icons, and dark/light themes.
1. Core API
Method
Description
Default Duration
toast(message, options?)
Generic blank toast — no built-in icon
4000ms
toast.success(message, options?)
Success toast with animated checkmark SVG
2000ms
toast.error(message, options?)
Error toast with animated X-mark SVG
4000ms
toast.loading(message, options?)
Loading toast with native ActivityIndicator
∞ (never auto-dismisses)
toast.custom(message, options?)
Custom toast — no built-in icon, message can be ReactNode
4000ms
toast.dismiss(toastId?)
Triggers exit animation then removes. No ID = dismiss all
—
toast.remove(toastId?)
Immediately removes with no animation. No ID = remove all
—
toast.promise(promise, msgs, opts?)
Shows loading → success/error based on resolution. promise accepts Promise<T> or () => Promise<T>
—
All methods return the toast id string (except dismiss/remove/promise)
Auto-incrementing IDs (t_1, t_2, …) or custom via opts.id
Upsert behavior: same id updates existing toast instead of creating duplicate
2. Toast Types & Variants
Type
Icon
Use Case
blank
None
Generic notifications
success
Animated green checkmark SVG
Positive confirmations
error
Animated red X-mark SVG
Error states
loading
Native ActivityIndicator spinner
Async operations
custom
None (use icon option)
Fully custom content
Message types: plain string, any ReactNode, or render function (toast) => ReactNode
User overrides: opts.style and opts.textStyle spread onto the toast container and text
Same ID updates existing toast instead of duplicating
Dismiss all
toast.dismiss() with no ID dismisses all
Remove all
toast.remove() with no ID clears all
10. Layout & Positioning
Feature
Detail
Position
Top-center (hardcoded)
topOffset
Configurable vertical offset (default 50px)
Safe area
Integrated via useSafeAreaInsets()
gutter
Configurable gap between expanded toasts (default 8px)
Height measurement
Each toast self-measures via onLayout
Fallback height
48px used before measurement completes
Overlay
Full-screen absoluteFill with pointerEvents="box-none"
Max width
85% of screen
Min width
120px
Content layout
Horizontal row: icon (left) + message (right)
Text max lines
2 lines with ellipsis
Font scaling
Disabled (allowFontScaling={false})
Text selection
Disabled (selectable={false})
11. Public API Exports
import {
toast, // Imperative API object
useToaster, // Timer management hook
useToasterStore, // State subscription hook
ToastContainer, // Root overlay component
useTheme, // Theme reader hook
setTheme, // Theme setter function
type Toast,
type ToastOptions,
type ToastType,
type ToastTheme,
type ToastMessage,
} from "@ncrft/native-toast";