forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAttachmentCommentFragment.tsx
32 lines (27 loc) · 1.04 KB
/
AttachmentCommentFragment.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React from 'react';
import {View} from 'react-native';
import useThemeStyles from '@hooks/useThemeStyles';
import CONST from '@src/CONST';
import type {OriginalMessageSource} from '@src/types/onyx/OriginalMessage';
import RenderCommentHTML from './RenderCommentHTML';
type AttachmentCommentFragmentProps = {
source: OriginalMessageSource;
html: string;
addExtraMargin: boolean;
styleAsDeleted: boolean;
};
function AttachmentCommentFragment({addExtraMargin, html, source, styleAsDeleted}: AttachmentCommentFragmentProps) {
const styles = useThemeStyles();
const isUploading = html === CONST.ATTACHMENT_UPLOADING_MESSAGE_HTML;
const htmlContent = styleAsDeleted && isUploading ? `<del>${html}</del>` : html;
return (
<View style={addExtraMargin ? styles.mt2 : {}}>
<RenderCommentHTML
source={source}
html={htmlContent}
/>
</View>
);
}
AttachmentCommentFragment.displayName = 'AttachmentCommentFragment';
export default AttachmentCommentFragment;