@@ -3,12 +3,14 @@ import {View} from 'react-native';
33import HeaderWithBackButton from '@components/HeaderWithBackButton' ;
44import Modal from '@components/Modal' ;
55import type { AnimationOut } from '@components/Modal/ReanimatedModal/types' ;
6+ import SafeAreaConsumer from '@components/SafeAreaConsumer' ;
67import ScrollView from '@components/ScrollView' ;
78import Text from '@components/Text' ;
89import TextLink from '@components/TextLink' ;
910import useLocalize from '@hooks/useLocalize' ;
1011import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
1112import useThemeStyles from '@hooks/useThemeStyles' ;
13+ import useWindowDimensions from '@hooks/useWindowDimensions' ;
1214import CONST from '@src/CONST' ;
1315import SubscriptionPlanCard from './SubscriptionPlanCard' ;
1416
@@ -23,6 +25,7 @@ type ComparePlansModalProps = {
2325function ComparePlansModal ( { isModalVisible, setIsModalVisible} : ComparePlansModalProps ) {
2426 const styles = useThemeStyles ( ) ;
2527 const { translate} = useLocalize ( ) ;
28+ const { windowHeight} = useWindowDimensions ( ) ;
2629 // We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to be consistent with BaseModal component
2730 // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
2831 const { isSmallScreenWidth} = useResponsiveLayout ( ) ;
@@ -59,23 +62,29 @@ function ComparePlansModal({isModalVisible, setIsModalVisible}: ComparePlansModa
5962 </ View >
6063 ) ;
6164
65+ const maxHeight = isSmallScreenWidth ? undefined : windowHeight - 40 ;
66+
6267 return (
63- < Modal
64- isVisible = { isModalVisible }
65- type = { isSmallScreenWidth ? CONST . MODAL . MODAL_TYPE . CENTERED : CONST . MODAL . MODAL_TYPE . CENTERED_SMALL }
66- onClose = { ( ) => setIsModalVisible ( false ) }
67- animationOut = { isSmallScreenWidth ? animationOut : undefined }
68- innerContainerStyle = { isSmallScreenWidth ? undefined : styles . workspaceSection }
69- >
70- < HeaderWithBackButton
71- title = { translate ( 'subscription.compareModal.comparePlans' ) }
72- shouldShowCloseButton
73- onCloseButtonPress = { ( ) => setIsModalVisible ( false ) }
74- shouldShowBackButton = { false }
75- style = { isSmallScreenWidth ? styles . pl4 : [ styles . pr3 , styles . pl8 ] }
76- />
77- { isSmallScreenWidth ? < ScrollView addBottomSafeAreaPadding > { renderPlans ( ) } </ ScrollView > : renderPlans ( ) }
78- </ Modal >
68+ < SafeAreaConsumer >
69+ { ( { safeAreaPaddingBottomStyle} ) => (
70+ < Modal
71+ isVisible = { isModalVisible }
72+ type = { isSmallScreenWidth ? CONST . MODAL . MODAL_TYPE . CENTERED : CONST . MODAL . MODAL_TYPE . CENTERED_SMALL }
73+ onClose = { ( ) => setIsModalVisible ( false ) }
74+ animationOut = { isSmallScreenWidth ? animationOut : undefined }
75+ innerContainerStyle = { isSmallScreenWidth ? { ...safeAreaPaddingBottomStyle , maxHeight} : { ...styles . workspaceSection , ...safeAreaPaddingBottomStyle , maxHeight} }
76+ >
77+ < HeaderWithBackButton
78+ title = { translate ( 'subscription.compareModal.comparePlans' ) }
79+ shouldShowCloseButton
80+ onCloseButtonPress = { ( ) => setIsModalVisible ( false ) }
81+ shouldShowBackButton = { false }
82+ style = { isSmallScreenWidth ? styles . pl4 : [ styles . pr3 , styles . pl8 ] }
83+ />
84+ < ScrollView > { renderPlans ( ) } </ ScrollView >
85+ </ Modal >
86+ ) }
87+ </ SafeAreaConsumer >
7988 ) ;
8089}
8190
0 commit comments