Hi,
I’m using sendbird-uikit 2.5.0 and trying to customize renderChatItem element.
New component is working correctly.
Only issue I see is: ‘Warning’ in console:
Warning: Failed prop type: Invalid prop `renderChatItem` of type `function` supplied to `ConversationScroll`, expected a single ReactElement.
Should I ignore this warning, or maybe there is solution to fix it?
Below my code:
// CustomizedApp.js
import React, { useState } from "react";
import {
Channel as SBConversation,
withSendBird
} from "sendbird-uikit";
import {MyCustomChatMessage} from './Message';
function CustomizedApp(props) {
const [currentChannelUrl, setCurrentChannelUrl] = useState("sendbird_group_channel_123_abc");
return (
<div className="customized-app">
<div className="sendbird-app__wrap">
<div className="sendbird-app__conversation-wrap">
<SBConversation
channelUrl={currentChannelUrl}
renderChatItem={({ message, onDeleteMessage, onUpdateMessage }) => (
<MyCustomChatMessage
message={message}
onDeleteMessage={onDeleteMessage}
onUpdateMessage={onUpdateMessage}
channelUrl={currentChannelUrl}
/>
)}
/>
</div>
</div>
</div>
);
}
export default withSendBird(CustomizedApp);
And Message.jsx :
// Message.jsx
import React from 'react';
export const MyCustomChatMessage = ({ message, onDeleteMessage, onUpdateMessage, channelUrl }) => {
return (
<>
<div>{message.message}</div>
<div>{message.createdAt}</div>
<hr/>
</>
)
}