Skip to content

Commit

Permalink
Merge pull request #31 from commutatus/PRO-7320
Browse files Browse the repository at this point in the history
fix: Scroll adds white strip at bottom on safari
  • Loading branch information
barath46 authored Dec 9, 2024
2 parents 4d0fe9e + 851ef95 commit f48995b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/react-pdf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"make-event-props": "^1.6.0",
"merge-refs": "^1.2.1",
"prop-types": "^15.6.2",
"seamless-scroll-polyfill": "^2.3.4",
"tiny-invariant": "^1.0.0",
"warning": "^4.0.0"
},
Expand Down
7 changes: 6 additions & 1 deletion packages/react-pdf/src/Document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import type {
import Page, { type PageProps } from './Page.js';
import { PDFFindController } from './shared/pdf_find_controller.js';
import { DownloadManager } from './shared/download_manager.js';
import { scrollIntoView } from 'seamless-scroll-polyfill';

const { PDFDataRangeTransport } = pdfjs;

Expand Down Expand Up @@ -289,7 +290,11 @@ class Viewer {

if (page) {
// Scroll to the page automatically
page.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' });
scrollIntoView(page, {
behavior: 'smooth',
block: 'nearest',
inline: 'nearest',
});
this.currentPageNumber = pageNumber;
return;
}
Expand Down
7 changes: 6 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,7 @@ eslint-module-utils@^2.7.4, eslint-module-utils@^2.8.0:
dependencies:
debug "^3.2.7"

eslint-plugin-import@^2.25.0, "eslint-plugin-import@npm:eslint-plugin-i@^2.28.0":
eslint-plugin-import@^2.25.0:
version "2.29.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-i/-/eslint-plugin-i-2.29.1.tgz#97e4a055b6b2040cec0842700dd1d2066773b5a4"
integrity sha512-ORizX37MelIWLbMyqI7hi8VJMf7A0CskMmYkB+lkCX3aF4pkGV7kwx5bSEb4qx7Yce2rAf9s34HqDRPjGRZPNQ==
Expand Down Expand Up @@ -3861,6 +3861,11 @@ scheduler@^0.23.2:
dependencies:
loose-envify "^1.1.0"

seamless-scroll-polyfill@^2.3.4:
version "2.3.4"
resolved "https://registry.yarnpkg.com/seamless-scroll-polyfill/-/seamless-scroll-polyfill-2.3.4.tgz#d2fd1833993a2ad41a3ac319c65dc839bf0746d5"
integrity sha512-Biobd4LDoeFODX1bfiru84GveSajzFELFB3ejMZsRR2TpD73W46uEZYAEqSx5RtKpN2umhGWaoSRivs0ZcHp9g==

semver@^6.0.0, semver@^6.3.1:
version "6.3.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
Expand Down

0 comments on commit f48995b

Please sign in to comment.