diff --git a/src/pages/settings/Subscription/CardAuthenticationModal/index.tsx b/src/pages/settings/Subscription/CardAuthenticationModal/index.tsx index 97498a4f62e2..5a5624aa66c4 100644 --- a/src/pages/settings/Subscription/CardAuthenticationModal/index.tsx +++ b/src/pages/settings/Subscription/CardAuthenticationModal/index.tsx @@ -5,6 +5,7 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton'; import Modal from '@components/Modal'; import ScreenWrapper from '@components/ScreenWrapper'; import useOnyx from '@hooks/useOnyx'; +import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import {clearPaymentCard3dsVerification, verifySetupIntent} from '@userActions/PaymentMethods'; import {verifySetupIntentAndRequestPolicyOwnerChange} from '@userActions/Policy/Policy'; @@ -19,6 +20,9 @@ type CardAuthenticationModalProps = { }; function CardAuthenticationModal({headerTitle, policyID}: CardAuthenticationModalProps) { const styles = useThemeStyles(); + // We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to be consistent with BaseModal component + // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth + const {isSmallScreenWidth} = useResponsiveLayout(); const [authenticationLink] = useOnyx(ONYXKEYS.VERIFY_3DS_SUBSCRIPTION, {canBeMissing: true}); const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: true}); const [isLoading, setIsLoading] = useState(true); @@ -75,9 +79,10 @@ function CardAuthenticationModal({headerTitle, policyID}: CardAuthenticationModa {isLoading && } diff --git a/src/pages/settings/Subscription/SubscriptionPlan/ComparePlansModal.tsx b/src/pages/settings/Subscription/SubscriptionPlan/ComparePlansModal.tsx index 6c3ee583028c..8825b676ab33 100644 --- a/src/pages/settings/Subscription/SubscriptionPlan/ComparePlansModal.tsx +++ b/src/pages/settings/Subscription/SubscriptionPlan/ComparePlansModal.tsx @@ -40,6 +40,8 @@ function ComparePlansModal({isModalVisible, setIsModalVisible}: ComparePlansModa setIsModalVisible(false); }; + const onClose = () => setIsModalVisible(false); + const renderPlans = () => ( @@ -70,15 +72,17 @@ function ComparePlansModal({isModalVisible, setIsModalVisible}: ComparePlansModa setIsModalVisible(false)} + onClose={onClose} animationOut={isSmallScreenWidth ? animationOut : undefined} innerContainerStyle={isSmallScreenWidth ? {...safeAreaPaddingBottomStyle, maxHeight} : {...styles.workspaceSection, ...safeAreaPaddingBottomStyle, maxHeight}} + shouldUseReanimatedModal > setIsModalVisible(false)} - shouldShowBackButton={false} + shouldShowCloseButton={!isSmallScreenWidth} + onCloseButtonPress={onClose} + shouldShowBackButton={isSmallScreenWidth} + onBackButtonPress={onClose} style={isSmallScreenWidth ? styles.pl4 : [styles.pr3, styles.pl8]} shouldDisplayHelpButton={false} /> diff --git a/src/styles/utils/generators/ModalStyleUtils.ts b/src/styles/utils/generators/ModalStyleUtils.ts index 368e9020c966..d7be62cddb28 100644 --- a/src/styles/utils/generators/ModalStyleUtils.ts +++ b/src/styles/utils/generators/ModalStyleUtils.ts @@ -208,6 +208,8 @@ const createModalStyleUtils: StyleUtilGenerator = ({the boxShadow: theme.shadow, borderRadius: variables.componentBorderRadiusLarge, borderWidth: 0, + marginTop: 'auto', + marginBottom: 'auto', }; // Allow this modal to be dismissed with a swipe down or swipe right