Skip to content

Commit fd2f824

Browse files
committed
consolidate Onyx.connect call
Fix the context methods more report screen organizing create more context helpers remove bad merged code remove unusued imports and fix style undo context changes remove unused line add missing session
1 parent 2fc68a5 commit fd2f824

File tree

4 files changed

+12
-29
lines changed

4 files changed

+12
-29
lines changed

src/components/createOnyxContext.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default (onyxKeyName) => {
2626
},
2727
})(Provider);
2828

29-
const withOnyxKey = ({propName = onyxKeyName, transformValue = () => {}} = {}) => (WrappedComponent) => {
29+
const withOnyxKey = ({propName = onyxKeyName, transformValue} = {}) => (WrappedComponent) => {
3030
const Consumer = forwardRef((props, ref) => (
3131
<Context.Consumer>
3232
{(value) => {

src/pages/home/ReportScreen.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,14 @@ class ReportScreen extends React.Component {
134134

135135
<View nativeID={CONST.REPORT.DROP_NATIVE_ID} style={[styles.flex1, styles.justifyContentEnd]}>
136136
<FullScreenLoadingIndicator visible={this.shouldShowLoader()} />
137-
{!this.shouldShowLoader() && <ReportActionsView reportID={reportID} />}
137+
{!this.shouldShowLoader() && (
138+
<ReportActionsView
139+
reportID={reportID}
140+
reportActions={this.props.reportActions}
141+
report={this.props.report}
142+
session={this.props.session}
143+
/>
144+
)}
138145
{this.props.session.shouldShowComposeInput && (
139146
<SwipeableView onSwipeDown={() => Keyboard.dismiss()}>
140147
<ReportActionCompose

src/pages/home/report/ReportActionCompose.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import Text from '../../../components/Text';
5656
import {participantPropTypes} from '../sidebar/optionPropTypes';
5757
import currentUserPersonalDetailsPropsTypes from '../../settings/Profile/currentUserPersonalDetailsPropsTypes';
5858
import ParticipantLocalTime from './ParticipantLocalTime';
59+
import {withNetwork, withPersonalDetails} from '../../../components/OnyxProvider';
5960

6061
const propTypes = {
6162
/** Beta features list */
@@ -673,6 +674,8 @@ export default compose(
673674
withDrawerState,
674675
withNavigationFocus,
675676
withLocalize,
677+
withPersonalDetails(),
678+
withNetwork(),
676679
withOnyx({
677680
betas: {
678681
key: ONYXKEYS.BETAS,
@@ -683,22 +686,9 @@ export default compose(
683686
modal: {
684687
key: ONYXKEYS.MODAL,
685688
},
686-
network: {
687-
key: ONYXKEYS.NETWORK,
688-
},
689689
myPersonalDetails: {
690690
key: ONYXKEYS.MY_PERSONAL_DETAILS,
691691
},
692-
personalDetails: {
693-
key: ONYXKEYS.PERSONAL_DETAILS,
694-
},
695-
reportActions: {
696-
key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
697-
canEvict: false,
698-
},
699-
report: {
700-
key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
701-
},
702692
blockedFromConcierge: {
703693
key: ONYXKEYS.NVP_BLOCKED_FROM_CONCIERGE,
704694
},

src/pages/home/report/ReportActionsView.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
import PropTypes from 'prop-types';
99
import _ from 'underscore';
1010
import lodashGet from 'lodash/get';
11-
import {withOnyx} from 'react-native-onyx';
1211
import Text from '../../../components/Text';
1312
import {
1413
fetchActions,
@@ -18,7 +17,6 @@ import {
1817
subscribeToReportTypingEvents,
1918
unsubscribeFromReportChannel,
2019
} from '../../../libs/actions/Report';
21-
import ONYXKEYS from '../../../ONYXKEYS';
2220
import ReportActionItem from './ReportActionItem';
2321
import styles from '../../../styles/styles';
2422
import ReportActionPropTypes from './ReportActionPropTypes';
@@ -457,16 +455,4 @@ export default compose(
457455
withWindowDimensions,
458456
withDrawerState,
459457
withLocalize,
460-
withOnyx({
461-
report: {
462-
key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
463-
},
464-
reportActions: {
465-
key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
466-
canEvict: false,
467-
},
468-
session: {
469-
key: ONYXKEYS.SESSION,
470-
},
471-
}),
472458
)(ReportActionsView);

0 commit comments

Comments
 (0)