react-scroll-sync icon indicating copy to clipboard operation
react-scroll-sync copied to clipboard

[Feature request] Sync callback

Open acontreras89 opened this issue 4 years ago • 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.

acontreras89 avatar Jun 05 '20 10:06 acontreras89

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

okonet avatar Jun 05 '20 15:06 okonet

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.

acontreras89 avatar Jun 08 '20 06:06 acontreras89