getContainer() cannot be a parent component
See original GitHub issueI wanted to use getContainer()
in the SortableContainer
HOC to set the scroll container to a parent component.
Unfortunately the getContainer()
is called in SortableContainer.componentDidMount()
, when the parent component is not yet mounted, so it returns undefined, and crashes.
Suggestion: allow specifying the container
and scrollContainer
separately in SortableContainer
(adding a getScollContainer()
function property would make the most sense; it would actually match the internal representation). Then lazily call getScrollContainer()
when needed.
More information: basically the use case is the same as with useWindowAsScrollContainer
, but where only part of the page scrolls.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
java - JLabel - get parent panel? - Stack Overflow
getParent() it will return the panel the label is inside. ... boolean flag = true; Component parent = label; while (flag) { parent...
Read more >Here is how to get ViewContainerRef before ... - InDepth.Dev
Suppose we have our parent App component and we want to add a child A component into the specific place in the template....
Read more >Placing controls outside map container with Leaflet?
addTo(map); // Call the getContainer routine. var htmlObject = control.getContainer(); // Get the desired parent node. var a = document.
Read more >Container (Java Platform SE 7 ) - Oracle Help Center
If the component is not an ancestor of this container and has a non-null parent, it is removed from its current parent before...
Read more >tinymce.Editor | Docs
destroy(), Destroys the editor instance by removing all events, element references or other ... getContainer(), Returns the container element of the editor.
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
Would you mind give me a example how to use Promise to getContainer. I get the same problem as below and look for a solution. Thx very much
Since I wanted to be able to set the container from the outside of the component, I added
this.props.scrollContainer ||
. Inside CustomSortableContainer, I resolve getContainer and just apply as a scrollContainer prop to a deeper component.