@@ -9,6 +9,7 @@ import useKeyboardState from '@hooks/useKeyboardState';
99import useLocalize from '@hooks/useLocalize' ;
1010import useOnyx from '@hooks/useOnyx' ;
1111import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
12+ import useSafeAreaPaddings from '@hooks/useSafeAreaPaddings' ;
1213import useStyleUtils from '@hooks/useStyleUtils' ;
1314import useThemeStyles from '@hooks/useThemeStyles' ;
1415import useWindowDimensions from '@hooks/useWindowDimensions' ;
@@ -52,6 +53,7 @@ function PDFView({onToggleKeyboard, onLoadComplete, fileName, onPress, isFocused
5253 const themeStyles = useThemeStyles ( ) ;
5354 const { isKeyboardShown} = useKeyboardState ( ) ;
5455 const StyleUtils = useStyleUtils ( ) ;
56+ const { insets} = useSafeAreaPaddings ( ) ;
5557
5658 const [ activePolicyID ] = useOnyx ( ONYXKEYS . NVP_ACTIVE_POLICY_ID ) ;
5759
@@ -152,9 +154,14 @@ function PDFView({onToggleKeyboard, onLoadComplete, fileName, onPress, isFocused
152154 ) ;
153155
154156 function renderPDFView ( ) {
155- const pdfWidth = isUsedAsChatAttachment ? LOADING_THUMBNAIL_WIDTH : windowWidth ;
157+ // Insets are used to adjust the maxWidth of the PDF view in landscape mode
158+ const pdfWidth = isUsedAsChatAttachment ? LOADING_THUMBNAIL_WIDTH : windowWidth - insets . left - insets . right ;
156159 const pdfHeight = isUsedAsChatAttachment ? LOADING_THUMBNAIL_HEIGHT : windowHeight ;
157- const pdfStyles : StyleProp < ViewStyle > = [ themeStyles . imageModalPDF , StyleUtils . getWidthAndHeightStyle ( pdfWidth , pdfHeight ) ] ;
160+
161+ const pdfStyles : StyleProp < ViewStyle > = [
162+ themeStyles . imageModalPDF ,
163+ isUsedAsChatAttachment ? StyleUtils . getWidthAndHeightStyle ( pdfWidth , pdfHeight ) : StyleUtils . getPDFViewStyle ( pdfWidth , pdfHeight ) ,
164+ ] ;
158165
159166 // If we haven't yet successfully validated the password and loaded the PDF,
160167 // then we need to hide the react-native-pdf/PDF component so that PDFPasswordForm
0 commit comments