import { useContext } from 'react';
import { OwnCapabilitiesContext } from 'stream-chat-react-native';
const { uploadFile, updateAnyMessage, deleteAnyMessage } = useContext(OwnCapabilitiesContext);
OwnCapabilitiesContext
OwnCapabilitiesContext
is provided by Channel
component. It provides the capabilities of the current user on current channel.
To know more about capabilities, please take a look at following documentation: /chat/docs/javascript/channel_capabilities/
If you are not familiar with React Context API, please read about it on React docs.
Basic Usage
OwnCapabilitiesContext
can be consumed by any of the child component of Channel
component as following:
Alternatively, you can also use useOwnCapabilitiesContext
hook provided by library to consume OwnCapabilitiesContext.
import { useOwnCapabilitiesContext } from 'stream-chat-react-native';
const { uploadFile, updateAnyMessage, deleteAnyMessage } = useOwnCapabilitiesContext();
Value
banChannelMembers
Ability to ban/block channel members.
Type |
---|
boolean |
deleteAnyMessage
Ability to delete any message from the channel.
Type |
---|
boolean |
deleteOwnMessage
Ability to delete own messages from the channel.
Type |
---|
boolean |
flagMessage
Ability to flag a message.
Type |
---|
boolean |
pinMessage
Ability to pin a message.
Type |
---|
boolean |
quoteMessage
Ability to quote a message.
Type |
---|
boolean |
readEvents
Ability to receive read events.
Type |
---|
boolean |
sendLinks
Ability to attach links to messages.
Type |
---|
boolean |
sendMessage
Ability to send a message.
Type |
---|
boolean |
sendReaction
Ability to send reactions.
Type |
---|
boolean |
sendReply
Ability to reply to a message.
Type |
---|
boolean |
sendTypingEvents
Ability to send typing events.
Type |
---|
boolean |
updateAnyMessage
Ability to update any message in the channel.
Type |
---|
boolean |
updateOwnMessage
Ability to update own messages in the channel.
Type |
---|
boolean |
uploadFile
Ability to upload message attachments.
Type |
---|
boolean |