@sendbird/uikit-react
Advanced tools
Changelog
[v3.15.2] (Sep 6th, 2024)
message
event handlers for onSendMessageFailed
, onUpdateMessageFailed
, and onFileUploadFailed
in the eventHandlers
prop of the message input component. These handlers allow developers to respond to message send, update, and file upload failures.
<Sendbird
eventHandlers={{
message: {
onSendMessageFailed: (message, error) => {
// You can use the message parameter to create specific conditions
if (message.isUserMessage()) {
alert(`Message failed to send: ${error?.message}`);
}
},
onUpdateMessageFailed: (message, error) => {
console.log(`Failed to update message: ${message.messageId}, Error: ${error}`);
},
onFileUploadFailed: (error) => {
console.error('File upload failed', error);
},
},
}}
Changelog
[v3.15.1] (Aug 29, 2024)
Changelog
[v3.15.0] (Aug 29, 2024)
UIKit now supports form messages! Messages with messageForm
will be displayed as form messages.
enableFormTypeMessage
global option
<App
appId={appId}
userId={userId}
uikitOptions={{
groupChannel: {
// Below turns on the form message feature. Default value is false.
enableFormTypeMessage: true,
}
}}
/>
MessageInput
is now being disabled if a channel has a form message that is not submitted and its extendedMessagePayload['disable_chat_input']
value is trueFormMessageItemBody
, and FormInput
Added support for EmojiCategory. You can now filter emojis for different messages when adding Reactions to a message.
Added filterEmojiCategoryIds
to GroupChannelProvider
and ThreadProvider
.
const filterEmojiCategoryIds = (message: SendableMessage) => {
if (message.customType === 'emoji_category_2') return [2];
return [1];
}
<GroupChannel
filterEmojiCategoryIds={filterEmojiCategoryIds}
/>
Added sub-rendering props to the ThreadListItem
and ThreadListItemContent
components.
renderSenderProfile
, renderMessageBody
, renderMessageHeader
, renderEmojiReactions
, and renderMobileMenuOnLongPress
.const CustomThread = () => (
<ThreadProvider>
<ThreadUI
renderMessage={(props) => (
<ThreadListItem
{...props}
renderSenderProfile={() => <></>}
/>
)}
/>
</ThreadProvider>
);
Exported subcomponents of MessageContent
:
import { MessageBody, MessageHeader, MessageProfile } from '@sendbird/uikit-react/ui/MessageContent';
ParentMessageInfo
until the first message was received on the thread list.§
or <
were automatically converted to symbols when pasted into a contentEditable element, ensuring they are now preserved as plain text.EditUserProfileUIView
when the app was displayed in horizontal view on mobile devices.onUserProfileMessage
to onStartDirectMessage
.
onUserProfileMessage
prop in SendbirdProvider
and UserProfileProvider
.onUserProfileMessage
interface in SendbirdStateContext
and UserProfileContext
.onStartDirectMessage
instead.Changelog
[v3.14.14] (Aug 1, 2024)
forceLeftToRightMessageLayout
to enable LTR message layout display in RTL mode. This helps users who set htmlTextDirection='rtl'
to keep the message layout in LTR format (outgoing messages on the right, incoming messages on the left).
import SendbirdProvider from ‘@sendbird/uikit-react/SendbirdProvider’;
import ar from 'date-fns/locale/ar';
const YourComponent() => {
return (
<SendbirdProvider
htmlTextDirection="rtl" // for RTL display
forceLeftToRightMessageLayout={true} // to enforce the message layout to Left-to-Right direction even though htmlTextDirection is set to ‘rtl’
dateLocale={ar} // locale setting would be necessary too
{…other props}
>
{...other components}
</SendbirdProvider>
)
}
GroupChannelCollection
was not recreated when channelListQueryParams
changed. The channel list now refreshes when the values of channelListQueryParams
are updated.renderUserListItem
of ChannelSettingsUIProps
from the ChannelSettingsProps
.Changelog
[v3.14.13] (July 18, 2024)
Address RTL UI Feedback
htmlTextDirection
prop didn't work when using SendbirdProvider
, but only worked in the App module.Message Menu Customization in Threads
renderMessageMenu
and renderEmojiMenu
props to the <ParentMessageInfo />
, <ThreadListItem />
, and <ThreadListItemContent />
components.<Thread
renderMessage={(props) => (
<ThreadListItem {...props} renderMessageMenu={(props) => (
<MessageMenu {...props} renderMenuItems={({ items }) => (
<>
<items.CopyMenuItem />
<items.DeleteMenuItem />
</>
)} />
)} />
)}
/>
Channel
, ChannelProvider
, ChannelList
, and ChannelListProvider
as deprecated.useMenuItems
useMenuItems
hook.ChannelListQueryParamsType
.renderUserListItem
prop to the Provider from the UI component.ChannelSettingsMenuItem
component.interop: "compat"
setting for the CommonJS output in Rollup Config to enhance the compatibility between ESM and CJS.Changelog
[v3.14.12] (July 3, 2024)
RTL Support
htmlTextDirection
prop to SendbirdProvider
to support Right-To-Left (RTL) text direction for Middle East customers. Read more.import ar from 'date-fns/locale/ar';
<SendbirdProvider
...
htmlTextDirection={'rtl' | 'ltr'}
// Setting a proper value to dateLocale would be necessary
dateLocale={ar}
>
</SendbirdProvider>
DX Improvements: ChannelSetting SettingMenu
ChannelSettingsUI
more modular and customizable.useMenuItems.tsx
: Custom hook for menu items based on user roles.MenuItem.tsx
: Reusable and customizable menu item component.MenuListByRole.tsx
: Renders a list of menu items based on user roles.import React from 'react';
import ChannelSettingsUI from '@sendbird-uikit/ChannelSettings/components/ChannelSettingsUI';
import useMenuItems from '@sendbird-uikit/ChannelSettings/hooks/useMenuList';
const CustomChannelSettings = () => {
const menuItems = useMenuItems();
const renderCustomModerationPanel = () => {
// Create a new object by selecting only the desired menu items.
const customMenuItems = {
operator: {
operators: menuItems.operator.operators, // Keep the operators menu
allUsers: menuItems.operator.allUsers, // Keep the all users menu
// Add or remove other menu items as needed.
},
nonOperator: {
allUsers: menuItems.nonOperator.allUsers, // Keep the all users menu
// Add or remove other menu items as needed.
},
};
return <MenuListByRole menuItems={customMenuItems} />;
};
return (
<ChannelSettingsUI renderModerationPanel={renderCustomModerationPanel} />
);
};
export default CustomChannelSettings;
DX Improvements: ChannelSetting UserListItem
UserListItemMenu
has been newly createdUserListItemMenuProvider
and useUserListItemMenuContext
import { UserListItemMenu, UserListItemMenuProvider, useUserListItemMenuContext } from '@sendbird/uikit-react/ui/UserListItemMenu';
renderUserListItem
props to the list components of ChannelSettings
:
OperatorList
, MemberList
, MutedMemberList
, BannedUserList
OperatorList
, MemberList
, MutedMemberList
, BannedUserList
import { OperatorList, MemberList, MutedMemberList, BannedUserList } from '@sendbird/uikit-react/ChannelSettings/components/ChannelSettingsUI';
ui/UserListItem
and ChannelSettings/components/UserListItem
:
ui/UserListItem
from now onsize
prop to UserListItem
, which now accepts two values: 'normal' and 'small' ('small' replaces the previous ChannelSettings/components/UserListItem
)
normal
: Used primarily in Modalssmall
: Used primarily in Lists<ChannelSettings
renderUserListItem={(props) => (
<UserListItem {...props}
renderListItemMenu={(props) => (
<UserListItemMenu
{...props}
onToggleOperatorState={({ user, newState, error }) => {/** Handle operator state change */}}
onToggleMuteState={({ user, newState, error }) => {/** Handle mute state change */}}
onToggleBanState={({ user, newState, error }) => {/** Handle ban state change */}}
renderTrigger={({ ref }) => (<div ref={ref}>{/** Render your custom trigger icon here */}</div>)}
renderMenuItems={({ items }) => (
<>
<items.OperatorToggleMenuItem />
<items.MuteToggleMenuItem />
<items.BanToggleMenuItem />
</>
)}
/>
)}
/>
)}
/>
isSuperGroupReactionsEnabled
setterAPP_LAYOUT_ROOT
to get the area info of the UIKit
export const APP_LAYOUT_ROOT = 'sendbird-app__layout';
SendbirdProvider
with a tag that has the specified ID.@sendbird/chat
version to 4.13.0