你是对的,我没有正确地传递道具。现在,我将其设置为:
Container.jsx
<div className='container' ref={(ref) => {this.foo = ref;}}>
this.renderContainer()
</div>
<Section scrollContainer={this.foo}/>Section.jsx (只是传递道具)
<Panel scrollContainer={this.props.scrollContainer}/>
Section.propTypes = { scrollContainer: PropTypes.object.isRequired }Panel.jsx (传递道具)
<RenderedTable scrollContainer={this.props.scrollContainer} />RenderedTable.jsx
return (
<div className='padding-top-20 font-smoothing'>
<WindowScroller scrollElement={this.props.scrollContainer}>
{({ height, isScrolling, scrollTop, onChildScroll }) => (
<AutoSizer disableHeight>
{({ width }) => (
<Table不幸的是,windowScroller仍然不能调整大小。我也没有收到任何警告或错误。您是否使用css技巧来调整滚动条的大小?我看到在示例https://bvaughn.github.io/react-virtualized/#/components/WindowScroller中,当将scrollElement从window更改为scrollingBody时,您更改了flex和overflow属性。
我知道你很忙,非常感谢你的帮助!
发布于 2017-06-30 09:35:36
在您的示例中,您将滚动引用分配给了this.tabsContainer,但您试图以this.props.tabContainer的身份访问它。这要么是您的错误,要么是示例不完整,需要更多上下文。:)你能提供一个Plnkr吗?
https://stackoverflow.com/questions/44836378
复制相似问题