diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 5a27c0836144..e46a4ed27abb 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -5,6 +5,7 @@ import {Keyboard, View} from 'react-native'; import lodashGet from 'lodash/get'; import _ from 'underscore'; import lodashFindLast from 'lodash/findLast'; +import DrawerStatusContext from '@react-navigation/drawer/lib/module/utils/DrawerStatusContext'; import styles from '../../styles/styles'; import ScreenWrapper from '../../components/ScreenWrapper'; import HeaderView from './HeaderView'; @@ -26,6 +27,7 @@ import addViewportResizeListener from '../../libs/VisualViewport'; import {withNetwork} from '../../components/OnyxProvider'; import compose from '../../libs/compose'; import networkPropTypes from '../../components/networkPropTypes'; +import withWindowDimensions, {windowDimensionsPropTypes} from '../../components/withWindowDimensions'; const propTypes = { /** Navigation route context info provided by react navigation */ @@ -83,6 +85,8 @@ const propTypes = { /** Information about the network */ network: networkPropTypes.isRequired, + + ...windowDimensionsPropTypes, }; const defaultProps = { @@ -194,6 +198,10 @@ class ReportScreen extends React.Component { return null; } + if (this.props.isSmallScreenWidth && this.context === 'open') { + return null; + } + // We let Free Plan default rooms to be shown in the App - it's the one exception to the beta, otherwise do not show policy rooms in product if (!Permissions.canUseDefaultRooms(this.props.betas) && ReportUtils.isDefaultRoom(this.props.report) @@ -268,34 +276,39 @@ class ReportScreen extends React.Component { } } +ReportScreen.contextType = DrawerStatusContext; ReportScreen.propTypes = propTypes; ReportScreen.defaultProps = defaultProps; -export default compose(withNetwork(), withOnyx({ - isSidebarLoaded: { - key: ONYXKEYS.IS_SIDEBAR_LOADED, - }, - session: { - key: ONYXKEYS.SESSION, - }, - reportActions: { - key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${getReportID(route)}`, - canEvict: false, - }, - report: { - key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${getReportID(route)}`, - }, - isComposerFullSize: { - key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${getReportID(route)}`, - }, - betas: { - key: ONYXKEYS.BETAS, - }, - isLoadingInitialReportActions: { - key: ({route}) => `${ONYXKEYS.COLLECTION.IS_LOADING_INITIAL_REPORT_ACTIONS}${getReportID(route)}`, - initWithStoredValues: false, - }, - policies: { - key: ONYXKEYS.COLLECTION.POLICY, - }, -}))(ReportScreen); +export default compose( + withWindowDimensions, + withNetwork(), + withOnyx({ + isSidebarLoaded: { + key: ONYXKEYS.IS_SIDEBAR_LOADED, + }, + session: { + key: ONYXKEYS.SESSION, + }, + reportActions: { + key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${getReportID(route)}`, + canEvict: false, + }, + report: { + key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${getReportID(route)}`, + }, + isComposerFullSize: { + key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${getReportID(route)}`, + }, + betas: { + key: ONYXKEYS.BETAS, + }, + isLoadingInitialReportActions: { + key: ({route}) => `${ONYXKEYS.COLLECTION.IS_LOADING_INITIAL_REPORT_ACTIONS}${getReportID(route)}`, + initWithStoredValues: false, + }, + policies: { + key: ONYXKEYS.COLLECTION.POLICY, + }, + }), +)(ReportScreen);