@@ -16,8 +16,6 @@ import {
16
16
UnreadChannelFilter ,
17
17
} from '@sendbird/chat/groupChannel' ;
18
18
19
- import { RenderUserProfileProps } from '../../../types' ;
20
-
21
19
import setupChannelList , { pubSubHandler , pubSubHandleRemover } from '../utils' ;
22
20
import { uuidv4 } from '../../../utils/uuid' ;
23
21
import { noop } from '../../../utils/utils' ;
@@ -26,7 +24,7 @@ import { DELIVERY_RECEIPT } from '../../../utils/consts';
26
24
import * as channelListActions from '../dux/actionTypes' ;
27
25
import { ChannelListActionTypes } from '../dux/actionTypes' ;
28
26
29
- import { UserProfileProvider } from '../../../lib/UserProfileContext' ;
27
+ import { UserProfileProvider , UserProfileProviderProps } from '../../../lib/UserProfileContext' ;
30
28
import useSendbirdStateContext from '../../../hooks/useSendbirdStateContext' ;
31
29
import channelListReducers from '../dux/reducers' ;
32
30
import channelListInitialState from '../dux/initialState' ;
@@ -75,7 +73,8 @@ type OverrideInviteUserType = {
75
73
channelType : CHANNEL_TYPE ;
76
74
} ;
77
75
78
- export interface ChannelListProviderProps {
76
+ export interface ChannelListProviderProps extends
77
+ Pick < UserProfileProviderProps , 'disableUserProfile' | 'renderUserProfile' > {
79
78
allowProfileEdit ?: boolean ;
80
79
onBeforeCreateChannel ?( users : Array < string > ) : GroupChannelCreateParams ;
81
80
overrideInviteUser ?( params : OverrideInviteUserType ) : void ;
@@ -86,8 +85,6 @@ export interface ChannelListProviderProps {
86
85
queries ?: ChannelListQueries ;
87
86
children ?: React . ReactElement ;
88
87
className ?: string | string [ ] ;
89
- renderUserProfile ?: ( props : RenderUserProfileProps ) => React . ReactElement ;
90
- disableUserProfile ?: boolean ;
91
88
disableAutoSelect ?: boolean ;
92
89
activeChannelUrl ?: string ;
93
90
typingChannels ?: Array < GroupChannel > ;
@@ -142,7 +139,7 @@ const ChannelListProvider: React.FC<ChannelListProviderProps> = (props: ChannelL
142
139
const globalStore = useSendbirdStateContext ( ) ;
143
140
const { config, stores } = globalStore ;
144
141
const { sdkStore } = stores ;
145
- const { pubSub, logger, onUserProfileMessage } = config ;
142
+ const { pubSub, logger } = config ;
146
143
const {
147
144
markAsDeliveredScheduler,
148
145
disableMarkAsDelivered = false ,
@@ -153,8 +150,6 @@ const ChannelListProvider: React.FC<ChannelListProviderProps> = (props: ChannelL
153
150
154
151
// derive some variables
155
152
// enable if it is true at least once(both are false by default)
156
- const userDefinedDisableUserProfile = disableUserProfile ?? ! config . common . enableUsingDefaultUserProfile ;
157
- const userDefinedRenderProfile = config ?. renderUserProfile ;
158
153
const enableEditProfile = allowProfileEdit || config . allowProfileEdit ;
159
154
160
155
const userFilledChannelListQuery = queries ?. channelListQuery ;
@@ -384,11 +379,7 @@ const ChannelListProvider: React.FC<ChannelListProviderProps> = (props: ChannelL
384
379
fetchChannelList,
385
380
} }
386
381
>
387
- < UserProfileProvider
388
- disableUserProfile = { userDefinedDisableUserProfile ?? ! config . common . enableUsingDefaultUserProfile }
389
- renderUserProfile = { userDefinedRenderProfile }
390
- onUserProfileMessage = { onUserProfileMessage }
391
- >
382
+ < UserProfileProvider { ...props } >
392
383
< div className = { `sendbird-channel-list ${ className } ` } > { children } </ div >
393
384
</ UserProfileProvider >
394
385
</ ChannelListContext . Provider >
0 commit comments