import { useChannelOwnCapabilities } from "stream-chat-react-native";
const capabilities = useChannelOwnCapabilities(channel);
const canDeleteChannel = capabilities?.includes("delete-channel") ?? false;useChannelOwnCapabilities
Reads channel.data?.own_capabilities reactively and re-renders on capabilities.changed events.
This is the foundation hook behind the channel permission helpers such as useCanEditChannel and useCanAddMembersToChannel.
Best Practices
- Use this hook to gate features by the current user's permissions in a channel.
- Prefer the purpose-built helpers (
useCanEditChannel,useCanAddMembersToChannel) for common checks, and fall back to this hook for less common capabilities. - Handle
undefinedwhen capabilities have not loaded yet — treat a missing capability as "not allowed". - Avoid hardcoding capability arrays; always derive UI from the live values.
Usage
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| channel | Channel | No | Channel whose own capabilities are read. |
Returns
| Type | Description |
|---|---|
string[] | undefined | The current user's capabilities in the channel, or undefined. |