@@ -47,6 +47,7 @@ const TALL_ROW_HEIGHT = 19;
47
47
*/
48
48
export default function FileList ( props : FileListProps ) {
49
49
const [ totalCount , setTotalCount ] = React . useState < number | null > ( null ) ;
50
+ const [ lastVisibleRowIndex , setLastVisibleRowIndex ] = React . useState < number > ( 0 ) ;
50
51
const fileView = useSelector ( selection . selectors . getFileView ) ;
51
52
const fileSelection = useSelector ( selection . selectors . getFileSelection ) ;
52
53
const fileGridColumnCount = useSelector ( selection . selectors . getFileGridColCount ) ;
@@ -74,6 +75,14 @@ export default function FileList(props: FileListProps) {
74
75
const calculatedHeight = Math . min ( MAX_NON_ROOT_HEIGHT , dataDrivenHeight ) ;
75
76
const height = isRoot ? measuredHeight : calculatedHeight ;
76
77
78
+ const totalRows = Math . ceil (
79
+ ( totalCount || DEFAULT_TOTAL_COUNT ) / ( fileView === FileView . LIST ? 1 : fileGridColumnCount )
80
+ ) ;
81
+ // complement to isColumnWidthOverflowing
82
+ const isRowHeightOverflowing = totalRows * rowHeight > height ;
83
+ // hide overlay when we reach the bottom of the list
84
+ const atEndOfList = lastVisibleRowIndex === totalRows - 1 ;
85
+
77
86
const listRef = React . useRef < FixedSizeList | null > ( null ) ;
78
87
const gridRef = React . useRef < FixedSizeGrid | null > ( null ) ;
79
88
const outerRef = React . useRef < HTMLDivElement | null > ( null ) ;
@@ -196,6 +205,7 @@ export default function FileList(props: FileListProps) {
196
205
const overscanStopIndex =
197
206
overscanRowStopIndex * ( overscanColumnStopIndex + 1 ) ;
198
207
208
+ setLastVisibleRowIndex ( visibleRowStopIndex ) ;
199
209
onItemsRendered ( {
200
210
// call onItemsRendered from InfiniteLoader
201
211
visibleStartIndex,
@@ -216,7 +226,10 @@ export default function FileList(props: FileListProps) {
216
226
itemSize = { rowHeight } // row height
217
227
height = { height } // height of the list itself; affects number of rows rendered at any given time
218
228
itemCount = { totalCount || DEFAULT_TOTAL_COUNT }
219
- onItemsRendered = { onItemsRendered }
229
+ onItemsRendered = { ( renderProps ) => {
230
+ setLastVisibleRowIndex ( renderProps . visibleStopIndex ) ;
231
+ onItemsRendered ( renderProps ) ;
232
+ } }
220
233
outerElementType = { Header }
221
234
outerRef = { outerRef }
222
235
ref = { callbackRefList }
@@ -262,14 +275,24 @@ export default function FileList(props: FileListProps) {
262
275
return (
263
276
< div className = { classNames ( styles . container , className ) } >
264
277
< div
265
- className = { classNames ( styles . list , {
266
- [ styles . horizontalOverflow ] : isColumnWidthOverflowing ,
267
- } ) }
278
+ className = { classNames ( styles . list ) }
268
279
style = { {
269
280
height : isRoot ? undefined : `${ calculatedHeight } px` ,
270
281
} }
271
282
ref = { measuredNodeRef }
272
283
>
284
+ < div
285
+ className = { classNames ( {
286
+ [ styles . horizontalGradient ] : isColumnWidthOverflowing ,
287
+ [ styles . horizontalGradientCropped ] : isRowHeightOverflowing ,
288
+ } ) }
289
+ > </ div >
290
+ < div
291
+ className = { classNames ( {
292
+ [ styles . verticalGradient ] : isRowHeightOverflowing && ! atEndOfList ,
293
+ [ styles . verticalGradientCropped ] : isColumnWidthOverflowing ,
294
+ } ) }
295
+ > </ div >
273
296
{ content }
274
297
</ div >
275
298
< p className = { styles . rowCountDisplay } >
0 commit comments