1
1
import React , { useEffect } from "react" ;
2
- import { List } from "react-virtualized" ;
2
+ import { List , AutoSizer } from "react-virtualized" ;
3
3
import PT from "prop-types" ;
4
4
5
5
import Button from "../Button" ;
@@ -237,24 +237,27 @@ export default function AddToGroupModal({ onCancel, updateUser, user }) {
237
237
< h3 className = { style . subTitle } >
238
238
My groups{ loadingGroups && " (Loading...)" }
239
239
</ h3 >
240
- < div >
241
- { ! loadingGroups && (
242
- < List
243
- className = { style . groupsList }
244
- width = { listWidth }
245
- height = {
246
- filteredMyGroups . length > 10
247
- ? 450
248
- : filteredMyGroups . length * 45
249
- }
250
- rowCount = { filteredMyGroups . length }
251
- rowHeight = { 45 }
252
- rowRenderer = { ( params ) =>
253
- rowRenderer ( { ...params , items : filteredMyGroups } )
254
- }
255
- />
256
- ) }
257
- </ div >
240
+
241
+ { ! loadingGroups && (
242
+ < AutoSizer disableHeight >
243
+ { ( ) => (
244
+ < List
245
+ className = { style . groupsList }
246
+ width = { listWidth + 20 }
247
+ height = {
248
+ filteredMyGroups . length > 10
249
+ ? 250
250
+ : filteredMyGroups . length * 45
251
+ }
252
+ rowCount = { filteredMyGroups . length }
253
+ rowHeight = { 45 }
254
+ rowRenderer = { ( params ) =>
255
+ rowRenderer ( { ...params , items : filteredMyGroups } )
256
+ }
257
+ />
258
+ ) }
259
+ </ AutoSizer >
260
+ ) }
258
261
{ myGroups . filter ( ( g ) =>
259
262
g . name . toLowerCase ( ) . includes ( filter . toLowerCase ( ) )
260
263
) . length === 0 &&
@@ -264,22 +267,26 @@ export default function AddToGroupModal({ onCancel, updateUser, user }) {
264
267
< h3 className = { style . subTitle } >
265
268
Other Groups{ loadingGroups && " (Loading...)" }
266
269
</ h3 >
267
- < div >
270
+ < div className = { style . clear } >
268
271
{ ! loadingGroups && (
269
- < List
270
- className = { style . groupsList }
271
- width = { listWidth }
272
- height = {
273
- filteredOtherGroups . length > 10
274
- ? 450
275
- : filteredOtherGroups . length * 45
276
- }
277
- rowCount = { filteredOtherGroups . length }
278
- rowHeight = { 45 }
279
- rowRenderer = { ( params ) =>
280
- rowRenderer ( { ...params , items : filteredOtherGroups } )
281
- }
282
- />
272
+ < AutoSizer disableHeight >
273
+ { ( ) => (
274
+ < List
275
+ className = { style . groupsList }
276
+ width = { listWidth + 20 }
277
+ height = {
278
+ filteredOtherGroups . length > 10
279
+ ? 250
280
+ : filteredOtherGroups . length * 45
281
+ }
282
+ rowCount = { filteredOtherGroups . length }
283
+ rowHeight = { 45 }
284
+ rowRenderer = { ( params ) =>
285
+ rowRenderer ( { ...params , items : filteredOtherGroups } )
286
+ }
287
+ />
288
+ ) }
289
+ </ AutoSizer >
283
290
) }
284
291
</ div >
285
292
{ otherGroups . filter ( ( g ) =>
0 commit comments