Ionic 4 and mapbox

I have implemented map in my ionic v3 solution. Everything works just fine. I’m now upgrading to v4, and the map always load with the size 300X400. If i resize the window the map will be full screen.

I believe that the container is not fully rendered before the map is constructed so the map will be rendered to whatever size the container originally is.

How can i solve this?