okonet/react-scroll-sync

[Feature request] Sync callback

acontreras89 opened this issue · 2 comments

It'd be handy to be able to pass a callback function that would be called every time the panes are sync. I have implemented this in a fork of my own and would be happy to open a PR if you're interested.

Something like

<ScrollSync onSync={() => console.log("Panes synchronized!")}>
  { /* ... some components including ScrollSyncPane */ }
</ScrollSync>

although we could discuss the name and signature of such function.

Yes that would be great. What’s your use case?

Basically I needed to add some more logic to your requestAnimationFrame code, as requesting frames of my own would make my code compete against yours causing some delay in my animations.

Also, adding a callback allowed me to reuse the logic of skipping scroll events caused by the synchronization of panels.