AudioAttachment
Renders audio attachment controls inside MessageList and MessageComposer. This is the default component for the AudioAttachment prop.
Best Practices
- Use the provided callbacks (
onLoad,onProgress,onPlayPause) to sync UI state. - Avoid heavy logic in progress handlers to keep playback smooth.
- 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 containing playback state. | object(duration, progress, paused, id, file) |
onLoad | Callback when audio loads. | (index: string, duration: number) => void |
onProgress | Callback for playback progress updates. | (index: string, currentTime?: number, hasEnd?: boolean) => void |
onPlayPause | Callback for play/pause toggle. | (index: string, pausedStatus?: boolean) => void |
testID | Test identifier for the component. | string |