diff --git a/src/pages/settings/Subscription/SubscriptionPlan/ComparePlansModal.tsx b/src/pages/settings/Subscription/SubscriptionPlan/ComparePlansModal.tsx index 048c3cf933fa..3a6b0426434a 100644 --- a/src/pages/settings/Subscription/SubscriptionPlan/ComparePlansModal.tsx +++ b/src/pages/settings/Subscription/SubscriptionPlan/ComparePlansModal.tsx @@ -3,12 +3,14 @@ import {View} from 'react-native'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import Modal from '@components/Modal'; import type {AnimationOut} from '@components/Modal/ReanimatedModal/types'; +import SafeAreaConsumer from '@components/SafeAreaConsumer'; import ScrollView from '@components/ScrollView'; import Text from '@components/Text'; import TextLink from '@components/TextLink'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; +import useWindowDimensions from '@hooks/useWindowDimensions'; import CONST from '@src/CONST'; import SubscriptionPlanCard from './SubscriptionPlanCard'; @@ -23,6 +25,7 @@ type ComparePlansModalProps = { function ComparePlansModal({isModalVisible, setIsModalVisible}: ComparePlansModalProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); + const {windowHeight} = useWindowDimensions(); // 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(); @@ -59,23 +62,29 @@ function ComparePlansModal({isModalVisible, setIsModalVisible}: ComparePlansModa ); + const maxHeight = isSmallScreenWidth ? undefined : windowHeight - 40; + return ( - setIsModalVisible(false)} - animationOut={isSmallScreenWidth ? animationOut : undefined} - innerContainerStyle={isSmallScreenWidth ? undefined : styles.workspaceSection} - > - setIsModalVisible(false)} - shouldShowBackButton={false} - style={isSmallScreenWidth ? styles.pl4 : [styles.pr3, styles.pl8]} - /> - {isSmallScreenWidth ? {renderPlans()} : renderPlans()} - + + {({safeAreaPaddingBottomStyle}) => ( + setIsModalVisible(false)} + animationOut={isSmallScreenWidth ? animationOut : undefined} + innerContainerStyle={isSmallScreenWidth ? {...safeAreaPaddingBottomStyle, maxHeight} : {...styles.workspaceSection, ...safeAreaPaddingBottomStyle, maxHeight}} + > + setIsModalVisible(false)} + shouldShowBackButton={false} + style={isSmallScreenWidth ? styles.pl4 : [styles.pr3, styles.pl8]} + /> + {renderPlans()} + + )} + ); }