Integrate SuprSend inbox in React Native using the headless library and 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 unSeenCount, markAllSeen which is related to the Bell icon in the inboxunSeenCount: Use this variable to show the unseen notification count anywhere in your application. markAllSeen: Used to mark seen for all notifications. Call this method on clicking the bell icon so that it will reset the bell count to 0.
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 SuprSendProviderHandled Events:
new_notification: Called when the new notification occurs can be used to show toast in your application.
Copy
Ask AI
import { useEvent } from "@suprsend/react-headless";function Home() { useEvent("new_notification", (newNotification) => { console.log("new notification data: ", newNotification); alert("You have new notifications"); }); return <p>Home</p>;}