Skip to content

Commit a3cf932

Browse files
fix: Fix issue in hide header feature when custom header is active
1 parent af092b8 commit a3cf932

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

example/screens/notifications.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function Notifications(): React.JSX.Element {
117117
{renderButton('Theme-Mode', () =>
118118
setSdkDarkModeEnabled((sdkDarkModeEnabled) => !sdkDarkModeEnabled)
119119
)}
120-
{renderButton(`${showCustomHeader ? 'Hide' : 'Show'}-Header`, () =>
120+
{renderButton(`${hideHeader ? 'Show' : 'Hide'}-Header`, () =>
121121
setHideHeader((hideHeader) => !hideHeader)
122122
)}
123123
{renderButton(`${showCustomHeader ? 'Default' : 'Custom'}-Header`, () =>

src/components/sirenInbox.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ const SirenInbox = (props: SirenInboxProps): ReactElement => {
164164

165165
// Initialize Siren SDK and fetch notifications
166166
const initialize = async (): Promise<void> => {
167-
168167
if (siren) {
169168
siren?.stopRealTimeNotificationFetch();
170169
const allNotifications = await fetchNotifications(siren, true);
@@ -173,7 +172,7 @@ const SirenInbox = (props: SirenInboxProps): ReactElement => {
173172
if (isNonEmptyArray(allNotifications))
174173
notificationParams.start = allNotifications[0].createdAt;
175174

176-
if(verificationStatus === VerificationStatus.SUCCESS)
175+
if (verificationStatus === VerificationStatus.SUCCESS)
177176
siren?.startRealTimeNotificationFetch(notificationParams);
178177
}
179178
};
@@ -223,7 +222,7 @@ const SirenInbox = (props: SirenInboxProps): ReactElement => {
223222
const response = await siren.fetchAllNotifications(notificationParams);
224223
const nonEmptyResponse = Boolean(isNonEmptyArray(response?.data));
225224

226-
if (response?.data)
225+
if (response?.data)
227226
updatedNotifications = processResponse(nonEmptyResponse, isResetList, response.data);
228227
if (response?.error) processError(response.error);
229228

@@ -262,8 +261,8 @@ const SirenInbox = (props: SirenInboxProps): ReactElement => {
262261

263262
if (isNonEmptyArray(allNotifications))
264263
notificationParams.start = allNotifications[0].createdAt;
265-
266-
if(verificationStatus === VerificationStatus.SUCCESS)
264+
265+
if (verificationStatus === VerificationStatus.SUCCESS)
267266
siren?.startRealTimeNotificationFetch(notificationParams);
268267
} catch (err) {
269268
setIsLoading(false);
@@ -350,8 +349,10 @@ const SirenInbox = (props: SirenInboxProps): ReactElement => {
350349
};
351350

352351
const renderHeader = (): JSX.Element | null => {
353-
if (customHeader) return customHeader;
354-
if (!hideHeader)
352+
353+
if (!hideHeader) {
354+
if (customHeader) return customHeader;
355+
355356
return (
356357
<Header
357358
title={title}
@@ -361,6 +362,7 @@ const SirenInbox = (props: SirenInboxProps): ReactElement => {
361362
clearAllDisabled={!isNonEmptyArray(notifications)}
362363
/>
363364
);
365+
}
364366

365367
return null;
366368
};

0 commit comments

Comments
 (0)