Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 229654

Ionic Native Google Maps plugin: map disappears after navigating to internal page, possible stacking issue

$
0
0

Quick update: On occasion, the map does still disappear. I’ve updated ionViewWillEnter as follows…

  ionViewWillEnter(){
    if (!this.initialMapLoad) {
      this.map.setDiv('map');
      this.map.setVisible(true);
      setTimeout(()=>{
        // hack to fix occasionally disappearing map
        this.map.setDiv('map');
      }, 1000);      
    } else {
      this.initialMapLoad = false;
    }
  }

This consistently fixes the issue after 1000ms when the map hasn’t loaded automatically (maybe 1 in 10-20 times), and doesn’t seem to interfere in any way when it’s unnecessary (most of the time).

Ideally there would be some condition I could check to detect when the hack is actually necessary but I can’t seem to find any way to test if the map is properly loaded and displayed (e.g. getDiv() returns an object even when the map has failed to load).


Viewing all articles
Browse latest Browse all 229654

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>