Skip to content
Info:
This is documentation for Stream Chat React Native SDK v8, which is no longer actively maintained. For up-to-date documentation, see the latest version (v9).

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

Note:

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

attachmentPickerBottomSheetHeight

Height of the attachment picker bottom sheet when open.

Type Default
Number 40% of Window Height

attachmentSelectionBarHeight

Height of the attachment selection bar in the attachment picker.

Type Default
Number 52

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.

Type Default
Number 50

asyncMessagesMinimumPressDuration

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

Type Default
Number 500

asyncMessagesMultiSendEnabled

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

Type Default
Boolean true

asyncMessagesSlideToCancelDistance

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

Type Default
Number 100

audioRecordingEnabled

Enable or disable audio recording.

Type Default
Boolean false

channel

Channel instance from the Stream Chat client.

Type
Channel

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

Defined with message type if the user is editing some message within MessageInput component else its undefined.

Type
Message| undefined

inputBoxRef

Ref for TextInput component within MessageInput

Type
React ref

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.

Warning:

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:

Parameter Description
localMessage Contains the message data that will be shown in the UI immediately
message Contains the data that will be sent to the backend
options Contains 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.

Warning:

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.

Type Default
ComponentType AttachmentUploadPreviewList

AttachmentPickerSelectionBar

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

Type Default
ComponentType undefined | AttachmentPickerSelectionBar

AudioRecorder

Custom UI for audio recorder controls in MessageInput.

Type Default
ComponentType AudioRecorder

AudioRecordingInProgress

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

Type Default
ComponentType AudioRecordingInProgress

AudioRecordingLockIndicator

Custom lock indicator for audio recording in MessageInput.

Type Default
ComponentType AudioRecordingLockIndicator

AudioRecordingPreview

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

Type Default
ComponentType AudioRecordingPreview

AudioRecordingWaveform

Custom waveform UI for audio recording in MessageInput.

Type Default
ComponentType AudioRecordingWaveform

AutoCompleteSuggestionList

Renders the autocomplete suggestion list.

Type Default
ComponentType AutoCompleteSuggestionList

CommandInput

Renders the message input in an active command state.

Type Default
ComponentType CommandInput

CooldownTimer

Renders a countdown timer for message send cooldowns in MessageInput.

Type Default
ComponentType CooldownTimer

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.

Type Default
ComponentType CreatePollContent

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.

Type Default
ComponentType InputButtons

InputEditingStateHeader

Renders the header when editing a message in the input.

Type Default
ComponentType InputEditingStateHeader

InputReplyStateHeader

Renders the reply header in the message input.

Type Default
ComponentType InputReplyStateHeader

Reply

Renders a preview of the parent message for quoted replies.

Type Default
ComponentType Reply

SendButton

Renders the send message button inside MessageInput.

Type Default
ComponentType SendButton

ShowThreadMessageInChannelButton

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

Type Default
ComponentType ShowThreadMessageInChannelButton

StartAudioRecordingButton

Custom mic button for audio recording in MessageInput.

Type Default
ComponentType StartAudioRecordingButton

StopMessageStreamingButton

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

Type Default
component StopMessageStreamingButton

TextInputComponent

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

Type Default
ComponentType Default React Native's TextInput