Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sticky element ref is overwriten #250

Open
2 of 3 tasks
hepiyellow opened this issue Jul 21, 2018 · 2 comments
Open
2 of 3 tasks

Sticky element ref is overwriten #250

hepiyellow opened this issue Jul 21, 2018 · 2 comments

Comments

@hepiyellow
Copy link

I'm submitting a ...

  • bug report
  • feature request
  • support request

If you're reporting a bug, please provide a minimal demonstration of the problem

What is the current behavior?

When rendering this Sticky element:

<Sticky>
  {
    ()=> <div ref={console.log('ref was called')}/>
  }
</Sticky>

The ref was called is not printed.
Since here the ref prop is overwritten.

What is the expected or desired behavior?

I expect to be able to get a ref to my <div/>

Why do you want this? What use case do you have?

I might need something other than the supplied 'calculatedHeight`.

What is your environment?

  • Version: 6.0.3
  • Browser: Chrome
@vcarl
Copy link
Contributor

vcarl commented Jul 22, 2018

Thanks for the report! Now that React provides a ref forwarding API this is definitely something we could provide. If you wanted to take a stab at it I'd be happy to merge a PR :)

@vcarl
Copy link
Contributor

vcarl commented Jul 22, 2018

Oh this is an interesting bit from that post, however

When you start using forwardRef in a component library, you should treat it as a breaking change and release a new major version of your library.

That's a good point, if there are people relying on ref returning the instance of Sticky, changing this would break their application. I'm not sure the marginal improvement is worth a major version release at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants