Current Version:
2.0.4
A modern, elegant toast notification library for React Native Expo applications with Material You and Neobrutalist themes.
- β¨ Beautiful, animated toast notifications with smooth enter/exit animations
- π¨ Multiple toast types (success, error, info, warning)
- π Two stunning themes:
- Material You: Modern Android 15 inspired pill-shaped toasts
- Neobrutalist: Bold, vibrant design with sharp shadows
- π 6 responsive sizes (xs, sm, md, lg, xl, 2xl) with theme-specific configurations
- π¨ Complete style customization - override any style property
- β‘ Fast and lightweight - built with performance in mind
- π§ Full TypeScript support with comprehensive type definitions
- π± Cross-platform - works perfectly on iOS, Android, and Web
- π― Flexible usage - works in React components AND standalone utility functions
- π Smart positioning (top/bottom) with safe area handling
- β±οΈ Configurable duration with auto-dismiss and manual control
- π Interactive - tap to dismiss, smooth animations
- βοΈ Dual configuration - via props or global settings
- π οΈ Developer friendly - built with Bun for faster development
npm install expo-toastee
# or
yarn add expo-toastee
# or
bun add expo-toasteeAdd the ToastContainer component to your app's root layout (usually App.tsx or your main layout file):
import React from 'react';
import { View } from 'react-native';
import { ToastContainer } from 'expo-toastee';
export default function App() {
return (
<View style={{ flex: 1 }}>
{/* Your app content */}
{/* Add ToastContainer at the root level */}
<ToastContainer />
</View>
);
}You can also configure the toast behavior directly through ToastContainer props:
<ToastContainer
theme="neobrutalist"
size="lg"
defaultDuration={4000}
defaultPosition="bottom"
customStyles={{
container: { borderRadius: 20 },
text: { fontSize: 16 }
}}
/>import { toast } from 'expo-toastee';
// In a React component
const MyComponent = () => {
const handleSuccess = () => {
toast.success('Operation completed successfully!');
};
return (
<TouchableOpacity onPress={handleSuccess}>
<Text>Show Success Toast</Text>
</TouchableOpacity>
);
};
// In a utility function (non-React)
export const showToast = (msg: string) => {
toast.success(msg, { duration: 5000 });
};
// In an async function
const saveData = async () => {
try {
await api.saveData();
toast.success('Data saved successfully!');
} catch (error) {
toast.error('Failed to save data');
}
};Shows a success toast with a green background.
Shows an error toast with a red background.
Shows an info toast with a blue background.
Shows a warning toast with an orange background.
Clears all currently visible toasts.
Removes a specific toast by its ID.
interface ToastOptions {
duration?: number; // Duration in milliseconds (default: 3000)
position?: 'top' | 'bottom'; // Position on screen (default: 'top')
animationType?: 'fade' | 'slide'; // Animation type (default: 'slide')
theme?: 'material' | 'neobrutalist'; // Theme selection
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'; // Size selection (default: 'md')
customStyles?: ToastCustomStyles; // Custom style overrides
}// Basic usage
toast.success('Hello World!');
// With custom duration
toast.error('Something went wrong!', { duration: 5000 });
// Bottom positioned toast
toast.info('Check your network connection', {
position: 'bottom',
duration: 4000
});
// No auto-dismiss (duration: 0)
toast.warning('This will stay until manually dismissed', { duration: 0 });Expo Toastee comes with two carefully crafted themes:
Inspired by Android 15's Material You design:
- Pill-shaped containers with generous rounded corners
- Soft, tinted backgrounds with subtle borders
- Dark text on light backgrounds for better accessibility
- Diffuse shadows for elegant depth
- Responsive sizing that adapts beautifully across all sizes
Modern take on brutalist design:
- Bold borders with sharp contrast
- Vibrant colors that pop off the screen
- Hard drop shadows for dramatic effect
- Strong typography with confident letterforms
- Geometric precision in every element
There are two ways to configure toast defaults:
<ToastContainer
theme="neobrutalist"
defaultDuration={4000}
defaultPosition="bottom"
/>import { configureToasts } from 'expo-toastee';
// Set global theme
configureToasts({
theme: 'neobrutalist',
defaultDuration: 4000,
defaultPosition: 'bottom',
});
// Now all toasts will use neobrutalist theme by default
toast.success('This uses neobrutalist theme!');Override theme, size, and other options for individual toasts:
// Use neobrutalist theme with large size
toast.success('Bold message!', {
theme: 'neobrutalist',
size: 'lg'
});
// Small error toast
toast.error('Gentle error', {
theme: 'material',
size: 'sm'
});
// Extra large info toast
toast.info('Important announcement!', {
size: '2xl',
duration: 6000
});Completely customize the appearance:
toast.success('Custom styled!', {
customStyles: {
container: {
backgroundColor: 'transparent',
borderWidth: 2,
borderColor: '#FF6B6B',
},
successContainer: {
backgroundColor: '#FF6B6B',
},
successText: {
color: '#FFFFFF',
fontWeight: 'bold',
fontSize: 18,
},
},
});Set default custom styles for all toasts:
configureToasts({
customStyles: {
container: {
borderRadius: 20,
},
text: {
fontSize: 16,
fontFamily: 'MyCustomFont',
},
},
});Expo Toastee includes 6 responsive sizes to fit different use cases:
| Size | Width | Max Width | Font Size | Use Case |
|---|---|---|---|---|
| xs | 120px | 180px | 12px | Compact notifications |
| sm | 160px | 240px | 14px | Small alerts |
| md | 200px | 300px | 16px | Default size |
| lg | 250px | 400px | 18px | Important messages |
| xl | 320px | 500px | 20px | Prominent notifications |
| 2xl | 400px | 600px | 22px | Major announcements |
// Different sizes
toast.success('Compact', { size: 'xs' });
toast.info('Default size'); // md is default
toast.error('Large error', { size: 'lg' });
toast.warning('Major alert!', { size: '2xl' });Expo Toastee is written in TypeScript and provides full type definitions:
import {
toast,
ToastOptions,
ToastType,
ToastTheme,
ToastCustomStyles,
configureToasts
} from 'expo-toastee';
const showCustomToast = (message: string, type: ToastType, options?: ToastOptions) => {
switch (type) {
case 'success':
toast.success(message, options);
break;
case 'error':
toast.error(message, options);
break;
// ... etc
}
};
// Type-safe theme configuration
const themeConfig: ToastGlobalConfig = {
theme: 'neobrutalist',
defaultDuration: 5000,
customStyles: {
container: { borderRadius: 20 },
text: { fontWeight: 'bold' },
},
};
configureToasts(themeConfig);The ToastContainer component accepts all the same options as the global configuration:
interface ToastContainerProps {
theme?: 'material' | 'neobrutalist';
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
defaultDuration?: number;
defaultPosition?: 'top' | 'bottom';
defaultAnimationType?: 'fade' | 'slide';
customStyles?: ToastCustomStyles;
}
// Example usage
<ToastContainer
theme="neobrutalist"
size="lg"
defaultDuration={5000}
defaultPosition="bottom"
customStyles={{
container: { borderRadius: 12 },
text: { fontWeight: 'bold' }
}}
/>For advanced use cases, you can access the underlying toast manager:
import { toastManager } from 'expo-toastee';
// Subscribe to toast updates
const unsubscribe = toastManager.subscribe((toasts) => {
console.log('Current toasts:', toasts);
});
// Don't forget to unsubscribe
unsubscribe();Expo Toastee is built with performance in mind:
- Minimal bundle size - Only includes what you use
- Optimized animations - Uses native driver for 60fps animations
- Memory efficient - Automatic cleanup of timers and subscriptions
- Fast development - Built with Bun for lightning-fast builds
- Cross-platform shadows - Custom shadow implementation for consistent look
| Platform | Support | Notes |
|---|---|---|
| iOS | β Full | Native shadows, smooth animations |
| Android | β Full | Custom shadow implementation |
| Web | β Full | Responsive design, touch/mouse support |
Requirements:
- React Native 0.64+
- Expo SDK 47+
- React 17+
This package uses GitHub Actions for automated CI/CD:
- Continuous Integration: Runs on every PR and push to main
- Automated Testing: Type checking and build verification
- Smart Publishing: Only publishes when version number changes
- Bun Integration: Fast builds and dependency management
- Push to main with updated version in
package.json - GitHub Actions automatically:
- Installs dependencies with Bun
- Runs type checking
- Builds the package
- Compares versions with npm registry
- Publishes if version changed
To enable automated publishing, add NPM_TOKEN to your GitHub repository secrets:
- Go to your repo β Settings β Secrets and variables β Actions
- Add
NPM_TOKENwith your npm access token
- Icon support for toast types
- Sound notifications (optional)
- Gesture dismissal (swipe to dismiss)
- Queue management for multiple toasts
- Custom animation presets
- Theme builder/generator
- Accessibility improvements (screen reader support)
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please read our Contributing Guidelines for more details.
MIT License - see the LICENSE file for details.
- π Documentation: Full API reference and examples
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π§ Email: support@expo-toastee.dev
Made with β€οΈ for the React Native Expo community
If you find this package helpful, please consider:
- β Starring the repository
- π Reporting bugs
- π‘ Suggesting features
- π Improving documentation
- π€ Contributing code