You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LazyImageFull allows for more fine-grained rendering based on
the state. This is particularly useful for css transitions and
when re-rendering is undesirable. LazyImage has been reimplemented
on top of this.
Copy file name to clipboardExpand all lines: README.md
+47-2Lines changed: 47 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -118,7 +118,8 @@ Additionally, make sure you understand [how to polyfill IntersectionObserver](#p
118
118
From then on:
119
119
120
120
* If you want to learn more about the API and the problem space, read the rest of this section.
121
-
* If you want to list the props, see the [API reference](#api-reference)
121
+
* If you need more fine-grained rendering, [read about `LazyImageFull`](#more-control-with-lazyimagefull).
122
+
* If you want to list the props, see the [API reference](#api-reference).
122
123
123
124
### Customising what is displayed
124
125
@@ -160,6 +161,39 @@ Thus, whether you want to display a simple `<img>`, your own `<Image>`, or even
160
161
161
162
These props are there to instruct the component what to render in those places, and they take some useful information (in this case, a className) from the LazyImage.
162
163
164
+
### More control with LazyImageFull
165
+
166
+
`LazyImage` should work for most cases, but you might need more fine-grained rendering.
167
+
One use case would be doing animations with CSS transitions, where re-rendering the component (which `LazyImage` does) would not be sufficient.
| **src** | String | | true | The source of the image to load |
403
+
| **srcSet** | String | | false | If your images use srcset, you can pass the `srcSet` prop to provide that information for preloading. |
404
+
| **loadEagerly** | Boolean | false | false | Whether to skip checking for viewport and always show the 'actual' component |
405
+
| **observerProps** | {threshold: number, rootMargin: string} | {threshold: 0.01, rootMargin: "50px 0px"} | false | Subset of props for the IntersectionObserver |
406
+
| **render** | Function of type ({src, srcSet, imageState}) => React.ReactNode | | true (or `children`) | Function to call that renders based on the props and state provided to it by LazyImageFull |
407
+
| **children** | Function of type ({src, srcSet, imageState}) => React.ReactNode | | true (or `render`) | Function to call that renders based on the props and state provided to it by LazyImageFull |
408
+
364
409
## Feedback
365
410
366
411
I have some specific questions that I would like input on. If you want to go exploring, or have used the library and had gripes with it, then see [`FEEDBACK.md`](./FEEDBACK.md) and let's have a discussion!
0 commit comments