Ionic Native Google Maps: get instance of current map

I’ve created a map provider so I can reuse my code to create multiple maps using cordova-plugin-googlemaps. I use the following function to reset the map as needed, for example, when the view changes.


When that function gets called, XCode gives me the following errors:

ERROR: [ignore]map_1_923157887876.setDiv, because removed.
ERROR: [ignore]map_1_923157887876.setVisible, because removed.

My assumption is that this is due to the fact that the map provider doesn’t know which of the two maps I’m trying to reset.

So I’d like to be able to pass that function a specific map instance, e.g.

  resetMapContainer(currentMapInstance: GoogleMap; div:string,visible:boolean,timer:number){

Also worth noting, the map appears in a segment. The issue arises when I switch away from the map segment (which loads the first time) and then return. Here’s the code for that.

      // reset on segment change...

    // loads map and locations specific to each view

I’m not sure this is the right approach so I’m open to alternatives.

Thanks! – Erin

Could you share your project files on Github?

Hi @wf9a5m75, I’ve created a gist with my map provider and the two components where I use it. See:

Sorry, but I’m not familiar with ionic itself.
I can not reproduce your issue only code (and it spends my private time a lot).

So I always ask to share project files (everything) to reproduce the trouble easily.
I accept any git repo services. Otherwise, not at all.

If you don’t want to share your project files, please create a new project that reproduce your issue 100%.

Ok, no problem. I’ve given you access to the private repo via a team invite. Let me know if this helps and thank you for taking the time to look into this.

Thank you for inviting me. Then which repo should I check?

I’ve just messaged you on Github :slight_smile:

For what it’s worth, I ended up moving the secondary map into a modal controller, which eliminates the issues described above.