import { useMutedUsers } from "stream-chat-react-native";
const mutedUsers = useMutedUsers(client);
const isUserMuted = mutedUsers.some((mute) => mute.target.id === userId);useMutedUsers
Tracks the list of users muted by the current user. It initialises the list from the client and keeps it up to date by listening to notification.mutes_updated events.
Best Practices
- Access the
mutedUserslist throughuseChatContextinstead. - Treat the returned list as read-only; use the client methods
muteUserandunmuteUserto modify mutes. - Handle an empty muted users array gracefully.
Usage
useMutedUsers.ts
This hook is used internally by the Chat component. The mutedUsers list is available through the ChatContext via the mutedUsers property.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| client | StreamChat | Yes | The Stream Chat client instance. |
Returns
| Type | Description |
|---|---|
Mute[] | An array of mute objects for the current user's muted users. |