|
1 | 1 | import noop from 'lodash/noop'; |
2 | 2 | import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; |
3 | 3 | import type {NativeEventSubscription, ViewStyle} from 'react-native'; |
4 | | -import {BackHandler, Dimensions, InteractionManager, Modal, View} from 'react-native'; |
| 4 | +import {BackHandler, InteractionManager, Modal, View} from 'react-native'; |
5 | 5 | import {LayoutAnimationConfig} from 'react-native-reanimated'; |
6 | 6 | import FocusTrapForModal from '@components/FocusTrap/FocusTrapForModal'; |
7 | 7 | import KeyboardAvoidingView from '@components/KeyboardAvoidingView'; |
8 | 8 | import useThemeStyles from '@hooks/useThemeStyles'; |
| 9 | +import useWindowDimensions from '@hooks/useWindowDimensions'; |
9 | 10 | import getPlatform from '@libs/getPlatform'; |
10 | 11 | import variables from '@styles/variables'; |
11 | 12 | import CONST from '@src/CONST'; |
@@ -49,6 +50,8 @@ function ReanimatedModal({ |
49 | 50 | const [isVisibleState, setIsVisibleState] = useState(isVisible); |
50 | 51 | const [isContainerOpen, setIsContainerOpen] = useState(false); |
51 | 52 | const [isTransitioning, setIsTransitioning] = useState(false); |
| 53 | + const {windowWidth, windowHeight} = useWindowDimensions(); |
| 54 | + |
52 | 55 | const backHandlerListener = useRef<NativeEventSubscription | null>(null); |
53 | 56 | const handleRef = useRef<number | undefined>(undefined); |
54 | 57 |
|
@@ -119,9 +122,8 @@ function ReanimatedModal({ |
119 | 122 | }, [isVisible, isContainerOpen, isTransitioning]); |
120 | 123 |
|
121 | 124 | const backdropStyle: ViewStyle = useMemo(() => { |
122 | | - const {width, height} = Dimensions.get('screen'); |
123 | | - return {width, height, backgroundColor: backdropColor}; |
124 | | - }, [backdropColor]); |
| 125 | + return {width: windowWidth, height: windowHeight, backgroundColor: backdropColor}; |
| 126 | + }, [windowWidth, windowHeight, backdropColor]); |
125 | 127 |
|
126 | 128 | const onOpenCallBack = useCallback(() => { |
127 | 129 | setIsTransitioning(false); |
|
0 commit comments