为什么我的列表上没有调用onSectionRendered?

时间:2017-08-06 17:30:35

标签: javascript react-virtualized

出于某种原因,onSectionRendered未在我的列表中被调用。其他一切都很好。不确定如果我正确地传递它。当我最初加载网格列表时,以及当不同的行变得可见时,它不会呈现。

<AutoSizer>
    {({ width, height }) =>
    <List
        ref={this.set_reference}
        className={stylesheet.nestedVirtualizedList}
        width={width}
        height={height}
        onSectionRendered={()=>{console.log('Please show up ;(')}}
        onScroll={this.update_scroller_position}
        rowCount={this.props.data.length}
        rowHeight={(this.props.get_dynamic_height) ? this.props.get_dynamic_height : height}
        rowRenderer={this.render_row}
        overscanRowCount={this.props.overscan_row_count}

        />
    }
</AutoSizer>

我也试过这个......

<AutoSizer>
      {({ width, height }) =>
      <List
          {...{onSectionRendered:this.on_section_rendered}}
          ref={this.set_reference}
          className={stylesheet.nestedVirtualizedList}
          width={width}
          height={height}
          onScroll={this.update_scroller_position}
          rowCount={this.props.data.length}
          rowHeight={(this.props.get_dynamic_height) ? this.props.get_dynamic_height : height}
          rowRenderer={this.render_row}
          overscanRowCount={this.props.overscan_row_count}

          />
      }
  </AutoSizer>

1 个答案:

答案 0 :(得分:0)

List属性名为onRowsRendered(请查看docs):

  

<强> onRowsRendered

     

使用有关刚呈现的行切片的信息调用回调:({overscanStartIndex:number,overscanStopIndex:number,startIndex:number,stopIndex:number}):void