Skip to content

Commit 2a7cee3

Browse files
authored
fix: add theme for overlay reaction list icon and introduce shouldShowUnreadOverlay for message bubble (#2722)
* fix: add theme for overlay reaction list icon and introduce shouldShowUnreadOverlay for message bubble * fix: lint issues * fix: add theme * fix: lint issues
1 parent bd41607 commit 2a7cee3

File tree

13 files changed

+53
-9
lines changed

13 files changed

+53
-9
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
@@ -66,6 +66,7 @@ import OverlayReactionList from '../common-content/ui-components/overlay-provide
6666
import ReactionList from '../common-content/ui-components/channel/props/reaction-list.mdx';
6767
import Reply from '../common-content/ui-components/channel/props/reply.mdx';
6868
import ScrollToBottomButton from '../common-content/ui-components/channel/props/scroll-to-bottom-button.mdx';
69+
import ShouldShowUnreadUnderlay from '../common-content/ui-components/channel/props/should_show_unread_underlay.mdx';
6970
import SelectReaction from '../common-content/ui-components/channel/props/select_reaction.mdx';
7071
import SupportedReactions from '../common-content/ui-components/channel/props/supported_reactions.mdx';
7172
import TypingIndicator from '../common-content/ui-components/channel/props/typing_indicator.mdx';
@@ -235,6 +236,10 @@ Enables quoted-reply state on given message.
235236
| ------------------- |
236237
| `(message) => void` |
237238

239+
### <div class="label description">_forwarded from [Channel](../../core-components/channel#shouldshowunreadunderlay)_ props</div> shouldShowUnreadUnderlay {#shouldshowunreadunderlay}
240+
241+
<ShouldShowUnreadUnderlay />
242+
238243
### <div class="label description">_forwarded from [Channel](../../core-components/channel#supportedreactions)_ props</div> supportedReactions {#supportedreactions}
239244

240245
<SupportedReactions />

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ import ScrollToBottomButton from '../common-content/ui-components/channel/props/
134134
import SelectReaction from '../common-content/ui-components/channel/props/select_reaction.mdx';
135135
import SendButton from '../common-content/ui-components/channel/props/send_button.mdx';
136136
import SendMessageDisallowedIndicator from '../common-content/ui-components/channel/props/send_message_disallowed_indicator.mdx';
137+
import ShouldShowUnreadUnderlay from '../common-content/ui-components/channel/props/should_show_unread_underlay.mdx';
137138
import ShowThreadMessageInChannelButton from '../common-content/ui-components/channel/props/show_thread_message_in_channel_button.mdx';
138139
import StartAudioRecordingButton from '../common-content/ui-components/channel/props/start_audio_recording_button.mdx';
139140
import StateUpdateThrottleInterval from '../common-content/ui-components/channel/props/state_update_throttle_interval.mdx';
@@ -702,6 +703,10 @@ Callback function to set the [ref](https://reactjs.org/docs/refs-and-the-dom.htm
702703
| --------- | -------------------- |
703704
| ref | ref of the TextInput |
704705

706+
### `shouldShowUnreadUnderlay`
707+
708+
<ShouldShowUnreadUnderlay />
709+
705710
### stateUpdateThrottleInterval
706711

707712
<StateUpdateThrottleInterval />

package/src/components/Channel/Channel.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ export type ChannelPropsWithContext<
322322
| 'OverlayReactionList'
323323
| 'ReactionList'
324324
| 'Reply'
325+
| 'shouldShowUnreadUnderlay'
325326
| 'ScrollToBottomButton'
326327
| 'selectReaction'
327328
| 'supportedReactions'
@@ -582,6 +583,7 @@ const ChannelWithContext = <
582583
setTyping,
583584
setWatcherCount,
584585
setWatchers,
586+
shouldShowUnreadUnderlay = true,
585587
shouldSyncChannel,
586588
ShowThreadMessageInChannelButton = ShowThreadMessageInChannelButtonDefault,
587589
StartAudioRecordingButton = AudioRecordingButtonDefault,
@@ -2412,6 +2414,7 @@ const ChannelWithContext = <
24122414
sendReaction,
24132415
setEditingState,
24142416
setQuotedMessageState,
2417+
shouldShowUnreadUnderlay,
24152418
supportedReactions,
24162419
targetedMessage,
24172420
TypingIndicator,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export const useCreateMessagesContext = <
8585
sendReaction,
8686
setEditingState,
8787
setQuotedMessageState,
88+
shouldShowUnreadUnderlay,
8889
supportedReactions,
8990
targetedMessage,
9091
TypingIndicator,
@@ -183,6 +184,7 @@ export const useCreateMessagesContext = <
183184
sendReaction,
184185
setEditingState,
185186
setQuotedMessageState,
187+
shouldShowUnreadUnderlay,
186188
supportedReactions,
187189
targetedMessage,
188190
TypingIndicator,

package/src/components/ImageGallery/components/ImageGalleryFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const styles = StyleSheet.create({
2828
},
2929
innerContainer: {
3030
flexDirection: 'row',
31-
height: 56,
31+
minHeight: 56,
3232
},
3333
leftContainer: {
3434
flex: 1,

package/src/components/ImageGallery/components/ImageGalleryHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const styles = StyleSheet.create({
2929
},
3030
innerContainer: {
3131
flexDirection: 'row',
32-
height: 56,
32+
minHeight: 56,
3333
},
3434
leftContainer: {
3535
flex: 1,

package/src/components/Message/Message.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ const MessageWithContext = <
305305
const { client } = chatContext;
306306
const {
307307
theme: {
308-
colors: { bg_gradient_start, targetedMessageBackground },
309-
messageSimple: { targetedMessageContainer, targetedMessageUnderlay },
308+
colors: { targetedMessageBackground },
309+
messageSimple: { targetedMessageContainer, targetedMessageUnderlay, unreadUnderlayColor },
310310
},
311311
} = useTheme();
312312

@@ -762,7 +762,7 @@ const MessageWithContext = <
762762
style={[
763763
style,
764764
{
765-
backgroundColor: showUnreadUnderlay ? bg_gradient_start : undefined,
765+
backgroundColor: showUnreadUnderlay ? unreadUnderlayColor : undefined,
766766
},
767767
]}
768768
>

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/components/MessageOverlay/OverlayReactionList.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export const ReactionButton = <
120120
theme: {
121121
colors: { accent_blue, grey },
122122
overlay: {
123-
reactionsList: { reaction, reactionSize },
123+
reactionsList: { reaction, reactionSize, selectedIcon, unSelectedIcon },
124124
},
125125
},
126126
} = useTheme();
@@ -217,9 +217,14 @@ export const ReactionButton = <
217217
<Animated.View
218218
style={[index !== numberOfReactions - 1 ? styles.notLastReaction : {}, reaction, iconStyle]}
219219
>
220-
<Icon height={reactionSize} pathFill={grey} width={reactionSize} />
220+
<Icon height={reactionSize} pathFill={grey} width={reactionSize} {...unSelectedIcon} />
221221
<Animated.View style={[styles.selectedIcon, selectedStyle]}>
222-
<Icon height={reactionSize} pathFill={accent_blue} width={reactionSize} />
222+
<Icon
223+
height={reactionSize}
224+
pathFill={accent_blue}
225+
width={reactionSize}
226+
{...selectedIcon}
227+
/>
223228
</Animated.View>
224229
</Animated.View>
225230
</TapGestureHandler>

0 commit comments

Comments
 (0)