diff --git a/src/pages/home/report/ReportActionItemFragment.js b/src/pages/home/report/ReportActionItemFragment.js
index ce607aa6a3c8..ea077fffbf53 100644
--- a/src/pages/home/report/ReportActionItemFragment.js
+++ b/src/pages/home/report/ReportActionItemFragment.js
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, {memo} from 'react';
import {ActivityIndicator, View} from 'react-native';
import PropTypes from 'prop-types';
import Str from 'expensify-common/lib/str';
@@ -44,83 +44,82 @@ const defaultProps = {
tooltipText: '',
};
-class ReportActionItemFragment extends React.PureComponent {
- render() {
- switch (this.props.fragment.type) {
- case 'COMMENT':
- // If this is an attachment placeholder, return the placeholder component
- if (this.props.isAttachment && this.props.loading) {
- return (
-
-
-
- );
- }
-
- // Only render HTML if we have html in the fragment
- return this.props.fragment.html !== this.props.fragment.text
- ? (
- ${this.props.fragment.html + (this.props.fragment.isEdited ? '' : '')}`}
- />
- ) : (
-
- {Str.htmlDecode(this.props.fragment.text)}
- {this.props.fragment.isEdited && (
-
- {/* Native devices do not support margin between nested Text */}
- {' '}
- {this.props.translate('reportActionCompose.edited')}
-
- )}
-
- );
- case 'TEXT':
+const ReportActionItemFragment = (props) => {
+ switch (props.fragment.type) {
+ case 'COMMENT':
+ // If this is an attachment placeholder, return the placeholder component
+ if (props.isAttachment && props.loading) {
return (
-
-
- {Str.htmlDecode(this.props.fragment.text)}
-
-
+
+
+
);
- case 'LINK':
- return LINK;
- case 'INTEGRATION_COMMENT':
- return REPORT_LINK;
- case 'REPORT_LINK':
- return REPORT_LINK;
- case 'POLICY_LINK':
- return POLICY_LINK;
+ }
- // If we have a message fragment type of OLD_MESSAGE this means we have not yet converted this over to the
- // new data structure. So we simply set this message as inner html and render it like we did before.
- // This wil allow us to convert messages over to the new structure without needing to do it all at once.
- case 'OLD_MESSAGE':
- return OLD_MESSAGE;
- default:
- return fragment.text;
- }
+ // Only render HTML if we have html in the fragment
+ return props.fragment.html !== props.fragment.text
+ ? (
+ ${props.fragment.html + (props.fragment.isEdited ? '' : '')}`}
+ />
+ ) : (
+
+ {Str.htmlDecode(props.fragment.text)}
+ {props.fragment.isEdited && (
+
+ {/* Native devices do not support margin between nested Text */}
+ {' '}
+ {props.translate('reportActionCompose.edited')}
+
+ )}
+
+ );
+ case 'TEXT':
+ return (
+
+
+ {Str.htmlDecode(props.fragment.text)}
+
+
+ );
+ case 'LINK':
+ return LINK;
+ case 'INTEGRATION_COMMENT':
+ return REPORT_LINK;
+ case 'REPORT_LINK':
+ return REPORT_LINK;
+ case 'POLICY_LINK':
+ return POLICY_LINK;
+
+ // If we have a message fragment type of OLD_MESSAGE this means we have not yet converted this over to the
+ // new data structure. So we simply set this message as inner html and render it like we did before.
+ // This wil allow us to convert messages over to the new structure without needing to do it all at once.
+ case 'OLD_MESSAGE':
+ return OLD_MESSAGE;
+ default:
+ return fragment.text;
}
-}
+};
ReportActionItemFragment.propTypes = propTypes;
ReportActionItemFragment.defaultProps = defaultProps;
+ReportActionItemFragment.displayName = 'ReportActionItemFragment';
export default compose(
withWindowDimensions,
withLocalize,
-)(ReportActionItemFragment);
+)(memo(ReportActionItemFragment));