Skip to content

Commit 3d122a1

Browse files
Merge pull request #554 from GetStream/vishal/changelog-and-docs
Added changelog for 3.1.0 and some prop docs
2 parents a172c15 + 3ceaaa1 commit 3d122a1

File tree

4 files changed

+119
-2
lines changed

4 files changed

+119
-2
lines changed

CHANGELOG.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,59 @@
99
- openCommandsPicker (function)
1010
- toggleAttachmentPicker (function)
1111

12-
- Added support for new prop on `Channel` component - `InputButtons`, to replace the extra buttons on the left on input box.
12+
- Added support for new prop on `Channel` component - `InputButtons`, to replace the extra buttons on the left on input box [#536](https://github.com/GetStream/stream-chat-react-native/pull/536)
13+
14+
- Added support for `messageActions` prop as callback. Also added support for prop `messageActions` on Channel component [#548](https://github.com/GetStream/stream-chat-react-native/pull/548)
15+
Earlier you could override messageActions prop as following:
16+
17+
```jsx
18+
<Channel
19+
messageActions=[
20+
{
21+
action: () => { /** Some message action logic */ };
22+
title: "Pin Message";
23+
icon: PinIcon;
24+
titleStyle: {};
25+
},
26+
{
27+
action: () => { /** Some message action logic */ };
28+
title: "Delete Message";
29+
icon: PinIcon;
30+
titleStyle: {};
31+
}
32+
]
33+
>
34+
{/** MessageList and MessageInput component here */}
35+
</Channel>
36+
```
37+
38+
But now, you can selectly keep certain action and remove some:
39+
40+
```jsx
41+
/** Lets say you only want to keep threadReply and copyMessage actions */
42+
<Channel
43+
messageActions={({
44+
blockUser,
45+
copyMessage,
46+
deleteMessage,
47+
editMessage,
48+
flagMessage,
49+
muteUser,
50+
reply,
51+
retry,
52+
threadReply,
53+
}) => ([
54+
threadReply, copyMessage
55+
])}
56+
>
57+
{/** MessageList and MessageInput component here */}
58+
</Channel>
59+
```
60+
61+
- Issue fix: make OverlayReactions customizable through props. [c7a83b8](https://github.com/GetStream/stream-chat-react-native/commit/c7a83b87804d9492ce01ef0dfa63fe9b6cc203ad)
62+
- Issue fix: Image upload for expo and assets-library [5a2d0e8](https://github.com/GetStream/stream-chat-react-native/commit/5a2d0e827dd4a4067058787b49b07c584f3e370c)
63+
- Issue fix: Compatibility with jest as described in [#508](https://github.com/GetStream/stream-chat-react-native/issues/508) [a172c15](https://github.com/GetStream/stream-chat-react-native/commit/a172c15b1304932051f0f699daf47981e488fde4)
64+
1365

1466
## [3.0.0] (2021-02-23)
1567

src/components/ImageGallery/ImageGallery.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export type ImageGalleryCustomComponents<
9090
Us extends UnknownType = DefaultUserType
9191
> = {
9292
/**
93-
* Override props for following UI components, which are part of [image gallery](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/3.png).
93+
* Override props for following UI components, which are part of [image gallery](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#gallery-components).
9494
*
9595
* - [ImageGalleryFooter](#ImageGalleryFooter)
9696
*

src/contexts/messageInputContext/MessageInputContext.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,21 @@ export type InputMessageInputContextValue<
364364
getUsers: () => UserResponse<Us>[];
365365
}
366366
>;
367+
/**
368+
* Custom UI component to override buttons on left side of input box
369+
* Defaults to [InputButtons](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageInput/InputButtons.tsx),
370+
* which contain following components/buttons:
371+
*
372+
* - AttachButton
373+
* - CommandsButtom
374+
*
375+
* You have access to following prop functions:
376+
*
377+
* - closeAttachmentPicker
378+
* - openAttachmentPicker
379+
* - openCommandsPicker
380+
* - toggleAttachmentPicker
381+
*/
367382
InputButtons?: React.ComponentType<
368383
InputButtonsProps<At, Ch, Co, Ev, Me, Re, Us>
369384
>;

src/contexts/messagesContext/MessagesContext.tsx

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,56 @@ export type MessagesContextValue<
379379
) => Promise<void>;
380380
/** Object specifying rules defined within simple-markdown https://github.com/Khan/simple-markdown#adding-a-simple-extension */
381381
markdownRules?: MarkdownRules;
382+
/**
383+
* Use this prop to override message actions (which pop-up in message overlay).
384+
*
385+
* You can either completely override the default messageActions object.
386+
*
387+
* ```
388+
* <Channel
389+
* messageActions=[
390+
* {
391+
* action: () => { someAction() };
392+
* title: "Pin Message";
393+
* icon: PinIcon;
394+
* titleStyle: {};
395+
* },
396+
* {
397+
* action: () => { someAction() };
398+
* title: "Delete Message";
399+
* icon: PinIcon;
400+
* titleStyle: {};
401+
* }
402+
* ]
403+
* >
404+
* </Channel>
405+
* ```
406+
*
407+
* Or you can selectly keep certain action and remove some:
408+
*
409+
* e.g. Lets say you only want to keep threadReply and copyMessage actions
410+
*
411+
* ```
412+
* <Channel
413+
* messageActions={({
414+
* blockUser,
415+
* copyMessage,
416+
* deleteMessage,
417+
* editMessage,
418+
* flagMessage,
419+
* muteUser,
420+
* reply,
421+
* retry,
422+
* threadReply,
423+
* }) => ([
424+
* threadReply, copyMessage
425+
* ])}
426+
* >
427+
* </Channel>
428+
* ```
429+
*
430+
* @overrideType Function | Array<Objects>
431+
*/
382432
messageActions?:
383433
| (MessageAction | null)[]
384434
| (({

0 commit comments

Comments
 (0)