Skip to content

Commit

Permalink
Merge pull request #25529 from tienifr/fix/24375
Browse files Browse the repository at this point in the history
Fix: 24375 Navigation arrows are not shown on PDF until navigated to an image
  • Loading branch information
johnmlee101 authored Aug 24, 2023
2 parents 0b62ee5 + a9d3d6d commit 74be5f6
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {memo, useCallback, useContext} from 'react';
import React, {memo, useCallback, useContext, useEffect} from 'react';
import styles from '../../../../styles/styles';
import {attachmentViewPdfPropTypes, attachmentViewPdfDefaultProps} from './propTypes';
import PDFView from '../../../PDFView';
Expand All @@ -7,6 +7,11 @@ import AttachmentCarouselPagerContext from '../../AttachmentCarousel/Pager/Attac
function AttachmentViewPdf({file, encryptedSourceUrl, isFocused, isUsedInCarousel, onPress, onScaleChanged: onScaleChangedProp, onToggleKeyboard, onLoadComplete}) {
const attachmentCarouselPagerContext = useContext(AttachmentCarouselPagerContext);

useEffect(() => {
attachmentCarouselPagerContext.onPinchGestureChange(false);
// eslint-disable-next-line react-hooks/exhaustive-deps -- we just want to call this function when component is mounted
}, []);

const onScaleChanged = useCallback(
(scale) => {
onScaleChangedProp();
Expand All @@ -15,6 +20,8 @@ function AttachmentViewPdf({file, encryptedSourceUrl, isFocused, isUsedInCarouse
if (isUsedInCarousel) {
const shouldPagerScroll = scale === 1;

attachmentCarouselPagerContext.onPinchGestureChange(!shouldPagerScroll);

if (attachmentCarouselPagerContext.shouldPagerScroll.value === shouldPagerScroll) return;

attachmentCarouselPagerContext.shouldPagerScroll.value = shouldPagerScroll;
Expand Down

0 comments on commit 74be5f6

Please sign in to comment.