@@ -41,11 +41,10 @@ export default class RecentFilesTab extends React.Component<IRecentFilesTabProps
41
41
42
42
this . _selection = null ;
43
43
44
-
45
44
this . state = {
46
45
isLoading : true ,
47
46
results : [ ] ,
48
- filePickerResults : [ ]
47
+ filePickerResults : [ ] ,
49
48
} ;
50
49
}
51
50
@@ -123,11 +122,16 @@ export default class RecentFilesTab extends React.Component<IRecentFilesTabProps
123
122
*/
124
123
private _getItemCountForPage = ( itemIndex : number , surfaceRect : IRectangle ) : number => {
125
124
if ( itemIndex === 0 ) {
126
- this . _columnCount = Math . ceil ( surfaceRect . width / MAX_ROW_HEIGHT ) ;
127
- this . _columnWidth = Math . floor ( surfaceRect . width / this . _columnCount ) ;
128
- this . _rowHeight = this . _columnWidth ;
125
+ if ( surfaceRect . width === 0 ) {
126
+ //surfaceRect.width is 0 on load of this component, passing some default values so it renders.
127
+ this . _columnCount = 9 ;
128
+ this . _columnWidth = 161 ;
129
+ } else {
130
+ this . _columnCount = Math . ceil ( surfaceRect . width / MAX_ROW_HEIGHT ) ;
131
+ this . _columnWidth = Math . floor ( surfaceRect . width / this . _columnCount ) ;
132
+ }
133
+ this . _rowHeight = this . _columnWidth ;
129
134
}
130
-
131
135
return this . _columnCount * ROWS_PER_PAGE ;
132
136
}
133
137
@@ -157,7 +161,7 @@ export default class RecentFilesTab extends React.Component<IRecentFilesTabProps
157
161
/**
158
162
* Renders a grid list containing results
159
163
*/
160
- private _renderGridList = ( ) : JSX . Element => {
164
+ private _renderGridList = ( ) : JSX . Element => {
161
165
return < span className = { styles . recentGridList } role = "grid" >
162
166
< FocusZone >
163
167
< SelectionZone selection = { this . _selection }
@@ -168,9 +172,9 @@ export default class RecentFilesTab extends React.Component<IRecentFilesTabProps
168
172
< List
169
173
ref = { this . _linkElement }
170
174
items = { this . state . results }
171
- onRenderCell = { this . _onRenderCell }
175
+ onRenderCell = { this . _onRenderCell }
172
176
getItemCountForPage = { this . _getItemCountForPage }
173
- getPageHeight = { this . _getPageHeight }
177
+ getPageHeight = { this . _getPageHeight }
174
178
renderedWindowsAhead = { 4 }
175
179
/>
176
180
</ SelectionZone >
0 commit comments