From d61e13790fc8e5ec50d430d423b66f1f2d9240fe Mon Sep 17 00:00:00 2001 From: bang9 Date: Sat, 10 Feb 2024 18:50:27 +0900 Subject: [PATCH 1/2] fix: remove conditional hooks even if they depend on an unchanging value. --- .../GroupChannelMessageOutgoingStatus.tsx | 6 +++--- .../src/fragments/createGroupChannelListFragment.tsx | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/uikit-react-native/src/components/GroupChannelMessageRenderer/GroupChannelMessageOutgoingStatus.tsx b/packages/uikit-react-native/src/components/GroupChannelMessageRenderer/GroupChannelMessageOutgoingStatus.tsx index 0adf29c19..27b0d44d2 100644 --- a/packages/uikit-react-native/src/components/GroupChannelMessageRenderer/GroupChannelMessageOutgoingStatus.tsx +++ b/packages/uikit-react-native/src/components/GroupChannelMessageRenderer/GroupChannelMessageOutgoingStatus.tsx @@ -15,13 +15,13 @@ type Props = { style?: StyleProp; }; const GroupChannelMessageOutgoingStatus = ({ channel, message, style }: Props) => { - if (!message.isUserMessage() && !message.isFileMessage()) return null; - if (channel.isEphemeral) return null; - const { sdk } = useSendbirdChat(); const { colors } = useUIKitTheme(); const outgoingStatus = useMessageOutgoingStatus(sdk, channel, message); + if (!message.isUserMessage() && !message.isFileMessage()) return null; + if (channel.isEphemeral) return null; + if (outgoingStatus === 'PENDING') { return ; } diff --git a/packages/uikit-react-native/src/fragments/createGroupChannelListFragment.tsx b/packages/uikit-react-native/src/fragments/createGroupChannelListFragment.tsx index e90087a57..704e6e43d 100644 --- a/packages/uikit-react-native/src/fragments/createGroupChannelListFragment.tsx +++ b/packages/uikit-react-native/src/fragments/createGroupChannelListFragment.tsx @@ -32,11 +32,11 @@ const createGroupChannelListFragment = (initModule?: Partial { + useAppState('change', (status) => { + if (sbOptions.appInfo.deliveryReceiptEnabled) { if (status === 'active') groupChannels.forEach(markAsDeliveredWithChannel); - }); - } + } + }); const _renderGroupChannelPreview: GroupChannelListProps['List']['renderGroupChannelPreview'] = useFreshCallback( (props) => { From d02ab11f9d319a2407f1a1e94482b9658a9ecca9 Mon Sep 17 00:00:00 2001 From: bang9 Date: Fri, 23 Feb 2024 10:38:01 +0900 Subject: [PATCH 2/2] chore: update types in utils --- packages/uikit-utils/src/types.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/uikit-utils/src/types.ts b/packages/uikit-utils/src/types.ts index f5cb06213..5f60d4658 100644 --- a/packages/uikit-utils/src/types.ts +++ b/packages/uikit-utils/src/types.ts @@ -1,9 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ - -/* eslint-disable @typescript-eslint/no-empty-interface */ import type React from 'react'; -import type SendbirdChat from '@sendbird/chat'; import type { BaseChannel, Emoji, @@ -13,6 +10,7 @@ import type { Participant, RestrictedUser, SendbirdError as SBError, + SendbirdChatWith, User, UserUpdateParams, } from '@sendbird/chat'; @@ -28,7 +26,6 @@ import type { MessageCollection, } from '@sendbird/chat/groupChannel'; import type { - ModuleNamespaces, OpenChannelCreateParams, OpenChannelUpdateParams, SendableMessage, @@ -82,7 +79,7 @@ export type OnBeforeHandler = (params: T) => T | Promise; export interface UserStruct { userId: string; } -export type SendbirdChatSDK = SendbirdChat & ModuleNamespaces<[GroupChannelModule, OpenChannelModule]>; +export type SendbirdChatSDK = SendbirdChatWith<[GroupChannelModule, OpenChannelModule]>; export type SendbirdMessage = BaseMessage | FileMessage | UserMessage | AdminMessage | SendableMessage; export type SendbirdChannel = BaseChannel | GroupChannel | OpenChannel; export type SendbirdUserMessage = UserMessage;