I’ve successfully implemented my map with all my markers and it works great. When switching between top level tabs, the map is always available and loaded. But as soon as I switch to a subpage/nested page (i.e. one with a back button) on a separate tab, returning to my map tab shows a blank screen. But the map is actually still there. I can log the object to my console and am not getting any errors.
Interestingly, when I open an infowindow before making the map disappear (by navigating to a new tab and then clicking on a nested page), the infowindow will still be there and open when I return, albeit on a blank canvas. Dragging the infowindow causes the existing map to be visible again.
I think what’s happening is that the page stacking of inactive nested pages is actually blocking the view of the map, which ends up being stacked beneath another page. As I understand it the native map runs underneath the webview, so it’s easy to imagine that this is a z-index or transparency issue.
Can anyone verify or offer tips to fix this?
ngAfterViewInit(){
console.log('ngAfterViewInit MapPage');
this.loadMap(); // works fine every time without error
}
ionViewDidEnter(){
console.log('ionViewDidEnter MapPage');
console.log(this.map); // always returns the map object so it's still there
if(!this.map) this.loadMap(); // never needs to fire
// need to reset tab/page stacking order?
}
com.googlemaps.ios 2.6.0 "Google Maps SDK for iOS"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-googlemaps 2.2.4 "cordova-plugin-googlemaps"
cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.1 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-sqlite-storage 2.2.0 "Cordova sqlite storage plugin"
ionic-plugin-keyboard 2.2.1 "Keyboard"
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 7.0.0 ios 4.5.4
Ionic Framework : ionic-angular 3.9.2
System:
ios-deploy : 1.9.1
ios-sim : 5.0.11
Node : v6.9.1
npm : 3.10.8
OS : macOS High Sierra
Xcode : Xcode 9.2 Build version 9C40b
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : legacy
EDIT: I should add that I’m testing on a physical device, iPhone 8, iOS 11.2.6. The problem happens in the Simulator as well, though less consistently.