Skip to content

Commit

Permalink
Add ref forwarding for next/image (vercel#43193)
Browse files Browse the repository at this point in the history
Add ref forwarding for next/image with integration test


- fixes vercel#42885
- fixes vercel#18398 (this one was closed with `onLoadingComplete`)

## Feature

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Documentation added


Co-authored-by: Steven <[email protected]>
  • Loading branch information
jankaifer and styfle authored Nov 25, 2022
1 parent 0f195f0 commit c4b6bb8
Show file tree
Hide file tree
Showing 5 changed files with 590 additions and 502 deletions.
2 changes: 1 addition & 1 deletion docs/api-reference/next/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description: Enable Image Optimization with the built-in Image component.

| Version | Changes |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `v13.0.6` | `ref` prop added. |
| `v13.0.0` | `<span>` wrapper removed. `layout`, `objectFit`, `objectPosition`, `lazyBoundary`, `lazyRoot` props removed. `alt` is required. `onLoadingComplete` receives reference to `img` element. Built-in loader config removed. |
| `v12.3.0` | `remotePatterns` and `unoptimized` configuration is stable. |
| `v12.2.0` | Experimental `remotePatterns` and experimental `unoptimized` configuration added. `layout="raw"` removed. |
Expand Down Expand Up @@ -284,7 +285,6 @@ Other properties on the `<Image />` component will be passed to the underlying
`img` element with the exception of the following:

- `srcSet`. Use [Device Sizes](#device-sizes) instead.
- `ref`. Use [`onLoadingComplete`](#onloadingcomplete) instead.
- `decoding`. It is always `"async"`.

## Configuration Options
Expand Down
Loading

0 comments on commit c4b6bb8

Please sign in to comment.