captivationsoftware/react-sticky

Support passing refs through Sticky HOC

Closed this issue · 3 comments

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

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?

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

vcarl commented

Thanks for following up :)