Skip to content

Commit

Permalink
Merge pull request #11441 from Expensify/marcaaron-blockedFromConcier…
Browse files Browse the repository at this point in the history
…geContext

Use Context for `blockedFromConcierge`
  • Loading branch information
stitesExpensify authored Sep 29, 2022
2 parents 1ff9206 + 96a53c4 commit 9198db3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/components/OnyxProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ import ComposeProviders from './ComposeProviders';
const [withNetwork, NetworkProvider] = createOnyxContext(ONYXKEYS.NETWORK);
const [withPersonalDetails, PersonalDetailsProvider] = createOnyxContext(ONYXKEYS.PERSONAL_DETAILS);
const [withCurrentDate, CurrentDateProvider] = createOnyxContext(ONYXKEYS.CURRENT_DATE);
const [
withReportActionsDrafts,
ReportActionsDraftsProvider,
] = createOnyxContext(ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS);
const [withReportActionsDrafts, ReportActionsDraftsProvider] = createOnyxContext(ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS);
const [withBlockedFromConcierge, BlockedFromConciergeProvider] = createOnyxContext(ONYXKEYS.NVP_BLOCKED_FROM_CONCIERGE);

const propTypes = {
/** Rendered child component */
Expand All @@ -26,6 +24,7 @@ const OnyxProvider = props => (
PersonalDetailsProvider,
ReportActionsDraftsProvider,
CurrentDateProvider,
BlockedFromConciergeProvider,
]}
>
{props.children}
Expand All @@ -42,4 +41,5 @@ export {
withPersonalDetails,
withReportActionsDrafts,
withCurrentDate,
withBlockedFromConcierge,
};
9 changes: 2 additions & 7 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import _ from 'underscore';
import lodashGet from 'lodash/get';
import React, {Component} from 'react';
import {withOnyx} from 'react-native-onyx';
import {View} from 'react-native';
import PropTypes from 'prop-types';
import CONST from '../../../CONST';
Expand All @@ -24,7 +23,7 @@ import canUseTouchScreen from '../../../libs/canUseTouchscreen';
import MiniReportActionContextMenu from './ContextMenu/MiniReportActionContextMenu';
import * as ReportActionContextMenu from './ContextMenu/ReportActionContextMenu';
import * as ContextMenuActions from './ContextMenu/ContextMenuActions';
import {withNetwork, withReportActionsDrafts} from '../../../components/OnyxProvider';
import {withBlockedFromConcierge, withNetwork, withReportActionsDrafts} from '../../../components/OnyxProvider';
import RenameAction from '../../../components/ReportActionItem/RenameAction';
import InlineSystemMessage from '../../../components/InlineSystemMessage';
import styles from '../../../styles/styles';
Expand Down Expand Up @@ -240,16 +239,12 @@ ReportActionItem.defaultProps = defaultProps;
export default compose(
withWindowDimensions,
withNetwork(),
withBlockedFromConcierge({propName: 'blockedFromConcierge'}),
withReportActionsDrafts({
propName: 'draftMessage',
transformValue: (drafts, props) => {
const draftKey = `${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${props.report.reportID}_${props.action.reportActionID}`;
return lodashGet(drafts, draftKey, '');
},
}),
withOnyx({
blockedFromConcierge: {
key: ONYXKEYS.NVP_BLOCKED_FROM_CONCIERGE,
},
}),
)(ReportActionItem);

0 comments on commit 9198db3

Please sign in to comment.