Skip to main content

In App Notifications

MNToaster Component

Import

import {MNToaster} from '@/components/ui/MNToaster';

Props

PropTypeRequiredDefaultDescription
type'success' | 'error' | 'info''success'Type of toast notification
headstring''Title or header text of the toast
bodystring''Optional body or message below the header
onPress() => void-Callback when toast is pressed
position'top' | 'bottom''top'Position of the toast on screen
visibilityTimenumber4000Duration in milliseconds the toast stays visible
topOffsetnumber60Distance from the top edge when positioned at the top
bottomOffsetnumber40Distance from the bottom edge when positioned at the bottom
keyboardOffsetnumber30Offset to avoid keyboard overlap
autoHidebooleantrueWhether the toast hides automatically after visibilityTime
onShow() => void-Callback when toast appears
onHide() => void-Callback when toast disappears

Basic Usage

MNToaster({
type: 'success',
head: 'Success!',
body: 'Your operation completed successfully.',
position: 'top',
visibilityTime: 3000,
autoHide: true,
topOffset: 70,
onShow: () => console.log('Toast shown'),
onHide: () => console.log('Toast hidden'),
onPress: () => console.log('Toast pressed'),
});

NOTE: All example can be founded in push_notifications.tsx