You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, reactions are sorted alphabetically by type. You can change this behavior by passing a`sortReactions` prop to the `MessageList` (or `VirtualizedMessageList`).
124
+
By default, reactions are sorted alphabetically by type. You can change this behavior by passing the`sortReactions` prop to the `MessageList` (or `VirtualizedMessageList`).
125
125
126
126
In this example, we sort the reactions in the descending order by the number of users:
127
127
@@ -142,7 +142,9 @@ function sortByReactionCount(a, b) {
142
142
</Chat>;
143
143
```
144
144
145
-
For better performance, keep this function memoized with `useCallback`, or declare it in either global or module scope.
145
+
Similarly, the `sortReactionDetails` prop can be passed to the `MessageList` (or `VirtualizedMessageList`) to sort the list of reacted users. The default implementation used by the reactions list modal dialog sorts users alphabetically by name.
146
+
147
+
For better performance, keep the sorting functions memoized with `useCallback`, or declare it in either global or module scope.
146
148
147
149
## ReactionSelector Props
148
150
@@ -301,6 +303,14 @@ If true, adds a CSS class that reverses the horizontal positioning of the select
301
303
| ------- | ------- |
302
304
| boolean | false |
303
305
306
+
### sortReactionDetails
307
+
308
+
Comparator function to sort the list of reacted users. Should have the same signature as an array's `sort` method. This prop overrides the function stored in `MessageContext`.
| (this: ReactionResponse, that: ReactionResponse) => number | alphabetical order |
313
+
304
314
### sortReactions
305
315
306
316
Comparator function to sort reactions. Should have the same signature as an array's `sort` method. This prop overrides the function stored in `MessageContext`.
0 commit comments