11import React , { createContext , useCallback } from 'react' ;
22
3- import { useActiveGroupChannel , useChannelHandler } from '@sendbird/uikit-chat-hooks' ;
3+ import { useChannelHandler } from '@sendbird/uikit-chat-hooks' ;
44import { useActionMenu , useAlert , useBottomSheet , usePrompt , useToast } from '@sendbird/uikit-react-native-foundation' ;
55import {
66 NOOP ,
@@ -36,18 +36,16 @@ export const GroupChannelSettingsContextsProvider: GroupChannelSettingsModule['P
3636 const { fileService } = usePlatformService ( ) ;
3737 const { alert } = useAlert ( ) ;
3838
39- const { activeChannel, setActiveChannel } = useActiveGroupChannel ( sdk , channel ) ;
40-
41- const onChannelChanged = ( channel : SendbirdBaseChannel ) => {
42- if ( isDifferentChannel ( channel , activeChannel ) || ! channel . isGroupChannel ( ) ) return ;
43- setActiveChannel ( channel ) ;
39+ const onChannelChanged = ( eventChannel : SendbirdBaseChannel ) => {
40+ if ( isDifferentChannel ( eventChannel , channel ) ) return ;
4441 forceUpdate ( ) ;
4542 } ;
4643
4744 useChannelHandler ( sdk , `${ HOOK_NAME } _${ uniqId } ` , {
4845 onChannelChanged : onChannelChanged ,
4946 onChannelFrozen : onChannelChanged ,
5047 onChannelUnfrozen : onChannelChanged ,
48+ onUserBanned : onChannelChanged ,
5149 } ) ;
5250
5351 const toast = useToast ( ) ;
@@ -57,22 +55,21 @@ export const GroupChannelSettingsContextsProvider: GroupChannelSettingsModule['P
5755
5856 const updateChannel = useCallback (
5957 async ( params : SendbirdGroupChannelUpdateParams ) => {
60- const updatedChannel = await activeChannel . updateChannel ( params ) ;
61- setActiveChannel ( updatedChannel ) ;
58+ await channel . updateChannel ( params ) ;
6259 forceUpdate ( ) ;
6360 } ,
64- [ activeChannel ] ,
61+ [ channel ] ,
6562 ) ;
6663
6764 const changeChannelName = useCallback ( ( ) => {
6865 openPrompt ( {
6966 title : STRINGS . GROUP_CHANNEL_SETTINGS . DIALOG_CHANGE_NAME_PROMPT_TITLE ,
7067 submitLabel : STRINGS . GROUP_CHANNEL_SETTINGS . DIALOG_CHANGE_NAME_PROMPT_OK ,
7168 placeholder : STRINGS . GROUP_CHANNEL_SETTINGS . DIALOG_CHANGE_NAME_PROMPT_PLACEHOLDER ,
72- defaultValue : activeChannel . name ,
69+ defaultValue : channel . name ,
7370 onSubmit : ( channelName ) => updateChannel ( { name : channelName } ) ,
7471 } ) ;
75- } , [ STRINGS , updateChannel , activeChannel . name ] ) ;
72+ } , [ STRINGS , updateChannel , channel . name ] ) ;
7673
7774 const changeChannelImage = useCallback ( ( ) => {
7875 openMenu ( {
@@ -140,7 +137,7 @@ export const GroupChannelSettingsContextsProvider: GroupChannelSettingsModule['P
140137 < ProviderLayout >
141138 < GroupChannelSettingsContexts . Fragment . Provider
142139 value = { {
143- channel : activeChannel ,
140+ channel,
144141 headerTitle : STRINGS . GROUP_CHANNEL_SETTINGS . HEADER_TITLE ,
145142 headerRight : STRINGS . GROUP_CHANNEL_SETTINGS . HEADER_RIGHT ,
146143 onPressHeaderRight,
0 commit comments