Skip to content

Commit

Permalink
Merge pull request Expensify#27734 from bernhardoj/fix/25953-console-…
Browse files Browse the repository at this point in the history
…error

Fix console error when zoom avatar with keyboard
  • Loading branch information
pecanoro authored Sep 21, 2023
2 parents 89141ac + 192d459 commit 415504d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/components/ImageView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,16 @@ function ImageView({isAuthTokenRequired, url, fileName}) {
*/
const onContainerPress = (e) => {
if (!isZoomed && !isDragging) {
const {offsetX, offsetY} = e.nativeEvent;
// Dividing clicked positions by the zoom scale to get coordinates
// so that once we zoom we will scroll to the clicked location.
const delta = getScrollOffset(offsetX / zoomScale, offsetY / zoomScale);
setZoomDelta(delta);
if (e.nativeEvent) {
const {offsetX, offsetY} = e.nativeEvent;

// Dividing clicked positions by the zoom scale to get coordinates
// so that once we zoom we will scroll to the clicked location.
const delta = getScrollOffset(offsetX / zoomScale, offsetY / zoomScale);
setZoomDelta(delta);
} else {
setZoomDelta({offsetX: 0, offsetY: 0});
}
}

if (isZoomed && isDragging && isMouseDown) {
Expand Down

0 comments on commit 415504d

Please sign in to comment.