MessageInput
The MessageInput component is a React Context provider that does not inject any UI. The MessageInput renders ChatAutoComplete component by default when it does not inject the Input as the props.MessageInputmust be used in the Chat and Channel components.
Basic Usage
If your channelList list is empty, you can create a chat room in createChannel and select it to send messages.
ChatAutoComplete component
As the default render Input component of MessageInpt, ChatAutoComplete gets the sendMessage method through useMessageInputContext, and cannot be used without the MessageInput component.
Use Custom Input
You can render the custom Input component by passing Input as props to the MessageInput.
API
MessageInput
The properties of the MessageInput are described as follows:
| Property | Description | Type | Default | required |
|---|---|---|---|---|
| Input | set your custom Input component | React.ComponentType | - | false |
ChatAutoComplete
The properties of the ChatAutoComplete are described as follows:
| Property | Description | Type | Default | required |
|---|---|---|---|---|
| placeholder | set the placeholder | String | 'Send a Message’ | false |
| row | adaptive content height | Number | 1 | false |
| value | input content | String | ‘’ | false |
| onChange | callback when the contents of the input change | Function | - | false |
useMessageInputContext data
| Property | Description | Type | Default | required |
|---|---|---|---|---|
| sendMessage | Sending message method | Function | - | - |