MessageInput

MessageInput provides UI and functionality for composing messages (attachment picker, commands, mentions, autocomplete). It must be rendered inside Channel.

Best Practices

  • Render MessageInput inside Channel to ensure composer state is available.
  • Customize via Channel props first to keep behavior consistent.
  • Keep additionalTextInputProps stable to avoid re-renders.
  • Respect cooldowns and permissions to prevent invalid sends.
  • Use built-in components for attachments and audio before rolling your own.

General Usage

import { StreamChat } from "stream-chat";
import {
  Chat,
  Channel,
  MessageList,
  MessageInput,
  OverlayProvider,
} from "stream-chat-react-native";

const client = StreamChat.getInstance("api_key");

export const App = () => (
  <OverlayProvider>
    <Chat client={client}>
      <Channel channel={channel}>
        <MessageList />
        <MessageInput />
      </Channel>
    </Chat>
  </OverlayProvider>
);

TypeScript

File type

The File type is now exported from the stream-chat-react-native package and extends the FileReference type from the stream-chat package. It looks like this:

import { FileReference } from "stream-chat";

export type File = FileReference;

Props

Most configuration lives on the Channel component. See the Guide Section for UI customization.

attachmentPickerBottomSheetHeight

Height of the attachment picker bottom sheet when open.

TypeDefault
Number40% of Window Height

attachmentSelectionBarHeight

Height of the attachment selection bar in the attachment picker.

TypeDefault
Number52

bottomInset

Offsets the MessageList when the attachment picker opens. Use to override bottomInset from AttachmentPickerContext.

Type
Number | undefined

additionalTextInputProps

Extra props passed to the underlying TextInput in MessageInput.

Type
object

asyncMessagesLockDistance

Pixels the user must drag upward to lock recording and lift their finger without stopping it.

TypeDefault
Number50

asyncMessagesMinimumPressDuration

Minimum press duration (ms) on the record button to start voice recording.

TypeDefault
Number500

asyncMessagesMultiSendEnabled

When enabled, recordings don’t send immediately. They stack in the composer so users can send multiple voice recordings in one message.

TypeDefault
Booleantrue

asyncMessagesSlideToCancelDistance

Pixels the user must drag toward the leading side to cancel voice recording.

TypeDefault
Number100

audioRecordingEnabled

Enable or disable audio recording.

TypeDefault
Booleanfalse

channel

Channel instance from the Stream Chat client.

closeAttachmentPicker

Dismiss the attachment picker, if its already open.

Type
Function

closePollCreationDialog

Function called whenever the close button is pressed on the poll creation modal. Has no effect if PollCreateContent is custom.

Type
function

cooldownEndsAt

The time at which the active cool-down will end.

Type
Date

editing

inputBoxRef

Ref for TextInput component within MessageInput

isOnline

The value is true, when current user is connected to chat.

Type
boolean

members

Members of current channel. This value is received from backend when you query a channel, either using client.queryChannels() or channel.watch() API call.

client.queryChannels() or channel.watch() returns only up to 100 members of channel. So if you expect total number of members to be > 100, its better to use client.queryMembers() API endpoint separately to get the list of members.

Record<
  string, // userId
  {
    banned?: boolean;
    created_at?: string;
    invite_accepted_at?: string;
    invite_rejected_at?: string;
    invited?: boolean;
    is_moderator?: boolean;
    role?: string;
    shadow_banned?: boolean;
    updated_at?: string;
    user?: UserResponse<UserType>;
    user_id?: string;
  }
>;
Type
object

selectedPicker

Value is images (string), when image attachment picker is open else undefined.

Type
'images' | undefined

sendMessage

Sends a composed message within MessageInput component to channel. This function is attached to onPress handler of SendButton. The message optimistically gets added to message list UI first, before actually making API call to server. During this intermediate stage, MessageStatus component will display an indicator for "pending" state.

Type
Function

The function takes an object as a parameter with the following properties:

ParameterDescription
localMessageContains the message data that will be shown in the UI immediately
messageContains the data that will be sent to the backend
optionsContains options for sending/updating the message

showPollCreationDialog

A boolean signifying whether the poll creation dialog is shown or not. Will always be false if PollCreateContent is custom.

Type
boolean

threadList

Indicates the Channel is rendering a thread. Used to avoid concurrency issues between the main channel and thread.

Type
boolean

watchers

Watchers of current channel. This value is received from backend when you query a channel, either using client.queryChannels() or channel.watch() API call.

client.queryChannels() or channel.watch() returns only up to 100 watchers for channel. So if you expect total number of watchers to be > 100, you should request them explicitly using Channel Pagination

Record<
  string, // string
  UserResponse<UserType>
>;
Type
object

UI Component Props

AttachmentUploadPreviewList

Renders previews of attached files and images in MessageInput.

TypeDefault
ComponentTypeAttachmentUploadPreviewList

AttachmentPickerSelectionBar

Renders the attachment picker selection bar (image, file, camera icons).

TypeDefault
ComponentTypeundefined | AttachmentPickerSelectionBar

AudioRecorder

Custom UI for audio recorder controls in MessageInput.

TypeDefault
ComponentTypeAudioRecorder

AudioRecordingInProgress

Custom UI for an in-progress audio recording in MessageInput (waveform, duration, etc.).

TypeDefault
ComponentTypeAudioRecordingInProgress

AudioRecordingLockIndicator

Custom lock indicator for audio recording in MessageInput.

TypeDefault
ComponentTypeAudioRecordingLockIndicator

AudioRecordingPreview

Custom UI to preview and play an audio recording in MessageInput.

TypeDefault
ComponentTypeAudioRecordingPreview

AudioRecordingWaveform

Custom waveform UI for audio recording in MessageInput.

TypeDefault
ComponentTypeAudioRecordingWaveform

AutoCompleteSuggestionList

Renders the autocomplete suggestion list.

TypeDefault
ComponentTypeAutoCompleteSuggestionList

CommandInput

Renders the message input in an active command state.

TypeDefault
ComponentTypeCommandInput

CooldownTimer

Renders a countdown timer for message send cooldowns in MessageInput.

TypeDefault
ComponentTypeCooldownTimer

CreatePollContent

A custom UI component used to render the entire poll creation form. It has access to the CreatePollContext values by default through the useCreatePollContext hook.

TypeDefault
ComponentTypeCreatePollContent

Input

Renders the UI for the enclosed MessageInput. See Customizing Message Input.

Type
ComponentType

InputButtons

Renders action buttons (CommandsButton and AttachButton) on the left side of the MessageInput.

TypeDefault
ComponentTypeInputButtons

InputEditingStateHeader

Renders the header when editing a message in the input.

TypeDefault
ComponentTypeInputEditingStateHeader

InputReplyStateHeader

Renders the reply header in the message input.

TypeDefault
ComponentTypeInputReplyStateHeader

Reply

Renders a preview of the parent message for quoted replies.

TypeDefault
ComponentTypeReply

SendButton

Renders the send message button inside MessageInput.

TypeDefault
ComponentTypeSendButton

ShowThreadMessageInChannelButton

Renders a checkbox in Thread that sets show_in_channel to true when checked.

TypeDefault
ComponentTypeShowThreadMessageInChannelButton

StartAudioRecordingButton

Custom mic button for audio recording in MessageInput.

TypeDefault
ComponentTypeStartAudioRecordingButton

StopMessageStreamingButton

Custom button to stop AI generation, shown instead of SendButton in MessageInput.

TypeDefault
componentStopMessageStreamingButton

TextInputComponent

The component prop to override the default TextInput component used in the message input's AutoCompleteInput.

TypeDefault
ComponentTypeDefault React Native's TextInput