diff --git a/src/libs/ReportScrollManager/index.js b/src/libs/ReportScrollManager/index.js
deleted file mode 100644
index 1dd9922b33b8..000000000000
--- a/src/libs/ReportScrollManager/index.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Scroll to the provided index. On non-native implementations we do not want to scroll when we are scrolling because
- * we are editing a comment.
- *
- * @param {Object} ref
- * @param {Object} index
- * @param {Boolean} isEditing
- */
-function scrollToIndex(ref, index, isEditing) {
- if (!ref.current || isEditing) {
- return;
- }
-
- ref.current.scrollToIndex(index);
-}
-
-/**
- * Scroll to the bottom of the flatlist.
- *
- * @param {Object} ref
- */
-function scrollToBottom(ref) {
- if (!ref.current) {
- return;
- }
-
- ref.current.scrollToOffset({animated: false, offset: 0});
-}
-
-export {scrollToIndex, scrollToBottom};
diff --git a/src/libs/ReportScrollManager/index.native.js b/src/libs/ReportScrollManager/index.native.js
deleted file mode 100644
index 570d3a72acac..000000000000
--- a/src/libs/ReportScrollManager/index.native.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Scroll to the provided index.
- *
- * @param {Object} ref
- * @param {Object} index
- */
-function scrollToIndex(ref, index) {
- if (!ref.current) {
- return;
- }
-
- ref.current.scrollToIndex(index);
-}
-
-/**
- * Scroll to the bottom of the flatlist.
- *
- * @param {Object} ref
- */
-function scrollToBottom(ref) {
- if (!ref.current) {
- return;
- }
-
- ref.current.scrollToOffset({animated: false, offset: 0});
-}
-
-export {scrollToIndex, scrollToBottom};
diff --git a/src/pages/home/report/ReportActionsView.js b/src/pages/home/report/ReportActionsView.js
index f3c9e67d79db..4ca11ae543de 100755
--- a/src/pages/home/report/ReportActionsView.js
+++ b/src/pages/home/report/ReportActionsView.js
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, {useRef, useState, useEffect, useContext, useMemo} from 'react';
import PropTypes from 'prop-types';
import _ from 'underscore';
import lodashGet from 'lodash/get';
@@ -10,7 +10,7 @@ import Timing from '../../../libs/actions/Timing';
import CONST from '../../../CONST';
import compose from '../../../libs/compose';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions';
-import * as ReportScrollManager from '../../../libs/ReportScrollManager';
+import useReportScrollManager from '../../../hooks/useReportScrollManager';
import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize';
import Performance from '../../../libs/Performance';
import {withNetwork} from '../../../components/OnyxProvider';
@@ -34,6 +34,7 @@ const propTypes = {
reportActions: PropTypes.arrayOf(PropTypes.shape(reportActionPropTypes)),
/** Whether the composer is full size */
+ /* eslint-disable-next-line react/no-unused-prop-types */
isComposerFullSize: PropTypes.bool.isRequired,
/** Information about the network */
@@ -57,240 +58,205 @@ const defaultProps = {
policy: null,
};
-class ReportActionsView extends React.Component {
- constructor(props) {
- super(props);
+function ReportActionsView(props) {
+ const context = useContext(ReportScreenContext);
- this.didLayout = false;
- this.didSubscribeToReportTypingEvents = false;
- this.unsubscribeVisibilityListener = null;
- this.hasCachedActions = _.size(props.reportActions) > 0;
+ const reportScrollManager = useReportScrollManager();
- this.reactionListRef = React.createRef();
- this.state = {
- isFloatingMessageCounterVisible: false,
- newMarkerReportActionID: ReportUtils.getNewMarkerReportActionID(this.props.report, props.reportActions),
- };
+ const didLayout = useRef(false);
+ const didSubscribeToReportTypingEvents = useRef(false);
+ const unsubscribeVisibilityListener = useRef(null);
+ const hasCachedActions = useRef(_.size(props.reportActions) > 0);
- this.currentScrollOffset = 0;
- this.mostRecentIOUReportActionID = ReportActionsUtils.getMostRecentIOURequestActionID(props.reportActions);
- this.trackScroll = this.trackScroll.bind(this);
- this.toggleFloatingMessageCounter = this.toggleFloatingMessageCounter.bind(this);
- this.loadMoreChats = this.loadMoreChats.bind(this);
- this.recordTimeToMeasureItemLayout = this.recordTimeToMeasureItemLayout.bind(this);
- this.scrollToBottomAndMarkReportAsRead = this.scrollToBottomAndMarkReportAsRead.bind(this);
- this.openReportIfNecessary = this.openReportIfNecessary.bind(this);
- }
+ const [isFloatingMessageCounterVisible, setIsFloatingMessageCounterVisible] = useState(false);
+ const [newMarkerReportActionID, setNewMarkerReportActionID] = useState(ReportUtils.getNewMarkerReportActionID(props.report, props.reportActions));
+
+ const currentScrollOffset = useRef(0);
+ const mostRecentIOUReportActionID = useRef(ReportActionsUtils.getMostRecentIOURequestActionID(props.reportActions));
+
+ const unsubscribeFromNewActionEvent = useRef(null);
+
+ const prevReportActionsRef = useRef(props.reportActions);
+ const prevReportRef = useRef(props.report);
+ const prevNetworkRef = useRef(props.network);
+ const prevIsSmallScreenWidthRef = useRef(props.isSmallScreenWidth);
+
+ /**
+ * @returns {Boolean}
+ */
+ const isReportFullyVisible = useMemo(() => getIsReportFullyVisible(props.isFocused), [props.isFocused]);
+
+ const openReportIfNecessary = () => {
+ // If the report is optimistic (AKA not yet created) we don't need to call openReport again
+ if (props.report.isOptimisticReport) {
+ return;
+ }
+
+ Report.openReport(props.report.reportID);
+ };
- componentDidMount() {
- this.unsubscribeVisibilityListener = Visibility.onVisibilityChange(() => {
- if (!this.isReportFullyVisible()) {
+ useEffect(() => {
+ unsubscribeVisibilityListener.current = Visibility.onVisibilityChange(() => {
+ if (!isReportFullyVisible) {
return;
}
-
// If the app user becomes active and they have no unread actions we clear the new marker to sync their device
// e.g. they could have read these messages on another device and only just become active here
- const hasUnreadActions = ReportUtils.isUnread(this.props.report);
+ const hasUnreadActions = ReportUtils.isUnread(props.report);
if (!hasUnreadActions) {
- this.setState({newMarkerReportActionID: ''});
+ setNewMarkerReportActionID('');
}
});
+ return () => {
+ if (!unsubscribeVisibilityListener.current) {
+ return;
+ }
+ unsubscribeVisibilityListener.current();
+ };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
- this.openReportIfNecessary();
+ useEffect(() => {
+ openReportIfNecessary();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+ useEffect(() => {
// This callback is triggered when a new action arrives via Pusher and the event is emitted from Report.js. This allows us to maintain
// a single source of truth for the "new action" event instead of trying to derive that a new action has appeared from looking at props.
- this.unsubscribeFromNewActionEvent = Report.subscribeToNewActionEvent(this.props.report.reportID, (isFromCurrentUser, newActionID) => {
- const isNewMarkerReportActionIDSet = !_.isEmpty(this.state.newMarkerReportActionID);
+ unsubscribeFromNewActionEvent.current = Report.subscribeToNewActionEvent(props.report.reportID, (isFromCurrentUser, newActionID) => {
+ const isNewMarkerReportActionIDSet = !_.isEmpty(newMarkerReportActionID);
// If a new comment is added and it's from the current user scroll to the bottom otherwise leave the user positioned where
// they are now in the list.
if (isFromCurrentUser) {
- ReportScrollManager.scrollToBottom(this.context.flatListRef);
-
+ reportScrollManager.scrollToBottom();
// If the current user sends a new message in the chat we clear the new marker since they have "read" the report
- this.setState({newMarkerReportActionID: ''});
- } else if (this.isReportFullyVisible()) {
+ setNewMarkerReportActionID('');
+ } else if (isReportFullyVisible) {
// We use the scroll position to determine whether the report should be marked as read and the new line indicator reset.
// If the user is scrolled up and no new line marker is set we will set it otherwise we will do nothing so the new marker
// stays in it's previous position.
- if (this.currentScrollOffset === 0) {
- Report.readNewestAction(this.props.report.reportID);
- this.setState({newMarkerReportActionID: ''});
+ if (currentScrollOffset.current === 0) {
+ Report.readNewestAction(props.report.reportID);
+ setNewMarkerReportActionID('');
} else if (!isNewMarkerReportActionIDSet) {
- this.setState({newMarkerReportActionID: newActionID});
+ // The report is not in view and we received a comment from another user while the new marker is not set
+ // so we will set the new marker now.
+ setNewMarkerReportActionID(newActionID);
}
} else if (!isNewMarkerReportActionIDSet) {
- // The report is not in view and we received a comment from another user while the new marker is not set
- // so we will set the new marker now.
- this.setState({newMarkerReportActionID: newActionID});
+ setNewMarkerReportActionID(newActionID);
}
});
- }
-
- shouldComponentUpdate(nextProps, nextState) {
- if (!_.isEqual(nextProps.reportActions, this.props.reportActions)) {
- this.mostRecentIOUReportActionID = ReportActionsUtils.getMostRecentIOURequestActionID(nextProps.reportActions);
- return true;
- }
-
- if (lodashGet(nextProps.network, 'isOffline') !== lodashGet(this.props.network, 'isOffline')) {
- return true;
- }
-
- if (nextProps.report.isLoadingMoreReportActions !== this.props.report.isLoadingMoreReportActions) {
- return true;
- }
-
- if (nextProps.report.isLoadingReportActions !== this.props.report.isLoadingReportActions) {
- return true;
- }
-
- if (nextProps.report.lastReadTime !== this.props.report.lastReadTime) {
- return true;
- }
-
- if (nextState.isFloatingMessageCounterVisible !== this.state.isFloatingMessageCounterVisible) {
- return true;
- }
-
- if (nextState.newMarkerReportActionID !== this.state.newMarkerReportActionID) {
- return true;
- }
-
- if (this.props.isSmallScreenWidth !== nextProps.isSmallScreenWidth) {
- return true;
- }
-
- if (lodashGet(this.props.report, 'hasOutstandingIOU') !== lodashGet(nextProps.report, 'hasOutstandingIOU')) {
- return true;
- }
-
- if (this.props.isComposerFullSize !== nextProps.isComposerFullSize) {
- return true;
- }
- if (lodashGet(this.props.report, 'statusNum') !== lodashGet(nextProps.report, 'statusNum') || lodashGet(this.props.report, 'stateNum') !== lodashGet(nextProps.report, 'stateNum')) {
- return true;
- }
-
- if (lodashGet(this.props, 'policy.avatar') !== lodashGet(nextProps, 'policy.avatar')) {
- return true;
- }
-
- if (lodashGet(this.props, 'policy.name') !== lodashGet(nextProps, 'policy.name')) {
- return true;
- }
-
- return !_.isEqual(lodashGet(this.props.report, 'icons', []), lodashGet(nextProps.report, 'icons', []));
- }
+ return () => {
+ if (unsubscribeFromNewActionEvent.current) {
+ unsubscribeFromNewActionEvent.current();
+ }
- componentDidUpdate(prevProps) {
- const isReportFullyVisible = this.isReportFullyVisible();
+ Report.unsubscribeFromReportChannel(props.report.reportID);
+ };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+ useEffect(() => {
+ const prevNetwork = prevNetworkRef.current;
// When returning from offline to online state we want to trigger a request to OpenReport which
// will fetch the reportActions data and mark the report as read. If the report is not fully visible
// then we call ReconnectToReport which only loads the reportActions data without marking the report as read.
- const wasNetworkChangeDetected = lodashGet(prevProps.network, 'isOffline') && !lodashGet(this.props.network, 'isOffline');
+ const wasNetworkChangeDetected = lodashGet(prevNetwork, 'isOffline') && !lodashGet(props.network, 'isOffline');
if (wasNetworkChangeDetected) {
if (isReportFullyVisible) {
- this.openReportIfNecessary();
+ openReportIfNecessary();
} else {
- Report.reconnect(this.props.report.reportID);
+ Report.reconnect(props.report.reportID);
}
}
+ // update ref with current network state
+ prevNetworkRef.current = props.network;
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [props.network, props.report, isReportFullyVisible]);
+ useEffect(() => {
+ const prevIsSmallScreenWidth = prevIsSmallScreenWidthRef.current;
// If the view is expanded from mobile to desktop layout
// we update the new marker position, mark the report as read, and fetch new report actions
- const didScreenSizeIncrease = prevProps.isSmallScreenWidth && !this.props.isSmallScreenWidth;
+ const didScreenSizeIncrease = prevIsSmallScreenWidth && !props.isSmallScreenWidth;
const didReportBecomeVisible = isReportFullyVisible && didScreenSizeIncrease;
if (didReportBecomeVisible) {
- this.setState({
- newMarkerReportActionID: ReportUtils.isUnread(this.props.report) ? ReportUtils.getNewMarkerReportActionID(this.props.report, this.props.reportActions) : '',
- });
- this.openReportIfNecessary();
+ setNewMarkerReportActionID(ReportUtils.isUnread(props.report) ? ReportUtils.getNewMarkerReportActionID(props.report, props.reportActions) : '');
+ openReportIfNecessary();
}
+ // update ref with current state
+ prevIsSmallScreenWidthRef.current = props.isSmallScreenWidth;
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [props.isSmallScreenWidth, props.report, props.reportActions, isReportFullyVisible]);
+ useEffect(() => {
+ const prevReportActions = prevReportActionsRef.current;
// If the report is unread, we want to check if the number of actions has decreased. If so, then it seems that one of them was deleted. In this case, if the deleted action was the
// one marking the unread point, we need to recalculate which action should be the unread marker.
- if (ReportUtils.isUnread(this.props.report) && prevProps.reportActions.length > this.props.reportActions.length) {
- this.setState({
- newMarkerReportActionID: ReportUtils.getNewMarkerReportActionID(this.props.report, this.props.reportActions),
- });
- }
+ if (prevReportActions && ReportUtils.isUnread(props.report) && prevReportActions.length > props.report.length)
+ setNewMarkerReportActionID(ReportUtils.getNewMarkerReportActionID(props.report, props.reportActions));
+ prevReportActionsRef.current = props.reportActions;
+ }, [props.report, props.reportActions]);
+
+ useEffect(() => {
// If the last unread message was deleted, remove the *New* green marker and the *New Messages* notification at scroll just as the deletion starts.
if (
- ReportUtils.isUnread(this.props.report) &&
- this.props.reportActions.length > 0 &&
- this.props.reportActions[0].pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE &&
- !this.props.network.isOffline
+ !(
+ ReportUtils.isUnread(props.report) &&
+ props.reportActions.length > 0 &&
+ props.reportActions[0].pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE &&
+ !props.network.isOffline
+ )
) {
- const reportActionsWithoutPendingOne = lodashCloneDeep(this.props.reportActions);
- reportActionsWithoutPendingOne.shift();
- const newMarkerReportActionID = ReportUtils.getNewMarkerReportActionID(this.props.report, reportActionsWithoutPendingOne);
- if (newMarkerReportActionID !== this.state.newMarkerReportActionID) {
- this.setState({newMarkerReportActionID});
- }
+ return;
}
+ const reportActionsWithoutPendingOne = lodashCloneDeep(props.reportActions);
+ reportActionsWithoutPendingOne.shift();
+ if (newMarkerReportActionID !== ReportUtils.getNewMarkerReportActionID(props.report, reportActionsWithoutPendingOne)) {
+ setNewMarkerReportActionID(ReportUtils.getNewMarkerReportActionID(props.report, reportActionsWithoutPendingOne));
+ }
+ }, [props.report, props.reportActions, props.network, newMarkerReportActionID]);
+ useEffect(() => {
+ const prevReport = prevReportRef.current;
// Checks to see if a report comment has been manually "marked as unread". All other times when the lastReadTime
// changes it will be because we marked the entire report as read.
- const didManuallyMarkReportAsUnread = prevProps.report.lastReadTime !== this.props.report.lastReadTime && ReportUtils.isUnread(this.props.report);
+ const didManuallyMarkReportAsUnread = prevReport && prevReport.lastReadTime !== props.report.lastReadTime && ReportUtils.isUnread(props.report);
if (didManuallyMarkReportAsUnread) {
- this.setState({newMarkerReportActionID: ReportUtils.getNewMarkerReportActionID(this.props.report, this.props.reportActions)});
+ setNewMarkerReportActionID(ReportUtils.getNewMarkerReportActionID(props.report, props.reportActions));
}
+ // update ref with current report
+ prevReportRef.current = props.report;
+ }, [props.report, props.reportActions]);
+ useEffect(() => {
// Ensures subscription event succeeds when the report/workspace room is created optimistically.
// Check if the optimistic `OpenReport` or `AddWorkspaceRoom` has succeeded by confirming
// any `pendingFields.createChat` or `pendingFields.addWorkspaceRoom` fields are set to null.
// Existing reports created will have empty fields for `pendingFields`.
- const didCreateReportSuccessfully = !this.props.report.pendingFields || (!this.props.report.pendingFields.addWorkspaceRoom && !this.props.report.pendingFields.createChat);
- if (!this.didSubscribeToReportTypingEvents && didCreateReportSuccessfully) {
- Report.subscribeToReportTypingEvents(this.props.report.reportID);
- this.didSubscribeToReportTypingEvents = true;
- }
- }
-
- componentWillUnmount() {
- if (this.unsubscribeVisibilityListener) {
- this.unsubscribeVisibilityListener();
- }
-
- if (this.unsubscribeFromNewActionEvent) {
- this.unsubscribeFromNewActionEvent();
- }
-
- Report.unsubscribeFromReportChannel(this.props.report.reportID);
- }
-
- /**
- * @returns {Boolean}
- */
- isReportFullyVisible() {
- return getIsReportFullyVisible(this.props.isFocused);
- }
-
- // If the report is optimistic (AKA not yet created) we don't need to call openReport again
- openReportIfNecessary() {
- if (this.props.report.isOptimisticReport) {
- return;
+ const didCreateReportSuccessfully = !props.report.pendingFields || (!props.report.pendingFields.addWorkspaceRoom && !props.report.pendingFields.createChat);
+ if (!didSubscribeToReportTypingEvents && didCreateReportSuccessfully) {
+ Report.subscribeToReportTypingEvents(props.report.reportID);
+ didSubscribeToReportTypingEvents.current = true;
}
-
- Report.openReport(this.props.report.reportID);
- }
+ }, [props.report, didSubscribeToReportTypingEvents]);
/**
* Retrieves the next set of report actions for the chat once we are nearing the end of what we are currently
* displaying.
*/
- loadMoreChats() {
+ const loadMoreChats = () => {
// Only fetch more if we are not already fetching so that we don't initiate duplicate requests.
- if (this.props.report.isLoadingMoreReportActions) {
+ if (props.report.isLoadingMoreReportActions) {
return;
}
- const oldestReportAction = _.last(this.props.reportActions);
+ const oldestReportAction = _.last(props.reportActions);
// Don't load more chats if we're already at the beginning of the chat history
if (oldestReportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED) {
@@ -298,47 +264,46 @@ class ReportActionsView extends React.Component {
}
// Retrieve the next REPORT.ACTIONS.LIMIT sized page of comments
- Report.readOldestAction(this.props.report.reportID, oldestReportAction.reportActionID);
- }
+ Report.readOldestAction(props.report.reportID, oldestReportAction.reportActionID);
+ };
- scrollToBottomAndMarkReportAsRead() {
- ReportScrollManager.scrollToBottom(this.context.flatListRef);
- Report.readNewestAction(this.props.report.reportID);
- }
+ const scrollToBottomAndMarkReportAsRead = () => {
+ reportScrollManager.scrollToBottom();
+ Report.readNewestAction(props.report.reportID);
+ };
/**
* Show/hide the new floating message counter when user is scrolling back/forth in the history of messages.
*/
- toggleFloatingMessageCounter() {
- if (this.currentScrollOffset < -200 && !this.state.isFloatingMessageCounterVisible) {
- this.setState({isFloatingMessageCounterVisible: true});
+ const toggleFloatingMessageCounter = () => {
+ if (currentScrollOffset.current < -200 && !isFloatingMessageCounterVisible) {
+ setIsFloatingMessageCounterVisible(true);
}
- if (this.currentScrollOffset > -200 && this.state.isFloatingMessageCounterVisible) {
- this.setState({isFloatingMessageCounterVisible: false});
+ if (currentScrollOffset.current > -200 && isFloatingMessageCounterVisible) {
+ setIsFloatingMessageCounterVisible(false);
}
- }
+ };
/**
* keeps track of the Scroll offset of the main messages list
*
* @param {Object} {nativeEvent}
*/
- trackScroll({nativeEvent}) {
- this.currentScrollOffset = -nativeEvent.contentOffset.y;
- this.toggleFloatingMessageCounter();
- }
-
+ const trackScroll = ({nativeEvent}) => {
+ currentScrollOffset.current = -nativeEvent.contentOffset.y;
+ toggleFloatingMessageCounter();
+ };
/**
* Runs when the FlatList finishes laying out
*/
- recordTimeToMeasureItemLayout() {
- if (this.didLayout) {
+ const recordTimeToMeasureItemLayout = () => {
+ if (didLayout.current) {
return;
}
- this.didLayout = true;
- Timing.end(CONST.TIMING.SWITCH_REPORT, this.hasCachedActions ? CONST.TIMING.WARM : CONST.TIMING.COLD);
+ didLayout.current = true;
+ Timing.end(CONST.TIMING.SWITCH_REPORT, hasCachedActions.current ? CONST.TIMING.WARM : CONST.TIMING.COLD);
// Capture the init measurement only once not per each chat switch as the value gets overwritten
if (!ReportActionsView.initMeasured) {
@@ -347,41 +312,90 @@ class ReportActionsView extends React.Component {
} else {
Performance.markEnd(CONST.TIMING.SWITCH_REPORT);
}
- }
+ };
- render() {
- // Comments have not loaded at all yet do nothing
- if (!_.size(this.props.reportActions)) {
- return null;
- }
- return (
- <>
-
-
-
-
- >
- );
+ // Comments have not loaded at all yet do nothing
+ if (!_.size(props.reportActions)) {
+ return null;
}
+
+ return (
+ <>
+
+
+
+
+ >
+ );
}
ReportActionsView.propTypes = propTypes;
ReportActionsView.defaultProps = defaultProps;
-ReportActionsView.contextType = ReportScreenContext;
+ReportActionsView.displayName = 'ReportActionsView';
+
+function arePropsEqual(oldProps, newProps) {
+ if (!_.isEqual(oldProps.reportActions, newProps.reportActions)) {
+ return false;
+ }
+
+ if (lodashGet(oldProps.network, 'isOffline') !== lodashGet(newProps.network, 'isOffline')) {
+ return false;
+ }
+
+ if (oldProps.report.isLoadingMoreReportActions !== newProps.report.isLoadingMoreReportActions) {
+ return false;
+ }
+
+ if (oldProps.report.isLoadingReportActions !== newProps.report.isLoadingReportActions) {
+ return false;
+ }
+
+ if (oldProps.report.lastReadTime !== newProps.report.lastReadTime) {
+ return false;
+ }
+
+ if (newProps.isSmallScreenWidth !== oldProps.isSmallScreenWidth) {
+ return false;
+ }
+
+ if (lodashGet(newProps.report, 'hasOutstandingIOU') !== lodashGet(oldProps.report, 'hasOutstandingIOU')) {
+ return false;
+ }
+
+ if (newProps.isComposerFullSize !== oldProps.isComposerFullSize) {
+ return false;
+ }
+
+ if (lodashGet(newProps.report, 'statusNum') !== lodashGet(oldProps.report, 'statusNum') || lodashGet(newProps.report, 'stateNum') !== lodashGet(oldProps.report, 'stateNum')) {
+ return false;
+ }
+
+ if (lodashGet(newProps, 'policy.avatar') !== lodashGet(oldProps, 'policy.avatar')) {
+ return false;
+ }
+
+ if (lodashGet(newProps, 'policy.name') !== lodashGet(oldProps, 'policy.name')) {
+ return false;
+ }
+
+ return _.isEqual(lodashGet(newProps.report, 'icons', []), lodashGet(oldProps.report, 'icons', []));
+}
+
+const MemoizedReportActionsView = React.memo(ReportActionsView, arePropsEqual);
-export default compose(Performance.withRenderTrace({id: ' rendering'}), withWindowDimensions, withNavigationFocus, withLocalize, withNetwork())(ReportActionsView);
+export default compose(Performance.withRenderTrace({id: ' rendering'}), withWindowDimensions, withNavigationFocus, withLocalize, withNetwork())(MemoizedReportActionsView);