Skip to content

Commit 8c7a4ea

Browse files
committed
chore: resolve conflicts from develop
2 parents f087ee5 + 2a7cee3 commit 8c7a4ea

File tree

11 files changed

+45
-4
lines changed

11 files changed

+45
-4
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Boolean to enable/disable the message underlay background when there are unread messages in the Message List.
2+
3+
| Type | Default |
4+
| ---------------------- | ------- |
5+
| `boolean`\|`undefined` | `true` |

docusaurus/docs/reactnative/contexts/messages-context.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ import ReactionListPosition from '../common-content/ui-components/channel/props/
7474
import ReactionListTop from '../common-content/ui-components/channel/props/reaction-list-top.mdx';
7575
import Reply from '../common-content/ui-components/channel/props/reply.mdx';
7676
import ScrollToBottomButton from '../common-content/ui-components/channel/props/scroll-to-bottom-button.mdx';
77+
import ShouldShowUnreadUnderlay from '../common-content/ui-components/channel/props/should_show_unread_underlay.mdx';
7778
import SelectReaction from '../common-content/ui-components/channel/props/select_reaction.mdx';
7879
import SupportedReactions from '../common-content/ui-components/channel/props/supported_reactions.mdx';
7980
import TypingIndicator from '../common-content/ui-components/channel/props/typing_indicator.mdx';
@@ -247,6 +248,10 @@ Enables quoted-reply state on given message.
247248
| ------------------- |
248249
| `(message) => void` |
249250

251+
### <div class="label description">_forwarded from [Channel](../../core-components/channel#shouldshowunreadunderlay)_ props</div> shouldShowUnreadUnderlay {#shouldshowunreadunderlay}
252+
253+
<ShouldShowUnreadUnderlay />
254+
250255
### <div class="label description">_forwarded from [Channel](../../core-components/channel#supportedreactions)_ props</div> supportedReactions {#supportedreactions}
251256

252257
<SupportedReactions />

docusaurus/docs/reactnative/core-components/channel-list.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ export const App = () => <OverlayProvider>
4040
</OverlayProvider>;
4141
```
4242

43+
:::note
44+
When receiving channel information from channel events, the filters are not respected; the reason for this is that channel filters can get very complex, and implementing that filtering logic that supports all of the custom filter would be very hard to do. Implementing this on the backend side isn't an option as it is inefficient and has to cater to different filters. So, to help you with it, you will have to override the `notification.message_new` event using the [`onNewMessageNotification`](./channel-list.mdx#onnewmessagenotification) and `message.new` event handlers using the [`onNewMessage`](./channel-list.mdx#onnewmessage) prop of the `ChannelList` component.
45+
:::
46+
4347
## Context Providers
4448

4549
`ChannelList` contains the provider for the `ChannelsContext`. This can be accessed using the corresponding hook.

docusaurus/docs/reactnative/core-components/channel.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ import ScrollToBottomButton from '../common-content/ui-components/channel/props/
143143
import SelectReaction from '../common-content/ui-components/channel/props/select_reaction.mdx';
144144
import SendButton from '../common-content/ui-components/channel/props/send_button.mdx';
145145
import SendMessageDisallowedIndicator from '../common-content/ui-components/channel/props/send_message_disallowed_indicator.mdx';
146+
import ShouldShowUnreadUnderlay from '../common-content/ui-components/channel/props/should_show_unread_underlay.mdx';
146147
import ShowThreadMessageInChannelButton from '../common-content/ui-components/channel/props/show_thread_message_in_channel_button.mdx';
147148
import StartAudioRecordingButton from '../common-content/ui-components/channel/props/start_audio_recording_button.mdx';
148149
import StateUpdateThrottleInterval from '../common-content/ui-components/channel/props/state_update_throttle_interval.mdx';
@@ -715,6 +716,10 @@ Callback function to set the [ref](https://reactjs.org/docs/refs-and-the-dom.htm
715716
| --------- | -------------------- |
716717
| ref | ref of the TextInput |
717718

719+
### `shouldShowUnreadUnderlay`
720+
721+
<ShouldShowUnreadUnderlay />
722+
718723
### stateUpdateThrottleInterval
719724

720725
<StateUpdateThrottleInterval />

package/src/components/Channel/Channel.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ export type ChannelPropsWithContext<
347347
| 'reactionListPosition'
348348
| 'ReactionListTop'
349349
| 'Reply'
350+
| 'shouldShowUnreadUnderlay'
350351
| 'ScrollToBottomButton'
351352
| 'selectReaction'
352353
| 'supportedReactions'
@@ -615,6 +616,7 @@ const ChannelWithContext = <
615616
setTyping,
616617
setWatcherCount,
617618
setWatchers,
619+
shouldShowUnreadUnderlay = true,
618620
shouldSyncChannel,
619621
ShowThreadMessageInChannelButton = ShowThreadMessageInChannelButtonDefault,
620622
StartAudioRecordingButton = AudioRecordingButtonDefault,
@@ -2341,6 +2343,7 @@ const ChannelWithContext = <
23412343
sendReaction,
23422344
setEditingState,
23432345
setQuotedMessageState,
2346+
shouldShowUnreadUnderlay,
23442347
supportedReactions,
23452348
targetedMessage,
23462349
TypingIndicator,

package/src/components/Channel/hooks/useCreateMessagesContext.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export const useCreateMessagesContext = <
9393
sendReaction,
9494
setEditingState,
9595
setQuotedMessageState,
96+
shouldShowUnreadUnderlay,
9697
supportedReactions,
9798
targetedMessage,
9899
TypingIndicator,
@@ -199,6 +200,7 @@ export const useCreateMessagesContext = <
199200
sendReaction,
200201
setEditingState,
201202
setQuotedMessageState,
203+
shouldShowUnreadUnderlay,
202204
supportedReactions,
203205
targetedMessage,
204206
TypingIndicator,

package/src/components/Message/Message.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ const MessageWithContext = <
257257
const { client } = chatContext;
258258
const {
259259
theme: {
260-
colors: { bg_gradient_start, targetedMessageBackground },
261-
messageSimple: { targetedMessageContainer },
260+
colors: { targetedMessageBackground },
261+
messageSimple: { targetedMessageContainer, unreadUnderlayColor },
262262
screenPadding,
263263
},
264264
} = useTheme();
@@ -665,7 +665,7 @@ const MessageWithContext = <
665665
style={[
666666
style,
667667
{
668-
backgroundColor: showUnreadUnderlay ? bg_gradient_start : undefined,
668+
backgroundColor: showUnreadUnderlay ? unreadUnderlayColor : undefined,
669669
},
670670
]}
671671
>

package/src/components/MessageList/MessageList.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ type MessageListPropsWithContext<
144144
| 'ScrollToBottomButton'
145145
| 'MessageSystem'
146146
| 'myMessageTheme'
147+
| 'shouldShowUnreadUnderlay'
147148
| 'TypingIndicator'
148149
| 'TypingIndicatorContainer'
149150
> &
@@ -270,6 +271,7 @@ const MessageListWithContext = <
270271
setMessages,
271272
setSelectedPicker,
272273
setTargetedMessage,
274+
shouldShowUnreadUnderlay,
273275
StickyHeader,
274276
targetedMessage,
275277
thread,
@@ -630,7 +632,10 @@ const MessageListWithContext = <
630632

631633
const isCurrentMessageUnread = isMessageUnread(index);
632634
const showUnreadUnderlay =
633-
!channel.muteStatus().muted && isCurrentMessageUnread && scrollToBottomButtonVisible;
635+
!!shouldShowUnreadUnderlay &&
636+
!channel.muteStatus().muted &&
637+
isCurrentMessageUnread &&
638+
scrollToBottomButtonVisible;
634639
const insertInlineUnreadIndicator = showUnreadUnderlay && !isMessageUnread(index + 1); // show only if previous message is read
635640

636641
if (message.type === 'system') {
@@ -1260,6 +1265,7 @@ export const MessageList = <
12601265
MessageSystem,
12611266
myMessageTheme,
12621267
ScrollToBottomButton,
1268+
shouldShowUnreadUnderlay,
12631269
TypingIndicator,
12641270
TypingIndicatorContainer,
12651271
} = useMessagesContext<StreamChatGenerics>();
@@ -1309,6 +1315,7 @@ export const MessageList = <
13091315
setMessages,
13101316
setSelectedPicker,
13111317
setTargetedMessage,
1318+
shouldShowUnreadUnderlay,
13121319
StickyHeader,
13131320
targetedMessage,
13141321
thread,

package/src/contexts/messageInputContext/MessageInputContext.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,7 @@ export const MessageInputProvider = <
918918

919919
const prevText = giphyEnabled && giphyActive ? `/giphy ${text}` : text;
920920
setText('');
921+
921922
if (inputBoxRef.current) {
922923
inputBoxRef.current.clear();
923924
}

package/src/contexts/messagesContext/MessagesContext.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,13 @@ export type MessagesContextValue<
560560
message: MessageType<StreamChatGenerics>,
561561
) => (reactionType: string) => Promise<void>;
562562

563+
/**
564+
* Boolean to enable/disable the message underlay background when there are unread messages in the Message List.
565+
*/
566+
shouldShowUnreadUnderlay?: boolean;
567+
/**
568+
* The supported reactions that the user can use to react to messages.
569+
*/
563570
supportedReactions?: ReactionData[];
564571

565572
targetedMessage?: string;

0 commit comments

Comments
 (0)