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 undefined when capabilities have not loaded yet — treat a missing capability as "not allowed".
  • Avoid hardcoding capability arrays; always derive UI from the live values.

Usage

import { useChannelOwnCapabilities } from "stream-chat-react-native";

const capabilities = useChannelOwnCapabilities(channel);
const canDeleteChannel = capabilities?.includes("delete-channel") ?? false;

Parameters

NameTypeRequiredDescription
channelChannelNoChannel whose own capabilities are read.

Returns

TypeDescription
string[] | undefinedThe current user's capabilities in the channel, or undefined.