@@ -112,10 +112,10 @@ theme | Object for custom themes | Theme | {} |
112
112
customStyles | Object for custom styling | CustomStyleProps | {} |
113
113
darkMode | Toggle to enable dark mode| boolean | false |
114
114
itemsPerFetch | 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 |
119
119
headerProps | Props for customizing the header | HeaderProps | { title: "Notifications", hideHeader: false, hideClearAll: false, customHeader: null, showBackButton: false , backButton: null, onBackPress: ()=> null } |
120
120
customFooter | Custom footer component | JSX Element | null |
121
121
customLoader | 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:
171
171
172
172
``` js
173
173
type CustomStyleProps = {
174
- notificationIcon?: {
175
- size?: number;
176
- };
177
174
window ?: {
178
175
width?: DimensionValue;
179
176
height?: DimensionValue;
@@ -194,18 +191,12 @@ Here are the custom style options for the notification inbox:
194
191
avatarSize?: number;
195
192
titleFontWeight?: TextStyle[' fontWeight' ];
196
193
titleSize?: number;
197
- subTitleFontWeight ?: TextStyle[' fontWeight' ];
198
- subTitleSize ?: number
194
+ subtitleFontWeight ?: TextStyle[' fontWeight' ];
195
+ subtitleSize ?: number
199
196
descriptionFontWeight?: TextStyle[' fontWeight' ];
200
197
descriptionSize?: number;
201
198
dateSize?: number;
202
199
};
203
- badgeStyle?: {
204
- size?: number;
205
- textSize?: number;
206
- top?: number;
207
- right?: number;
208
- };
209
200
deleteIcon?: {
210
201
size?: number
211
202
};
@@ -249,10 +240,10 @@ Here are the custom style options for the notification inbox:
249
240
import { useSiren } from ' @sirenapp/react-native-inbox' ;
250
241
251
242
function MyComponent () {
252
- const { markAsRead , deleteById } = useSiren ();
243
+ const { markAsReadById , deleteById } = useSiren ();
253
244
254
245
function handleMarkAsRead (id ) {
255
- markAsRead (id);
246
+ markAsReadById (id);
256
247
}
257
248
258
249
function handleDeleteNotification (id ) {
@@ -269,32 +260,11 @@ function MyComponent() {
269
260
Functions | Parameters | Type | Description |
270
261
----------|------------|-------|------------|
271
262
markAsReadByDate | 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 |
273
264
deleteById | id | string | Delete a notification by id |
274
265
deleteByDate | startDate | ISO date string | Delete all notifications until given date |
275
266
markAllAsViewed | startDate | ISO date string |Sets the viewed status of notifications to true until the given date |
276
267
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
-
298
268
## Example
299
269
Here's a basic example to help you get started
300
270
``` js
0 commit comments