Ionic 4 native element size is null

Why native element have 0 size in ngAfterViewInit?
I have embedded component like this:

//my parent component

in inner component:

  <div id="map" style="width:500px; height: 500px;"  #map  ></div>
@ViewChild('map') mapElement: ElementRef;
ngAfterViewInit() {
   console.log('height: ' + this.mapElement.nativeElement.offsetHeight);
   console.log('width: ' + this.mapElement.nativeElement.offsetWidth);

Output is always “height: 0 width: 0”
But sometimes: “height: 500 width: 500”
I think that is because the element that i created has not been rendered in the Dom yet?
How i can solve this? Ionic hooks not work with embedded components(