How to show toast notifications in React Native
By the LumioUI team · Updated
To show toast notifications in React Native, put a toast provider at the root of your app and call a hook from anywhere to show one. Name the variant: success, error, info, warning or loading. Toasts should stack, dismiss themselves after a few seconds, and swipe away. The LumioUI Toast does this, and a loading toast can turn into a success in place.
Live demo of the LumioUI Toast component. It's interactive, so try it.
What a good toast system needs
- One provider, one hook. The provider renders the stack above everything else and owns the timers. Screens call
useToast()and never render toasts themselves. - Entrance and exit. Toasts grow out of the screen edge they live on and leave by dimming in place. The exit should run about 60% as long as the entrance.
- Stacking. Newer toasts push older ones back, and only a few stay visible. The rest wait their turn, and their timers keep running.
- Swipe to dismiss. A horizontal flick (around 500 points per second) removes one. A slow drag springs it back.
- Accessibility. Announce the toast's text to screen readers once, not every animation frame. Never put the only way to do something inside a toast that disappears.
The quick way: LumioUI Toast
Wrap your app once:
// app/_layout.tsx (Expo Router) or App.tsx
import { ToastProvider } from "@/components/ui/toast/toast";
export default function RootLayout() {
return (
<ToastProvider position="top" defaultDuration={4000}>
{/* your app */}
</ToastProvider>
);
} Then show toasts from any screen. Here a loading toast covers a save:
import { useToast } from "@/components/ui/toast/toast";
import { Button } from "@/components/ui/button/button";
export function SaveButton() {
const toast = useToast();
const save = async () => {
// One toast: loading while it saves, then it turns into the result in place.
const id = toast.loading("Saving…");
try {
await api.save();
toast.update(id, { title: "Saved", description: "Your changes are live.", variant: "success", duration: 4000 });
} catch {
toast.update(id, { title: "Couldn't save", description: "Check your connection and try again.", variant: "error", duration: 6000 });
}
};
return <Button onPress={save}>Save</Button>;
} toast.show(title, options)takesdescription,variant,icon,duration(0 keeps it open),dismissibleand anactionbutton.toast.success,error,warning,infoandloadingare shortcuts.toast.update(id, …)changes a toast in place, anddismiss(id)ordismissAll()close them.- The provider sets
position("top"or"bottom"),limit,maxVisibleand thesurface("solid"or"glass").
For a message that should stay on the page, like a form error, use Alert. For an app-wide banner that drops from the top, see Notification Banner (Pro).
Add it to your app
LumioUI's CLI copies the component's source into your project, so it's yours to read and change. Run init once per project:
npx @lumioui/cli init
npx @lumioui/cli add toast It works in Expo (SDK 54+) and bare React Native, with Reanimated 4 and NativeWind. See the installation guide and the full Toast API.
Related components
- Alert
- Notification Banner (Pro)
- Offline Banner (Pro)
- Dialog
More React Native guides
- How to make a bottom sheet in React Native
- Animated tabs with a sliding indicator in React Native
- Skeleton loading screens in React Native
- How to add dark mode and a theme toggle in React Native
- How to build an accordion in React Native
- How to make a side drawer menu in React Native
- How to make an animated heart like button in React Native
- How to make a modal dialog in React Native
- How to build an animated carousel in React Native
- How to make an animated splash screen in React Native and Expo
- How to build a month calendar in React Native