Search code examples
reactjsscrollto

React indiana scroll - initial scroll doesn't work


I would like to initialize my component to an initial scroll with react-indiana-drag-scroll but it doesn't work and I don't know why.

You will find the code on this sandbox.

I would like to initialize the scroll on the red line (current time), but the scrollTo function doesn't work in this code.


Solution

  • ScrollTo function didn't work because the component isn't fully constructed when we call the function. Instead of constructing it in componentDidMount(), I did it in componentWillMount() and called scrollTo in componentDidMount().

    See the code : here