FileAttachment

Renders file attachments inside MessageList.

Best Practices

  • Keep file rows compact and readable.
  • Validate file size/type before rendering heavy previews.
  • Use consistent icons and sizes across your app.
  • Customize via WithComponents instead of editing internals.

Basic Usage

Replace the default UI via WithComponents.

Example: change the file attachment icon size.

import { WithComponents, FileAttachment } from "stream-chat-react-native";

<WithComponents
  overrides={{
    FileAttachment: () => <FileAttachment attachmentIconSize="lg" />,
  }}
>
  <Channel channel={channel}>
    <MessageList />
    <MessageComposer />
  </Channel>
</WithComponents>;

Props

PropDescriptionType
attachmentAttachment object for a file type attachment.object
attachmentIconSizeSize of the file icon, forwarded to FilePreview/FileIcon. Defaults to 'md'.'sm' | 'md' | 'lg'
additionalPressablePropsExtra props passed to the underlying Pressable used in message components like MessageContent.object
onLongPressDefault long press handler for message UI.function
onPressDefault press handler for message UI.function
onPressInDefault pressIn handler for message UI.function
preventPressDisable press interactions for the file row.boolean
stylesStyle overrides for the file row (container, details, size, title).object

UI Component Props

PropDescriptionType
FilePreviewRenders the file row content and receives the upload progress indicator while a local attachment is pending. Defaults to FilePreview.ComponentType