From b9ae77ae57d7332e517670217a9ecf7ad56fea64 Mon Sep 17 00:00:00 2001 From: Kyle Shevlin Date: Wed, 9 Oct 2024 13:59:25 -0700 Subject: [PATCH] Update CometChatBadge.tsx `defaultProps` will be deprecated for function components soon. This uses default parameters instead and suppresses a React Native warning. --- src/shared/views/CometChatBadge/CometChatBadge.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/shared/views/CometChatBadge/CometChatBadge.tsx b/src/shared/views/CometChatBadge/CometChatBadge.tsx index e4b8a32..8964dfe 100644 --- a/src/shared/views/CometChatBadge/CometChatBadge.tsx +++ b/src/shared/views/CometChatBadge/CometChatBadge.tsx @@ -16,11 +16,11 @@ import styles from './styles'; * */ interface CometChatBadgeProps { - count: number; + count?: number; style?: BadgeStyle; } -export const CometChatBadge = (props: CometChatBadgeProps) => { +export const CometChatBadge = ({ count = 0, style = new BadgeStyle({}) }: CometChatBadgeProps) => { const { theme } = useContext(CometChatContext); const defaultStyleProps = new BadgeStyle({ @@ -63,8 +63,3 @@ export const CometChatBadge = (props: CometChatBadgeProps) => { ); }; - -CometChatBadge.defaultProps = { - count: 0, - style: new BadgeStyle({}), -};