For AI agents: this page in Markdown: https://www.pubnub.com/docs/chat/components/react-native/chat-provider.md. Documentation index: https://www.pubnub.com/llms-full.txt.
Chat Provider for PubNub Chat Components for React Native
USED BY THE OLD IA, PLEASE DISREGARD
Chat provider is used to configure various common options and feed the components with data. It expects at least currentChannel to display within components.
Chat itself is supposed to be wrapped with a PubNubProvider component that is a part of the PubNub React SDK. You should use it to pre-configure your PubNub instance. Read the Getting Started page for details.
Parameters
You can configure the component using these parameters:
theme?#- General theme to be used by the components. Exact looks can be tweaked later on by injecting styles.
- Default value
"light"
currentChannel#- Current channel to display the messages and members from.
- Default value
- n/a
channels?#- Array of channels to subscribe to get events. Allows up to 50 channels. Setting this option will disable the auto subscription when switching the current channel.
- Default value
[]
channelGroups?#- Array of channel groups to subscribe to get events. Allows up to 50 channel groups. Setting this option will disable the auto subscription when switching the current channel group.
- Default value
[]
enablePresence?#- Option to disable presence events when set to
false. OccupancyIndicator and MemberList components will only work with memberships in that case.- Default value
true
users?#- Option to provide an external list of user metadata. It's used to display information about senders on MessageList and TypingIndicator.
- Default value
[]
getUser?#- Pass a callback function to get user metadata whenever it's not passed to the
usersoption.- Default value
- n/a
typingIndicatorTimeout?#- Option to define a timeout in seconds for typing indicators to hide after the last typed character.
- Default value
10
retryOptions?#- Options for automatic retries on errors.
- Default value
retryOptions: {maxRetries: 1, timeout: 0, exponentialFactor: 1}
onMessage?#- Callback run on new messages.
- Default value
- n/a
onSignal?#- Callback run on signals.
- Default value
- n/a
onMessageAction?#- Callback run on message actions.
- Default value
- n/a
onPresence?#- Callback run on presence events.
- Default value
- n/a
onUser?#- Callback run on object events.
- Default value
- n/a
onChannel?#- Callback run on object events.
- Default value
- n/a
onMembership?#- Callback run on object events.
- Default value
- n/a
onFile?#- Callback run on file events.
- Default value
- n/a
onStatus?#- Callback run on status events.
- Default value
- n/a
onError?#- Callback run on any type of errors raised by the components.
- Default value
(): void => null