diff --git a/src/components/HeaderWithBackButton/headerWithBackButtonPropTypes.js b/src/components/HeaderWithBackButton/headerWithBackButtonPropTypes.js index 109e60adf672..a98ab7d52741 100644 --- a/src/components/HeaderWithBackButton/headerWithBackButtonPropTypes.js +++ b/src/components/HeaderWithBackButton/headerWithBackButtonPropTypes.js @@ -96,6 +96,9 @@ const propTypes = { /** Whether we should navigate to report page when the route have a topMostReport */ shouldNavigateToTopMostReport: PropTypes.bool, + + /** Whether we should show the back button only on mobile */ + shouldUseCentralPaneView: PropTypes.bool, }; export default propTypes; diff --git a/src/components/HeaderWithBackButton/index.js b/src/components/HeaderWithBackButton/index.js index 1fa37dfb8693..9b97b5f4f2db 100755 --- a/src/components/HeaderWithBackButton/index.js +++ b/src/components/HeaderWithBackButton/index.js @@ -42,7 +42,7 @@ function HeaderWithBackButton({ shouldShowPinButton = false, shouldShowThreeDotsButton = false, shouldDisableThreeDotsButton = false, - shouldShowBackButtonOnlyOnMobile = false, + shouldUseCentralPaneView = false, stepCounter = null, subtitle = '', title = '', @@ -65,8 +65,7 @@ function HeaderWithBackButton({ const {isKeyboardShown} = useKeyboardState(); const waitForNavigate = useWaitForNavigation(); const {isSmallScreenWidth} = useWindowDimensions(); - - const shouldFinalShowBackButton = shouldShowBackButton && (!shouldShowBackButtonOnlyOnMobile || isSmallScreenWidth); + const shouldFinalShowBackButton = shouldShowBackButton && (!shouldUseCentralPaneView || isSmallScreenWidth); return ( - + {shouldFinalShowBackButton && ( } // TODO: move to variables - headerContainerStyles={[styles.justifyContentCenter, styles.w100, shouldUseMaxHeight && {height: CONST.CENTRAL_PANE_ANIMATION_HEIGHT}]} + headerContainerStyles={[styles.justifyContentCenter, styles.w100, shouldUseMaxHeight && styles.centralPaneAnimation]} footer={footer} // eslint-disable-next-line react/jsx-props-no-spreading {...propsToPassToHeader} diff --git a/src/components/QRShare/index.js b/src/components/QRShare/index.js index 1490d2a99afd..775b407f5fe0 100644 --- a/src/components/QRShare/index.js +++ b/src/components/QRShare/index.js @@ -10,6 +10,7 @@ import withThemeStyles, {withThemeStylesPropTypes} from '@components/withThemeSt import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions'; import compose from '@libs/compose'; import variables from '@styles/variables'; +import CONST from '@src/CONST'; import {qrShareDefaultProps, qrSharePropTypes} from './propTypes'; const propTypes = { @@ -35,9 +36,15 @@ class QRShare extends Component { onLayout(event) { const containerWidth = event.nativeEvent.layout.width - variables.qrShareHorizontalPadding * 2 || 0; + if (this.props.isSmallScreenWidth) { + this.setState({ + qrCodeSize: Math.max(1, containerWidth), + }); + return; + } + this.setState({ - // TODO: Check on mobile devices - qrCodeSize: Math.max(1, Math.min(containerWidth, 200)), + qrCodeSize: Math.max(1, Math.min(containerWidth, CONST.CENTRAL_PANE_ANIMATION_HEIGHT)), }); } diff --git a/src/pages/ShareCodePage.js b/src/pages/ShareCodePage.js index 44f2b49eea2e..e734ce4ec16e 100644 --- a/src/pages/ShareCodePage.js +++ b/src/pages/ShareCodePage.js @@ -82,7 +82,7 @@ class ShareCodePage extends React.Component { Navigation.goBack(isReport ? ROUTES.REPORT_WITH_ID_DETAILS.getRoute(this.props.report.reportID) : ROUTES.SETTINGS_HOME)} - shouldShowBackButtonOnlyOnMobile + shouldUseCentralPaneView /> @@ -95,7 +95,6 @@ class ShareCodePage extends React.Component { logo={isReport ? expensifyLogo : UserUtils.getAvatarUrl(this.props.currentUserPersonalDetails.avatar, this.props.currentUserPersonalDetails.accountID)} logoRatio={isReport ? CONST.QR.EXPENSIFY_LOGO_SIZE_RATIO : CONST.QR.DEFAULT_LOGO_SIZE_RATIO} logoMarginRatio={isReport ? CONST.QR.EXPENSIFY_LOGO_MARGIN_RATIO : CONST.QR.DEFAULT_LOGO_MARGIN_RATIO} - shareCodeContainer={[{height: 100}]} /> diff --git a/src/pages/settings/AboutPage/AboutPage.js b/src/pages/settings/AboutPage/AboutPage.js index d978783314ed..ac56758080cc 100644 --- a/src/pages/settings/AboutPage/AboutPage.js +++ b/src/pages/settings/AboutPage/AboutPage.js @@ -104,7 +104,7 @@ function AboutPage(props) { Navigation.goBack(ROUTES.SETTINGS_HOME)} - shouldShowBackButtonOnlyOnMobile + shouldUseCentralPaneView /> diff --git a/src/pages/settings/Preferences/PreferencesPage.js b/src/pages/settings/Preferences/PreferencesPage.js index bae1774f9f74..637c3bf58239 100755 --- a/src/pages/settings/Preferences/PreferencesPage.js +++ b/src/pages/settings/Preferences/PreferencesPage.js @@ -48,8 +48,7 @@ function PreferencesPage(props) { // onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS)} backgroundColor={theme.PAGE_THEMES[SCREENS.SETTINGS.PREFERENCES].backgroundColor} illustration={LottieAnimations.PreferencesDJ} - shouldUseMaxHeight - shouldShowBackButtonOnlyOnMobile + shouldUseCentralPaneView > Navigation.goBack(ROUTES.SETTINGS_HOME)} - shouldShowBackButtonOnlyOnMobile + shouldUseCentralPaneView /> diff --git a/src/pages/settings/Wallet/WalletPage/WalletPage.js b/src/pages/settings/Wallet/WalletPage/WalletPage.js index 7fa5089e30c6..b0a0ed541e4a 100644 --- a/src/pages/settings/Wallet/WalletPage/WalletPage.js +++ b/src/pages/settings/Wallet/WalletPage/WalletPage.js @@ -325,7 +325,7 @@ function WalletPage({bankAccountList, cardList, fundList, isLoadingPaymentMethod Navigation.goBack(ROUTES.SETTINGS_HOME)} - shouldShowBackButtonOnlyOnMobile + shouldUseCentralPaneView /> diff --git a/src/pages/workspace/WorkspacesListPage.js b/src/pages/workspace/WorkspacesListPage.js index b6d41511e818..cffd2373fbb9 100755 --- a/src/pages/workspace/WorkspacesListPage.js +++ b/src/pages/workspace/WorkspacesListPage.js @@ -187,7 +187,7 @@ function WorkspacesListPage({policies, allPolicyMembers, reimbursementAccount, u illustration={LottieAnimations.WorkspacePlanet} onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_HOME)} title={translate('common.workspaces')} - shouldShowBackButtonOnlyOnMobile + shouldUseCentralPaneView footer={