My app has few different types of customMessage that we render ourselves instead of having UIKit render them. I’m not sure if this should be supported, but on web this is how we “fool” the renderMessage function to only apply custom UI when message has customType, otherwise use UIKIt default message rendering:
const renderCustomMessage = useCallback(
({ message }: any): any => {
if (message.customType) {
return <CustomChatMessage message={message} user={user} />;
} else {
// Because we're using Typescript, we need to return something from this function,
// but we want Sendbird UIKit to render normal text messages, so we trick Typescript with this return
return undefined as unknown as any;
}
},
[user]
);
<Channel
channelUrl={channelId}
renderMessage={renderCustomMessage}
/>
Now I’m implementing Sendbird in React Native UIKit and I want to do something similar, but I have not been able to solve it yet.
Is there another way around this?
I’m using version @sendbird/uikit-react-native: 1.1.2