在Autosizer的宽度为我提供适当的值时,我始终得到Autosizer高度为0,这会导致VirtualScroll组件不显示。但是,如果我使用disableHeight属性并为VirtualScroll提供一个固定的高度值(即200px),VirtualScroll会按预期显示行。有没有人能看出来哪里不对劲?
归根结底,Autosizer应该存在于Material-ui Dialog组件中,但我也尝试过简单地将autosizer呈现到div中。同样的问题。
render() {
return (
<Dialog
modal={false}
open={this.state.open}
onRequestClose={this.handleClose}
contentStyle={pageOptionsDialog.body}
>
<div>
<AutoSizer>
{({ width, height }) => (
<VirtualScroll
id="virtualScroll"
onRowsRendered={this.props.loadNextPage}
rowRenderer={this.rowRenderer}
height={height}
rowCount={this.props.rowCount}
rowHeight={30}
width={width}
/>
)}
</AutoSizer>
</div>
</dialog>
)}https://stackoverflow.com/questions/38340054
复制相似问题