@@ -112,10 +112,10 @@ theme | Object for custom themes | Theme | {} |
112112customStyles | 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 |
115- cardProps | Props for customizing the notification cards | CardProps | { hideAvatar: false, disableAutoMarkAsRead: false, hideDelete: false } |
116- customCard | Function for rendering custom notification cards | (notification)=> JSX Element | null |
117- onCardClick | Custom click handler for notification cards | (notification)=> void | ()=>null |
118- listEmptyComponent | Custom component for empty notification list | JSX Element | null |
115+ cardProps | Props for customizing the card | CardProps | { hideAvatar: false, disableAutoMarkAsRead: false, hideDelete: false, deleteIcon: JSX.Element, onAvatarClick: ()=> null } |
116+ customCard | Function for rendering custom card | (notification)=> JSX Element | null |
117+ onCardClick | Custom click handler for card | (notification)=> void | ()=>null |
118+ listEmptyComponent | Custom component for empty list | JSX Element | null |
119119headerProps | 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 |
@@ -171,9 +171,6 @@ Here are the custom style options for the notification inbox:
171171
172172``` js
173173 type CustomStyleProps = {
174- notificationIcon?: {
175- size?: number;
176- };
177174 window ?: {
178175 width?: DimensionValue;
179176 height?: DimensionValue;
@@ -194,18 +191,12 @@ Here are the custom style options for the notification inbox:
194191 avatarSize?: number;
195192 titleFontWeight?: TextStyle[' fontWeight' ];
196193 titleSize?: number;
197- subTitleFontWeight ?: TextStyle[' fontWeight' ];
198- subTitleSize ?: number
194+ subtitleFontWeight ?: TextStyle[' fontWeight' ];
195+ subtitleSize ?: number
199196 descriptionFontWeight?: TextStyle[' fontWeight' ];
200197 descriptionSize?: number;
201198 dateSize?: number;
202199 };
203- badgeStyle?: {
204- size?: number;
205- textSize?: number;
206- top?: number;
207- right?: number;
208- };
209200 deleteIcon?: {
210201 size?: number
211202 };
@@ -249,10 +240,10 @@ Here are the custom style options for the notification inbox:
249240import { useSiren } from ' @sirenapp/react-native-inbox' ;
250241
251242function MyComponent () {
252- const { markAsRead , deleteById } = useSiren ();
243+ const { markAsReadById , deleteById } = useSiren ();
253244
254245 function handleMarkAsRead (id ) {
255- markAsRead (id);
246+ markAsReadById (id);
256247 }
257248
258249 function handleDeleteNotification (id ) {
@@ -269,32 +260,11 @@ function MyComponent() {
269260Functions | Parameters | Type | Description |
270261----------|------------|-------|------------|
271262markAsReadByDate | startDate | ISO date string | Sets the read status of notifications to true until the given date |
272- markAsRead | id | string | Set read status of a notification to true |
263+ markAsReadById | id | string | Set read status of a notification to true |
273264deleteById | id | string | Delete a notification by id |
274265deleteByDate | startDate | ISO date string | Delete all notifications until given date |
275266markAllAsViewed | startDate | ISO date string |Sets the viewed status of notifications to true until the given date |
276267
277- ## 4. Error codes
278- Given below are all possible error codes thrown by sdk:
279-
280- Error code | Description |
281- --- | --- |
282- AUTHENTICATION_FAILED | Failed to authenticate given credentials |
283- TOKEN_VERIFICATION_FAILED | Verification of the given tokens has failed |
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 |
293- OUTSIDE_SIREN_CONTEXT | Attempting to invoke the functions outside the siren inbox context |
294- MISSING_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 |
297-
298268## Example
299269Here's a basic example to help you get started
300270``` js
0 commit comments