0.0.6 âĸ Published 6 months ago
react-native-animated-toast-alerts v0.0.6
React Native Animated Toast
A modern, highly customizable animated toast notification library for React Native featuring stacking animations, gesture support, and comprehensive TypeScript compatibility.
⨠Features
- đ¨ Modern Design - Clean, minimalist interface with smooth animations.
- đ Animated Stacking - Beautiful entrance and exit animations with proper stacking.
- đ Theme Integration - Seamless dark mode support with customizable themes.
- đą Multiple Positions - Support for top, bottom, and center positions.
- đ Advanced Gestures - Intuitive swipe-to-dismiss with natural physics.
- đ Flexible Styling - Extensive customization options for colors, icons, and animations.
- đ§ TypeScript Support - Comprehensive type definitions for better development.
- ⥠Performance Optimized - Efficient animations using React Native's Animated API.
- đ Icon Integration - Seamless support for Lucide icons.
đ Installation
1. Install the package and dependencies
# 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
2. iOS Setup
Run the following command to install the required CocoaPods dependencies:
cd ios && pod install && cd ..
đ¯ Quick Start
Wrap your Application with the ToastProvider
import { ToastProvider } from 'react-native-animated-toast-alerts';
const App = () => {
return (
<ToastProvider>
<YourApp />
</ToastProvider>
);
};
export default App;
Display a Toast
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} />;
};
đ¨ Toast Types
Predefined Toast Types
// âšī¸ 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',
});
đ Customization
Styling Options
showToast({
type: 'info',
message: 'Custom styled toast',
position: 'center',
customStyle: {
borderRadius: 12,
backgroundColor: '#F8FAFC',
},
messageStyle: {
fontSize: 16,
fontWeight: 'bold',
},
});
Custom Icons
import { AlertCircle } from 'lucide-react-native';
showToast({
type: 'info',
message: 'Custom icon toast',
icon: {
icon: AlertCircle,
props: {
size: 24,
color: '#1D4ED8',
strokeWidth: 2
}
}
});
đ API Reference
ToastOptions
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;
};
};
đą Platform Specific Features
The library provides optimized experiences for both platforms:
- iOS: Native shadows, safe area handling, and smooth animations.
- Android: Material Design elevation and touch feedback.
- Both: Natural gesture interactions and proper theme integration.
đ§ Technical Requirements
- React Native >= 0.63.0
- React >= 16.8.0
- TypeScript >= 4.0.0 (for TypeScript users)
đ¤ Contributing
Contributions are welcome! Please feel free to submit issues and pull requests. For major changes, kindly open a discussion first.
đ License
MIT Š Rajeshwar Kashyap
0.0.6
6 months ago
0.0.5
6 months ago
0.0.4
6 months ago
0.0.3
7 months ago
0.0.2
7 months ago
0.0.1
7 months ago
1.1.4
7 months ago
1.1.3
7 months ago
1.1.2
7 months ago
1.1.1
7 months ago
1.1.0
7 months ago
1.0.10
7 months ago
1.0.9
7 months ago
1.0.8
7 months ago
1.0.7
7 months ago
1.0.6
7 months ago
1.0.5
7 months ago
1.0.4
7 months ago
1.0.3
7 months ago
1.0.2
7 months ago
1.0.1
7 months ago
1.0.0
7 months ago