@@ -51,7 +51,7 @@ Below are optional props available for the icon component:
5151Prop | Description | Type | Default value |
5252--- | --- | --- | --- |
5353theme | Object for custom themes | Theme | {} |
54- customStyles | Object for custom styling | StyleProps | {} |
54+ customStyles | Object for custom styling | CustomStyleProps | {} |
5555notificationIcon | Option to use custom notification icon | JSX Element | null |
5656darkMode | Toggle to enable dark mode | boolean | false |
5757onError | Callback for handling errors | (error: SirenErrorType)=> void | null |
@@ -80,7 +80,7 @@ Here are the available theme options:
8080Here are the custom style options for the notification icon:
8181``` js
8282
83- type StyleProps = {
83+ type CustomStyleProps = {
8484 notificationIcon?: {
8585 size?: number,
8686 };
@@ -109,14 +109,14 @@ Below are optional props available for the inbox component:
109109Prop | Description | Type | Default value |
110110--- | --- | --- | --- |
111111theme | Object for custom themes | Theme | {} |
112- customStyles | Object for custom styling | StyleProps | {} |
112+ customStyles | Object for custom styling | CustomStyleProps | {} |
113113darkMode | Toggle to enable dark mode| boolean | false |
114114itemsPerFetch | Number of notifications fetch per api request (have a max cap of 50) | number | 20 |
115115cardProps | Props for customizing the notification cards | CardProps | { hideAvatar: false, disableAutoMarkAsRead: false, hideDelete: false } |
116- customNotificationCard | Function for rendering custom notification cards | (notification)=> JSX Element | null |
117- onNotificationCardClick | Custom click handler for notification cards | (notification)=> void | ()=>null |
116+ customCard | Function for rendering custom notification cards | (notification)=> JSX Element | null |
117+ onCardClick | Custom click handler for notification cards | (notification)=> void | ()=>null |
118118listEmptyComponent | Custom component for empty notification list | JSX Element | null |
119- inboxHeaderProps | Props for customizing the header | InboxHeaderProps | { title: "Notifications", hideHeader: false, hideClearAll: false, customHeader: null, showBackButton: false , backButton: null, onBackPress: ()=> null } |
119+ headerProps | Props for customizing the header | HeaderProps | { title: "Notifications", hideHeader: false, hideClearAll: false, customHeader: null, showBackButton: false , backButton: null, onBackPress: ()=> null } |
120120customFooter | Custom footer component | JSX Element | null |
121121customLoader | Custom component to display the initial loading state| JSX Element | null |
122122customErrorWindow | Custom error window | JSX Element | null |
@@ -170,7 +170,7 @@ Here are the available theme options:
170170Here are the custom style options for the notification inbox:
171171
172172``` js
173- type StyleProps = {
173+ type CustomStyleProps = {
174174 notificationIcon?: {
175175 size?: number;
176176 };
@@ -228,9 +228,9 @@ Here are the custom style options for the notification inbox:
228228 };
229229```
230230
231- #### InboxHeaderProps
231+ #### HeaderProps
232232``` js
233- type InboxHeaderProps = {
233+ type HeaderProps = {
234234 title?: string;
235235 hideHeader?: boolean;
236236 hideClearAll?: boolean;
@@ -249,14 +249,14 @@ Here are the custom style options for the notification inbox:
249249import { useSiren } from ' @sirenapp/react-native-inbox' ;
250250
251251function MyComponent () {
252- const { markAsRead , deleteNotification } = useSiren ();
252+ const { markAsRead , deleteById } = useSiren ();
253253
254254 function handleMarkAsRead (id ) {
255255 markAsRead (id);
256256 }
257257
258258 function handleDeleteNotification (id ) {
259- deleteNotification (id);
259+ deleteById (id);
260260 }
261261
262262 return (
@@ -268,23 +268,32 @@ function MyComponent() {
268268
269269Functions | Parameters | Type | Description |
270270----------|------------|-------|------------|
271- markNotificationsAsReadByDate | startDate | ISO date string | Sets the read status of notifications to true until the given date |
271+ markAsReadByDate | startDate | ISO date string | Sets the read status of notifications to true until the given date |
272272markAsRead | id | string | Set read status of a notification to true |
273- deleteNotification | id | string | Delete a notification by id |
274- deleteNotificationsByDate | startDate | ISO date string | Delete all notifications until given date |
275- markNotificationsAsViewed | startDate | ISO date string |Sets the viewed status of notifications to true until the given date |
273+ deleteById | id | string | Delete a notification by id |
274+ deleteByDate | startDate | ISO date string | Delete all notifications until given date |
275+ markAllAsViewed | startDate | ISO date string |Sets the viewed status of notifications to true until the given date |
276276
277277## 4. Error codes
278278Given below are all possible error codes thrown by sdk:
279279
280280Error code | Description |
281281--- | --- |
282- INVALID_TOKEN | The token passed in the provider is invalid |
283- INVALID_RECIPIENT_ID | The recipient id passed in the provider is invalid |
282+ AUTHENTICATION_FAILED | Failed to authenticate given credentials |
284283TOKEN_VERIFICATION_FAILED | Verification of the given tokens has failed |
285- GENERIC_API_ERROR | Occurrence of an unexpected api error |
284+ TOKEN_VERIFICATION_PENDING | Authentication in progress |
285+ API_ERROR | Occurrence of an unexpected api error |
286+ UNVIEWED_COUNT_FETCH_FAILED | Failed to fetch unviewed notifications count |
287+ NOTIFICATION_FETCH_FAILED | Failed to fetch notifications |
288+ DELETE_FAILED | Failed to delete notification |
289+ MARK_AS_READ_FAILED | Failed to mark notification as read |
290+ BULK_DELETE_FAILED | Bulk deletion of notifications failed |
291+ MARK_ALL_AS_READ_FAILED | Failed to mark all notifications as read |
292+ MARK_ALL_AS_VIEWED_FAILED | Failed to mark notification as viewed |
286293OUTSIDE_SIREN_CONTEXT | Attempting to invoke the functions outside the siren inbox context |
287294MISSING_PARAMETER | The required parameter is missing |
295+ UNAUTHORIZED_OPERATION | This operation require valid credentials |
296+ INVALID_ERROR_FUNCTION | The error function passed to sdk is invalid |
288297
289298## Example
290299Here's a basic example to help you get started
0 commit comments