Skip to content

Commit e8c2a86

Browse files
authored
Merge pull request #159 from sendbird/feat/reactions-super-group
feat(CLNP-2026): support reactions for super group channel
2 parents 48aa109 + 8ab0720 commit e8c2a86

File tree

7 files changed

+21
-12
lines changed

7 files changed

+21
-12
lines changed

packages/uikit-react-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"@openspacelabs/react-native-zoomable-view": "^2.1.5",
6363
"@sendbird/uikit-chat-hooks": "3.4.3",
6464
"@sendbird/uikit-react-native-foundation": "3.4.3",
65-
"@sendbird/uikit-tools": "0.0.1-alpha.58",
65+
"@sendbird/uikit-tools": "0.0.1-alpha.66",
6666
"@sendbird/uikit-utils": "3.4.3"
6767
},
6868
"devDependencies": {

packages/uikit-react-native/src/components/ChannelMessageList/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,13 @@ const useCreateMessagePressActions = <T extends SendbirdGroupChannel | SendbirdO
356356
}
357357
}
358358

359+
const configs = sbOptions.uikitWithAppInfo.groupChannel.channel;
359360
const bottomSheetItem: BottomSheetItem = {
360361
sheetItems,
361-
HeaderComponent: shouldRenderReaction(channel, sbOptions.uikitWithAppInfo.groupChannel.channel.enableReactions)
362+
HeaderComponent: shouldRenderReaction(
363+
channel,
364+
channel.isGroupChannel() && (channel.isSuper ? configs.enableReactionsSupergroup : configs.enableReactions),
365+
)
362366
? ({ onClose }) => <ReactionAddons.BottomSheet message={message} channel={channel} onClose={onClose} />
363367
: undefined,
364368
};

packages/uikit-react-native/src/components/GroupChannelMessageRenderer/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ const GroupChannelMessageRenderer: GroupChannelProps['Fragment']['renderMessage'
5959
);
6060

6161
const reactionChildren = useIIFE(() => {
62+
const configs = sbOptions.uikitWithAppInfo.groupChannel.channel;
6263
if (
63-
shouldRenderReaction(channel, sbOptions.uikitWithAppInfo.groupChannel.channel.enableReactions) &&
64+
shouldRenderReaction(channel, channel.isSuper ? configs.enableReactionsSupergroup : configs.enableReactions) &&
6465
message.reactions &&
6566
message.reactions.length > 0
6667
) {

packages/uikit-react-native/src/contexts/ReactionCtx.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ export const ReactionProvider = ({ children, onPressUserProfile }: Props) => {
4646

4747
const openReactionUserList: ReactionContextType['openReactionUserList'] = useCallback(
4848
({ channel, message, focusIndex = 0 }) => {
49+
// NOTE: We don't support reaction user list for supergroup channel
50+
if (channel.isGroupChannel() && channel.isSuper) return;
51+
4952
setState({ channel, message });
5053
setReactionUserListFocusIndex(focusIndex);
5154
setReactionUserListVisible(true);

packages/uikit-react-native/src/contexts/SendbirdChatCtx.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,17 @@ export type SendbirdChatContextType = {
5252
uikitWithAppInfo: {
5353
groupChannel: {
5454
channel: {
55-
enableReactions: boolean;
56-
enableOgtag: boolean;
55+
readonly enableReactions: boolean;
56+
readonly enableReactionsSupergroup: boolean;
57+
readonly enableOgtag: boolean;
5758
};
5859
setting: {
59-
enableMessageSearch: boolean;
60+
readonly enableMessageSearch: boolean;
6061
};
6162
};
6263
openChannel: {
6364
channel: {
64-
enableOgtag: boolean;
65+
readonly enableOgtag: boolean;
6566
};
6667
};
6768
};

packages/uikit-utils/src/sendbird/message.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ export function shouldRenderReaction(channel: SendbirdBaseChannel, reactionEnabl
144144

145145
if (channel.isGroupChannel()) {
146146
if (channel.isBroadcast) return false;
147-
if (channel.isSuper) return false;
148147
if (channel.isEphemeral) return false;
148+
if (channel.isChatNotification) return false;
149149
}
150150

151151
return reactionEnabled;

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3389,10 +3389,10 @@
33893389
resolved "https://registry.yarnpkg.com/@sendbird/react-native-scrollview-enhancer/-/react-native-scrollview-enhancer-0.2.1.tgz#25de4af78293978a4c0ef6fddee25d822a364c46"
33903390
integrity sha512-LN+Tm+ZUkE2MBVreg/JI8SVr8SOKRteZN0YFpGzRtbKkP45+pKyPN4JQPf73eFx7qO8zDL+TUVyzz/1MOnIK7g==
33913391

3392-
"@sendbird/[email protected].58":
3393-
version "0.0.1-alpha.58"
3394-
resolved "https://registry.yarnpkg.com/@sendbird/uikit-tools/-/uikit-tools-0.0.1-alpha.58.tgz#1aabaed673e0f38e46d149f76309c8ae04db2835"
3395-
integrity sha512-lZfG+1CjV3eNHpX58D56Yjr24OaH0qjs4gqKJb2rHin4wcD6yJ8Plhb7+mp8IuinM+BXhCsNwwikVQVPzgHnUA==
3392+
"@sendbird/[email protected].66":
3393+
version "0.0.1-alpha.66"
3394+
resolved "https://registry.yarnpkg.com/@sendbird/uikit-tools/-/uikit-tools-0.0.1-alpha.66.tgz#5328f1768c130b15cdec9f0ab9f21d2da269ba62"
3395+
integrity sha512-IE8HHqTcAVunnVhcfsxQCRmOoCNHx3c8ZP3eZeqYJB876DrnM38ne5TZVao2ZFSmbiZZQ7xc9DClEiZuZUgvnQ==
33963396

33973397
"@sideway/address@^4.1.3":
33983398
version "4.1.4"

0 commit comments

Comments
 (0)