Skip to content

Commit

Permalink
use hook instead of hoc
Browse files Browse the repository at this point in the history
  • Loading branch information
perunt committed Sep 19, 2023
1 parent a7db8b3 commit 43a586c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 43 deletions.
40 changes: 0 additions & 40 deletions src/components/withRoute.js

This file was deleted.

6 changes: 3 additions & 3 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, {useState, useRef, useEffect, memo, useCallback, useContext, useMe
import {InteractionManager, View} from 'react-native';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import {useRoute} from '@react-navigation/native';
import CONST from '../../../CONST';
import ONYXKEYS from '../../../ONYXKEYS';
import reportActionPropTypes from './reportActionPropTypes';
Expand Down Expand Up @@ -67,7 +68,6 @@ import usePrevious from '../../../hooks/usePrevious';
import ReportScreenContext from '../ReportScreenContext';
import Permissions from '../../../libs/Permissions';
import themeColors from '../../../styles/themes/default';
import withRoute from '../../../components/withRoute';
import ReportActionItemBasicMessage from './ReportActionItemBasicMessage';
import RenderHTML from '../../../components/RenderHTML';
import ReportAttachmentsContext from './ReportAttachmentsContext';
Expand Down Expand Up @@ -129,6 +129,7 @@ const defaultProps = {
};

function ReportActionItem(props) {
const route = useRoute();
const [isContextMenuActive, setIsContextMenuActive] = useState(ReportActionContextMenu.isActiveReportAction(props.action.reportActionID));
const [isHidden, setIsHidden] = useState(false);
const [moderationDecision, setModerationDecision] = useState(CONST.MODERATION.MODERATOR_DECISION_APPROVED);
Expand All @@ -140,7 +141,7 @@ function ReportActionItem(props) {
const prevDraftMessage = usePrevious(props.draftMessage);
const originalReportID = ReportUtils.getOriginalReportID(props.report.reportID, props.action);
const originalReport = props.report.reportID === originalReportID ? props.report : ReportUtils.getReport(originalReportID);
const reportActionID = lodashGet(props.route, 'params.reportActionID');
const reportActionID = lodashGet(route, 'params.reportActionID');

const highlightedBackgroundColorIfNeeded = useMemo(
() => (reportActionID === props.action.reportActionID ? {backgroundColor: themeColors.highlightBG} : {}),
Expand Down Expand Up @@ -695,7 +696,6 @@ export default compose(
key: ({action}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${action.reportActionID}`,
},
}),
withRoute,
)(
memo(
ReportActionItem,
Expand Down

0 comments on commit 43a586c

Please sign in to comment.