A modern, highly customizable animated toast notification library for React Native featuring stacking animations, gesture support, and comprehensive TypeScript compatibility.
Installation β’ Usage β’ Customization β’ API Reference
# Using npm
npm install react-native-animated-toast-alerts lucide-react-native react-native-svg
# Using yarn
yarn add react-native-animated-toast-alerts lucide-react-native react-native-svg
# Using pnpm
pnpm add react-native-animated-toast-alerts lucide-react-native react-native-svg
Run the following command to install the required CocoaPods dependencies:
cd ios && pod install && cd ..
ToastProvider
import { ToastProvider } from 'react-native-animated-toast-alerts';
const App = () => {
return (
<ToastProvider>
<YourApp />
</ToastProvider>
);
};
export default App;
import { useToast } from 'react-native-animated-toast-alerts';
import { Camera } from 'lucide-react-native';
const MyComponent = () => {
const { showToast } = useToast();
const handlePress = () => {
showToast({
type: 'success',
message: 'β¨ Operation completed!',
position: 'top',
icon: {
icon: Camera,
props: {
size: 24,
color: '#16A34A'
}
}
});
};
return <Button title="Show Toast" onPress={handlePress} />;
};
// βΉοΈ Info toast
showToast({
type: 'info',
message: 'Updates available',
});
// β
Success toast
showToast({
type: 'success',
message: 'Changes saved!',
});
// β Error toast
showToast({
type: 'error',
message: 'Something went wrong',
});
// β οΈ Warning toast
showToast({
type: 'warning',
message: 'Please review input',
});
showToast({
type: 'info',
message: 'Custom styled toast',
position: 'center',
customStyle: {
borderRadius: 12,
backgroundColor: '#F8FAFC',
},
messageStyle: {
fontSize: 16,
fontWeight: 'bold',
},
});
import { AlertCircle } from 'lucide-react-native';
showToast({
type: 'info',
message: 'Custom icon toast',
icon: {
icon: AlertCircle,
props: {
size: 24,
color: '#1D4ED8',
strokeWidth: 2
}
}
});
interface ToastOptions {
type?: 'info' | 'success' | 'error' | 'warning';
message: string;
duration?: number;
position?: 'top' | 'bottom';
icon?: ToastIcon;
customStyle?: StyleProp<ViewStyle>;
messageStyle?: StyleProp<TextStyle>;
}
type ToastIcon = {
icon: LucideIcon | React.ComponentType<any>;
props?: {
size?: number;
color?: string;
[key: string]: any;
};
};
The library provides optimized experiences for both platforms:
Contributions are welcome! Please feel free to submit issues and pull requests. For major changes, kindly open a discussion first.
MIT Β© Rajeshwar Kashyap
Made with β€οΈ by Rajeshwar Kashyap