From 82cee02c1e3faac04bfd8c938cc571058fd13f43 Mon Sep 17 00:00:00 2001 From: Khushal Agarwal Date: Wed, 25 Dec 2024 13:17:00 +0530 Subject: [PATCH] fix: exports of hooks --- .../src/screens/ChannelListScreen.tsx | 3 --- .../src/components/ChannelList/ChannelList.tsx | 18 +++++++++--------- ...erUpdated.ts => useChannelMemberUpdated.ts} | 0 package/src/components/index.ts | 1 + 4 files changed, 10 insertions(+), 12 deletions(-) rename package/src/components/ChannelList/hooks/listeners/{useMemberUpdated.ts => useChannelMemberUpdated.ts} (100%) diff --git a/examples/SampleApp/src/screens/ChannelListScreen.tsx b/examples/SampleApp/src/screens/ChannelListScreen.tsx index 254b7f722..45178f4db 100644 --- a/examples/SampleApp/src/screens/ChannelListScreen.tsx +++ b/examples/SampleApp/src/screens/ChannelListScreen.tsx @@ -196,9 +196,6 @@ export const ChannelListScreen: React.FC = () => { channel, }); }} - onNewMessage={(arg1, arg2, arg3, arg4) => { - console.log(arg1, arg2, arg3, arg4); - }} options={options} Preview={ChannelPreview} setFlatListRef={setScrollRef} diff --git a/package/src/components/ChannelList/ChannelList.tsx b/package/src/components/ChannelList/ChannelList.tsx index 1bd08c3e7..73d553eff 100644 --- a/package/src/components/ChannelList/ChannelList.tsx +++ b/package/src/components/ChannelList/ChannelList.tsx @@ -33,7 +33,7 @@ import type { DefaultStreamChatGenerics } from '../../types/types'; import { ChannelPreviewMessenger } from '../ChannelPreview/ChannelPreviewMessenger'; import { EmptyStateIndicator as EmptyStateIndicatorDefault } from '../Indicators/EmptyStateIndicator'; import { LoadingErrorIndicator as LoadingErrorIndicatorDefault } from '../Indicators/LoadingErrorIndicator'; -import { useChannelMemberUpdated } from './hooks/listeners/useMemberUpdated'; +import { useChannelMemberUpdated } from './hooks/listeners/useChannelMemberUpdated'; export type ChannelListProps< StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, @@ -324,6 +324,14 @@ export const ChannelList = < setChannels, }); + useChannelMemberUpdated({ + lockChannelOrder, + setChannels, + onChannelMemberUpdated, + filters, + sort, + }); + useChannelTruncated({ onChannelTruncated, refreshList, @@ -364,14 +372,6 @@ export const ChannelList = < setForceUpdate, }); - useChannelMemberUpdated({ - lockChannelOrder, - setChannels, - onChannelMemberUpdated, - filters, - sort, - }); - const channelIdsStr = channels?.reduce((acc, channel) => `${acc}${channel.cid}`, ''); useEffect(() => { diff --git a/package/src/components/ChannelList/hooks/listeners/useMemberUpdated.ts b/package/src/components/ChannelList/hooks/listeners/useChannelMemberUpdated.ts similarity index 100% rename from package/src/components/ChannelList/hooks/listeners/useMemberUpdated.ts rename to package/src/components/ChannelList/hooks/listeners/useChannelMemberUpdated.ts diff --git a/package/src/components/index.ts b/package/src/components/index.ts index 0fe5e5dd4..c170b7b6c 100644 --- a/package/src/components/index.ts +++ b/package/src/components/index.ts @@ -46,6 +46,7 @@ export * from './ChannelList/ChannelListMessenger'; export * from './ChannelList/hooks/listeners/useAddedToChannelNotification'; export * from './ChannelList/hooks/listeners/useChannelDeleted'; export * from './ChannelList/hooks/listeners/useChannelHidden'; +export * from './ChannelList/hooks/listeners/useChannelMemberUpdated'; export * from './ChannelList/hooks/listeners/useChannelTruncated'; export * from './ChannelList/hooks/listeners/useChannelUpdated'; export * from './ChannelList/hooks/listeners/useNewMessage';