Trigger re-calculation of visibility from outside the component
See original GitHub issueHi, I’ve got a scenario where unmounting components brings others into view. As neither a scroll nor resize event is fired so no computation is done. My current thinking is to have a prop be passed in (say detectOnChange
) and when that prop changes we trigger a re-calculation of visibility.
In my use case, I’ve got a series of accordions. Inside those accordion are visibility tracked components. Closing one of those accordions brings other components into view. What I’m doing is tracking the state of open accordions and passing the count of open accordions to the tracked component. Then on change I can fire the isComponentVisible
function.
What are your thoughts?
Thanks, Tom
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (11 by maintainers)
Top Results From Across the Web
Conditional visibility in a react component - Stack Overflow
I have a react component that contains a div with a conditional visibility. The component represents the page of a specific product on...
Read more >The Element Visibility Trigger In Google Tag Manager
In short, the Element Visibility trigger fires whenever an element, or elements, you specify appear in the browser's viewport.
Read more >Flow Conditional Visibility Considerations - Salesforce Help
Before you set visibility for a screen component, understand the behavior of conditional visibility in flows.Required Editions Available in: both Salesfor.
Read more >Controlling component visibility with React Hooks
Here we have set up a hook to control the visibility of the component. The initial state value is null as this will...
Read more >Report visibility tracking ineligible in amp-analytics visible trigger ...
In case such a cooperation is failed to be established, we might want amp-analytics to report back to ad server or 3rd party...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, it looks interesting. I don’t see a problem with both solutions co-existing. I’ll put together a PR with what I was suggesting, don’t hold back as it’s a little out there!
Hey,
I think that it can be a good idea to extend PureComponent. At least we can try and see if there is any performance impact.
I also like the idea to add a third event like https://github.com/Stanko/window-scroll-manager.