OwnCapabilitiesContext

OwnCapabilitiesContext is provided by Channel. It exposes the current user's capabilities on the channel. For details, see: /chat/docs/javascript/chat_permission_policies/

If you are not familiar with the React Context API, see the React docs.

Best Practices

  • Use useOwnCapabilitiesContext to gate UI actions consistently.
  • Hide or disable controls when capabilities are false to avoid invalid actions.
  • Treat capabilities as read-only; change permissions via server configuration.
  • Re-check capabilities when channel membership changes.
  • Keep capability checks close to the UI elements they govern.

Basic Usage

Consume OwnCapabilitiesContext in any child of Channel:

import { useContext } from "react";
import { OwnCapabilitiesContext } from "stream-chat-react-native";

const { uploadFile, updateAnyMessage, deleteAnyMessage } = useContext(
  OwnCapabilitiesContext,
);

Alternatively, use the useOwnCapabilitiesContext hook.

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

const { uploadFile, updateAnyMessage, deleteAnyMessage } =
  useOwnCapabilitiesContext();

Values

ValueDescriptionType
banChannelMembersCan ban/block channel members.boolean
castPollVoteCan cast poll votes.boolean
deleteAnyMessageCan delete any message in the channel.boolean
deleteOwnMessageCan delete own messages in the channel.boolean
flagMessageCan flag a message.boolean
pinMessageCan pin a message.boolean
queryPollVotesCan query poll votes.boolean
quoteMessageCan quote a message.boolean
readEventsCan receive read events.boolean
sendLinksCan attach links to messages.boolean
sendMessageCan send messages.boolean
sendPollCan send polls as messages.boolean
sendReactionCan send reactions.boolean
sendReplyCan reply to a message.boolean
sendTypingEventsCan send typing events.boolean
updateAnyMessageCan update any message in the channel.boolean
updateOwnMessageCan update own messages in the channel.boolean
uploadFileCan upload message attachments.boolean