Skip to content

Commit eb9b05d

Browse files
fix: Fixed issue custom delete icon press is not working
1 parent f424331 commit eb9b05d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/components/card.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,14 @@ const Card = (props: NotificationCardProps): ReactElement => {
173173
<Text numberOfLines={2} style={[styles.cardTitle, style.cardTitle]}>
174174
{notification.message?.header}
175175
</Text>
176-
{!hideDelete &&
177-
(deleteIcon || (
178-
<CloseIcon onDelete={onDeleteItem} notification={notification} styles={styles} />
179-
))}
176+
{!hideDelete && (
177+
<CloseIcon
178+
onDelete={onDeleteItem}
179+
customIcon={deleteIcon}
180+
notification={notification}
181+
styles={styles}
182+
/>
183+
)}
180184
</View>
181185
{Boolean(notification.message?.subHeader) && (
182186
<Text numberOfLines={2} style={[style.cardSubTitle, styles.cardSubTitle]}>

src/components/closeIcon.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ import type { StyleProps } from '../types';
88
const CloseIcon = ({
99
notification,
1010
styles,
11+
customIcon,
1112
onDelete
1213
}: {
1314
notification: NotificationDataType;
1415
styles: Partial<StyleProps>;
16+
customIcon?: ReactElement | null;
1517
onDelete: (id: string) => void;
1618
}): ReactElement => {
1719
const icon: JSX.Element[] = [];
@@ -36,7 +38,7 @@ const CloseIcon = ({
3638
testID='delete-button'
3739
accessibilityLabel={`siren-notification-delete${notification.id}`}
3840
>
39-
<>{icon}</>
41+
<>{customIcon || icon}</>
4042
</TouchableOpacity>
4143
);
4244
};

0 commit comments

Comments
 (0)