Skip to content

Commit

Permalink
fix crash when trying to scroll pdf preview
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhutornyi committed Dec 20, 2023
1 parent fdf5d68 commit 41ba476
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 41ba476

Please sign in to comment.