Skip to content

Commit 99a8893

Browse files
authored
Merge pull request #24308 from rezkiy37/fix/19918-pdf-blinks
Fix PDF blinks
2 parents 457c6df + 6d655d5 commit 99a8893

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/components/PDFView/index.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class PDFView extends Component {
101101
* Calculates a proper page height. The method should be called only when there are page viewports.
102102
* It is based on a ratio between the specific page viewport width and provided page width.
103103
* Also, the app should take into account the page borders.
104-
* @param {*} pageIndex
104+
* @param {Number} pageIndex
105105
* @returns {Number}
106106
*/
107107
calculatePageHeight(pageIndex) {
@@ -178,13 +178,17 @@ class PDFView extends Component {
178178
}
179179

180180
/**
181-
* It is a currying method that returns a function that renders a specific page based on its index.
182-
* The function includes a wrapper to apply virtualized styles.
183-
* @param {Number} pageWidth
181+
* Render a specific page based on its index.
182+
* The method includes a wrapper to apply virtualized styles.
183+
* @param {Object} page item object of the List
184+
* @param {Number} page.index index of the page
185+
* @param {Object} page.style virtualized styles
184186
* @returns {JSX.Element}
185187
*/
186-
renderPage(pageWidth) {
187-
return ({index, style}) => (
188+
renderPage({index, style}) {
189+
const pageWidth = this.calculatePageWidth();
190+
191+
return (
188192
<View style={style}>
189193
<Page
190194
key={`page_${index}`}
@@ -240,7 +244,7 @@ class PDFView extends Component {
240244
itemCount={this.state.numPages}
241245
itemSize={this.calculatePageHeight}
242246
>
243-
{this.renderPage(pageWidth)}
247+
{this.renderPage}
244248
</List>
245249
)}
246250
</Document>

0 commit comments

Comments
 (0)