AudioAttachment
Renders audio attachment controls inside MessageList and MessageComposer. This is the default component for the AudioAttachment prop.
Best Practices
- Playback is handled internally through the shared audio-player state store; you don't wire up load/progress/play-pause callbacks yourself.
- Use
hideProgressBar,showTitle, andshowSpeedSettingsto tune what the row displays. - Respect concurrent playback settings from the
Channel/Audio provider. - Provide clear play/pause affordances and accessibility labels.
- Test on both iOS and Android for consistent audio behavior.
Props
| Prop | Description | Type |
|---|---|---|
item |
Audio item to render. Contains playback metadata such as id, type ('audio' | 'voiceRecording'), duration, waveform_data, asset_url, title, and mime_type. |
AudioAttachmentType |
message |
Message object the attachment belongs to. Used to scope the audio player instance. | LocalMessage |
hideProgressBar |
When true, the progress/waveform bar isn't rendered. Defaults to false. |
boolean |
showTitle |
When true, the file title (or "Voice Message") is shown. Defaults to true. |
boolean |
showSpeedSettings |
When true, the playback-speed button is shown. Defaults to false. |
boolean |
isPreview |
Set to true when the attachment is rendered as a preview in the message input. Defaults to false. |
boolean |
indicator |
Node rendered in place of the progress info while a local attachment is uploading. | React.ReactNode |
containerStyle |
Additional style applied to the outer container. | StyleProp<ViewStyle> |
styles |
Style overrides for container, playPauseButton, speedSettingsButton, durationText, and leftContainer. |
object |
testID |
Test identifier for the component. | string |