0

I am trying to use an <ScrollSync> with an embedded <AutoSizer> like this:

<ScrollSync>
  {({ clientHeight, clientWidth, onScroll, scrollHeight, scrollLeft, scrollTop, scrollWidth }) => {
    <AutoSizer onResize={this.onResize}>{
      ({ width, height }) => (
        <Grid {...alltheprops} onScroll={onScroll}/>
      )
    }</AutoSizer>
  }
</ScrollSync>

This is of course greatly simplified but will get my point across (I hope). So the onScroll of the grid is connected to the scrollsync. My problem is that whenever the autoresizer triggers because I made my window wider the scrollSync will not be notified of the new scrollWidth. Any idea how to fix this?

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
meerlol
  • 355
  • 3
  • 14
  • `scrollWidth` is equal to the total width of all columns, which is a measurement that doesn't change when a parent resizes. I don't see a reason/need for that parameter in the example you posted above. Why would you need that measurement? – bvaughn Dec 25 '16 at 21:14
  • I worked around it by using the width of the AutoSizer instead of the scrollWidth, although I still believe the ScrollSync should somehow update its scrollWidth after resizing. – meerlol Jan 04 '17 at 13:18
  • `scrollWidth` is the width of the content (all of the columns). `AutoSizer` `width` is like `clientWidth`, the size of the viewport showing visible columsn. They aren't the same. (Well, they would only be the same if there were too few columns cause scrolling.) `scrollWidth` for a `Grid` won't change when `AutoSizer` `width` changes. – bvaughn Jan 04 '17 at 16:47
  • Thanx, I was misunderstanding some crucial parts there. And forgive me, I oversimplified my question. The AutoResizer was connected to a redux store through the onResize. The reducer calculates the new columncount and width. So the Grid is then redrawn with the new columncount and width. But I forgot to supply the columncount and columnwidth to the ScrollSync as properties so it probably did not see a need to rerender (because of the shallowCompare in the shouldComponentUpdate). – meerlol Jan 06 '17 at 10:19
  • No problem. Sounds like you've got a handle on it then. Glad to hear! – bvaughn Jan 06 '17 at 16:42

0 Answers0