From e299ff55afe3fe876e9bc2bce6b1044b04fcdc56 Mon Sep 17 00:00:00 2001
From: rayane-djouah <77965000+rayane-djouah@users.noreply.github.com>
Date: Fri, 19 Jan 2024 20:59:11 +0100
Subject: [PATCH 01/10] replace usages of shouldShowSmallScreen and isInModal
props in components
---
src/pages/signin/LoginForm/BaseLoginForm.js | 8 ++---
src/pages/signin/SignInHeroImage.js | 10 ++----
src/pages/signin/SignInModal.js | 2 +-
src/pages/signin/SignInPage.js | 32 ++++++++-----------
src/pages/signin/SignInPageLayout/Footer.js | 9 ++----
.../SignInPageLayout/SignInPageContent.js | 9 +++---
src/pages/signin/SignInPageLayout/index.js | 17 +++-------
7 files changed, 32 insertions(+), 55 deletions(-)
diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js
index 8fcea461eacd..52c4e31c9418 100644
--- a/src/pages/signin/LoginForm/BaseLoginForm.js
+++ b/src/pages/signin/LoginForm/BaseLoginForm.js
@@ -17,6 +17,7 @@ import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import withToggleVisibilityView from '@components/withToggleVisibilityView';
import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions';
import usePrevious from '@hooks/usePrevious';
+import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import canFocusInputOnScreenFocus from '@libs/canFocusInputOnScreenFocus';
import compose from '@libs/compose';
@@ -70,9 +71,6 @@ const propTypes = {
/** Props to detect online status */
network: networkPropTypes.isRequired,
- /** Whether or not the sign in page is being rendered in the RHP modal */
- isInModal: PropTypes.bool,
-
isVisible: PropTypes.bool.isRequired,
...windowDimensionsPropTypes,
@@ -88,7 +86,6 @@ const defaultProps = {
closeAccount: {},
blurOnSubmit: false,
innerRef: () => {},
- isInModal: false,
};
function LoginForm(props) {
@@ -100,6 +97,7 @@ function LoginForm(props) {
const firstBlurred = useRef(false);
const isFocused = useIsFocused();
const isLoading = useRef(false);
+ const {shouldUseNarrowLayout} = useResponsiveLayout();
const {translate} = props;
@@ -213,7 +211,7 @@ function LoginForm(props) {
return;
}
let focusTimeout;
- if (props.isInModal) {
+ if (shouldUseNarrowLayout) {
focusTimeout = setTimeout(() => input.current.focus(), CONST.ANIMATED_TRANSITION);
} else {
input.current.focus();
diff --git a/src/pages/signin/SignInHeroImage.js b/src/pages/signin/SignInHeroImage.js
index c665a09932c2..8754ed9c10dd 100644
--- a/src/pages/signin/SignInHeroImage.js
+++ b/src/pages/signin/SignInHeroImage.js
@@ -3,23 +3,19 @@ import React from 'react';
import Lottie from '@components/Lottie';
import LottieAnimations from '@components/LottieAnimations';
import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions';
+import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import variables from '@styles/variables';
const propTypes = {
...windowDimensionsPropTypes,
-
- shouldShowSmallScreen: PropTypes.bool,
-};
-
-const defaultProps = {
- shouldShowSmallScreen: false,
};
function SignInHeroImage(props) {
const styles = useThemeStyles();
+ const {shouldUseNarrowLayout} = useResponsiveLayout();
let imageSize;
- if (props.isSmallScreenWidth || props.shouldShowSmallScreen) {
+ if (shouldUseNarrowLayout) {
imageSize = {
height: variables.signInHeroImageMobileHeight,
width: variables.signInHeroImageMobileWidth,
diff --git a/src/pages/signin/SignInModal.js b/src/pages/signin/SignInModal.js
index df266b557ced..2be6c8bc0bc9 100644
--- a/src/pages/signin/SignInModal.js
+++ b/src/pages/signin/SignInModal.js
@@ -30,7 +30,7 @@ function SignInModal() {
testID={SignInModal.displayName}
>
-
+
);
}
diff --git a/src/pages/signin/SignInPage.js b/src/pages/signin/SignInPage.js
index 9d5b51d667ff..12efce4f300c 100644
--- a/src/pages/signin/SignInPage.js
+++ b/src/pages/signin/SignInPage.js
@@ -9,6 +9,7 @@ import CustomStatusBarAndBackground from '@components/CustomStatusBarAndBackgrou
import ThemeProvider from '@components/ThemeProvider';
import ThemeStylesProvider from '@components/ThemeStylesProvider';
import useLocalize from '@hooks/useLocalize';
+import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useSafeAreaInsets from '@hooks/useSafeAreaInsets';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
@@ -71,9 +72,6 @@ const propTypes = {
/** Active Clients connected to ONYX Database */
activeClients: PropTypes.arrayOf(PropTypes.string),
- /** Whether or not the sign in page is being rendered in the RHP modal */
- isInModal: PropTypes.bool,
-
/** The user's preferred locale */
preferredLocale: PropTypes.string,
};
@@ -81,7 +79,6 @@ const propTypes = {
const defaultProps = {
account: {},
credentials: {},
- isInModal: false,
activeClients: [],
preferredLocale: '',
};
@@ -132,12 +129,11 @@ function getRenderOptions({hasLogin, hasValidateCode, account, isPrimaryLogin, i
};
}
-function SignInPageInner({credentials, account, isInModal, activeClients, preferredLocale}) {
+function SignInPageInner({credentials, account, activeClients, preferredLocale}) {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const {translate, formatPhoneNumber} = useLocalize();
- const {isSmallScreenWidth} = useWindowDimensions();
- const shouldShowSmallScreen = isSmallScreenWidth || isInModal;
+ const {shouldUseNarrowLayout} = useResponsiveLayout();
const safeAreaInsets = useSafeAreaInsets();
const signInPageLayoutRef = useRef();
const loginFormRef = useRef();
@@ -208,12 +204,12 @@ function SignInPageInner({credentials, account, isInModal, activeClients, prefer
welcomeHeader = translate('welcomeText.anotherLoginPageIsOpen');
welcomeText = translate('welcomeText.anotherLoginPageIsOpenExplanation');
} else if (shouldShowLoginForm) {
- welcomeHeader = isSmallScreenWidth ? headerText : translate('welcomeText.getStarted');
- welcomeText = isSmallScreenWidth ? translate('welcomeText.getStarted') : '';
+ welcomeHeader = shouldUseNarrowLayout ? headerText : translate('welcomeText.getStarted');
+ welcomeText = shouldUseNarrowLayout ? translate('welcomeText.getStarted') : '';
} else if (shouldShowValidateCodeForm) {
if (account.requiresTwoFactorAuth) {
// We will only know this after a user signs in successfully, without their 2FA code
- welcomeHeader = isSmallScreenWidth ? '' : translate('welcomeText.welcomeBack');
+ welcomeHeader = shouldUseNarrowLayout ? '' : translate('welcomeText.welcomeBack');
welcomeText = isUsingRecoveryCode ? translate('validateCodeForm.enterRecoveryCode') : translate('validateCodeForm.enterAuthenticatorCode');
} else {
const userLogin = Str.removeSMSDomain(credentials.login || '');
@@ -221,19 +217,19 @@ function SignInPageInner({credentials, account, isInModal, activeClients, prefer
// replacing spaces with "hard spaces" to prevent breaking the number
const userLoginToDisplay = Str.isSMSLogin(userLogin) ? formatPhoneNumber(userLogin).replace(/ /g, '\u00A0') : userLogin;
if (account.validated) {
- welcomeHeader = shouldShowSmallScreen ? '' : translate('welcomeText.welcomeBack');
- welcomeText = shouldShowSmallScreen
+ welcomeHeader = shouldUseNarrowLayout ? '' : translate('welcomeText.welcomeBack');
+ welcomeText = shouldUseNarrowLayout
? `${translate('welcomeText.welcomeBack')} ${translate('welcomeText.welcomeEnterMagicCode', {login: userLoginToDisplay})}`
: translate('welcomeText.welcomeEnterMagicCode', {login: userLoginToDisplay});
} else {
- welcomeHeader = shouldShowSmallScreen ? '' : translate('welcomeText.welcome');
- welcomeText = shouldShowSmallScreen
+ welcomeHeader = shouldUseNarrowLayout ? '' : translate('welcomeText.welcome');
+ welcomeText = shouldUseNarrowLayout
? `${translate('welcomeText.welcome')} ${translate('welcomeText.newFaceEnterMagicCode', {login: userLoginToDisplay})}`
: translate('welcomeText.newFaceEnterMagicCode', {login: userLoginToDisplay});
}
}
} else if (shouldShowUnlinkLoginForm || shouldShowEmailDeliveryFailurePage || shouldShowChooseSSOOrMagicCode) {
- welcomeHeader = shouldShowSmallScreen ? headerText : translate('welcomeText.welcomeBack');
+ welcomeHeader = shouldUseNarrowLayout ? headerText : translate('welcomeText.welcomeBack');
// Don't show any welcome text if we're showing the user the email delivery failed view
if (shouldShowEmailDeliveryFailurePage || shouldShowChooseSSOOrMagicCode) {
@@ -251,21 +247,19 @@ function SignInPageInner({credentials, account, isInModal, activeClients, prefer
return (
// Bottom SafeAreaView is removed so that login screen svg displays correctly on mobile.
// The SVG should flow under the Home Indicator on iOS.
-
+
{/* LoginForm must use the isVisible prop. This keeps it mounted, but visually hidden
so that password managers can access the values. Conditionally rendering this component will break this feature. */}
[
@@ -142,7 +138,8 @@ function Footer(props) {
const theme = useTheme();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
- const isVertical = props.shouldShowSmallScreen;
+ const {shouldUseNarrowLayout} = useResponsiveLayout();
+ const isVertical = shouldUseNarrowLayout;
const imageDirection = isVertical ? styles.flexRow : styles.flexColumn;
const imageStyle = isVertical ? styles.pr0 : styles.alignSelfCenter;
const columnDirection = isVertical ? styles.flexColumn : styles.flexRow;
diff --git a/src/pages/signin/SignInPageLayout/SignInPageContent.js b/src/pages/signin/SignInPageLayout/SignInPageContent.js
index 5865c235335a..4735e75f6b9b 100755
--- a/src/pages/signin/SignInPageLayout/SignInPageContent.js
+++ b/src/pages/signin/SignInPageLayout/SignInPageContent.js
@@ -7,6 +7,7 @@ import OfflineIndicator from '@components/OfflineIndicator';
import SignInPageForm from '@components/SignInPageForm';
import Text from '@components/Text';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
+import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
@@ -32,14 +33,12 @@ const propTypes = {
/** Whether to show welcome header on a particular page */
shouldShowWelcomeHeader: PropTypes.bool.isRequired,
- /** Whether to show signIn hero image on a particular page */
- shouldShowSmallScreen: PropTypes.bool.isRequired,
-
...withLocalizePropTypes,
};
function SignInPageContent(props) {
const {isSmallScreenWidth} = useWindowDimensions();
+ const {shouldUseNarrowLayout} = useResponsiveLayout();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
@@ -77,9 +76,9 @@ function SignInPageContent(props) {
- {props.shouldShowSmallScreen ? (
+ {shouldUseNarrowLayout ? (
-
+
) : null}
diff --git a/src/pages/signin/SignInPageLayout/index.js b/src/pages/signin/SignInPageLayout/index.js
index e2f9c28f9fcd..08fd101f1b7b 100644
--- a/src/pages/signin/SignInPageLayout/index.js
+++ b/src/pages/signin/SignInPageLayout/index.js
@@ -6,6 +6,7 @@ import SignInGradient from '@assets/images/home-fade-gradient.svg';
import ImageSVG from '@components/ImageSVG';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import usePrevious from '@hooks/usePrevious';
+import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
@@ -39,9 +40,6 @@ const propTypes = {
/** A reference so we can expose scrollPageToTop */
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
- /** Whether or not the sign in page is being rendered in the RHP modal */
- shouldShowSmallScreen: PropTypes.bool,
-
/** Override the green headline copy */
customHeadline: PropTypes.string,
@@ -53,7 +51,6 @@ const propTypes = {
const defaultProps = {
innerRef: () => {},
- shouldShowSmallScreen: false,
customHeadline: '',
customHeroBody: '',
};
@@ -67,11 +64,12 @@ function SignInPageLayout(props) {
let containerStyles = [styles.flex1, styles.signInPageInner];
let contentContainerStyles = [styles.flex1, styles.flexRow];
const {windowHeight} = useWindowDimensions();
+ const {shouldUseNarrowLayout} = useResponsiveLayout();
// To scroll on both mobile and web, we need to set the container height manually
const containerHeight = windowHeight - props.insets.top - props.insets.bottom;
- if (props.shouldShowSmallScreen) {
+ if (shouldUseNarrowLayout) {
containerStyles = [styles.flex1];
contentContainerStyles = [styles.flex1, styles.flexColumn];
}
@@ -99,7 +97,7 @@ function SignInPageLayout(props) {
return (
- {!props.shouldShowSmallScreen ? (
+ {!shouldUseNarrowLayout ? (
{props.children}
@@ -172,16 +169,12 @@ function SignInPageLayout(props) {
welcomeText={props.welcomeText}
shouldShowWelcomeText={props.shouldShowWelcomeText}
shouldShowWelcomeHeader={props.shouldShowWelcomeHeader}
- shouldShowSmallScreen={props.shouldShowSmallScreen}
>
{props.children}
-
+
)}
From bfcc20f20a4f6bc96cc031d89be7a4785bafe5a1 Mon Sep 17 00:00:00 2001
From: rayane-djouah <77965000+rayane-djouah@users.noreply.github.com>
Date: Sat, 27 Jan 2024 20:52:03 +0100
Subject: [PATCH 02/10] Update BaseLoginForm.js
---
src/pages/signin/LoginForm/BaseLoginForm.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js
index 9914ad063a0b..e77ac963120d 100644
--- a/src/pages/signin/LoginForm/BaseLoginForm.js
+++ b/src/pages/signin/LoginForm/BaseLoginForm.js
@@ -97,7 +97,7 @@ function LoginForm(props) {
const firstBlurred = useRef(false);
const isFocused = useIsFocused();
const isLoading = useRef(false);
- const {shouldUseNarrowLayout} = useResponsiveLayout();
+ const {shouldUseNarrowLayout, isInModal} = useResponsiveLayout();
const {translate} = props;
@@ -157,7 +157,7 @@ function LoginForm(props) {
);
function getSignInWithStyles() {
- return props.isSmallScreenWidth ? [styles.mt1] : [styles.mt5, styles.mb5];
+ return shouldUseNarrowLayout ? [styles.mt1] : [styles.mt5, styles.mb5];
}
/**
@@ -211,7 +211,7 @@ function LoginForm(props) {
return;
}
let focusTimeout;
- if (shouldUseNarrowLayout) {
+ if (isInModal) {
focusTimeout = setTimeout(() => input.current.focus(), CONST.ANIMATED_TRANSITION);
} else {
input.current.focus();
@@ -330,7 +330,7 @@ function LoginForm(props) {
{props.translate('common.signInWith')}
-
+
e.preventDefault()}>
From 887e051f506e5003521e5e917a8020ddccbf4f40 Mon Sep 17 00:00:00 2001
From: rayane-djouah <77965000+rayane-djouah@users.noreply.github.com>
Date: Mon, 29 Jan 2024 16:23:00 +0100
Subject: [PATCH 03/10] fix lint errors
---
src/pages/signin/SignInHeroImage.js | 8 +-------
src/pages/signin/SignInPage.js | 1 -
src/pages/signin/SignInPageLayout/Footer.js | 1 -
3 files changed, 1 insertion(+), 9 deletions(-)
diff --git a/src/pages/signin/SignInHeroImage.js b/src/pages/signin/SignInHeroImage.js
index 8754ed9c10dd..aa1b6d122d6f 100644
--- a/src/pages/signin/SignInHeroImage.js
+++ b/src/pages/signin/SignInHeroImage.js
@@ -1,4 +1,3 @@
-import PropTypes from 'prop-types';
import React from 'react';
import Lottie from '@components/Lottie';
import LottieAnimations from '@components/LottieAnimations';
@@ -7,10 +6,6 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import variables from '@styles/variables';
-const propTypes = {
- ...windowDimensionsPropTypes,
-};
-
function SignInHeroImage(props) {
const styles = useThemeStyles();
const {shouldUseNarrowLayout} = useResponsiveLayout();
@@ -45,6 +40,5 @@ function SignInHeroImage(props) {
SignInHeroImage.displayName = 'SignInHeroImage';
SignInHeroImage.propTypes = propTypes;
-SignInHeroImage.defaultProps = defaultProps;
-export default withWindowDimensions(SignInHeroImage);
+export default SignInHeroImage;
diff --git a/src/pages/signin/SignInPage.js b/src/pages/signin/SignInPage.js
index e06476ef982e..9043cb0f4afc 100644
--- a/src/pages/signin/SignInPage.js
+++ b/src/pages/signin/SignInPage.js
@@ -13,7 +13,6 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useSafeAreaInsets from '@hooks/useSafeAreaInsets';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
-import useWindowDimensions from '@hooks/useWindowDimensions';
import * as ActiveClientManager from '@libs/ActiveClientManager';
import * as Localize from '@libs/Localize';
import Log from '@libs/Log';
diff --git a/src/pages/signin/SignInPageLayout/Footer.js b/src/pages/signin/SignInPageLayout/Footer.js
index e07ae015724c..279c18e8fc42 100644
--- a/src/pages/signin/SignInPageLayout/Footer.js
+++ b/src/pages/signin/SignInPageLayout/Footer.js
@@ -216,6 +216,5 @@ function Footer(props) {
Footer.propTypes = propTypes;
Footer.displayName = 'Footer';
-Footer.defaultProps = defaultProps;
export default withLocalize(Footer);
From b110b6d7bbaa1a02afa52547cdac3f9082b3090f Mon Sep 17 00:00:00 2001
From: rayane-djouah <77965000+rayane-djouah@users.noreply.github.com>
Date: Mon, 29 Jan 2024 19:50:15 +0100
Subject: [PATCH 04/10] fix lint errors
---
src/pages/signin/SignInHeroImage.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/pages/signin/SignInHeroImage.js b/src/pages/signin/SignInHeroImage.js
index aa1b6d122d6f..36761fa693bf 100644
--- a/src/pages/signin/SignInHeroImage.js
+++ b/src/pages/signin/SignInHeroImage.js
@@ -1,7 +1,6 @@
import React from 'react';
import Lottie from '@components/Lottie';
import LottieAnimations from '@components/LottieAnimations';
-import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import variables from '@styles/variables';
@@ -39,6 +38,5 @@ function SignInHeroImage(props) {
}
SignInHeroImage.displayName = 'SignInHeroImage';
-SignInHeroImage.propTypes = propTypes;
export default SignInHeroImage;
From d356b59657550e539e2e4e27dc9d4e412daa3203 Mon Sep 17 00:00:00 2001
From: rayane-djouah <77965000+rayane-djouah@users.noreply.github.com>
Date: Mon, 29 Jan 2024 20:07:08 +0100
Subject: [PATCH 05/10] fix error
---
src/pages/signin/SignInHeroImage.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/pages/signin/SignInHeroImage.js b/src/pages/signin/SignInHeroImage.js
index 36761fa693bf..ecd2812a9ccc 100644
--- a/src/pages/signin/SignInHeroImage.js
+++ b/src/pages/signin/SignInHeroImage.js
@@ -3,10 +3,12 @@ import Lottie from '@components/Lottie';
import LottieAnimations from '@components/LottieAnimations';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
+import useWindowDimensions from '@hooks/useWindowDimensions';
import variables from '@styles/variables';
function SignInHeroImage(props) {
const styles = useThemeStyles();
+ const {isMediumScreenWidth} = useWindowDimensions();
const {shouldUseNarrowLayout} = useResponsiveLayout();
let imageSize;
if (shouldUseNarrowLayout) {
@@ -14,7 +16,7 @@ function SignInHeroImage(props) {
height: variables.signInHeroImageMobileHeight,
width: variables.signInHeroImageMobileWidth,
};
- } else if (props.isMediumScreenWidth) {
+ } else if (isMediumScreenWidth) {
imageSize = {
height: variables.signInHeroImageTabletHeight,
width: variables.signInHeroImageTabletWidth,
From 15ef1d8a44c41ab5234b4a9ae72a2cea5c44009f Mon Sep 17 00:00:00 2001
From: rayane-djouah <77965000+rayane-djouah@users.noreply.github.com>
Date: Mon, 29 Jan 2024 20:11:42 +0100
Subject: [PATCH 06/10] fix lint errors
---
src/pages/signin/SignInHeroImage.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/signin/SignInHeroImage.js b/src/pages/signin/SignInHeroImage.js
index ecd2812a9ccc..fc4bce808dbf 100644
--- a/src/pages/signin/SignInHeroImage.js
+++ b/src/pages/signin/SignInHeroImage.js
@@ -6,7 +6,7 @@ import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import variables from '@styles/variables';
-function SignInHeroImage(props) {
+function SignInHeroImage() {
const styles = useThemeStyles();
const {isMediumScreenWidth} = useWindowDimensions();
const {shouldUseNarrowLayout} = useResponsiveLayout();
From 1c711fa0af79a392f372b0d7d079c9847e316582 Mon Sep 17 00:00:00 2001
From: rayane-djouah <77965000+rayane-djouah@users.noreply.github.com>
Date: Thu, 8 Feb 2024 14:39:55 +0100
Subject: [PATCH 07/10] Replace usages of isInModal and shouldShowSmallScreen
props in components
---
src/pages/signin/LoginForm/BaseLoginForm.js | 4 ----
src/pages/signin/SignInPageLayout/SignInPageContent.js | 10 ++++------
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js
index d9da8c5b7ecb..1d9c6b6d0de1 100644
--- a/src/pages/signin/LoginForm/BaseLoginForm.js
+++ b/src/pages/signin/LoginForm/BaseLoginForm.js
@@ -15,7 +15,6 @@ import Text from '@components/Text';
import TextInput from '@components/TextInput';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import withToggleVisibilityView from '@components/withToggleVisibilityView';
-import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions';
import usePrevious from '@hooks/usePrevious';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
@@ -74,8 +73,6 @@ const propTypes = {
isVisible: PropTypes.bool.isRequired,
- ...windowDimensionsPropTypes,
-
...withLocalizePropTypes,
};
@@ -381,7 +378,6 @@ export default compose(
credentials: {key: ONYXKEYS.CREDENTIALS},
closeAccount: {key: ONYXKEYS.FORMS.CLOSE_ACCOUNT_FORM},
}),
- withWindowDimensions,
withLocalize,
withToggleVisibilityView,
withNetwork(),
diff --git a/src/pages/signin/SignInPageLayout/SignInPageContent.js b/src/pages/signin/SignInPageLayout/SignInPageContent.js
index 4735e75f6b9b..2be9a10c6575 100755
--- a/src/pages/signin/SignInPageLayout/SignInPageContent.js
+++ b/src/pages/signin/SignInPageLayout/SignInPageContent.js
@@ -10,7 +10,6 @@ import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
-import useWindowDimensions from '@hooks/useWindowDimensions';
import compose from '@libs/compose';
import SignInHeroImage from '@pages/signin/SignInHeroImage';
import variables from '@styles/variables';
@@ -37,7 +36,6 @@ const propTypes = {
};
function SignInPageContent(props) {
- const {isSmallScreenWidth} = useWindowDimensions();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
@@ -46,10 +44,10 @@ function SignInPageContent(props) {
{/* This empty view creates margin on the top of the sign in form which will shrink and grow depending on if the keyboard is open or not */}
-
+
-
+
@@ -60,7 +58,7 @@ function SignInPageContent(props) {
StyleUtils.getLineHeightStyle(variables.lineHeightSignInHeroXSmall),
StyleUtils.getFontSizeStyle(variables.fontSizeSignInHeroXSmall),
!props.welcomeText ? styles.mb5 : {},
- !isSmallScreenWidth ? styles.textAlignLeft : {},
+ !shouldUseNarrowLayout ? styles.textAlignLeft : {},
styles.mb5,
]}
>
@@ -68,7 +66,7 @@ function SignInPageContent(props) {
) : null}
{props.shouldShowWelcomeText && props.welcomeText ? (
- {props.welcomeText}
+ {props.welcomeText}
) : null}
{props.children}
From 1dd040743c3d075fe13d5320f9ef3f67c4b5e21f Mon Sep 17 00:00:00 2001
From: rayane-djouah <77965000+rayane-djouah@users.noreply.github.com>
Date: Thu, 8 Feb 2024 15:59:09 +0100
Subject: [PATCH 08/10] fix type error
---
src/hooks/useResponsiveLayout.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/hooks/useResponsiveLayout.ts b/src/hooks/useResponsiveLayout.ts
index f00890116d47..5d76e0e8d52c 100644
--- a/src/hooks/useResponsiveLayout.ts
+++ b/src/hooks/useResponsiveLayout.ts
@@ -1,4 +1,4 @@
-import {navigationRef} from '@libs/Navigation/Navigation';
+import navigationRef from '@libs/Navigation/navigationRef';
import NAVIGATORS from '@src/NAVIGATORS';
import useWindowDimensions from './useWindowDimensions';
From ec998566a69596008e15b5eeba1ff6f78f3d326d Mon Sep 17 00:00:00 2001
From: rayane-djouah <77965000+rayane-djouah@users.noreply.github.com>
Date: Thu, 8 Feb 2024 16:10:53 +0100
Subject: [PATCH 09/10] fix type error
---
src/hooks/useResponsiveLayout.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/hooks/useResponsiveLayout.ts b/src/hooks/useResponsiveLayout.ts
index 5d76e0e8d52c..c568ba9af096 100644
--- a/src/hooks/useResponsiveLayout.ts
+++ b/src/hooks/useResponsiveLayout.ts
@@ -1,4 +1,4 @@
-import navigationRef from '@libs/Navigation/navigationRef';
+import {navigationRef} from '@libs/Navigation/Navigation';
import NAVIGATORS from '@src/NAVIGATORS';
import useWindowDimensions from './useWindowDimensions';
@@ -12,7 +12,7 @@ type ResponsiveLayoutResult = {
*/
export default function useResponsiveLayout(): ResponsiveLayoutResult {
const {isSmallScreenWidth} = useWindowDimensions();
- const state = navigationRef?.getRootState();
+ const state = navigationRef?.current?.getRootState?.();
const lastRoute = state?.routes?.at(-1);
const lastRouteName = lastRoute?.name;
const isInModal = lastRouteName === NAVIGATORS.LEFT_MODAL_NAVIGATOR || lastRouteName === NAVIGATORS.RIGHT_MODAL_NAVIGATOR;
From c9bc9604cbba54b6b49d06fdfb7e52d57e7d9617 Mon Sep 17 00:00:00 2001
From: rayane-djouah <77965000+rayane-djouah@users.noreply.github.com>
Date: Fri, 9 Feb 2024 15:19:30 +0100
Subject: [PATCH 10/10] Update src/hooks/useResponsiveLayout.ts
Co-authored-by: Getabalew Tesfaye <75031127+getusha@users.noreply.github.com>
---
src/hooks/useResponsiveLayout.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/hooks/useResponsiveLayout.ts b/src/hooks/useResponsiveLayout.ts
index c568ba9af096..75e20ed9b5e0 100644
--- a/src/hooks/useResponsiveLayout.ts
+++ b/src/hooks/useResponsiveLayout.ts
@@ -12,7 +12,7 @@ type ResponsiveLayoutResult = {
*/
export default function useResponsiveLayout(): ResponsiveLayoutResult {
const {isSmallScreenWidth} = useWindowDimensions();
- const state = navigationRef?.current?.getRootState?.();
+ const state = navigationRef?.current?.getRootState();
const lastRoute = state?.routes?.at(-1);
const lastRouteName = lastRoute?.name;
const isInModal = lastRouteName === NAVIGATORS.LEFT_MODAL_NAVIGATOR || lastRouteName === NAVIGATORS.RIGHT_MODAL_NAVIGATOR;