react-on-screen icon indicating copy to clipboard operation
react-on-screen copied to clipboard

Adding a prop that can contain a callback function that will receive isVisible

Open blaineo opened this issue 6 years ago • 5 comments

This will be helpful for setting state of parent components.

blaineo avatar Dec 19 '18 23:12 blaineo

@fkhadra I'd love to have this functionality in your component. Is there any reason it can not be merged and released? If you don't plan on doing so, please let me know so that I can move forward with a fork. Many thanks.

blaineo avatar Feb 11 '19 18:02 blaineo

Hello @blaineo,

Sorry for the late reply. Since the end of december I'm preparing my move so I'm quite busy. It will be done at the end of the month. I'll try to review your PR asap even this weekend if I can.

fkhadra avatar Feb 12 '19 07:02 fkhadra

It might be useful for the callback to receive some more data and be able to extrapolate which side[s] of the screen the component is off-screen of.

liao-frank avatar Feb 18 '19 17:02 liao-frank

@liao-frank I think in the sprit of reducing complexity and keeping the component abstract, that kind of functionality would be handled in the referenced callback.

blaineo avatar Feb 20 '19 20:02 blaineo

My thought process was that, in order to implement the functionality that I suggested, someone would have to re-implement the getBoundingClientRect and ref logic. When instead, at least the rect could be passed back for the dev to work with and perform any of their own functionality.

But perhaps this suggestion is a larger design choice that needs to be approved. I should probably first suggest to have the rect passed to the child render function.

liao-frank avatar Feb 20 '19 20:02 liao-frank