import { TouchableOpacity } from "react-native-gesture-handler";
import { ChannelList, ChannelAvatar } from "stream-chat-react-native";
<ChannelList
PreviewAvatar={({ channel }) => (
<TouchableOpacity
disallowInterruption={true}
onPress={() => {
/** Handler for press action */
}}
>
<ChannelAvatar channel={channel} />
</TouchableOpacity>
)}
/>;ChannelAvatar
Renders a channel avatar inside ChannelList.
Best Practices
- Keep avatar rendering lightweight to avoid list performance issues.
- Use
PreviewAvatarto wrap interactions without alteringChannelAvatarinternals. - Ensure touch targets are accessible when adding custom
onPress. - Use the context-provided
ImageComponentfor consistent image handling. - Avoid inline handlers when rendering large lists; memoize where possible.
General Usage
Customize it and pass it via PreviewAvatar on ChannelList.
Example with an onPress handler:
Props
channel
Channel instance from the Stream Chat client.
| Type |
|---|
| Channel |
UI Component Props
ImageComponent
Drop-in replacement for all underlying Image components in the SDK. Useful for offline image caching. See the Offline Support Guide.
| Type | Default |
|---|---|
| ComponentType | Image |