Resize of container Issue
See original GitHub issueProbably related to
- https://github.com/alex3165/react-mapbox-gl/issues/445
- https://github.com/alex3165/react-mapbox-gl/issues/372
- https://github.com/alex3165/react-mapbox-gl/issues/395
- https://github.com/alex3165/react-mapbox-gl/issues/130
- https://github.com/alex3165/react-mapbox-gl/issues/32
So the structure I have is something like this
<style>
.container {
display: flex;
flex-flow: row nowrap;
width: 100vw;
height: 100vh;
}
aside {
width: 300px;
height: 100%;
transition: width 0.2s ease;
}
aside.collapsed {
width: 0px;
}
.map {
flex: 1 1 auto;
}
</style>
<div class="container">
<aside>
<span>controls</span>
</aside>
<div class="map">
</div>
</div>
When I collapse the sidebar, the size of the map doesn’t get updated as it should, I tried forcing a map.resize()
when the sidebar is toggled, the problem is that as it has a transition I had to do this
const sidebarAnimationDuration = 220;
afterCollapse = () => {
window.setTimeout(() => {
window.dispatchEvent(new Event('resize'));
}, sidebarAnimationDuration);
};
setCollapse = collapsed => {
this.setState({ collapsed }, this.afterCollapse);
};
Which feels like a messy hack, is there any better way of doing this ?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:12
- Comments:7
Top Results From Across the Web
how do i fix this resizing issue with my container and div boxes
I want the div and header to resize proportionally when I make it bigger and smaller. The issue is that as I am...
Read more >Issue with resizing containers in dashboard.
Issue with resizing containers in dashboard. Formatting in Tableau can be painful, and meaningless sometimes. I'm trying to align worksheets in a dashboard ......
Read more >APFS Container Resizing Issues 49153 - Apple Developer
Running into strange error when attempting to resize a APFS container. Example APFS container is currently 499g with 161g free. Attempted to resize...
Read more >Can We Create a "Resize Hack" With Container Queries?
The idea is that you could have a container with a resizable element inside it, and then another element that gets fixed positioning...
Read more >How to Auto-Resize the Image to fit an HTML Container
It is not complicated to make the image stretch to fit the <div> container. CSS makes it possible to resize the image so...
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
This is how I made it work, by using a ResizeObserver:
If you are using Angular, you might need a polyfill for ResizeObserver, or just do:
any update on this? the above solutions dont feel right