@@ -20,7 +20,7 @@ import useTheme from '@hooks/useTheme';
2020import useThemeStyles from '@hooks/useThemeStyles' ;
2121import useWindowDimensions from '@hooks/useWindowDimensions' ;
2222import ComposerFocusManager from '@libs/ComposerFocusManager' ;
23- import getPlatform from '@libs/getPlatform ' ;
23+ import { canUseTouchScreen as canUseTouchScreenCheck } from '@libs/DeviceCapabilities ' ;
2424import NarrowPaneContext from '@libs/Navigation/AppNavigator/Navigators/NarrowPaneContext' ;
2525import Overlay from '@libs/Navigation/AppNavigator/Navigators/Overlay' ;
2626import Navigation from '@libs/Navigation/Navigation' ;
@@ -110,6 +110,7 @@ function BaseModal(
110110 const StyleUtils = useStyleUtils ( ) ;
111111 const { windowWidth, windowHeight} = useWindowDimensions ( ) ;
112112 // We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to apply correct modal width
113+ const canUseTouchScreen = canUseTouchScreenCheck ( ) ;
113114 // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
114115 const { isSmallScreenWidth, shouldUseNarrowLayout} = useResponsiveLayout ( ) ;
115116 const { sidePanelOffset} = useSidePanel ( ) ;
@@ -216,23 +217,13 @@ function BaseModal(
216217
217218 // Checks if modal overlaps with topSafeArea. Used to offset tall bottom docked modals with keyboard.
218219 useEffect ( ( ) => {
219- if ( type !== CONST . MODAL . MODAL_TYPE . BOTTOM_DOCKED || getPlatform ( ) === CONST . PLATFORM . WEB ) {
220+ if ( type !== CONST . MODAL . MODAL_TYPE . BOTTOM_DOCKED || ! canUseTouchScreen || ! isSmallScreenWidth ) {
220221 return ;
221222 }
222223 const { paddingTop} = StyleUtils . getPlatformSafeAreaPadding ( insets ) ;
223224 const availableHeight = windowHeight - modalHeight - keyboardStateContextValue . keyboardActiveHeight - paddingTop ;
224225 setModalOverlapsWithTopSafeArea ( ( keyboardStateContextValue . isKeyboardAnimatingRef . current || keyboardStateContextValue . isKeyboardActive ) && Math . floor ( availableHeight ) <= 0 ) ;
225- } , [
226- StyleUtils ,
227- insets ,
228- keyboardStateContextValue . isKeyboardActive ,
229- keyboardStateContextValue . isKeyboardAnimatingRef ,
230- keyboardStateContextValue . keyboardActiveHeight ,
231- modalHeight ,
232- type ,
233- windowHeight ,
234- modalOverlapsWithTopSafeArea ,
235- ] ) ;
226+ } , [ StyleUtils , insets , keyboardStateContextValue . isKeyboardActive , keyboardStateContextValue . isKeyboardAnimatingRef , keyboardStateContextValue . keyboardActiveHeight , modalHeight , type , windowHeight , modalOverlapsWithTopSafeArea , canUseTouchScreen , isSmallScreenWidth ] ) ;
236227
237228 const onViewLayout = ( e : LayoutChangeEvent ) => {
238229 setModalHeight ( e . nativeEvent . layout . height ) ;
@@ -264,7 +255,7 @@ function BaseModal(
264255 shouldUseModalPaddingStyle ,
265256 {
266257 modalOverlapsWithTopSafeArea,
267- shouldDisableBottomSafeAreaPadding,
258+ shouldDisableBottomSafeAreaPadding : ! ! shouldDisableBottomSafeAreaPadding ,
268259 } ,
269260 shouldUseReanimatedModal ,
270261 ) ,
0 commit comments