1
+ import 'react-virtualized/styles.css' ;
1
2
import * as React from '@theia/core/shared/react' ;
2
3
import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer' ;
3
4
import {
@@ -59,7 +60,7 @@ export class ComponentList<T extends ArduinoComponent> extends React.Component<
59
60
this . mostRecentWidth = width ;
60
61
return (
61
62
< List
62
- className = { ' items-container' }
63
+ className = " items-container"
63
64
rowRenderer = { this . createItem }
64
65
height = { height }
65
66
width = { width }
@@ -88,7 +89,7 @@ export class ComponentList<T extends ArduinoComponent> extends React.Component<
88
89
}
89
90
}
90
91
91
- private setListRef = ( ref : List | null ) : void => {
92
+ private readonly setListRef = ( ref : List | null ) : void => {
92
93
this . list = ref || undefined ;
93
94
} ;
94
95
@@ -106,14 +107,21 @@ export class ComponentList<T extends ArduinoComponent> extends React.Component<
106
107
private clear ( index : number ) : void {
107
108
this . cache . clear ( index , 0 ) ;
108
109
this . list ?. recomputeRowHeights ( index ) ;
109
- // Update the last item if the if the one before was updated
110
- if ( index === this . props . items . length - 2 ) {
111
- this . cache . clear ( index + 1 , 0 ) ;
112
- this . list ?. recomputeRowHeights ( index + 1 ) ;
110
+ // The last item need extra space height for the footer on hover.
111
+ if ( index === this . props . items . length - 1 ) {
112
+ this . list ?. recomputeGridSize ( ) ;
113
+ // Scroll to the very end if the last item has the :hover, so that footer will be visible.
114
+ const endPosition = this . list ?. getOffsetForRow ( {
115
+ index,
116
+ alignment : 'end' ,
117
+ } ) ;
118
+ if ( endPosition ) {
119
+ this . list ?. scrollToPosition ( endPosition ) ;
120
+ }
113
121
}
114
122
}
115
123
116
- private createItem : ListRowRenderer = ( {
124
+ private readonly createItem : ListRowRenderer = ( {
117
125
index,
118
126
parent,
119
127
key,
0 commit comments