@@ -13,7 +13,11 @@ import {
13
13
} from './utils/itemUtil' ;
14
14
import { getIndexByStartLoc , findListDiffIndex } from './utils/algorithmUtil' ;
15
15
16
- type RenderFunc < T > = ( item : T , index : number ) => React . ReactNode ;
16
+ type RenderFunc < T > = (
17
+ item : T ,
18
+ index : number ,
19
+ props : { style : React . CSSProperties } ,
20
+ ) => React . ReactNode ;
17
21
18
22
const ITEM_SCALE_RATE = 1 ;
19
23
@@ -401,11 +405,14 @@ class List<T> extends React.Component<ListProps<T>, ListState<T>> {
401
405
/**
402
406
* Phase 4: Render item and get all the visible items height
403
407
*/
404
- public renderChildren = ( list : T [ ] , startIndex : number , renderFunc : RenderFunc < T > ) =>
408
+ public renderChildren = ( list : T [ ] , startIndex : number , renderFunc : RenderFunc < T > ) => {
409
+ const { status } = this . state ;
405
410
// We should measure rendered item height
406
- list . map ( ( item , index ) => {
411
+ return list . map ( ( item , index ) => {
407
412
const eleIndex = startIndex + index ;
408
- const node = renderFunc ( item , eleIndex ) as React . ReactElement ;
413
+ const node = renderFunc ( item , eleIndex , {
414
+ style : status === 'MEASURE_START' ? { visibility : 'hidden' } : { } ,
415
+ } ) as React . ReactElement ;
409
416
const eleKey = this . getIndexKey ( eleIndex ) ;
410
417
411
418
// Pass `key` and `ref` for internal measure
@@ -416,6 +423,7 @@ class List<T> extends React.Component<ListProps<T>, ListState<T>> {
416
423
} ,
417
424
} ) ;
418
425
} ) ;
426
+ } ;
419
427
420
428
public render ( ) {
421
429
const {
0 commit comments