mapsplugin / cordova-plugin-googlemaps

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

map.setDiv() tries to change value of a readonly property #2809

Closed longinius closed 4 years ago

longinius commented 4 years ago

I'm submitting a ...

If you choose 'problem or bug report', please select OS:

cordova information: (run $> cordova plugin list)

com.googlemaps.ios 3.8.0 "Google Maps SDK for iOS"
cordova-androidx-build 1.0.4 "cordova-androidx-build"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-googlemaps 2.8.0-20200701-2202 "cordova-plugin-googlemaps"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"

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

"@ionic-native/core": "^5.27.0",
"@ionic-native/google-maps": "^5.5.0",

Current behavior: If you hide the map with the map.setDiv() method through the Ionic lifecycle methods ionViewWillLeave it works the first time. But the second time it can't hide the map.

To reproduce in the repository you need to go to "Next page" and back two times. The second time the error occurs. In the browser platform the error occurs on the first call.

Expected behavior: Should hide the map without errors.

Screen capture or video record:

error

Related code, data or error log (please format your code or data): Repository: https://github.com/longinius/ionic-native-maps-error

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.
wf9a5m75 commented 4 years ago

Ok, I'll check it later

wf9a5m75 commented 4 years ago

Ok, I fixed problem, however you also need to change your code.

First, please upgrade @ionic-native/google-maps

$ npm uninstall @ionic-native/google-maps
$ npm install @ionic-native/google-maps@5.27.0-beta-20200630

Second, you also need to reinstall the cordova-plugin-googlemaps

$ ionic cordova plugin rm cordova-plugin-googlemaps
$ ionic cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps
$ ionic cordova plugin list

cordova-plugin-googlemaps 2.8.0-20200709-1800 "cordova-plugin-googlemaps"  <-- make sure `2.8.0-20200709-1800`

Third, modify your code https://github.com/wf9a5m75/ionic-native-maps-error-fixed/


Then the app should work like this

capture

longinius commented 4 years ago

Many thanks for the quick response and the adaptations to the source code. It now works as desired.