Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 自动生成高度和宽度为0的div_Reactjs_React Virtualized - Fatal编程技术网

Reactjs 自动生成高度和宽度为0的div

Reactjs 自动生成高度和宽度为0的div,reactjs,react-virtualized,Reactjs,React Virtualized,我的配置如下: // Calling it <div style={{ width: 1000, height: 800 }}> <MyComponent /> </div> // MyComponent.js <InfiniteLoader { ...itsProps }> {({ onRowsRendered }) => ( <AutoSizer> {({ width, height }) =&

我的配置如下:

// Calling it
<div style={{ width: 1000, height: 800 }}>
  <MyComponent />
</div>

// MyComponent.js
<InfiniteLoader { ...itsProps }>
  {({ onRowsRendered }) => (

    <AutoSizer>
      {({ width, height }) => (

      <Table
        width={ width }
        width={ height }
        ...
//调用它
//MyComponent.js
{({onRowsRendered})=>(
{({宽度,高度})=>(

您共享的HTML片段中的
height:0
样式实际上不是问题,因为
overflow:visible
样式。这就是
AutoSizer
的工作方式

我建议您阅读。我怀疑您的问题与此处提到的一个常见问题类似:

AutoSizer
展开以填充其父元素,但它不会拉伸父元素。这样做是为了防止flexbox布局出现问题。如果AutoSizer报告的高度(或宽度)为0,则父元素(或其父元素之一)的高度很可能为0。一种简单的测试方法是添加样式属性(例如
背景色:红色;
)以确保其大小正确。(例如,您可能需要将
高度:100%
弹性:1
添加到父级。)


您能从输出html提供更多信息吗
<div style="overflow: visible; height: 0px; width: 0px;">
  <div class="ReactVirtualized__Table" role="grid">
    ...