@@ -7,10 +7,12 @@ import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
77import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback' ;
88import Text from '@components/Text' ;
99import useLocalize from '@hooks/useLocalize' ;
10+ import useOnyx from '@hooks/useOnyx' ;
1011import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
1112import useThemeStyles from '@hooks/useThemeStyles' ;
1213import DateUtils from '@libs/DateUtils' ;
1314import CONST from '@src/CONST' ;
15+ import ONYXKEYS from '@src/ONYXKEYS' ;
1416import ArrowIcon from './ArrowIcon' ;
1517import Day from './Day' ;
1618import generateMonthMatrix from './generateMonthMatrix' ;
@@ -67,6 +69,9 @@ function CalendarPicker({
6769 const [ isYearPickerVisible , setIsYearPickerVisible ] = useState ( false ) ;
6870 const isFirstRender = useRef ( true ) ;
6971
72+ const [ isRHPVisible = false ] = useOnyx ( ONYXKEYS . MODAL , { selector : ( modal ) => modal ?. type === CONST . MODAL . MODAL_TYPE . RIGHT_DOCKED , canBeMissing : true } ) ;
73+ const isRHPVisibleWhenOpened = useRef ( isRHPVisible ) . current ;
74+
7075 const currentMonthView = currentDateView . getMonth ( ) ;
7176 const currentYearView = currentDateView . getFullYear ( ) ;
7277 const calendarDaysMatrix = generateMonthMatrix ( currentYearView , currentMonthView ) ;
@@ -301,6 +306,7 @@ function CalendarPicker({
301306 years = { years }
302307 currentYear = { currentYearView }
303308 onYearChange = { onYearSelected }
309+ isRHPVisible = { isRHPVisibleWhenOpened }
304310 onClose = { ( ) => setIsYearPickerVisible ( false ) }
305311 />
306312 </ View >
0 commit comments