-
Couldn't load subscription status.
- Fork 73
Allow custom optional visibility observer #77
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
base: master
Are you sure you want to change the base?
Conversation
| if (shouldAutoDownload) this.load(false) | ||
| this.setState( | ||
| {pickedSrc, shouldAutoDownload, url}, | ||
| shouldAutoDownload ? () => this.load(false) : undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's important for this to be callback otherwise this.load could have stale state (I encountered this with url being undefined)
| height={2095} | ||
| observer={Waypoint} | ||
| > | ||
| <Waypoint scrollableAncestor="window" /> // onEnter and onLeave are passed automatically |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started working on this PR mainly because I needed to provide scrollableAncestor="window". Lazy-loading didn't work at all without this. I'm guessing it's either due to SSR or overflow: auto in a parent, both common scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not because of SSR (SSR should be properly handled)
|
I don't want to overcomplicate already complex component, rather I would search a way to separate existing component into compassable subcomponents to be able to construct out of it what you want. For example, you do not observer - simply do not use observer subcomponent. This was my initial idea, but it was hard and I decided to construct one big component for the demo and handle this idea latter. Maybe try approach similar to state-containers. |
What:
This PR allows users to
Why:
The main thing this PR achieves isn't much different than #51 I would say the only differences are:
How:
Depending on what the user provides, in order:
Checklist:
Please feel free to check the published fork
npm install @gekorm/react-ideal-image