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

Image component should forward ref #38864

Closed
sophiawisdom opened this issue Jul 21, 2022 · 1 comment · Fixed by #40326
Closed

Image component should forward ref #38864

sophiawisdom opened this issue Jul 21, 2022 · 1 comment · Fixed by #40326

Comments

@sophiawisdom
Copy link

Describe the feature you'd like to request

I would like to be able to use useRef with nextjs/Image. I want to use the Image element to show remote images in a feed and then allow users to click to copy the image with some text over it. In order to do that I need to draw the image to a canvas, and in order to do that I need to have a reference to the htmlImageElement.

Describe the solution you'd like

Ideally nextjs/Image should forward the ref on Image to the underlying . It also wouldn't be unworkable if I could pass a function that would be called with an htmlImageElement when something updates. The important thing is that there's some way to access the underlying element.

Describe alternatives you've considered

As stands we just use an HTML <picture><img> but this sort of sucks because the images resize in weird ways. Additionally, this request is essentially the same as #18398, particularly these comments.

ijjk pushed a commit that referenced this issue Sep 8, 2022
…ce to `<img>` (#40326)

* fixes #18398
* fixes #38864

Co-authored-by: Steven <steven@ceriously.com>
@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant