Overview
ToastPortal is a specialized component for showing toasts inside Android modal screens.
On Android, native modals render above the root React view, so toasts from the main <BreadLoaf /> component won’t be visible. Add <ToastPortal /> inside your modal layouts to show toasts above modal content.
This component only renders on Android and returns null on iOS, where <BreadLoaf /> already handles modal overlay via FullWindowOverlay.
When to use
UseToastPortal when:
- You have modal screens on Android (e.g., Expo Router modal routes)
- You need to show toasts while a modal is open
- Toasts from the root
<BreadLoaf />are not visible in your modal
Basic usage
Props
ToastPortal does not accept any props. It only renders toasts and inherits all styling and behavior from your root <BreadLoaf /> configuration.
Platform behavior
- Android: Renders toast container to display toasts above modal content
- iOS: Returns
null(no rendering needed -BreadLoafhandles all modals)
Complete example
Implementation notes
ToastPortalshares the same toast store asBreadLoaf, so toasts triggered anywhere in your app will appear in both locations- Configuration is controlled globally through
<BreadLoaf config={...} />- you cannot configureToastPortalindependently - Only use
ToastPortalin modal layouts, not in regular screens (whereBreadLoafalready handles toasts) - Multiple
ToastPortalinstances can coexist (e.g., nested modals), and each will render the same toasts
Related
- BreadLoaf - Main toast provider component
- toast.success - Show success toasts
- Modal setup guide - Complete modal configuration guide