react-native-chating-ui-kit
Version:
CometChat React Native UI Kit is a collection of custom UI Components designed to build text , chat and calling features in your application. The UI Kit is developed to keep developers in mind and aims to reduce development efforts significantly
45 lines • 1.7 kB
JavaScript
import { DataSourceDecorator } from '../../shared/framework';
// @ts-ignore
import { CometChat } from '@cometchat-pro/react-native-chat';
// @ts-ignore
import React from 'react';
import { ImageModerationFilter } from './ImageModerationFilter';
export class ImageModerationExtensionDecorator extends DataSourceDecorator {
imageModerationConfiguration;
// loggedInUser: CometChat.User;
constructor(dataSource, imageModerationConfiguration) {
super(dataSource);
if (imageModerationConfiguration != undefined) {
this.imageModerationConfiguration = imageModerationConfiguration;
}
}
getId() {
return 'ImageModeration';
}
isImageMessage(message) {
return (message.getCategory() == CometChat.CATEGORY_MESSAGE &&
message.getType() == CometChat.MESSAGE_TYPE.IMAGE);
}
// getImageMessageContentView(
// message: CometChat.BaseMessage,
// alignment: MessageBubbleAlignmentType,
// theme: CometChatTheme
// ): JSX.Element {
// // console.log('message', message);
// let attachment = message.getAttachment();
// return this.getImageMessageBubble(
// attachment.getUrl(),
// attachment.getName(),
// {},
// message,
// theme
// );
// }
getImageMessageBubble(imageUrl, caption, style, message, theme) {
if (this.isImageMessage(message)) {
return (<ImageModerationFilter ChildView={super.getImageMessageBubble(imageUrl, caption, style, message, theme)} message={message} {...this.imageModerationConfiguration}/>);
}
return null;
}
}
//# sourceMappingURL=ImageModerationDecorator.js.map