From 41ba4768680bd8c5fd633c5f39772b7d0db87f2f Mon Sep 17 00:00:00 2001 From: mkhutornyi Date: Wed, 20 Dec 2023 16:49:11 -0500 Subject: [PATCH] fix crash when trying to scroll pdf preview --- .../AttachmentView/AttachmentViewPdf/BaseAttachmentViewPdf.js | 2 +- .../AttachmentView/AttachmentViewPdf/index.android.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Attachments/AttachmentView/AttachmentViewPdf/BaseAttachmentViewPdf.js b/src/components/Attachments/AttachmentView/AttachmentViewPdf/BaseAttachmentViewPdf.js index 40887ddee697..de14f848c37e 100644 --- a/src/components/Attachments/AttachmentView/AttachmentViewPdf/BaseAttachmentViewPdf.js +++ b/src/components/Attachments/AttachmentView/AttachmentViewPdf/BaseAttachmentViewPdf.js @@ -30,7 +30,7 @@ function BaseAttachmentViewPdf({ onScaleChangedProp(scale); // When a pdf is shown in a carousel, we want to disable the pager scroll when the pdf is zoomed in - if (isUsedInCarousel) { + if (isUsedInCarousel && attachmentCarouselPagerContext) { const shouldPagerScroll = scale === 1; attachmentCarouselPagerContext.onPinchGestureChange(!shouldPagerScroll); diff --git a/src/components/Attachments/AttachmentView/AttachmentViewPdf/index.android.js b/src/components/Attachments/AttachmentView/AttachmentViewPdf/index.android.js index 308d3cf2c0ba..6d510d234512 100644 --- a/src/components/Attachments/AttachmentView/AttachmentViewPdf/index.android.js +++ b/src/components/Attachments/AttachmentView/AttachmentViewPdf/index.android.js @@ -18,7 +18,7 @@ function AttachmentViewPdf(props) { const Pan = Gesture.Pan() .manualActivation(true) .onTouchesMove((evt) => { - if (offsetX.value !== 0 && offsetY.value !== 0) { + if (offsetX.value !== 0 && offsetY.value !== 0 && attachmentCarouselPagerContext) { // if the value of X is greater than Y and the pdf is not zoomed in, // enable the pager scroll so that the user // can swipe to the next attachment otherwise disable it.