Skip to content

Commit 3e09542

Browse files
authored
fix: Apply isReactionEnabled from SendbirdProvider to Channel (#291)
Apply the isReactionEnabled props from the SendbirdProvider to Channel component * Add isReactionEnabled props into the SendBirdStateConfig (internal interface) * Keep sync the properties of the interface ChannelContextProps
1 parent 13f96ef commit 3e09542

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

scripts/index_d_ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ declare module "SendbirdUIKitGlobal" {
214214
renderUserProfile?: (props: RenderUserProfileProps) => React.ReactNode | React.ReactElement;
215215
allowProfileEdit: boolean;
216216
isOnline: boolean;
217+
isReactionEnabled: boolean;
217218
isMentionEnabled: boolean;
218219
userMention: {
219220
maxMentionCount: number;
@@ -452,10 +453,10 @@ declare module "SendbirdUIKitGlobal" {
452453
};
453454

454455
export type ChannelContextProps = {
455-
channelUrl: string;
456456
children?: React.ReactElement;
457-
useMessageGrouping?: boolean;
458-
useReaction?: boolean;
457+
channelUrl: string;
458+
isReactionEnabled?: boolean;
459+
isMessageGroupingEnabled?: boolean;
459460
showSearchIcon?: boolean;
460461
highlightedMessage?: number;
461462
startingPoint?: number;
@@ -468,7 +469,6 @@ declare module "SendbirdUIKitGlobal" {
468469
queries?: ChannelQueries;
469470
renderUserProfile?: (props: RenderUserProfileProps) => React.ReactNode | React.ReactElement;
470471
disableUserProfile?: boolean;
471-
renderUserMentionItem?: (props: { user: User }) => JSX.Element;
472472
};
473473

474474
export interface ChannelUIProps {

src/index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ interface SendBirdStateConfig {
117117
renderUserProfile?: (props: RenderUserProfileProps) => React.ReactElement;
118118
allowProfileEdit: boolean;
119119
isOnline: boolean;
120+
isReactionEnabled: boolean;
120121
isMentionEnabled: boolean;
121122
userMention: {
122123
maxMentionCount: number;
@@ -596,8 +597,8 @@ type ChannelQueries = {
596597
};
597598

598599
type ChannelContextProps = {
599-
channelUrl: string;
600600
children?: React.ReactElement;
601+
channelUrl: string;
601602
isReactionEnabled?: boolean;
602603
isMessageGroupingEnabled?: boolean;
603604
showSearchIcon?: boolean;

src/lib/SendbirdState.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ interface SendBirdStateConfig {
4141
theme: SendbirdUIKitThemes;
4242
setCurrenttheme: (theme: SendbirdUIKitThemes) => void;
4343
userListQuery?(): UserListQuery;
44-
isMentionEnabled?: boolean;
44+
isReactionEnabled: boolean;
45+
isMentionEnabled: boolean;
4546
userMention: {
4647
maxMentionCount: number,
4748
maxSuggestionCount: number,

src/lib/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export interface SendBirdStateConfig {
6262
logger: Logger;
6363
setCurrenttheme: (theme: string) => void;
6464
userListQuery?(): SendBirdTypes.UserListQuery;
65+
isReactionEnabled: boolean;
6566
isMentionEnabled: boolean;
6667
userMention: {
6768
maxMentionCount: number,

src/smart-components/Channel/context/ChannelProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ const ChannelProvider: React.FC<ChannelContextProps> = (props: ChannelContextPro
209209
const isBroadcast = currentGroupChannel?.isBroadcast || false;
210210
const { appInfo } = sdk;
211211
const usingReaction = (
212-
appInfo?.useReaction && !isBroadcast && !isSuper && isReactionEnabled
212+
appInfo?.useReaction && !isBroadcast && !isSuper && (config?.isReactionEnabled || isReactionEnabled)
213213
// TODO: Make isReactionEnabled independent from appInfo.useReaction
214214
);
215215

0 commit comments

Comments
 (0)