@@ -94,7 +94,8 @@ class FlashList<T> extends React.PureComponent<
9494 } ;
9595
9696 private postLoadTimeoutId ?: ReturnType < typeof setTimeout > ;
97- private sizeWarningTimeoutId ?: ReturnType < typeof setTimeout > ;
97+ private itemSizeWarningTimeoutId ?: ReturnType < typeof setTimeout > ;
98+ private renderedSizeWarningTimeoutId ?: ReturnType < typeof setTimeout > ;
9899
99100 private isEmptyList = false ;
100101 private viewabilityManager : ViewabilityManager < T > ;
@@ -291,8 +292,9 @@ class FlashList<T> extends React.PureComponent<
291292 componentWillUnmount ( ) {
292293 this . viewabilityManager . dispose ( ) ;
293294 this . clearPostLoadTimeout ( ) ;
294- if ( this . sizeWarningTimeoutId !== undefined ) {
295- clearTimeout ( this . sizeWarningTimeoutId ) ;
295+ this . clearRenderSizeWarningTimeout ( ) ;
296+ if ( this . itemSizeWarningTimeoutId !== undefined ) {
297+ clearTimeout ( this . itemSizeWarningTimeoutId ) ;
296298 }
297299 }
298300
@@ -430,8 +432,11 @@ class FlashList<T> extends React.PureComponent<
430432
431433 private validateListSize ( event : LayoutChangeEvent ) {
432434 const { height, width } = event . nativeEvent . layout ;
435+ this . clearRenderSizeWarningTimeout ( ) ;
433436 if ( Math . floor ( height ) <= 1 || Math . floor ( width ) <= 1 ) {
434- console . warn ( WarningList . unusableRenderedSize ) ;
437+ this . renderedSizeWarningTimeoutId = setTimeout ( ( ) => {
438+ console . warn ( WarningList . unusableRenderedSize ) ;
439+ } , 1000 ) ;
435440 }
436441 }
437442
@@ -724,7 +729,7 @@ class FlashList<T> extends React.PureComponent<
724729
725730 private runAfterOnLoad = ( ) => {
726731 if ( this . props . estimatedItemSize === undefined ) {
727- this . sizeWarningTimeoutId = setTimeout ( ( ) => {
732+ this . itemSizeWarningTimeoutId = setTimeout ( ( ) => {
728733 const averageItemSize = Math . floor (
729734 this . state . layoutProvider . averageItemSize
730735 ) ;
@@ -752,6 +757,13 @@ class FlashList<T> extends React.PureComponent<
752757 }
753758 } ;
754759
760+ private clearRenderSizeWarningTimeout = ( ) => {
761+ if ( this . renderedSizeWarningTimeoutId !== undefined ) {
762+ clearTimeout ( this . renderedSizeWarningTimeoutId ) ;
763+ this . renderedSizeWarningTimeoutId = undefined ;
764+ }
765+ } ;
766+
755767 /**
756768 * Disables recycling for the next frame so that layout animations run well.
757769 * Warning: Avoid this when making large changes to the data as the list might draw too much to run animations. Single item insertions/deletions
0 commit comments