expo-toastee
Version:
A simple and elegant toast notification library for React Native Expo with Material You and Neobrutalist themes
54 lines (53 loc) • 1.43 kB
JavaScript
import { toastManager } from './ToastManager';
/**
* Toast utility functions that can be used anywhere in your app
* These functions are NOT React hooks and can be called from components,
* utility functions, services, etc.
*/
export const toast = {
/**
* Show a success toast
* @param message - The message to display
* @param options - Optional configuration
*/
success: (message, options) => {
toastManager.success(message, options);
},
/**
* Show an error toast
* @param message - The message to display
* @param options - Optional configuration
*/
error: (message, options) => {
toastManager.error(message, options);
},
/**
* Show an info toast
* @param message - The message to display
* @param options - Optional configuration
*/
info: (message, options) => {
toastManager.info(message, options);
},
/**
* Show a warning toast
* @param message - The message to display
* @param options - Optional configuration
*/
warning: (message, options) => {
toastManager.warning(message, options);
},
/**
* Remove a specific toast by ID
* @param id - The toast ID to remove
*/
remove: (id) => {
toastManager.removeToast(id);
},
/**
* Clear all toasts
*/
clear: () => {
toastManager.clearAll();
},
};