import React, { PropsWithChildren, useContext, } from 'react'; import { Friend, Profile, FriendApplication } from '@tencentcloud/chat'; export interface TUIContactContextValue { friendList?: Array, blocklistProfile?: Array, friendApplicationList?: Array, blockList?: Array, isShowContactList?: boolean, setShowContactList?: React.Dispatch> } export const TUIContactContext = React.createContext(null); export function TUIContactContextProvider({ children, value }:PropsWithChildren<{ value: TUIContactContextValue }>):React.ReactElement { return ( {children} ); } export function useTUIContactContext(componentName?:string) :TUIContactContextValue { const contextValue = useContext(TUIContactContext); if (!contextValue && componentName) { return {} as TUIContactContextValue; } return (contextValue as unknown) as TUIContactContextValue; }