A component that renders at the top of the list. Can be used to render a button that loads data.
The component to render when the messages
array is empty
The component to render when old messages
are being loaded. Defaults to an ActivityIndicator
As the component is pure, this can be used to force a re-render. Often used when derived components require the header and footer callbacks to re-run.
The length of the messages
array. This can be set explicitly to force a re-render of the Chat
. Usually, this
isn't needed as the component does a check of the length after the onSend
/onLoad
/etc functions run (which
often update the messages array)
The percentage threshold to use when older messages should automatically be loaded. Can be set to 0
to prevent
automatic invoking of onLoad
. The Chat#load
function can be used to explicitly invoke onLoad
The list of messages. The message at the start of the array is shown first.
Theming support for the input
Invoked when more historical messages should be loaded. This occurs on mount and then when the user has
scrolled back through the list of messages. The loadThreshold
property can be used to customise when the
function gets invoked. It can also be set to 0
to prevent automatic loading and the explicit Chat#load
function can be used to invoke this callback.
Performs rendering of a message. The user
property can be used to determine if the message is from the current
user by comparing it with the user
property set on the component.
the message data to render
the index of the message that is being rendered in the messages
array. 0
is the current message,
increasing values are historical messages
the state of the chat messages
a rendered element to display
A component that renders at the bottom of the list, above the user input. Can be used to provide suggested inputs values. The Suggestions component is often used here