Headless library to integrate Inbox, and Toast notification functionality in React Native Applications using hooks
The Headless Inbox library provides hooks that can be integrated into React Native components for building inbox, and toast functionality in your applications.
This hook provides a notifications list, unSeenCount, markClicked, markAllSeen.
notifications: List of all notifications. This array can be looped and notifications can be displayed.
unSeenCount: Use this variable to show the unseen notification count anywhere in your application.
markClicked: Method used to mark a notification as clicked. Pass notification id which is clicked as the first param.
markAllRead: This method is used to mark all individual notifications as seen. Add a button anywhere in your notification tray as Mark all as read and on clicking of that call this method.
This hook is an event emitter when and takes arguments event type and callback function when the event happens. Must be called anywhere inside SuprSendProvider
Handled Events:
new_notification: Called when the new notification occurs can be used to show toast in your application.
import{ useEvent }from"@suprsend/react-headless";functionHome(){useEvent("new_notification",(newNotification)=>{console.log("new notification data: ", newNotification);alert("You have new notifications");});return<p>Home</p>;}