From e6b20331a90469a260e9a9a6361d76dac7ee9fa5 Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Wed, 9 Aug 2023 11:23:23 -0400 Subject: [PATCH] Merge pull request #24308 from rezkiy37/fix/19918-pdf-blinks Fix PDF blinks (cherry picked from commit 99a8893b6a5072516393fc97097077b3165dc016) --- src/components/PDFView/index.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/PDFView/index.js b/src/components/PDFView/index.js index 75c99757e7e0..26e117815ec1 100644 --- a/src/components/PDFView/index.js +++ b/src/components/PDFView/index.js @@ -101,7 +101,7 @@ class PDFView extends Component { * Calculates a proper page height. The method should be called only when there are page viewports. * It is based on a ratio between the specific page viewport width and provided page width. * Also, the app should take into account the page borders. - * @param {*} pageIndex + * @param {Number} pageIndex * @returns {Number} */ calculatePageHeight(pageIndex) { @@ -178,13 +178,17 @@ class PDFView extends Component { } /** - * It is a currying method that returns a function that renders a specific page based on its index. - * The function includes a wrapper to apply virtualized styles. - * @param {Number} pageWidth + * Render a specific page based on its index. + * The method includes a wrapper to apply virtualized styles. + * @param {Object} page item object of the List + * @param {Number} page.index index of the page + * @param {Object} page.style virtualized styles * @returns {JSX.Element} */ - renderPage(pageWidth) { - return ({index, style}) => ( + renderPage({index, style}) { + const pageWidth = this.calculatePageWidth(); + + return ( - {this.renderPage(pageWidth)} + {this.renderPage} )}