Member List for PubNub Chat Components for React Native
Migrate to Chat SDK
PubNub will stop supporting Chat Components on January 1, 2025 but you are welcome to contribute. Learn how to migrate to the Chat SDK here.
Renders a list of members.
It can represent all users of the application, only members of the current channel, users currently subscribed/present on the channel, or whatever else is passed into it. Custom memberRenderer can be used to modify how the users are rendered. For example you can add presence indicators.
Component
Check the source code of the Member List component and its preview on the right.
You are set as Sue Flores.
Configurable parameters
The component source code contains additional parameters that are commented out. These parameters are optional and you can use them to configure the component layout to your liking. Refer to the Parameters section for details on their usage.
Try it out
Modify the source code of the component to your liking and see the changes live on the preview.
For example, you can change the theme
to dark
or uncomment one of the configurable parameters to see how you can modify the component's default behavior.
Parameters
You can configure the component using these parameters:
Parameter | Type | Default value | Description |
---|---|---|---|
members? | UserEntity[] | string[] | [] | Option to pass a list of members, including metadata, to render on the list. |
presentMembers? | string[] | [] | Option to pass a list of present member IDs to mark them with a presence indicator. |
selfText? | string | "(You)" | This text is added after current user's name. |
sort? | (a: UserEntity, b: UserEntity) => -1 | 0 | 1 | n/a | Members are sorted by presence and alphabetically by default, you can override that by providing a sorter function. |
extraActionsRenderer? | (member: UserEntity) => JSX.Element | n/a | Provide extra actions renderer to add custom action buttons to each member. |
memberRenderer? | (member: UserEntity) => JSX.Element | n/a | Option to provide a custom user renderer to override themes and styles. |
onMemberClicked? | (member: UserEntity) => unknown | n/a | Callback run when a user clicked one of the members. |
onMemberLongPressed? | (member: UserEntity) => unknown | n/a | Callback run when a user long pressed one of the members. Can be used for extra actions menu. |
style? | MemberListStyle | n/a | Option to provide a custom StyleSheet for the component. It will be merged with the default styles. |