react-native-nitro-simple-toast
v0.1.1
Published
react native simple toast powered by nitro
Downloads
604
Readme
react-native-nitro-simple-toast
A native toast library for React Native powered by Nitro Modules.
Inspired by burnt, but without the Expo dependency.
- iOS: Native floating indicator via SPIndicator — displays above modals and all other views
- Android: Native
android.widget.Toastwith haptic feedback
Installation
npm install react-native-nitro-simple-toast react-native-nitro-modules
react-native-nitro-modulesis a peer dependency required by this library.
For iOS:
cd ios && pod installUsage
import { toast } from 'react-native-nitro-simple-toast';
// Simple toast
toast({ title: 'Success!' });
// Full options
toast({
title: 'Complete',
message: 'File uploaded successfully',
preset: 'done',
duration: 2,
haptic: 'success',
shouldDismissByDrag: true,
from: 'top',
});API
toast(options: ToastOptions): void
| Option | Type | Default | Description |
|---|---|---|---|
| title | string | required | Toast title text |
| message | string | — | Optional subtitle/message |
| preset | 'done' \| 'error' \| 'none' | 'done' | Visual preset (iOS animated icon) |
| duration | number | — | Display duration in seconds |
| haptic | 'success' \| 'warning' \| 'error' \| 'none' | 'success' | Haptic feedback type |
| shouldDismissByDrag | boolean | true | Allow drag to dismiss (iOS only) |
| from | 'top' \| 'bottom' | 'top' | Presentation side (iOS only) |
Platform Notes
iOS
Full support for all options. Uses SPIndicator for native floating indicators with animated preset icons (checkmark, error cross).
Android
Uses android.widget.Toast with haptic vibration feedback. The following options are iOS-only and ignored on Android:
from— Android toast always appears at the bottomshouldDismissByDrag— Android toast is not draggablepreset— No visual icon on Android toastduration— Maps toToast.LENGTH_SHORT(<= 2s) orToast.LENGTH_LONG(> 2s)
Contributing
License
MIT
