captivationsoftware / react-sticky

<Sticky /> component for awesome React apps
MIT License
2.64k stars 385 forks source link

Support passing refs through Sticky HOC #215

Closed arielger closed 6 years ago

arielger commented 7 years ago

I'm not being able to use refs inside the component wrapped by the Sticky HOC.

I know this is a common problem for HOCs but according to the React documentation I could pass the reference function as a normal prop to the HOC and then use that function inside the content of the Sticky.

https://facebook.github.io/react/docs/higher-order-components.html#refs-arent-passed-through

The problem I found is that the HOC just supply an object with the properties defined in the documentation. The HOC should pass on all the properties provided to the children.

vcarl commented 6 years ago

Thanks @arielger for the suggestion. Just so I'm clear, you're trying to get a ref for a component that's being wrapped with the Sticky HOC? Could you provide a minimal code sample?

arielger commented 6 years ago

I think this was happening in v5. Now with the new API you don't need to handle any ref 👌

vcarl commented 6 years ago

Thanks for following up :)