@@ -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 |
115- cardProps | 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 |
118- listEmptyComponent | 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 } |
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+ 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 |
@@ -151,7 +151,6 @@ Here are the available theme options:
151151 titleColor?: string;
152152 headerActionColor?: string;
153153 borderColor?: string;
154- borderWidth?: string;
155154 };
156155 windowContainer?: {
157156 background?: string;
@@ -160,8 +159,8 @@ Here are the available theme options:
160159 borderColor?: string;
161160 background?: string;
162161 titleColor?: string;
162+ subTitleColor?: string;
163163 descriptionColor?: string;
164- dateColor?: string;
165164 };
166165 }
167166```
@@ -171,10 +170,7 @@ Here are the available theme options:
171170Here are the custom style options for the notification inbox:
172171
173172``` js
174- type StyleProps = {
175- notificationIcon?: {
176- size?: number;
177- };
173+ type CustomStyleProps = {
178174 window ?: {
179175 width?: DimensionValue;
180176 height?: DimensionValue;
@@ -183,6 +179,8 @@ Here are the custom style options for the notification inbox:
183179 height?: number;
184180 titleFontWeight?: TextStyle[' fontWeight' ];
185181 titleSize?: number;
182+ borderWidth?: string;
183+ titlePadding?: number;
186184 }
187185 windowContainer?: {
188186 padding?: number;
@@ -193,15 +191,12 @@ Here are the custom style options for the notification inbox:
193191 avatarSize?: number;
194192 titleFontWeight?: TextStyle[' fontWeight' ];
195193 titleSize?: number;
194+ subtitleFontWeight?: TextStyle[' fontWeight' ];
195+ subtitleSize?: number
196+ descriptionFontWeight?: TextStyle[' fontWeight' ];
196197 descriptionSize?: number;
197198 dateSize?: number;
198199 };
199- badgeStyle?: {
200- size?: number;
201- textSize?: number;
202- top?: number;
203- right?: number;
204- };
205200 deleteIcon?: {
206201 size?: number
207202 };
@@ -217,14 +212,16 @@ Here are the custom style options for the notification inbox:
217212``` js
218213 type CardProps = {
219214 hideAvatar?: boolean;
215+ onAvatarClick?: (notification : NotificationDataType ) => void ;
220216 disableAutoMarkAsRead?: boolean;
217+ deleteIcon?: JSX .Element ;
221218 hideDelete?: boolean;
222219 };
223220```
224221
225- #### InboxHeaderProps
222+ #### HeaderProps
226223``` js
227- type InboxHeaderProps = {
224+ type HeaderProps = {
228225 title?: string;
229226 hideHeader?: boolean;
230227 hideClearAll?: boolean;
@@ -243,14 +240,14 @@ Here are the custom style options for the notification inbox:
243240import { useSiren } from ' @sirenapp/react-native-inbox' ;
244241
245242function MyComponent () {
246- const { markAsRead , deleteNotification } = useSiren ();
243+ const { markAsReadById , deleteById } = useSiren ();
247244
248245 function handleMarkAsRead (id ) {
249- markAsRead (id);
246+ markAsReadById (id);
250247 }
251248
252249 function handleDeleteNotification (id ) {
253- deleteNotification (id);
250+ deleteById (id);
254251 }
255252
256253 return (
@@ -262,23 +259,11 @@ function MyComponent() {
262259
263260Functions | Parameters | Type | Description |
264261----------|------------|-------|------------|
265- markNotificationsAsReadByDate | startDate | ISO date string | Sets the read status of notifications to true until the given date |
266- markAsRead | id | string | Set read status of a notification to true |
267- deleteNotification | id | string | Delete a notification by id |
268- deleteNotificationsByDate | startDate | ISO date string | Delete all notifications until given date |
269- markNotificationsAsViewed | startDate | ISO date string |Sets the viewed status of notifications to true until the given date |
270-
271- ## 4. Error codes
272- Given below are all possible error codes thrown by sdk:
273-
274- Error code | Description |
275- --- | --- |
276- INVALID_TOKEN | The token passed in the provider is invalid |
277- INVALID_RECIPIENT_ID | The recipient id passed in the provider is invalid |
278- TOKEN_VERIFICATION_FAILED | Verification of the given tokens has failed |
279- GENERIC_API_ERROR | Occurrence of an unexpected api error |
280- OUTSIDE_SIREN_CONTEXT | Attempting to invoke the functions outside the siren inbox context |
281- MISSING_PARAMETER | The required parameter is missing |
262+ markAsReadByDate | startDate | ISO date string | Sets the read status of notifications to true until the given date |
263+ markAsReadById | id | string | Set read status of a notification to true |
264+ deleteById | id | string | Delete a notification by id |
265+ deleteByDate | startDate | ISO date string | Delete all notifications until given date |
266+ markAllAsViewed | startDate | ISO date string |Sets the viewed status of notifications to true until the given date |
282267
283268## Example
284269Here's a basic example to help you get started
@@ -312,7 +297,6 @@ function MyContainer(): React.JSX.Element {
312297 darkMode= {false }
313298 / >
314299 < SirenInbox
315- title= " Notifications"
316300 hideHeader= {false }
317301 darkMode= {false }
318302 cardProps= {{hideAvatar: false , disableAutoMarkAsRead: false }}
0 commit comments