@@ -101,7 +101,7 @@ class PDFView extends Component {
101
101
* Calculates a proper page height. The method should be called only when there are page viewports.
102
102
* It is based on a ratio between the specific page viewport width and provided page width.
103
103
* Also, the app should take into account the page borders.
104
- * @param {* } pageIndex
104
+ * @param {Number } pageIndex
105
105
* @returns {Number }
106
106
*/
107
107
calculatePageHeight ( pageIndex ) {
@@ -178,13 +178,17 @@ class PDFView extends Component {
178
178
}
179
179
180
180
/**
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
184
186
* @returns {JSX.Element }
185
187
*/
186
- renderPage ( pageWidth ) {
187
- return ( { index, style} ) => (
188
+ renderPage ( { index, style} ) {
189
+ const pageWidth = this . calculatePageWidth ( ) ;
190
+
191
+ return (
188
192
< View style = { style } >
189
193
< Page
190
194
key = { `page_${ index } ` }
@@ -240,7 +244,7 @@ class PDFView extends Component {
240
244
itemCount = { this . state . numPages }
241
245
itemSize = { this . calculatePageHeight }
242
246
>
243
- { this . renderPage ( pageWidth ) }
247
+ { this . renderPage }
244
248
</ List >
245
249
) }
246
250
</ Document >
0 commit comments