mapsplugin / cordova-plugin-googlemaps

Google Maps plugin for Cordova
Apache License 2.0
1.66k stars 913 forks source link

the map disappears when changing tab #2096

Closed jhonarodriguez closed 6 years ago

jhonarodriguez commented 6 years ago

I'm submitting a ... (check one with "x")

If you choose 'problem or bug report', please select OS: (check one with "x")

cordova information: (run $> cordova plugin list)

com.googlemaps.ios 2.6.0 "Google Maps SDK for iOS"
com.telerik.plugins.nativepagetransitions 0.6.5 "Native Page Transitions"
cordova-android-play-services-gradle-release 1.2.0 "cordova-android-play-services-gradle-release"
cordova-custom-config 3.2.0 "cordova-custom-config"
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-appavailability 0.4.2 "AppAvailability"
cordova-plugin-calendar 4.6.0 "Calendar"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-contacts 2.3.1 "Contacts"
cordova-plugin-dialogs 1.3.3 "Notification"
cordova-plugin-google-analytics 1.8.3 "Google Universal Analytics Plugin"
cordova-plugin-googlemaps 2.2.5 "cordova-plugin-googlemaps"
cordova-plugin-market 1.2.0 "Market"
cordova-plugin-spinner-dialog 1.3.1 "SpinnerDialog"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-vibration 2.1.5 "Vibration"
cordova-plugin-whitelist 1.3.2 "Whitelist"
cordova-plugin-x-socialsharing 5.1.8 "SocialSharing"
cordova-wheel-selector-plugin 1.0.0 "Cordova Wheel Selector Plugin"
cordova.plugins.diagnostic 3.7.1 "Diagnostic"
es6-promise-plugin 4.1.0 "Promise"
mobi.moica.whatsapp 0.0.1 "Whatsapp"
uk.co.workingedge.phonegap.plugin.launchnavigator 4.0.7 "Launch Navigator"
insert the output from the command here

If you use @ionic-native/google-maps, please tell the package.json (only @ionic-native/core and @ionic-native/google-maps are fine mostly)

Current behavior:

Expected behavior:

Screen capture or video record:

Related code, data or error log (please format your code or data):

The person who share your project files on Github (or other git repository) is in faster lane than other people.
Please share your project files on Github or others(Bitbucket, Gitlabs...etc).
If you don't want to share your project files, please create a demo project, then share it.

Screen captures, and/or native logs(such as Logcat, xcode logs) are appreciate.

Giving much information, you are waiting time is less.
Thank you for your cooperation.

Hello,

I have a problem that when I'm going from tabs, in the first tab is the map, returning to it from the map disappears, some method to reload the map template

wf9a5m75 commented 6 years ago

The map is removed automatically when the map div is removed.

If you want to keep the map, you need to detach the map from the map div when you leave, then attach the map to the map div when you come back to the map page.

wf9a5m75 commented 6 years ago

// detach
map.setDiv();

// attach
map.setDiv(document.getElementById("map_canvas");
jhonarodriguez commented 6 years ago

thank you very much friend, it worked perfectly