react-track icon indicating copy to clipboard operation
react-track copied to clipboard

Position value never updated

Open mvaivre opened this issue 8 years ago • 1 comments
trafficstars

I'm trying to setup a pretty simple examples to mess around with react-track, but I'm unable to get any value update for posTopTop. I've tried many different simple combinations, it never worked.

For instance, I have two div with height: 100vh;, stacked one over the other:

render() {
    return ( 
    <TrackDocument formulas={[topTop]} >
      {(topTop) =>
        <div>
          <Track component={Page1} formulas={[topTop]}>
            {(Page1Tracked,posTopTop) =>
              <Page1Tracked handleScrollToPage2={this._handleScroll} posTopTop={posTopTop} />
            }
          </Track>
          <Track component={Page2} formulas={[topTop]}>
            {(Page2Tracked,posTopTop) =>
              <Page2Tracked posTopTop={posTopTop} />
            }
          </Track>
        </div>
        }
      </TrackDocument>
    )
  }

When I console.log the posTopTopprops in Page1 and Page2 render(), I get the correct initial value when mounting, but if I scroll, this value doesn't change (the component gets new props and the console.log is executed, but the value stays the same). Any idea about what's going on? Thanks...

mvaivre avatar Apr 29 '17 11:04 mvaivre

hmm strange, seems like it should work

gilbox avatar Apr 29 '17 18:04 gilbox